Skip to content

Commit

Permalink
docker compose add pg healthcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
amalshaji committed Mar 26, 2024
1 parent f3a5519 commit edb7611
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ services:
env_file: .env
restart: unless-stopped
depends_on:
- postgres
postgres:
condition: service_healthy
labels:
caddy_0: $PORTR_DOMAIN
caddy_0.reverse_proxy: "{{upstreams http 8000}}"
Expand All @@ -31,8 +32,10 @@ services:
env_file: .env
restart: unless-stopped
depends_on:
- admin
- postgres
admin:
condition: service_healthy
postgres:
condition: service_healthy
labels:
caddy_1: "*.$PORTR_DOMAIN"
caddy_1.reverse_proxy: "{{upstreams http 8001}}"
Expand All @@ -49,6 +52,11 @@ services:
volumes:
- postgres_data:/var/lib/postgresql/data
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $POSTGRES_USER"]
interval: 10s
timeout: 5s
retries: 5

volumes:
postgres_data: {}
Expand Down

0 comments on commit edb7611

Please sign in to comment.