From 50691ad48b6a9c2fd63b9072fab0dfddc195edba Mon Sep 17 00:00:00 2001 From: "Arnaud G. GIBERT" Date: Tue, 29 Oct 2024 08:51:33 +0100 Subject: [PATCH] - Add database healthcheck & webapp service depencies. --- ReleaseNotes.txt | 3 ++- compose.yaml | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/ReleaseNotes.txt b/ReleaseNotes.txt index a4bedef..0f8d1c1 100644 --- a/ReleaseNotes.txt +++ b/ReleaseNotes.txt @@ -3,7 +3,8 @@ Rx3/Ampache-Mga9 V 1.2.3 - A. GIBERT - 2024/10/xx ------------------------------------------------------------------------------------------------------------------------------------ - Fix crontab: user ampache user instead of root and add it to git, -- Fix database restart in compose file. +- Fix database restart in compose file, +- Add database healthcheck & webapp service depencies. diff --git a/compose.yaml b/compose.yaml index 07395fe..d13cafd 100644 --- a/compose.yaml +++ b/compose.yaml @@ -20,6 +20,12 @@ services: MARIADB_USER: ${MARIADB_USER} MARIADB_PASSWORD: ${MARIADB_PASSWORD} + healthcheck: + test: ["CMD-SHELL", "sh -c 'pg_isready -U ${POSTGRESQL_USER} -d ${POSTGRESQL_DATABASE}'"] + interval: 10s + timeout: 3s + retries: 3 + volumes: - ./var/lib/mysql:/var/lib/mysql @@ -46,6 +52,10 @@ services: restart: unless-stopped + depends_on: + database: + condition: service_healthy + environment: APACHE_UID: ${APACHE_UID} APACHE_GID: ${APACHE_GID} @@ -75,6 +85,10 @@ services: restart: unless-stopped + depends_on: + database: + condition: service_healthy + environment: APACHE_UID: ${APACHE_UID} APACHE_GID: ${APACHE_GID}