From 26b3b37f1bf64c6ea5c682aa286eacd5e0bcecd9 Mon Sep 17 00:00:00 2001 From: euanmillar Date: Thu, 15 Feb 2024 15:39:27 +0000 Subject: [PATCH] Enforce wait for Kibana --- infrastructure/deployment/deploy.sh | 1 + infrastructure/docker-compose.deploy.yml | 2 ++ infrastructure/monitoring/kibana/setup-config.sh | 1 - 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/infrastructure/deployment/deploy.sh b/infrastructure/deployment/deploy.sh index 5623cd57e..b21c137c9 100755 --- a/infrastructure/deployment/deploy.sh +++ b/infrastructure/deployment/deploy.sh @@ -372,6 +372,7 @@ echo echo "Waiting 2 mins for mongo to deploy before working with data. Please note it can take up to 10 minutes for the entire stack to deploy in some scenarios." echo +sleep 120 # Required as Kibana cannot be immediately contacted echo "Setting up Kibana config & alerts" while true; do diff --git a/infrastructure/docker-compose.deploy.yml b/infrastructure/docker-compose.deploy.yml index c53c0fd78..7e7b0e834 100644 --- a/infrastructure/docker-compose.deploy.yml +++ b/infrastructure/docker-compose.deploy.yml @@ -405,6 +405,8 @@ services: - '/opt/opencrvs/infrastructure/monitoring/elastalert/rules:/opt/elastalert/rules' networks: - overlay_net + depends_on: + - elasticsearch deploy: labels: - 'traefik.enable=false' diff --git a/infrastructure/monitoring/kibana/setup-config.sh b/infrastructure/monitoring/kibana/setup-config.sh index e342a71d1..92e456d1d 100755 --- a/infrastructure/monitoring/kibana/setup-config.sh +++ b/infrastructure/monitoring/kibana/setup-config.sh @@ -13,7 +13,6 @@ set -e # Define Docker command with the image and network docker_command="docker run --rm -v /opt/opencrvs/infrastructure/monitoring/kibana/config.ndjson:/config.ndjson --network=opencrvs_overlay_net curlimages/curl" -echo "test: $ELASTICSEARCH_SUPERUSER_PASSWORD" # First delete all alerts. This is because the import doesn't remove alerts that are no longer in the config $docker_command --connect-timeout 60 -u elastic:$ELASTICSEARCH_SUPERUSER_PASSWORD http://kibana:5601/api/alerting/rules/_find\?page\=1\&per_page\=100\&default_search_operator\=AND\&sort_field\=name\&sort_order\=asc | docker run --rm -i --network=opencrvs_overlay_net stedolan/jq -r '.data[].id' | while read -r id; do $docker_command --connect-timeout 60 -X DELETE -H 'kbn-xsrf: true' -u elastic:$ELASTICSEARCH_SUPERUSER_PASSWORD "http://kibana:5601/api/alerting/rule/$id"