From 1323a7bdf42088952d318100e03b9690e4808b36 Mon Sep 17 00:00:00 2001 From: Laur Ivan Date: Fri, 28 Apr 2023 18:05:50 +0200 Subject: [PATCH] fix: Better healthcheck for sonarqube service. --- templates/docker-compose.yml.j2 | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/templates/docker-compose.yml.j2 b/templates/docker-compose.yml.j2 index e5ff135..04d5336 100644 --- a/templates/docker-compose.yml.j2 +++ b/templates/docker-compose.yml.j2 @@ -4,15 +4,19 @@ services: sonarqube: image: "{{ sonarqube_image }}" restart: always + healthcheck: + test: wget -qO- http://localhost:9000/api/system/health + interval: 10s + retries: 5 + start_period: 5s + timeout: 10s env_file: - "{{ sonarqube_config_path | expanduser }}/env.sonarqube.conf" ports: - "{{ sonarqube_http_port }}:9000" - "{{ sonarqube_api_port }}:9001" - # Add more ports if necessary networks: - sonarqube-net - # optional volumes: - sonarqube_conf:/opt/sonarqube/conf - sonarqube_data:/opt/sonarqube/data @@ -24,6 +28,11 @@ services: db: image: "{{ sonarqube_db_image }}" restart: always + healthcheck: + test: /usr/bin/pg_isready + interval: 5s + timeout: 10s + retries: 120 env_file: - "{{ sonarqube_config_path | expanduser }}/env.db.conf" volumes: