Add monitoring stack config for #18
Scrap-Web/pipeline/head This commit looks good

This commit is contained in:
2026-10-28 15:02:43 -04:00
parent 3301e2463e
commit 4c098708f4
10 changed files with 149 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
# Pinned image versions only. No passwords in this file.
PROMETHEUS_TAG=v3.13.5
GRAFANA_TAG=13.2.5
NODE_EXPORTER_TAG=v1.12.1
BLACKBOX_TAG=v0.29.0
+2
View File
@@ -0,0 +1,2 @@
# Secrets stay on the Droplet only
grafana.secrets.env
+12
View File
@@ -0,0 +1,12 @@
#!/bin/sh
# Step 1 baseline - run on the Droplet BEFORE starting the monitoring stack.
# Output contains no secrets; paste it into the Gitea issue.
echo "== date"; date -Is
echo "== OS"; cat /etc/os-release | head -4; uname -r
echo "== CPU"; nproc; grep -m1 "model name" /proc/cpuinfo; uname -m
echo "== memory (bytes)"; free -b
echo "== root disk"; df -B1 /; df -h /
echo "== docker"; docker version --format '{{.Server.Version}}'; docker compose version
echo "== containers"; docker ps --format 'table {{.Names}}\t{{.Image}}\t{{.Status}}'
echo "== container usage"; docker stats --no-stream --format 'table {{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}'
echo "== load"; uptime
+12
View File
@@ -0,0 +1,12 @@
modules:
http_2xx:
prober: http
timeout: 10s
http:
method: GET
preferred_ip_protocol: ip4
valid_status_codes: [] # empty = any 2xx is success
follow_redirects: true
fail_if_not_ssl: true
tls_config:
insecure_skip_verify: false
+67
View File
@@ -0,0 +1,67 @@
# SSW 590 - Monitoring stack (Prometheus, Grafana OSS, Node Exporter, Blackbox Exporter)
# Only Grafana joins gitea-net so the existing Caddy container can proxy it.
# No host ports are published; Prometheus and the exporters stay on the private network.
services:
prometheus:
image: prom/prometheus:${PROMETHEUS_TAG:?choose a release}
container_name: prometheus
restart: unless-stopped
command:
- --config.file=/etc/prometheus/prometheus.yml
- --storage.tsdb.path=/prometheus
- --storage.tsdb.retention.time=7d
- --storage.tsdb.retention.size=5GB
volumes:
- ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro
- prometheus_data:/prometheus
networks: [monitoring]
grafana:
image: grafana/grafana:${GRAFANA_TAG:?choose a release}
container_name: grafana
restart: unless-stopped
depends_on: [prometheus]
env_file: [grafana.secrets.env]
environment:
GF_SERVER_ROOT_URL: "https://metrics.ssw590-08.me/"
GF_SERVER_DOMAIN: "metrics.ssw590-08.me"
GF_AUTH_ANONYMOUS_ENABLED: "false"
GF_USERS_ALLOW_SIGN_UP: "false"
GF_DATE_FORMATS_DEFAULT_TIMEZONE: "America/New_York"
volumes:
- grafana_data:/var/lib/grafana
- ./grafana/provisioning:/etc/grafana/provisioning:ro
- ./grafana/dashboards:/var/lib/grafana/dashboards:ro
networks: [monitoring, gitea-net]
node-exporter:
image: quay.io/prometheus/node-exporter:${NODE_EXPORTER_TAG:?choose a release}
container_name: node-exporter
restart: unless-stopped
pid: host
command:
- --path.rootfs=/host
- --path.procfs=/host/proc
- --path.sysfs=/host/sys
volumes:
- /:/host:ro,rslave
networks: [monitoring]
blackbox-exporter:
image: quay.io/prometheus/blackbox-exporter:${BLACKBOX_TAG:?choose a release}
container_name: blackbox-exporter
restart: unless-stopped
command: ["--config.file=/config/blackbox.yml"]
volumes:
- ./blackbox/blackbox.yml:/config/blackbox.yml:ro
networks: [monitoring]
networks:
monitoring:
gitea-net:
external: true
name: gitea-net
volumes:
prometheus_data:
grafana_data:
+2
View File
@@ -0,0 +1,2 @@
# Copy to grafana.secrets.env on the Droplet and fill in. Never commit the real file.
GF_SECURITY_ADMIN_PASSWORD=CHANGE_ME
@@ -0,0 +1,8 @@
apiVersion: 1
providers:
- name: ssw590
folder: SSW 590
type: file
allowUiUpdates: true
options:
path: /var/lib/grafana/dashboards
@@ -0,0 +1,9 @@
apiVersion: 1
datasources:
- name: Prometheus
uid: prometheus
type: prometheus
access: proxy
url: http://prometheus:9090
isDefault: true
editable: false
+32
View File
@@ -0,0 +1,32 @@
global:
scrape_interval: 30s
evaluation_interval: 30s
scrape_configs:
- job_name: prometheus
static_configs:
- targets: ["prometheus:9090"]
- job_name: node
static_configs:
- targets: ["node-exporter:9100"]
- job_name: blackbox
static_configs:
- targets: ["blackbox-exporter:9115"]
- job_name: https
metrics_path: /probe
params:
module: [http_2xx]
static_configs:
- targets:
- https://git.ssw590-08.me/user/login
- https://ci.ssw590-08.me/login
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: blackbox-exporter:9115