From dafb20892bb27af03d449e6b19d782022c884349 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Thu, 26 Feb 2026 17:25:56 -0800 Subject: chore: add prometheus scrape configuration --- docker-compose.yml | 23 ++++++++++++++--------- prometheus.yml | 8 ++++++++ 2 files changed, 22 insertions(+), 9 deletions(-) create mode 100644 prometheus.yml diff --git a/docker-compose.yml b/docker-compose.yml index ed5c6c0..5009c56 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -24,19 +24,11 @@ services: PLUTIA_MIRROR_PRIVATE_KEY_PATH: ${MIRROR_PRIVATE_KEY_PATH:-/var/lib/plutia/mirror.key} ports: - "8080:8080" - # - job_name: "plutia" - # static_configs: - # - targets: ["localhost:8080"] - # metrics_path: /metrics volumes: - ./config.default.yaml:/etc/plutia/config.yaml:ro - ./data:/var/lib/plutia healthcheck: - test: - [ - "CMD-SHELL", - "wget -q -O- http://127.0.0.1:8080/health >/dev/null 2>&1 || curl -fsS http://127.0.0.1:8080/health >/dev/null", - ] + test: ["CMD", "wget", "-q", "-O-", "http://127.0.0.1:8080/health"] interval: 30s timeout: 5s retries: 5 @@ -54,3 +46,16 @@ services: max-size: "10m" max-file: "5" restart: unless-stopped + + prometheus: + image: prom/prometheus:latest + command: + - "--config.file=/etc/prometheus/prometheus.yml" + - "--storage.tsdb.path=/prometheus" + - "--storage.tsdb.retention.time=7d" + volumes: + - ./prometheus.yml:/etc/prometheus/prometheus.yml:ro + - ./prometheus-data:/prometheus + ports: + - "9090:9090" + restart: unless-stopped diff --git a/prometheus.yml b/prometheus.yml new file mode 100644 index 0000000..cf0ddc5 --- /dev/null +++ b/prometheus.yml @@ -0,0 +1,8 @@ +global: + scrape_interval: 15s + +scrape_configs: + - job_name: "plutia" + static_configs: + - targets: ["plutia:8080"] + metrics_path: /metrics -- cgit v1.2.3