# ConnectionError: getaddrinfo ENOTFOUND postgres

**URL:** <https://forum.getodk.org/t/connectionerror-getaddrinfo-enotfound-postgres/35742>\
**Category:** Support\
**Tags:** odk-central\
**Created:** [November 12, 2021, 12:36pm UTC](https://forum.getodk.org/t/connectionerror-getaddrinfo-enotfound-postgres/35742 "2021-11-12T12:36:35Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![sowe1](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/sowe1/32/13877_2.png) [@sowe1](https://forum.getodk.org/u/sowe1)\
**Post date:** [November 12, 2021, 12:36pm UTC](https://forum.getodk.org/t/connectionerror-getaddrinfo-enotfound-postgres/35742/1 "2021-11-12T12:36:35Z")

</div>

[default.json](https://forum.getodk.org/uploads/short-url/f9D9CW0E0t6SRW4edXHN78nNyZO.json) (1.2 KB)  
[config.json.template.txt](https://forum.getodk.org/uploads/short-url/yuvDhLFawhA2m0Xcvw5Wf26gaI1.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)

```auto
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](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](https://forum.getodk.org/uploads/short-url/f9D9CW0E0t6SRW4edXHN78nNyZO.json) (1.2 KB)  
Processing: docker-compose.yml...  
\*\*

---

<div class="post-metadata">

**Author:** ![Matthew\_White](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/matthew_white/32/1654_2.png) [@Matthew\_White](https://forum.getodk.org/u/Matthew_White)\
**Post date:** [November 13, 2021, 10:42pm UTC](https://forum.getodk.org/t/connectionerror-getaddrinfo-enotfound-postgres/35742/2 "2021-11-13T22:42:03Z")

</div>

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](https://forum.getodk.org/t/odk-central-v1-3/35255) for more information. (Note that we still need to [document](https://github.com/getodk/docs/issues/1403) 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.

---

<div class="post-metadata">

**Author:** ![sowe1](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/sowe1/32/13877_2.png) [@sowe1](https://forum.getodk.org/u/sowe1)\
**Post date:** [November 15, 2021, 2:18pm UTC](https://forum.getodk.org/t/connectionerror-getaddrinfo-enotfound-postgres/35742/3 "2021-11-15T14:18:55Z")

</div>

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

```json
    "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

```json
    "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

---

<div class="post-metadata">

**Author:** ![Matthew\_White](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/matthew_white/32/1654_2.png) [@Matthew\_White](https://forum.getodk.org/u/Matthew_White)\
**Post date:** [November 15, 2021, 3:57pm UTC](https://forum.getodk.org/t/connectionerror-getaddrinfo-enotfound-postgres/35742/4 "2021-11-15T15:57:15Z")

</div>

Great, v1.3.3 is the latest version.

> [@sowe1](#):
>
> you are referring to add another tag with the port or add the port in the host key

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`.

> [@sowe1](#):
>
> About the database configuration i'm guss is correct

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

---

<div class="post-metadata">

**Author:** ![sowe1](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/sowe1/32/13877_2.png) [@sowe1](https://forum.getodk.org/u/sowe1)\
**Post date:** [November 16, 2021, 11:32am UTC](https://forum.getodk.org/t/connectionerror-getaddrinfo-enotfound-postgres/35742/5 "2021-11-16T11:32:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![sowe1](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/sowe1/32/13877_2.png) [@sowe1](https://forum.getodk.org/u/sowe1)\
**Post date:** [November 18, 2021, 8:29am UTC](https://forum.getodk.org/t/connectionerror-getaddrinfo-enotfound-postgres/35742/6 "2021-11-18T08:29:47Z")

</div>

@Matthew_White  
Thanks for your suport , works !!

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

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

```

And change docker-compose and remove the PostgreSQL service and depends\_on:

```yaml
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:

```
