From 406d8eef51ffb9241fced5d326e8915f191d3867 Mon Sep 17 00:00:00 2001 From: Cat Aulucya Date: Sun, 15 Jun 2025 21:17:24 -0700 Subject: [PATCH] Wait for Postgres healthcheck before attempting to continue Signed-off-by: Cat Aulucya --- docker-compose.local.yaml | 11 +++++++++-- docker-compose.yaml | 11 +++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/docker-compose.local.yaml b/docker-compose.local.yaml index 5d022da..e08e84e 100644 --- a/docker-compose.local.yaml +++ b/docker-compose.local.yaml @@ -11,7 +11,8 @@ services: ports: - "6531:6531" depends_on: - - tranga-pg + tranga-pg: + condition: service_healthy environment: - POSTGRES_HOST=tranga-pg restart: unless-stopped @@ -22,4 +23,10 @@ services: - "5432:5432" environment: - POSTGRES_PASSWORD=postgres - restart: unless-stopped \ No newline at end of file + healthcheck: + test: ["CMD-SHELL", "pg_isready"] + interval: 30s + timeout: 60s + retries: 5 + start_period: 80s + restart: unless-stopped diff --git a/docker-compose.yaml b/docker-compose.yaml index b4e3405..bd44543 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,4 +1,4 @@ -version: '3' +version: '3' services: tranga-api: image: glax/tranga-api:latest @@ -9,7 +9,8 @@ services: ports: - "6531:6531" depends_on: - - tranga-pg + tranga-pg: + condition: service_healthy environment: - POSTGRES_HOST=tranga-pg restart: unless-stopped @@ -28,4 +29,10 @@ services: - "5432:5432" environment: - POSTGRES_PASSWORD=postgres + healthcheck: + test: ["CMD-SHELL", "pg_isready"] + interval: 30s + timeout: 60s + retries: 5 + start_period: 80s restart: unless-stopped