From 9d14873af2c4f0ca2221b1be3291c039a2e1ac6e Mon Sep 17 00:00:00 2001 From: "halil.cakal" Date: Tue, 26 Nov 2024 16:33:46 +0000 Subject: Add persistent storage to prometheus - add healthcheck to ensure prometheus service is running correctly and restarts it if it becomes unhealthy - set the data retention time to 30d - update readme Issue-ID: CPS-2466 Change-Id: I0f6186f8577e8e0113831ed040298b823e33d624 Signed-off-by: halil.cakal --- docker-compose/docker-compose.yml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'docker-compose/docker-compose.yml') diff --git a/docker-compose/docker-compose.yml b/docker-compose/docker-compose.yml index 604cfe91a2..d2eff8da2b 100644 --- a/docker-compose/docker-compose.yml +++ b/docker-compose/docker-compose.yml @@ -178,12 +178,19 @@ services: restart: always volumes: - ./config/prometheus.yml:/etc/prometheus/prometheus.yml + - prometheus_data:/prometheus + environment: + - PROMETHEUS_RETENTION_TIME=${PROMETHEUS_RETENTION_TIME:-30d} + healthcheck: + test: [ "CMD-SHELL", "wget --spider --quiet --tries=1 --timeout=10 http://localhost:9090/-/healthy || exit 1" ] + interval: 30s + timeout: 10s + retries: 3 profiles: - monitoring grafana: image: grafana/grafana-oss:latest - user: "" container_name: ${GRAFANA_CONTAINER_NAME:-grafana} depends_on: prometheus: @@ -196,7 +203,7 @@ services: - grafana:/var/lib/grafana environment: - GF_SECURITY_ADMIN_PASSWORD=admin - - GF_SERVER_DOMAIN:localhost + - GF_SERVER_DOMAIN=localhost profiles: - monitoring @@ -223,3 +230,6 @@ services: volumes: grafana: + driver: local + prometheus_data: + driver: local -- cgit