From 22a6ab103c3e06f55f755092aac4e94d9fb75edf Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 26 Mar 2026 11:27:10 +0000 Subject: [PATCH] fix: wait for Postgres to be ready before starting Forgejo Adds a pg_isready healthcheck to the postgres service and upgrades the Forgejo depends_on to condition: service_healthy, preventing the "connection refused" crash on startup. https://claude.ai/code/session_01FKCW3FDjNFj6jve4niMFXH --- infra/docker-compose.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/infra/docker-compose.yml b/infra/docker-compose.yml index d81ce6f..9f60585 100644 --- a/infra/docker-compose.yml +++ b/infra/docker-compose.yml @@ -73,6 +73,11 @@ services: - hiy-pg-data:/var/lib/postgresql/data # SQL files here run once on first init (ignored if data volume already exists). - ./postgres-init:/docker-entrypoint-initdb.d:ro + healthcheck: + test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"] + interval: 5s + timeout: 5s + retries: 10 networks: - hiy-net @@ -96,7 +101,8 @@ services: volumes: - forgejo-data:/data depends_on: - - postgres + postgres: + condition: service_healthy networks: - hiy-net