From 69d45e3af3cf91fac4c0747e5a6cf32ee3da2c36 Mon Sep 17 00:00:00 2001 From: Thomas Rusiecki Date: Wed, 19 Feb 2025 18:45:34 -0300 Subject: [PATCH] postgres added to idhub profile --- .env.example | 7 +++++++ docker-compose.yml | 26 +++++++++++++++++++++++++- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/.env.example b/.env.example index 9da0c5b..1460594 100644 --- a/.env.example +++ b/.env.example @@ -82,3 +82,10 @@ IDHUB_ENABLE_2FACTOR_AUTH=false IDHUB_ENABLE_DOMAIN_CHECKER=false IDHUB_PREDEFINED_TOKEN='27f944ce-3d58-4f48-b068-e4aa95f97c95' +# IDHUB- Postgres +### +IDHUB_DB_NAME="idhub" +IDHUB_DB_USER="ereuse" +IDHUB_DB_PASSWORD="ereuse" +IDHUB_DB_HOST="idhub-postgres" +IDHUB_DB_PORT=5432 diff --git a/docker-compose.yml b/docker-compose.yml index 8419505..eb32cc3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -55,6 +55,9 @@ services: profiles: [idhub] init: true image: farga.pangea.org/ereuse/idhub/latest + build: + context: /path/to/your/idhub/directory + dockerfile: /path/to/your/idhub/dockerfile environment: - DOMAIN=${IDHUB_DOMAIN:-localhost} - ALLOWED_HOSTS=${IDHUB_ALLOWED_HOSTS:-$IDHUB_DOMAIN} @@ -82,8 +85,29 @@ services: - SYNC_ORG_DEV=${IDHUB_SYNC_ORG_DEV} ports: - 9001:9001 + depends_on: + idhub-postgres: + condition: service_healthy + restart: true + + idhub-postgres: + profiles: [idhub] + 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 - # TODO add database service for idhub, meanwhile sqlite volumes: pg_data: + idhub_pg_data: