Added health check for database

This commit is contained in:
Kevin Veen-Birkenbach 2022-01-21 00:11:06 +01:00
parent eefb1c23c0
commit 70125a08d8

View File

@ -19,7 +19,11 @@ services:
MYSQL_RANDOM_ROOT_PASSWORD: 'yes' MYSQL_RANDOM_ROOT_PASSWORD: 'yes'
volumes: volumes:
- database:/var/lib/mysql - database:/var/lib/mysql
healthcheck:
test: "/usr/bin/mysql --user=mailu --password={{mailu_database_password}} --execute \"SHOW DATABASES;\""
interval: 3s
timeout: 1s
retries: 5
# Core services # Core services
front: front:
image: ${DOCKER_ORG:-mailu}/${DOCKER_PREFIX:-}nginx:${MAILU_VERSION:-1.8} image: ${DOCKER_ORG:-mailu}/${DOCKER_PREFIX:-}nginx:${MAILU_VERSION:-1.8}
@ -39,6 +43,9 @@ services:
volumes: volumes:
- "/etc/mailu/overrides/nginx:/overrides" - "/etc/mailu/overrides/nginx:/overrides"
- "/etc/mailu/certs:/certs" - "/etc/mailu/certs:/certs"
depends_on:
database:
condition: service_healthy
admin: admin:
image: ${DOCKER_ORG:-mailu}/${DOCKER_PREFIX:-}admin:${MAILU_VERSION:-1.8} image: ${DOCKER_ORG:-mailu}/${DOCKER_PREFIX:-}admin:${MAILU_VERSION:-1.8}
restart: always restart: always