From b3bf3dba283ca41fe5724ca1a6a4d381023b349d Mon Sep 17 00:00:00 2001 From: keyan Date: Thu, 7 Mar 2024 13:18:23 -0600 Subject: [PATCH] proper check for postgres health --- docker-compose.yml | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index f4e8f6de..4d2437b2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,10 +5,11 @@ services: build: ./db restart: unless-stopped healthcheck: - test: ["CMD-SHELL", "pg_isready -U sn -d stackernews"] - interval: 5s - timeout: 5s - retries: 5 + test: ["CMD-SHELL", "PGPASSWORD=$$POSTGRES_PASSWORD psql -U $$POSTGRES_USER $$POSTGRES_DB -c 'SELECT 1'"] + interval: 10s + timeout: 10s + retries: 10 + start_period: 1m expose: - "5432" ports: @@ -27,7 +28,7 @@ services: interval: 10s timeout: 10s retries: 10 - start_period: 1m30s + start_period: 1m depends_on: db: condition: service_healthy @@ -78,9 +79,10 @@ services: image: darthsim/imgproxy:v3.18.1 healthcheck: test: [ "CMD", "imgproxy", "health" ] - timeout: 10s interval: 10s - retries: 3 + timeout: 10s + retries: 10 + start_period: 1m restart: unless-stopped env_file: - ./.env.sndev @@ -98,6 +100,7 @@ services: interval: 10s timeout: 10s retries: 10 + start_period: 1m restart: unless-stopped environment: - discovery.type=single-node