From ceba6b06b97a3c78a411d2f289936fb32d97cde6 Mon Sep 17 00:00:00 2001 From: Michal Konečný Date: Jan 15 2021 16:26:10 +0000 Subject: release-monitoring: Wait for web deployment The migrations should be run when no pod is working with database. This commit will let the other two pods wait till web service pod, which is running the migrations starts. Signed-off-by: Michal Konečný --- diff --git a/roles/openshift-apps/release-monitoring/files/deploymentconfig.yml b/roles/openshift-apps/release-monitoring/files/deploymentconfig.yml index 227f6de..7d05c38 100644 --- a/roles/openshift-apps/release-monitoring/files/deploymentconfig.yml +++ b/roles/openshift-apps/release-monitoring/files/deploymentconfig.yml @@ -114,6 +114,16 @@ items: activeDeadlineSeconds: 21600 recreateParams: timeoutSeconds: 600 + mid: + failurePolicy: Abort + execNewPod: + containerName: release-monitoring-check-service + command: + - /bin/bash + args: + - /etc/anitya/wait_for_web_service.sh + volumes: + - config-volume resources: {} type: Recreate template: @@ -192,6 +202,16 @@ items: activeDeadlineSeconds: 21600 recreateParams: timeoutSeconds: 600 + mid: + failurePolicy: Abort + execNewPod: + containerName: release-monitoring-librariesio-consumer + command: + - /bin/bash + args: + - /etc/anitya/wait_for_web_service.sh + volumes: + - config-volume resources: {} type: Recreate template: diff --git a/roles/openshift-apps/release-monitoring/templates/configmap.yml b/roles/openshift-apps/release-monitoring/templates/configmap.yml index 205f229..e7c9ea4 100644 --- a/roles/openshift-apps/release-monitoring/templates/configmap.yml +++ b/roles/openshift-apps/release-monitoring/templates/configmap.yml @@ -21,6 +21,8 @@ items: {{ load_file('httpd.conf') | indent(6) }} anitya.wsgi: |- {{ load_file('anitya.wsgi') | indent(6) }} + wait_for_web_service: |- + {{ load_file('wait_for_web_service.sh') | indent(6) }} - apiVersion: v1 kind: ConfigMap metadata: diff --git a/roles/openshift-apps/release-monitoring/templates/wait_for_web_service.sh b/roles/openshift-apps/release-monitoring/templates/wait_for_web_service.sh new file mode 100644 index 0000000..1aa5364 --- /dev/null +++ b/roles/openshift-apps/release-monitoring/templates/wait_for_web_service.sh @@ -0,0 +1,10 @@ +#!/bin/bash + + +{% if env == 'staging' %} +until $(curl --output /dev/null --silent --head --fail https://stg.release-monitoring.org); do +{% else %} +until $(curl --output /dev/null --silent --head --fail https://release-monitoring.org); do +{% endif %} + sleep 5 +done