From 1576b180d00b7804c1e5cf72374359fba2ea730a Mon Sep 17 00:00:00 2001 From: spwoodcock Date: Mon, 23 Oct 2023 06:52:38 +0100 Subject: [PATCH] build: add healthcheck to postgres containers --- docker-compose.development.yml | 6 ++++++ docker-compose.main.yml | 6 ++++++ docker-compose.noodk.yml | 6 ++++++ docker-compose.yml | 14 ++++++++++++++ 4 files changed, 32 insertions(+) diff --git a/docker-compose.development.yml b/docker-compose.development.yml index 1e5710611b..a13cf215dc 100644 --- a/docker-compose.development.yml +++ b/docker-compose.development.yml @@ -77,6 +77,12 @@ services: networks: - fmtm-net restart: "unless-stopped" + healthcheck: + test: pg_isready -U ${FMTM_DB_USER:-fmtm} -d ${FMTM_DB_NAME:-fmtm} + start_period: 5s + interval: 10s + timeout: 5s + retries: 3 api: image: "ghcr.io/hotosm/fmtm/backend:${GIT_BRANCH}" diff --git a/docker-compose.main.yml b/docker-compose.main.yml index 7f10f510f3..5e7f33954d 100644 --- a/docker-compose.main.yml +++ b/docker-compose.main.yml @@ -76,6 +76,12 @@ services: networks: - fmtm-net restart: "unless-stopped" + healthcheck: + test: pg_isready -U ${FMTM_DB_USER:-fmtm} -d ${FMTM_DB_NAME:-fmtm} + start_period: 5s + interval: 10s + timeout: 5s + retries: 3 api: image: "ghcr.io/hotosm/fmtm/backend:${GIT_BRANCH}" diff --git a/docker-compose.noodk.yml b/docker-compose.noodk.yml index 49e9246335..1e8d68f0de 100644 --- a/docker-compose.noodk.yml +++ b/docker-compose.noodk.yml @@ -43,6 +43,12 @@ services: networks: - fmtm-dev restart: "unless-stopped" + healthcheck: + test: pg_isready -U ${FMTM_DB_USER:-fmtm} -d ${FMTM_DB_NAME:-fmtm} + start_period: 5s + interval: 10s + timeout: 5s + retries: 3 api: image: "ghcr.io/hotosm/fmtm/backend:debug" diff --git a/docker-compose.yml b/docker-compose.yml index 75e3b57b8e..cb33a4ad1f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -44,6 +44,12 @@ services: networks: - fmtm-dev restart: "unless-stopped" + healthcheck: + test: pg_isready -U ${FMTM_DB_USER:-fmtm} -d ${FMTM_DB_NAME:-fmtm} + start_period: 5s + interval: 10s + timeout: 5s + retries: 3 api: image: "ghcr.io/hotosm/fmtm/backend:${TAG_OVERRIDE:-debug}" @@ -90,6 +96,8 @@ services: - fmtm-dev entrypoint: ["/migrate-entrypoint.sh"] restart: "on-failure:3" + healthcheck: + test: [] # Set the health check test to an empty value to disable it ui: image: "ghcr.io/hotosm/fmtm/frontend:debug" @@ -129,6 +137,12 @@ services: networks: - fmtm-dev restart: "unless-stopped" + healthcheck: + test: pg_isready -U ${CENTRAL_DB_USER:-odk} -d ${CENTRAL_DB_NAME:-odk} + start_period: 5s + interval: 10s + timeout: 5s + retries: 3 central: image: "ghcr.io/hotosm/fmtm/odkcentral:${ODK_CENTRAL_TAG:-v2023.4.0}"