feat: Add healthcheck for pg

This commit is contained in:
Ryan W
2023-05-04 14:16:25 -07:00
parent abe4c4f322
commit 95a282c9a1
+9 -2
View File
@@ -12,8 +12,10 @@ services:
environment: environment:
- HISTFILE=/usr/src/app/log/.bash_history - HISTFILE=/usr/src/app/log/.bash_history
depends_on: depends_on:
- db db:
- redis condition: service_healthy
redis:
condition: service_started
db: db:
image: postgres:15 image: postgres:15
ports: ports:
@@ -22,6 +24,11 @@ services:
- POSTGRES_PASSWORD=changeme - POSTGRES_PASSWORD=changeme
volumes: volumes:
- pg_data:/var/lib/postgresql/data - pg_data:/var/lib/postgresql/data
healthcheck:
test: pg_isready -U postgres
interval: 2s
timeout: 5s
retries: 30
redis: redis:
image: redis image: redis
volumes: volumes: