Celebrating 700K+ Installs Up to 35% OFF! View Details →

Database clients panic on first start before postgres is ready

Published 13 days ago

# Github Issue
# pending

Published 13 days ago

profile_photo

AdzerKI

Updated 13 days ago

0

On a fresh install safeline-mgt, safeline-luigi and safeline-chaos start together with safeline-pg and panic with failed to connect to host=safeline-pg ... connection refused while postgres is still in initdb. restart: always brings them back after a few restarts, but docker compose up -d --wait gives up right away with container safeline-mgt is unhealthy.

Two things in compose.yaml cause it:

  • depends_on: [postgres] waits only for the container to start, not for the database; chaos has no depends_on at all.
  • The postgres healthcheck runs pg_isready over the unix socket. The temporary server of initdb listens on that socket only, so the check passes before the real server accepts TCP connections, and even condition: service_healthy would let the clients in too early.

Fix: condition: service_healthy on postgres for mgt, luigi and chaos, and pg_isready -h 127.0.0.1 in the healthcheck. PR follows.

Seen with 9.3.7 images, Docker 29.9.3, Compose v5.7.0.

profile_photo

Windsley

Updated 6 days ago

0

Thank you for the detailed report. We've logged this issue in our internal tracking system and will keep this Issue updated as progress is made. We appreciate your patience!