From a4646df8f23584996d53bcd71f0b082fa266a632 Mon Sep 17 00:00:00 2001 From: Christian Winther Date: Wed, 17 Jan 2024 15:47:39 +0000 Subject: [PATCH] add some health checks --- docker-compose.yml | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index ba1a211c..757d7690 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -33,6 +33,11 @@ services: ports: - "${DOCKER_PROXY_PORT_EXTERNAL_HTTP}:80" - "${DOCKER_PROXY_PORT_EXTERNAL_HTTPS}:443" + healthcheck: + test: 'curl --header "Host: $[APP_DOMAIN}" --fail http://localhost/api/service/health-check' + interval: 10s + retries: 2 + timeout: 5s # Proxy companion for managing letsencrypt SSL certificates # @@ -92,6 +97,11 @@ services: depends_on: - db - redis + healthcheck: + test: 'curl --header "Host: $[APP_DOMAIN}" --fail http://localhost/api/service/health-check' + interval: 10s + retries: 2 + timeout: 5s worker: image: "${DOCKER_IMAGE}:${DOCKER_TAG}" @@ -114,6 +124,11 @@ services: depends_on: - db - redis + healthcheck: + test: gosu www-data php artisan horizon:status | grep running + interval: 10s + timeout: 5s + retries: 2 db: image: mariadb:11.2 @@ -126,6 +141,18 @@ services: - "${DOCKER_DB_DATA_PATH}:/var/lib/mysql" ports: - "${DOCKER_DB_PORT_EXTERNAL}:3306" + healthcheck: + test: + [ + "CMD", + "healthcheck.sh", + "--su-mysql", + "--connect", + "--innodb_initialized", + ] + interval: 10s + retries: 2 + timeout: 5s redis: image: redis:7.2 @@ -142,7 +169,7 @@ services: ports: - "${DOCKER_REDIS_PORT_EXTERNAL}:6379" healthcheck: - interval: 10s - timeout: 5s - retries: 2 test: ["CMD", "redis-cli", "-p", "6379", "ping"] + interval: 10s + retries: 2 + timeout: 5s