From e48de7ddc0bee2fe0e2b2cfff57c88c1bad3bb8e Mon Sep 17 00:00:00 2001 From: furyhawk Date: Sun, 12 Jul 2026 12:09:13 +0800 Subject: [PATCH] feat: add setup-prometheus target and update Prometheus service configuration --- makefile | 8 +++++++- swarm/grafana.yml | 1 - swarm/prometheus.yml | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/makefile b/makefile index 2279468..5e7925e 100644 --- a/makefile +++ b/makefile @@ -238,7 +238,7 @@ deploy-grafana: pull setup-grafana set +a ;\ docker stack deploy --compose-file ./swarm/grafana.yml grafana ;\ } -deploy-prometheus: pull +deploy-prometheus: pull setup-prometheus { \ echo "Deploying the prometheus stack..." ;\ set -a ;\ @@ -246,6 +246,12 @@ deploy-prometheus: pull set +a ;\ docker stack deploy --compose-file ./swarm/prometheus.yml prometheus ;\ } +setup-prometheus: + { \ + echo "Setting up prometheus config on host..." ;\ + mkdir -p /var/data/prometheus ;\ + cp -n ./swarm/prometheus/prometheus.yml /var/data/prometheus/prometheus.yml 2>/dev/null || echo "prometheus.yml already exists, skipping" ;\ + } deploy-nodepad: pull { \ echo "Building the nodepad image..." ;\ diff --git a/swarm/grafana.yml b/swarm/grafana.yml index 7281665..07a8568 100644 --- a/swarm/grafana.yml +++ b/swarm/grafana.yml @@ -19,7 +19,6 @@ services: - /var/data/grafana/grafana.ini:/etc/grafana/grafana.ini:ro - /var/data/grafana/provisioning:/etc/grafana/provisioning:ro - /var/data/grafana/dashboards:/var/lib/grafana/dashboards:ro - - ./grafana/provisioning/datasources/prometheus.yml:/etc/grafana/provisioning/datasources/prometheus.yml:ro networks: - traefik-public deploy: diff --git a/swarm/prometheus.yml b/swarm/prometheus.yml index c03e830..a828d3d 100644 --- a/swarm/prometheus.yml +++ b/swarm/prometheus.yml @@ -18,7 +18,7 @@ services: volumes: - prometheus_data:/prometheus - /var/data/prometheus/rules:/etc/prometheus/rules:ro - - ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro + - /var/data/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro networks: - traefik-public ports: