From ac0335c9b548fe786f3201856d9d0fe243dd91d1 Mon Sep 17 00:00:00 2001 From: Tobias Manske Date: Wed, 10 Jan 2024 09:00:44 +0100 Subject: [PATCH] Add postgres healthchecks --- ansible/plays/services/gitea/docker-compose.yaml | 2 +- ansible/plays/services/hedgedoc/docker-compose.yaml | 2 +- ansible/plays/services/keycloak/docker-compose.yaml | 2 +- ansible/plays/services/matrix/docker-compose.yaml | 13 +++++++++---- ansible/plays/services/miniflux/docker-compose.yaml | 2 +- 5 files changed, 13 insertions(+), 8 deletions(-) diff --git a/ansible/plays/services/gitea/docker-compose.yaml b/ansible/plays/services/gitea/docker-compose.yaml index 4f071bd..cce73b5 100644 --- a/ansible/plays/services/gitea/docker-compose.yaml +++ b/ansible/plays/services/gitea/docker-compose.yaml @@ -47,7 +47,7 @@ services: volumes: - pg_data:/var/lib/postgresql/data healthcheck: - test: ["CMD-SHELL", "pg_isready"] + test: ["CMD-SHELL", "pg_isready", "-U", "{{ gitea.db.user }}"] interval: 10s timeout: 5s retries: 5 diff --git a/ansible/plays/services/hedgedoc/docker-compose.yaml b/ansible/plays/services/hedgedoc/docker-compose.yaml index 991427d..84fcd13 100644 --- a/ansible/plays/services/hedgedoc/docker-compose.yaml +++ b/ansible/plays/services/hedgedoc/docker-compose.yaml @@ -13,7 +13,7 @@ services: networks: - backend healthcheck: - test: ["CMD-SHELL", "pg_isready"] + test: ["CMD-SHELL", "pg_isready", "-U", "{{ hedgedoc.db.user }}"] interval: 10s timeout: 5s retries: 5 diff --git a/ansible/plays/services/keycloak/docker-compose.yaml b/ansible/plays/services/keycloak/docker-compose.yaml index e7db2b6..81712fb 100644 --- a/ansible/plays/services/keycloak/docker-compose.yaml +++ b/ansible/plays/services/keycloak/docker-compose.yaml @@ -14,7 +14,7 @@ services: networks: - backend healthcheck: - test: ["CMD-SHELL", "pg_isready", "-U", "keycloak"] + test: ["CMD-SHELL", "pg_isready", "-U", "{{ auth.db.user }}"] interval: 10s timeout: 5s retries: 5 diff --git a/ansible/plays/services/matrix/docker-compose.yaml b/ansible/plays/services/matrix/docker-compose.yaml index 0c65274..49f6fb1 100644 --- a/ansible/plays/services/matrix/docker-compose.yaml +++ b/ansible/plays/services/matrix/docker-compose.yaml @@ -58,7 +58,7 @@ services: volumes: - db_data:/var/lib/postgresql/data healthcheck: - test: ["CMD-SHELL", "pg_isready"] + test: ["CMD-SHELL", "pg_isready", "-U", "{{ matrix.db.user }}"] interval: 10s timeout: 5s retries: 5 @@ -108,7 +108,7 @@ services: volumes: - syncv3_db_data:/var/lib/postgresql/data healthcheck: - test: ["CMD-SHELL", "pg_isready"] + test: ["CMD-SHELL", "pg_isready", "-U", "{{ matrix.syncv3.user }}"] interval: 10s timeout: 5s retries: 5 @@ -167,7 +167,7 @@ services: volumes: - bridge_tg_db:/var/lib/postgresql/data healthcheck: - test: ["CMD-SHELL", "pg_isready"] + test: ["CMD-SHELL", "pg_isready", "-U", "{{ matrix.bridge.tg.dbuser }}"] interval: 10s timeout: 5s retries: 5 @@ -204,7 +204,7 @@ services: volumes: - bridge_slack_db:/var/lib/postgresql/data healthcheck: - test: ["CMD-SHELL", "pg_isready"] + test: ["CMD-SHELL", "pg_isready", "-U", "{{ matrix.bridge.slack.dbuser }}"] interval: 10s timeout: 5s retries: 5 @@ -248,6 +248,11 @@ services: - POSTGRES_PASSWORD={{ matrix.bridge.signal.dbpass }} volumes: - bridge_signal_db:/var/lib/postgresql/data + healthcheck: + test: ["CMD-SHELL", "pg_isready", "-U", "{{ matrix.bridge.signal.dbuser }}"] + interval: 10s + timeout: 5s + retries: 5 networks: backend: diff --git a/ansible/plays/services/miniflux/docker-compose.yaml b/ansible/plays/services/miniflux/docker-compose.yaml index c6d4877..35ae68e 100644 --- a/ansible/plays/services/miniflux/docker-compose.yaml +++ b/ansible/plays/services/miniflux/docker-compose.yaml @@ -47,7 +47,7 @@ services: volumes: - database:/var/lib/postgresql/data healthcheck: - test: ["CMD", "pg_isready", "-U", "miniflux"] + test: ["CMD", "pg_isready", "-U", "{{ miniflux.db.user }}"] interval: 10s start_period: 30s networks: