ConnectionError: getaddrinfo ENOTFOUND postgres

default.json (1.2 KB)
config.json.template.txt (723 Bytes)
Processing: docker-compose.txt.yml...

1. What is the problem? Be very detailed.
I'm trying to use a local database and Nginx . I'm removing these services in my docker-compose.

I'm removing this part in my docker-compose and changing the script (postgresqldb is my local IP in my /etc/hosts)

command: [ "./wait-for-it.sh", "postgresqldb:5432", "--", "./start-odk.sh" ]

i'm follow this instruction --> https://docs.getodk.org/central-install-digital-ocean/#using-a-custom-database-server
and I've this error

ConnectionError: getaddrinfo ENOTFOUND postgres
at Object.createConnection (/usr/odk/node_modules/slonik/dist/src/factories/createConnection.js:54:23)
at processTicksAndRejections (internal/process/task_queues.js:95:5)

2. What app or server are you using and on what device and operating system? Include version numbers.
Ubuntu 20

Attached my files .
**Processing: config.json.template...
default.json (1.2 KB)
Processing: docker-compose.yml...
**

Hi @sowe1! I'm not sure that ODK Central is currently compatible with what you're trying to achieve, but I wanted to ask more questions about your setup.

What version of ODK Central are you running? Based on your default.json, it looks like you're running one of the v1.3 versions. I ask because we made some improvements from v1.2 to v1.3 related to configuring custom database servers. See the forum topic about the v1.3 release for more information. (Note that we still need to document some of those changes.)

It's possible that your database configuration doesn't match what Central is expecting. It sounds like you stubbed out host in the default.json you uploaded here. Did you stub out other values? If so, what format do they follow? Do they contain non-alphanumeric characters?

Are you specifying a port? If so, that should be done by adding a separate port configuration.

Hi @Matthew_White !,
I'm use the last version ( master branch the last Friday the tag version is v1.3.3 ) and the docker-compose version is version: "3" . Maybe i'm worng but is the last version.
About the database configuration i'm guss is correct

    "database": {
      "host": "postgresqldb", # this is an alias, but in my / etc / hosts there is the name of the map's IP address and I also put the ip address directly in the file.
      "user": "odkuser",
      "password": "odkpass",
      "database": "odkpass"
    }
...

When you said
"Are you specifying a port? If so, that should be done by adding a separate port configuration." ,you are referring to add another tag with the port or add the port in the host key

    "database": {
      "host": "postgresqldb", # this is an alias, but in my / etc / hosts there is the name of the map's IP address and I also put the ip address directly in the file.
      "user": "odkuser",
      "password": "odkpass",
      "database": "odkpass",
     "port":5432
    }
...
or
    "database": {
      "host": "postgresqldb:5432", # this is an alias, but in my / etc / hosts there is the name of the map's IP address and I also put the ip address directly in the file.
      "user": "odkuser",
      "password": "odkpass",
      "database": "odkpass"
    }
...

Thanks alot

Great, v1.3.3 is the latest version.

The first one: "port": 5432. That said, I think that 5432 is the default, so if the port in use is 5432, probably you don't need to specify port.

Just to check, are you sure that odkpass is also the name of your database and not just the password?

Hi !,
Yes odkpass is my actual pass. Is for my developed environment. ok i'll try and

@Matthew_White
Thanks for your suport , works !!

Summary:
Change the central/files/service/config.json.template:

    "database": {
      "host": "ip",
      "user": "user",
      "password": "pass",
      "database": "db",
      "port":5432
    }

And change docker-compose and remove the PostgreSQL service and depends_on:

version: "3"
services:
  mail:
    image: "itsissa/namshi-smtp:4.92-8.deb10u6"
    volumes:
      - ./files/dkim/config:/etc/exim4/_docker_additional_macros:ro
      - ./files/dkim/rsa.private:/etc/exim4/domain.key:ro
    environment:
      - MAILNAME=${DOMAIN}
    restart: always
  service:
    build:
      context: .
      dockerfile: service.dockerfile
    depends_on:
      - secrets
      - mail
      - pyxform
      - enketo
    volumes:
      - secrets:/etc/secrets
      - /data/transfer:/data/transfer
    environment:
      - DOMAIN=${DOMAIN}
      - SYSADMIN_EMAIL=${SYSADMIN_EMAIL}
    command: [ "./wait-for-it.sh", "ip:5432", "--", "./start-odk.sh" ]
    restart: always
    logging:
      driver: local
  nginx:
    build:
      context: .
      dockerfile: nginx.dockerfile
    depends_on:
      - service
      - enketo
    environment:
      - SSL_TYPE=${SSL_TYPE:-letsencrypt}
      - DOMAIN=${DOMAIN}
      - CERTBOT_EMAIL=${SYSADMIN_EMAIL}
    ports:
      - "${HTTP_PORT:-80}:80"
      - "${HTTPS_PORT:-443}:443"
    healthcheck:
      test: [ "CMD-SHELL", "nc -z localhost 80 || exit 1" ]
    restart: always
    logging:
      driver: local
      options:
        max-file: "30"
  pyxform:
    image: 'ghcr.io/getodk/pyxform-http:v1.7.0'
    restart: always
  secrets:
    volumes:
      - secrets:/etc/secrets
    build:
      context: .
      dockerfile: secrets.dockerfile
    command: './generate-secrets.sh'
  enketo:
    volumes:
      - secrets:/etc/secrets
    build:
      context: .
      dockerfile: enketo.dockerfile
    restart: always
    depends_on:
      - secrets
      - enketo_redis_main
      - enketo_redis_cache
    environment:
      - DOMAIN=${DOMAIN}
      - SUPPORT_EMAIL=${SYSADMIN_EMAIL}
  enketo_redis_main:
    image: redis:5
    volumes:
      - ./files/enketo/redis-enketo-main.conf:/usr/local/etc/redis/redis.conf:ro
      - enketo_redis_main:/data
    command:
      - redis-server
      - /usr/local/etc/redis/redis.conf
    restart: always
  enketo_redis_cache:
    image: redis:5
    volumes:
      - ./files/enketo/redis-enketo-cache.conf:/usr/local/etc/redis/redis.conf:ro
      - enketo_redis_cache:/data
    command:
      - redis-server
      - /usr/local/etc/redis/redis.conf
    restart: always
volumes:
  transfer:
  enketo_redis_main:
  enketo_redis_cache:
  secrets: