fix(compose): health-gate Postgres dependents on real readiness
All checks were successful
CI / lint (push) Successful in 36s
Deploy / notebooks (push) Has been skipped
Deploy / zotero (push) Has been skipped
Deploy / docs (push) Has been skipped
Deploy / api (push) Has been skipped
Deploy / mc (push) Has been skipped
Infra CI / notebooks (push) Successful in 20s
Infra CI / zotero (push) Successful in 14s
Infra CI / docs (push) Successful in 1m47s
Infra CI / api (push) Successful in 27s
Infra CI / mc (push) Successful in 13s
Deploy / report (push) Successful in 16s
CI / test (push) Successful in 13m41s

compose.yml had zero `condition: service_healthy` gates — every
depends_on was a bare list, so dependents waited only for the container
to *start*, not for the service to accept connections. `api`, `git`,
`nessie`, and `polaris` could boot before Postgres was ready.

Add a `pg_isready` healthcheck to postgres (Bitnami image ships it) and
convert those four dependents to the mapping form, gating postgres on
`service_healthy` while keeping other deps at `service_started`.

Validated with `docker compose config`; the four gates resolve to
service_healthy. Runtime-confirm on the next deploy. Follow-up: add
readiness probes + gating for trino/nessie/polaris/rustfs themselves
(their in-container probe tooling needs live verification first).
This commit is contained in:
kert
2026-07-08 10:16:29 -04:00
parent 90b37fe4c2
commit c7ea28d13f

View File

@@ -139,6 +139,14 @@ services:
- "promtail=true"
security_opt:
- no-new-privileges:true
healthcheck:
# Gate dependents (git, nessie, polaris, api) on Postgres actually
# accepting connections, not just the container having started.
test: ["CMD-SHELL", "pg_isready -U postgres -d gitea"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
restart: unless-stopped
git:
@@ -204,8 +212,10 @@ services:
- "2222:2222"
- "3000:3000"
depends_on:
- postgres
- rustfs
postgres:
condition: service_healthy
rustfs:
condition: service_started
labels:
- "promtail=true"
security_opt:
@@ -399,8 +409,10 @@ services:
- QUARKUS_OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://otel-collector:4317
- QUARKUS_OTEL_SERVICE_NAME=nessie
depends_on:
- postgres
- rustfs
postgres:
condition: service_healthy
rustfs:
condition: service_started
labels:
- "promtail=true"
security_opt:
@@ -461,8 +473,10 @@ services:
- QUARKUS_OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://otel-collector:4317
- QUARKUS_OTEL_SERVICE_NAME=polaris
depends_on:
- postgres
- rustfs
postgres:
condition: service_healthy
rustfs:
condition: service_started
labels:
- "promtail=true"
security_opt:
@@ -528,9 +542,12 @@ services:
volumes:
- ./data:/app/data
depends_on:
- postgres
- rustfs
- nessie
postgres:
condition: service_healthy
rustfs:
condition: service_started
nessie:
condition: service_started
labels:
- "promtail=true"
security_opt: