From bdcb46720854f0a074e10ab0948b3b0fc63e7bf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1rton=20Sz=C3=BCcs?= <2458236+martonsz@users.noreply.github.com> Date: Thu, 20 Jun 2024 19:39:41 +0200 Subject: [PATCH] Fix healthcheck for Postgres in Authentic compose stack Postgres would never get in healthy state because the environment variable SERVICE_USER_POSTGRESQL was never set inside the container. Using POSTGRES_USER container env instead which receives the value from SERVICE_USER_POSTGRESQL. Also adding the condition "service_healthy" for the depends_on. This will make the Authentic containers to wait for Postgres and Redis to be healthy before starting. --- templates/compose/authentik.yaml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/templates/compose/authentik.yaml b/templates/compose/authentik.yaml index 51360e349..4fa7a7617 100644 --- a/templates/compose/authentik.yaml +++ b/templates/compose/authentik.yaml @@ -9,7 +9,7 @@ services: image: docker.io/library/postgres:12-alpine restart: unless-stopped healthcheck: - test: ["CMD-SHELL", "pg_isready -d authentik -U $${SERVICE_USER_POSTGRESQL}"] + test: ["CMD-SHELL", "pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}"] interval: 2s timeout: 10s retries: 15 @@ -55,8 +55,10 @@ services: - ./media:/media - ./custom-templates:/templates depends_on: - - postgresql - - redis + postgresql: + condition: service_healthy + redis: + condition: service_healthy authentik-worker: image: ghcr.io/goauthentik/server:${AUTHENTIK_TAG:-2024.2.2} restart: unless-stopped @@ -90,5 +92,7 @@ services: - ./certs:/certs - ./custom-templates:/templates depends_on: - - postgresql - - redis + postgresql: + condition: service_healthy + redis: + condition: service_healthy