PG::ConectionBad [solved]
hesslau opened this issue · comments
Since yesterday the loomio-app container isn't able to connect to loomio-db anymore.
loomio-app | PG::ConnectionBad: could not connect to server: Connection refused
loomio-app | Is the server running on host "db" (172.17.0.3) and accepting
loomio-app | TCP/IP connections on port 5432?
Connecting to loomio-db from inside the loomio-db container works:
root@loomio-db:/# psql -h 172.17.0.3 -p 5432 -U postgres
> psql (9.6.16)
> Type "help" for help.
> postgres=#
but not from the other containers (I added a link to loomio-nginx to test the connection). the server is reachable but apparently not on port 5432
root@loomio-nginx:/app# ping 172.17.0.3
> PING 172.17.0.3 (172.17.0.3) 56(84) bytes of data.
> 64 bytes from 172.17.0.3: icmp_seq=1 ttl=64 time=0.333 ms
root@loomio-nginx:/app# pgcli -h 172.17.0.3 -p 5432
> could not connect to server: Connection refused
Is the server running on host "172.17.0.3" and accepting
TCP/IP connections on port 5432?
inside loomio-db the pg_hba.conf
is set to accept all connections:
host all all all md5
any idea what could cause this?
I went for a fresh setup and migrated the database. But I'm still wondering how this misconfiguration happened out of the blue?
Hi @hesslau. I've been noticing it with many of my docker-compose based systems recently. I don't quite understand it, but, what I notice is:
We were using an old configuration format for docker-compose, which used "links" rather than a "network", it happens after you update the postgres image.
I think the problem goes away after I've upgraded the docker-compose format to v3. I pushed this change to master the other day, have you tried it?
Hey @robguthrie - I went for a fresh git clone of the repo, so the version change did probably fix it. However it's weird that the problem occurs without any change to the system.
We can close this issue.
Thanks for bringing it up. Might help someone else. I'll leave it open for a week just so people see it.