From 9c283409d8dd7f42b917002989b2e72f0efe0034 Mon Sep 17 00:00:00 2001 From: Quang Khai Nguyen Date: Wed, 15 Apr 2026 07:12:24 +0200 Subject: [PATCH] refactoring prometheus --- prometheus/docker-compose.yml | 45 +++++++++++++++++++++++++++++++---- 1 file changed, 40 insertions(+), 5 deletions(-) diff --git a/prometheus/docker-compose.yml b/prometheus/docker-compose.yml index 814e3c5..aba830d 100755 --- a/prometheus/docker-compose.yml +++ b/prometheus/docker-compose.yml @@ -18,17 +18,26 @@ services: image: pdreker/fritz_exporter:2 container_name: fritz-exporter restart: always + env_file: + - ./.env environment: - FRITZ_HOSTNAME: '192.168.178.1' - FRITZ_USERNAME: 'fritz9297' - FRITZ_PASSWORD: 'VeNuocNuocVe26!' + FRITZ_HOSTNAME: '${FRITZ_HOSTNAME}' + FRITZ_USERNAME: '${FRITZ_USERNAME}' + FRITZ_PASSWORD: '${FRITZ_PASSWORD}' ports: - "9787:9787" networks: - back-tier + resources: + limits: + cpus: '0.2' + memory: 128M + reservations: + cpus: '0.1' + memory: 64M prometheus: - image: prom/prometheus:latest + image: prom/prometheus:v2.54.0 volumes: - ./prometheus/:/etc/prometheus/ - prometheus_data:/prometheus @@ -44,13 +53,26 @@ services: networks: - back-tier restart: always + healthcheck: + test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:9090/-/healthy"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 40s + resources: + limits: + cpus: '1' + memory: 1G + reservations: + cpus: '0.5' + memory: 512M # deploy: # placement: # constraints: # - node.hostname == ${HOSTNAME} grafana: - image: grafana/grafana + image: grafana/grafana:11.0.0 user: "472" depends_on: - prometheus @@ -68,6 +90,19 @@ services: - front-tier - proxy_tier restart: always + healthcheck: + test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:3000/api/health"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 40s + resources: + limits: + cpus: '1' + memory: 512M + reservations: + cpus: '0.5' + memory: 256M labels: - "traefik.enable=true" # HTTP to HTTPS Redirect