Added health check for database

This commit is contained in:
Kevin Veen-Birkenbach 2022-01-21 00:11:06 +01:00
parent 32fdbdf84e
commit 4781e699e5

View File

@ -19,7 +19,11 @@ services:
MYSQL_RANDOM_ROOT_PASSWORD: 'yes'
volumes:
- 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
front:
image: ${DOCKER_ORG:-mailu}/${DOCKER_PREFIX:-}nginx:${MAILU_VERSION:-1.8}
@ -39,6 +43,9 @@ services:
volumes:
- "/etc/mailu/overrides/nginx:/overrides"
- "/etc/mailu/certs:/certs"
depends_on:
database:
condition: service_healthy
admin:
image: ${DOCKER_ORG:-mailu}/${DOCKER_PREFIX:-}admin:${MAILU_VERSION:-1.8}
restart: always