From 065a8e30daa6f02443f9b3bc201a709dc2a9d25f Mon Sep 17 00:00:00 2001 From: Akash Jain <15995028+akash-jain-10@users.noreply.github.com> Date: Mon, 5 Feb 2024 18:28:00 +0530 Subject: [PATCH] fix: docker-compose failed randomly without healthcheck of elasticsearch. #14854 (#15034) --- docker/development/docker-compose-postgres.yml | 9 +++++++-- docker/development/docker-compose.yml | 10 ++++++++-- .../docker-compose-postgres.yml | 9 +++++++-- docker/docker-compose-quickstart/docker-compose.yml | 9 +++++++-- 4 files changed, 29 insertions(+), 8 deletions(-) diff --git a/docker/development/docker-compose-postgres.yml b/docker/development/docker-compose-postgres.yml index 32e92328fe7..b6f0e05362c 100644 --- a/docker/development/docker-compose-postgres.yml +++ b/docker/development/docker-compose-postgres.yml @@ -57,6 +57,11 @@ services: ports: - "9200:9200" - "9300:9300" + healthcheck: + test: "curl -s http://localhost:9200/_cluster/health?pretty | grep status | grep -qE 'green|yellow' || exit 1" + interval: 15s + timeout: 10s + retries: 10 volumes: - es-data:/usr/share/opensearch/data @@ -248,7 +253,7 @@ services: WEB_CONF_PERMISSION_POLICY_OPTION: ${WEB_CONF_PERMISSION_POLICY_OPTION:-""} depends_on: opensearch: - condition: service_started + condition: service_healthy postgresql: condition: service_healthy networks: @@ -416,7 +421,7 @@ services: - "5005:5005" depends_on: opensearch: - condition: service_started + condition: service_healthy postgresql: condition: service_healthy execute-migrate-all: diff --git a/docker/development/docker-compose.yml b/docker/development/docker-compose.yml index 75aa0dff297..6cfa9b0372d 100644 --- a/docker/development/docker-compose.yml +++ b/docker/development/docker-compose.yml @@ -56,8 +56,14 @@ services: ports: - "9200:9200" - "9300:9300" + healthcheck: + test: "curl -s http://localhost:9200/_cluster/health?pretty | grep status | grep -qE 'green|yellow' || exit 1" + interval: 15s + timeout: 10s + retries: 10 volumes: - es-data:/usr/share/elasticsearch/data + execute-migrate-all: build: @@ -248,7 +254,7 @@ services: WEB_CONF_PERMISSION_POLICY_OPTION: ${WEB_CONF_PERMISSION_POLICY_OPTION:-""} depends_on: elasticsearch: - condition: service_started + condition: service_healthy mysql: condition: service_healthy networks: @@ -417,7 +423,7 @@ services: - "5005:5005" depends_on: elasticsearch: - condition: service_started + condition: service_healthy mysql: condition: service_healthy execute-migrate-all: diff --git a/docker/docker-compose-quickstart/docker-compose-postgres.yml b/docker/docker-compose-quickstart/docker-compose-postgres.yml index 679c11137a5..3b6c99d2b1d 100644 --- a/docker/docker-compose-quickstart/docker-compose-postgres.yml +++ b/docker/docker-compose-quickstart/docker-compose-postgres.yml @@ -51,6 +51,11 @@ services: ports: - "9200:9200" - "9300:9300" + healthcheck: + test: "curl -s http://localhost:9200/_cluster/health?pretty | grep status | grep -qE 'green|yellow' || exit 1" + interval: 15s + timeout: 10s + retries: 10 volumes: - es-data:/usr/share/elasticsearch/data @@ -236,7 +241,7 @@ services: WEB_CONF_PERMISSION_POLICY_OPTION: ${WEB_CONF_PERMISSION_POLICY_OPTION:-""} depends_on: elasticsearch: - condition: service_started + condition: service_healthy postgresql: condition: service_healthy networks: @@ -422,7 +427,7 @@ services: - "8586:8586" depends_on: elasticsearch: - condition: service_started + condition: service_healthy postgresql: condition: service_healthy execute-migrate-all: diff --git a/docker/docker-compose-quickstart/docker-compose.yml b/docker/docker-compose-quickstart/docker-compose.yml index b0ba0d5a81d..8c000bf4e5d 100644 --- a/docker/docker-compose-quickstart/docker-compose.yml +++ b/docker/docker-compose-quickstart/docker-compose.yml @@ -49,6 +49,11 @@ services: ports: - "9200:9200" - "9300:9300" + healthcheck: + test: "curl -s http://localhost:9200/_cluster/health?pretty | grep status | grep -qE 'green|yellow' || exit 1" + interval: 15s + timeout: 10s + retries: 10 volumes: - es-data:/usr/share/elasticsearch/data @@ -234,7 +239,7 @@ services: WEB_CONF_PERMISSION_POLICY_OPTION: ${WEB_CONF_PERMISSION_POLICY_OPTION:-""} depends_on: elasticsearch: - condition: service_started + condition: service_healthy mysql: condition: service_healthy networks: @@ -420,7 +425,7 @@ services: - "8586:8586" depends_on: elasticsearch: - condition: service_started + condition: service_healthy mysql: condition: service_healthy execute-migrate-all: