Add Prometheus/Grafana monitoring stack and Grafana route (#11)
seat-back-trivia/pipeline/head This commit looks good

Four pinned containers on a private network with memory caps for the 512 MB
droplet; provisioned data source, six-panel dashboard, HTTPS-availability and
root-disk alert rules, and the team-alerts Discord contact point. The Discord
webhook comes from the untracked grafana.secrets.env. Bring deploy/Caddyfile
in line with the droplet (ci route) and add metrics.pollefeys.dev.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Cedric Pollefeys
2026-10-28 15:28:47 -04:00
co-authored by Claude Opus 5.5
parent 55ab869735
commit adb8d5fab1
10 changed files with 890 additions and 0 deletions
+89
View File
@@ -0,0 +1,89 @@
# Seat-Back Trivia monitoring on the ssw-590 droplet: Prometheus, Grafana OSS,
# Node Exporter, and Blackbox Exporter. Nothing here publishes a host port.
# Prometheus and the exporters sit only on the private monitoring network.
# Grafana also joins the existing gitea_gitea-net so the Caddy container can
# proxy https://metrics.pollefeys.dev to grafana:3000.
# The droplet has 512 MB of RAM, so every container has a hard memory cap.
name: monitoring
services:
prometheus:
image: prom/prometheus:${PROMETHEUS_TAG:?choose a release}
restart: unless-stopped
command:
- --config.file=/etc/prometheus/prometheus.yml
- --storage.tsdb.path=/prometheus
- --storage.tsdb.retention.time=7d
- --storage.tsdb.retention.size=256MB
volumes:
- ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro
- prometheus_data:/prometheus
mem_limit: 160m
networks: [monitoring]
depends_on: [node-exporter, blackbox-exporter]
grafana:
image: grafana/grafana:${GRAFANA_TAG:?choose a release}
restart: unless-stopped
environment:
GF_SERVER_DOMAIN: metrics.pollefeys.dev
GF_SERVER_ROOT_URL: https://metrics.pollefeys.dev/
GF_AUTH_ANONYMOUS_ENABLED: "false"
GF_USERS_ALLOW_SIGN_UP: "false"
GF_SECURITY_COOKIE_SECURE: "true"
# Grafana's own /metrics would otherwise be public through Caddy.
GF_METRICS_ENABLED: "false"
GF_ANALYTICS_REPORTING_ENABLED: "false"
GF_ANALYTICS_CHECK_FOR_UPDATES: "false"
GF_ANALYTICS_CHECK_FOR_PLUGIN_UPDATES: "false"
GF_PLUGINS_PREINSTALL_DISABLED: "true"
GF_NEWS_NEWS_FEED_ENABLED: "false"
GF_DATE_FORMATS_DEFAULT_TIMEZONE: UTC
# DISCORD_WEBHOOK_URL for the team-alerts contact point. Untracked, mode 600.
env_file: grafana.secrets.env
volumes:
- grafana_data:/var/lib/grafana
- ./grafana/provisioning:/etc/grafana/provisioning:ro
- ./grafana/dashboards:/etc/grafana/dashboards:ro
mem_limit: 192m
networks: [monitoring, proxy]
depends_on: [prometheus]
node-exporter:
image: quay.io/prometheus/node-exporter:${NODE_EXPORTER_TAG:?choose a release}
restart: unless-stopped
pid: host
command:
- --path.rootfs=/host
- --path.procfs=/host/proc
- --path.sysfs=/host/sys
# Only what the dashboard and alerts use, to keep Prometheus small.
- --collector.disable-defaults
- --collector.cpu
- --collector.meminfo
- --collector.filesystem
- --collector.loadavg
- --collector.uname
volumes:
- /:/host:ro,rslave
mem_limit: 32m
networks: [monitoring]
blackbox-exporter:
image: quay.io/prometheus/blackbox-exporter:${BLACKBOX_TAG:?choose a release}
restart: unless-stopped
command: ["--config.file=/config/blackbox.yml"]
volumes:
- ./blackbox/blackbox.yml:/config/blackbox.yml:ro
mem_limit: 32m
networks: [monitoring]
networks:
monitoring:
proxy:
external: true
name: gitea_gitea-net
volumes:
prometheus_data:
grafana_data: