From c55b568cd3fc2449dbc55b662f63210a381a6588 Mon Sep 17 00:00:00 2001 From: tobias-trabelsi-sonarsource Date: Tue, 26 May 2020 14:00:21 +0200 Subject: [PATCH 1/2] fixed healthcheck as of image rework with 8.x release --- sonarqube/Dockerfile | 2 ++ sonarqube/docker-healthcheck | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/sonarqube/Dockerfile b/sonarqube/Dockerfile index ccacfd7..26fdee4 100644 --- a/sonarqube/Dockerfile +++ b/sonarqube/Dockerfile @@ -1,5 +1,7 @@ FROM sonarqube +RUN apk add --no-cache curl + COPY docker-healthcheck /usr/local/bin/ HEALTHCHECK CMD ["docker-healthcheck"] diff --git a/sonarqube/docker-healthcheck b/sonarqube/docker-healthcheck index 9bafe3b..630f637 100755 --- a/sonarqube/docker-healthcheck +++ b/sonarqube/docker-healthcheck @@ -2,7 +2,7 @@ # A Sonarqube container is considered healthy if the status is UP, DB_MIGRATION_NEEDED or DB_MIGRATION_RUNNING # status about migration are added to prevent the node to be kill while sonarqube is updating himself. -host="$(hostname --ip-address || echo '127.0.0.1')" +host="$(hostname -i || echo '127.0.0.1')" if curl -Ss http://${host}:9000/api/system/status | grep -q -e '"status":"UP"' -e '"status":"DB_MIGRATION_NEEDED"' -e '"status":"DB_MIGRATION_RUNNING"'; then exit 0 From b13a60f6b851bbf10231a180b66c192caa90c9bc Mon Sep 17 00:00:00 2001 From: tobias-trabelsi-sonarsource Date: Tue, 26 May 2020 20:02:41 +0200 Subject: [PATCH 2/2] using wget for healthcheck --- sonarqube/Dockerfile | 2 -- sonarqube/docker-healthcheck | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/sonarqube/Dockerfile b/sonarqube/Dockerfile index 26fdee4..ccacfd7 100644 --- a/sonarqube/Dockerfile +++ b/sonarqube/Dockerfile @@ -1,7 +1,5 @@ FROM sonarqube -RUN apk add --no-cache curl - COPY docker-healthcheck /usr/local/bin/ HEALTHCHECK CMD ["docker-healthcheck"] diff --git a/sonarqube/docker-healthcheck b/sonarqube/docker-healthcheck index 630f637..3975590 100755 --- a/sonarqube/docker-healthcheck +++ b/sonarqube/docker-healthcheck @@ -4,7 +4,7 @@ # status about migration are added to prevent the node to be kill while sonarqube is updating himself. host="$(hostname -i || echo '127.0.0.1')" -if curl -Ss http://${host}:9000/api/system/status | grep -q -e '"status":"UP"' -e '"status":"DB_MIGRATION_NEEDED"' -e '"status":"DB_MIGRATION_RUNNING"'; then +if wget -qO- http://${host}:9000/api/system/status | grep -q -e '"status":"UP"' -e '"status":"DB_MIGRATION_NEEDED"' -e '"status":"DB_MIGRATION_RUNNING"'; then exit 0 fi