proper check for postgres health

This commit is contained in:
keyan 2024-03-07 13:18:23 -06:00
parent f2fd2eb1d7
commit b3bf3dba28
1 changed files with 10 additions and 7 deletions

View File

@ -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