(docker-compose) Add health check to mariadb

This commit is contained in:
Viktor Lofgren 2023-10-26 11:10:53 +02:00
parent abbadc92a0
commit ba48c8e25b

View File

@ -9,7 +9,8 @@ x-svc: &service
networks: networks:
- wmsa - wmsa
depends_on: depends_on:
- mariadb mariadb:
condition: service_healthy
x-p1: &partition-1 x-p1: &partition-1
env_file: env_file:
@ -44,7 +45,8 @@ x-p2: &partition-2
networks: networks:
- wmsa - wmsa
depends_on: depends_on:
- mariadb mariadb:
condition: service_healthy
environment: environment:
- "WMSA_SERVICE_NODE=2" - "WMSA_SERVICE_NODE=2"
@ -164,6 +166,12 @@ services:
command: ['mysqld', '--character-set-server=utf8mb4', '--collation-server=utf8mb4_unicode_ci'] command: ['mysqld', '--character-set-server=utf8mb4', '--collation-server=utf8mb4_unicode_ci']
ports: ports:
- "127.0.0.1:3306:3306/tcp" - "127.0.0.1:3306:3306/tcp"
healthcheck:
test: mysqladmin ping -h 127.0.0.1 -u $$MARIADB_USER --password=$$MARIADB_PASSWORD
start_period: 5s
interval: 5s
timeout: 5s
retries: 60
volumes: volumes:
- db:/var/lib/mysql - db:/var/lib/mysql
- "./code/common/db/src/main/resources/sql/current/:/docker-entrypoint-initdb.d/" - "./code/common/db/src/main/resources/sql/current/:/docker-entrypoint-initdb.d/"