From 255e0f0d08c33636af38e1717828fd98041c568c Mon Sep 17 00:00:00 2001 From: radex Date: Thu, 17 Aug 2023 14:20:22 +0200 Subject: [PATCH] Docker: wait for postgres until starting web container --- docker-compose.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 19c7758..7100ac5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,6 +7,12 @@ services: - POSTGRES_USER=postgres - POSTGRES_PASSWORD=postgres - POSTGRES_DB=postgres + healthcheck: + #CHANGE 1: this command checks if the database is ready, right on the source db server + test: [ "CMD-SHELL", "pg_isready" ] + interval: 5s + timeout: 5s + retries: 5 web: image: registry.k0.hswaw.net/palid/spejstore:1689856372 @@ -17,7 +23,8 @@ services: ports: - "8000:8000" depends_on: - - db + db: + condition: service_healthy environment: - SPEJSTORE_CLIENT_ID - SPEJSTORE_SECRET