From 30c932a7f28a30865c1fb8b89f61c09df2989bc9 Mon Sep 17 00:00:00 2001 From: lesion Date: Wed, 21 Aug 2024 15:54:32 +0200 Subject: [PATCH] fix: docker compose mariadb/postgres healtcheck, fix #397 --- docs/docker/mariadb/docker-compose.yml | 12 ++++++++++-- docs/docker/postgres/docker-compose.yml | 9 ++++++++- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/docs/docker/mariadb/docker-compose.yml b/docs/docker/mariadb/docker-compose.yml index 5898646d..2048924e 100644 --- a/docs/docker/mariadb/docker-compose.yml +++ b/docs/docker/mariadb/docker-compose.yml @@ -2,7 +2,7 @@ version: '3' services: db: - image: mariadb + image: mariadb:11 container_name: mariadb volumes: - ./db:/var/lib/mysql @@ -14,6 +14,12 @@ services: - MARIADB_PASSWORD=gancio - MARIADB_RANDOM_ROOT_PASSWORD=yes restart: always + healthcheck: + test: ["CMD", "healthcheck.sh", "--connect", "--mariadbupgrade"] + interval: 2s + timeout: 5s + retries: 10 + gancio: restart: always image: cisti/gancio @@ -33,4 +39,6 @@ services: ports: - "127.0.0.1:13120:13120" depends_on: - - db + db: + condition: service_healthy + diff --git a/docs/docker/postgres/docker-compose.yml b/docs/docker/postgres/docker-compose.yml index 884e867b..7dd593d8 100644 --- a/docs/docker/postgres/docker-compose.yml +++ b/docs/docker/postgres/docker-compose.yml @@ -12,6 +12,11 @@ services: - POSTGRES_DB=gancio - POSTGRES_PASSWORD=gancio - PGDATA=/var/lib/postgresql/data + healthcheck: + test: ["CMD-SHELL", "pg_isready"] + interval: 2s + timeout: 5s + retries: 10 restart: always ports: - 5432:5432 @@ -34,4 +39,6 @@ services: ports: - "127.0.0.1:13120:13120" depends_on: - - db + db: + condition: service_healthy +