docker postgres service

This commit is contained in:
Thomas Nahuel Rusiecki 2025-02-18 21:25:24 -03:00
parent bb2972f672
commit 2263e9a514

View file

@ -31,8 +31,37 @@ services:
- EMAIL_BACKEND=${IDHUB_EMAIL_BACKEND}
- SUPPORTED_CREDENTIALS=${IDHUB_SUPPORTED_CREDENTIALS:-}
- SYNC_ORG_DEV=${IDHUB_SYNC_ORG_DEV}
- DB_PORT=${IDHUB_DB_PORT:-5432}
- DB_HOST=${IDHUB_DB_HOST:-devicehub-postgres}
- DB_NAME=${IDHUB_DB_NAME}
- DB_USER=${IDHUB_DB_USER}
- DB_PASSWORD=${IDHUB_DB_PASSWORD}
ports:
- ${IDHUB_PORT:-9001}:${IDHUB_PORT:-9001}
# TODO manage volumes dev vs prod
volumes:
- .:/opt/idhub
depends_on:
idhub-postgres:
condition: service_healthy
restart: true
idhub-postgres:
image: postgres:17
environment:
- POSTGRES_DB=${IDHUB_DB_NAME}
- POSTGRES_USER=${IDHUB_DB_USER}
- POSTGRES_PASSWORD=${IDHUB_DB_PASSWORD}
volumes:
- idhub_pg_data:/var/lib/postgresql/data
healthcheck:
# https://docs.docker.com/compose/how-tos/startup-order/
test: ["CMD-SHELL", "pg_isready -U ${IDHUB_DB_USER} -d ${IDHUB_DB_NAME}"]
start_period: 1s
interval: 1s
timeout: 10s
retries: 10
volumes:
idhub_pg_data: