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
This commit is contained in:
parent
ea172ae336
commit
22a6ab103c
1 changed files with 7 additions and 1 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue