From 0345b6826a62061323cb389789c64caf98572cee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laure=CE=B7t?= Date: Thu, 21 Apr 2022 13:48:31 +0200 Subject: [PATCH] feat: mariadb healthcheck + wildfly using external db --- .gitignore | 2 +- docker-compose.yml | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index cd74a91..ae41428 100644 --- a/.gitignore +++ b/.gitignore @@ -5,5 +5,5 @@ build bin -# Ignore mariadb volume directory +# Ignore docker volume directory mariadb diff --git a/docker-compose.yml b/docker-compose.yml index 84b45ae..ee1dc89 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -12,6 +12,11 @@ services: - ./build/libs/:/opt/jboss/wildfly/standalone/deployments/ environment: - WILDFLY_PASSWORD=password + - DB_PORT=3306 + - DB_HOST=mariadb + depends_on: + mariadb: + condition: service_healthy restart: always mariadb: @@ -27,6 +32,14 @@ services: - 3306:3306 volumes: - ./mariadb/:/var/lib/mysql/ + healthcheck: + test: + [ + "CMD-SHELL", + 'mysqladmin -p$$MYSQL_ROOT_PASSWORD -h localhost ping | grep "mysqld is alive" || exit 1', + ] + interval: 2s + retries: 10 restart: always volumes: