add db healtcheck to docker-compose.yml

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2023-07-04 21:03:37 +02:00
parent 3ff878b84a
commit f96573369f
No known key found for this signature in database
GPG Key ID: FE65CD384D5BF7B4
1 changed files with 19 additions and 15 deletions

View File

@ -1,21 +1,6 @@
version: "3.8"
services:
db:
image: postgres:14
restart: always
volumes:
- db_data:/var/lib/postgresql/data
environment:
POSTGRES_USER: ${POSTGRES_USER:-postgres}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-passwd}
POSTGRES_DB: db
PGDATABASE: db
PGPASSWORD: ${POSTGRES_PASSWORD:-passwd}
PGUSER: ${POSTGRES_USER:-postgres}
ports:
- '127.0.0.1:${LOCAL_DB_PORT:-15432}:5432'
app:
build: .
# restart: always
@ -31,5 +16,24 @@ services:
timeout: 10s
retries: 3
db:
image: postgres:14
restart: always
volumes:
- db_data:/var/lib/postgresql/data
environment:
POSTGRES_USER: ${POSTGRES_USER:-postgres}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-passwd}
POSTGRES_DB: db
PGDATABASE: db
PGPASSWORD: ${POSTGRES_PASSWORD:-passwd}
PGUSER: ${POSTGRES_USER:-postgres}
ports:
- '127.0.0.1:${LOCAL_DB_PORT:-15432}:5432'
healthcheck:
test: ["CMD", "pg_isready", "-U", "${POSTGRES_USER:-postgres}"]
interval: 30s
retries: 5
volumes:
db_data: