From 22d26f0e0f37093fb826494e4de735db1e3e9357 Mon Sep 17 00:00:00 2001 From: sam Date: Tue, 19 May 2026 13:53:09 -0700 Subject: [PATCH] Gate psql-app startup on Postgres health (fix cold-boot race) On a cold boot all containers start together; psql-app finishes its RPKI/IRR/DBIP setup and opens its single Postgres connection while the DB is still initialising -> "the database system is starting up" -> ConsumerApp.main throws and the consumer dies. The container does NOT exit (the wrapper keeps cron/rsyslog alive), so restart: unless-stopped never fires and the consumer stays dead silently. Add depends_on psql: condition: service_healthy (plus kafka) so Compose holds psql-app until Postgres passes its pg_isready healthcheck. Co-Authored-By: Claude Opus 4.7 --- docker-compose.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index eb15ee2..2205f17 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -199,6 +199,16 @@ services: psql-app: restart: unless-stopped container_name: obmp-psql-app + # Gate startup on Postgres being ready. psql-app's consumer connects to + # Postgres once at startup and, if it loses the cold-boot race (DB still + # initialising -> "the database system is starting up"), ConsumerApp.main + # throws and the consumer dies -- and the container does NOT exit, so + # restart: unless-stopped never fires. service_healthy avoids the race. + depends_on: + psql: + condition: service_healthy + kafka: + condition: service_started # No healthcheck — the consumer exposes no health port; Docker's # restart-on-exit covers process death. image: openbmp/psql-app:2.2.2