Error with custom docker-compose: "Can't reach database server" #861
Replies: 5 comments
-
I managed to solve this by creating a connection pool for Umami and connecting to that. This tutorial mentions that:
I didn't see anything about this mentioned in Umami's docs, but it may be worth adding a note somewhere if there isn't one already. |
Beta Was this translation helpful? Give feedback.
-
@william-roy Thanks for the info. The text about postgresql seems odd to me though. I am running postgresql myself and don't have any connection issues, and I don't use pooling. Maybe it's something specific with docker. |
Beta Was this translation helpful? Give feedback.
-
It might be something specific to digitalocean's database clusters? Maybe @okezieuc can clue us in. |
Beta Was this translation helpful? Give feedback.
-
I'm having the same issue, and maybe it's related to docker-entrypoint-initdb? I am not using digitalocean. I see this in the logs:
It definitely seems like a docker or container networking issue. I can ping between umami_db_1 and umami_umami_1 just fine. But when I try to establish a TCP connection, it gets blocked or hangs. For example, from the db -> web:
I just tested on another machine (Ubuntu 18.04) and it worked fine. I now suspect it's something like docker's networking state being messed up and requiring maybe a reset like described in https://stackoverflow.com/a/20431030/95560 but I haven't tested that because I don't want to disturb the other containers. The machine where it isn't working is a Debian 9 server running docker version 19.03.9 and the machine where it works is 20.10.7. @william-roy what version of docker are you using? |
Beta Was this translation helpful? Give feedback.
-
I narrowed down the issue to my host firewall. For example, if I disable my firewall with the command |
Beta Was this translation helpful? Give feedback.
-
I'm trying to add Umami to my existing docker-compose setup, and it starts up just fine, but upon trying to login, can't seem to connect to the database (a digital ocean postgres database cluster). I've seeded the database using the
sql/schema.postgresql.sql
file, which worked just fine—I can connect through pgadmin and verify this. I can also verify the database is connectable:Here's the relevant part of the docker-compose.yml (omitting private info):
And here's the error (again, omitting private info):
I've seen other closed issues where there were problems with the connection string, but i've triple-checked it and can say for sure it is correct and valid. I also have another service in the same docker-compose file connecting to another database in the same cluster just fine, so I don't think it's an issue of permissions, firewalls, outbound connections, etc.
Beta Was this translation helpful? Give feedback.
All reactions