From 66ef8c57fee62ff3cc0750671a09de3b162e0061 Mon Sep 17 00:00:00 2001 From: Vladyslav Vildanov <117659936+vladvildanov@users.noreply.github.com> Date: Tue, 30 Jan 2024 14:54:00 +0200 Subject: [PATCH] Added healthcheck and conditions per container (#15) --- build.sh | 1 - docker-compose.yml | 21 +++++++++++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/build.sh b/build.sh index 2599e59..805b053 100755 --- a/build.sh +++ b/build.sh @@ -6,7 +6,6 @@ fi ## Build infrastructure ## docker-compose up -d -sleep 10 ## Create cluster ## docker-compose exec -T master-node "/opt/setup_cluster.sh" diff --git a/docker-compose.yml b/docker-compose.yml index 3bfc411..b3e570b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,6 +5,11 @@ services: container_name: "master" cap_add: - SYS_RESOURCE + healthcheck: + test: ["CMD", "curl", "-k", "https://localhost:9443"] + interval: 5s + timeout: 2s + retries: 3 ports: - "12000:12000" - "9443:9443" @@ -30,7 +35,13 @@ services: cap_add: - SYS_RESOURCE depends_on: - - master-node + master-node: + condition: service_healthy + healthcheck: + test: ["CMD", "curl", "-k", "https://localhost:9443"] + interval: 5s + timeout: 2s + retries: 3 ports: - "12001:12000" - "9444:9443" @@ -54,7 +65,13 @@ services: cap_add: - SYS_RESOURCE depends_on: - - node-1 + node-1: + condition: service_healthy + healthcheck: + test: ["CMD", "curl", "-k", "https://localhost:9443"] + interval: 5s + timeout: 2s + retries: 3 ports: - "12002:12000" - "9445:9443"