fix: Better healthcheck for sonarqube service.

This commit is contained in:
Laur Ivan 2023-04-28 18:05:50 +02:00
parent d6cdbb6759
commit 1323a7bdf4

View File

@ -4,15 +4,19 @@ services:
sonarqube: sonarqube:
image: "{{ sonarqube_image }}" image: "{{ sonarqube_image }}"
restart: always restart: always
healthcheck:
test: wget -qO- http://localhost:9000/api/system/health
interval: 10s
retries: 5
start_period: 5s
timeout: 10s
env_file: env_file:
- "{{ sonarqube_config_path | expanduser }}/env.sonarqube.conf" - "{{ sonarqube_config_path | expanduser }}/env.sonarqube.conf"
ports: ports:
- "{{ sonarqube_http_port }}:9000" - "{{ sonarqube_http_port }}:9000"
- "{{ sonarqube_api_port }}:9001" - "{{ sonarqube_api_port }}:9001"
# Add more ports if necessary
networks: networks:
- sonarqube-net - sonarqube-net
# optional
volumes: volumes:
- sonarqube_conf:/opt/sonarqube/conf - sonarqube_conf:/opt/sonarqube/conf
- sonarqube_data:/opt/sonarqube/data - sonarqube_data:/opt/sonarqube/data
@ -24,6 +28,11 @@ services:
db: db:
image: "{{ sonarqube_db_image }}" image: "{{ sonarqube_db_image }}"
restart: always restart: always
healthcheck:
test: /usr/bin/pg_isready
interval: 5s
timeout: 10s
retries: 120
env_file: env_file:
- "{{ sonarqube_config_path | expanduser }}/env.db.conf" - "{{ sonarqube_config_path | expanduser }}/env.db.conf"
volumes: volumes: