# Monitoring stack on The-Ocean (Assignment 7 / Instructor Manual Chapter 5). # Four project-published images, pinned by tag and digest (the repository ignores # .env files, so versions live here). No service publishes a host port: # Caddy reaches grafana:3000 on gitea_web; Prometheus and the exporters stay on # the private "monitoring" network. Pause with stop/start; never "down -v". name: monitoring services: prometheus: image: prom/prometheus:v3.15.1@sha256:fa3302279710be2f21a8301ec17a8b4f2301fd829bd113839b3b6b02b6f191a2 restart: unless-stopped command: - --config.file=/etc/prometheus/prometheus.yml - --storage.tsdb.path=/prometheus - --storage.tsdb.retention.time=7d - --storage.tsdb.retention.size=500MB # whichever limit is hit first environment: - GOMEMLIMIT=96MiB # Go GC target below the container cap volumes: - ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro - prometheus_data:/prometheus networks: [monitoring] mem_limit: 128m grafana: image: grafana/grafana:13.2.5@sha256:9f7aa1e1e3246aade5792d35a738049f7f32f89cd51d1956cf426a4e86268a84 restart: unless-stopped # Root-only, untracked: GF_SECURITY_ADMIN_PASSWORD and DISCORD_WEBHOOK_URL (see README). env_file: [.env.secret] environment: GF_SERVER_ROOT_URL: https://metrics.yebilly.me/ GF_SECURITY_ADMIN_USER: billy GF_SECURITY_COOKIE_SECURE: "true" GF_SECURITY_DISABLE_GRAVATAR: "true" GF_AUTH_ANONYMOUS_ENABLED: "false" GF_USERS_ALLOW_SIGN_UP: "false" GF_METRICS_ENABLED: "false" # no public /metrics through the HTTPS hostname # 1 GiB droplet: skip plugin downloads, news, and phone-home checks. GF_PLUGINS_PREINSTALL_DISABLED: "true" GF_NEWS_NEWS_FEED_ENABLED: "false" GF_ANALYTICS_REPORTING_ENABLED: "false" GF_ANALYTICS_CHECK_FOR_UPDATES: "false" GF_ANALYTICS_CHECK_FOR_PLUGIN_UPDATES: "false" GOMEMLIMIT: 150MiB volumes: - grafana_data:/var/lib/grafana - ./grafana/provisioning:/etc/grafana/provisioning:ro - ./grafana/dashboards:/var/lib/grafana-dashboards:ro networks: [monitoring, web] mem_limit: 192m node-exporter: image: quay.io/prometheus/node-exporter:v1.12.1@sha256:1b4e4438faca4dd7e001dd445d161a4a2091b0fededa84093b3a8dfeae1f1be0 restart: unless-stopped pid: host command: - --path.rootfs=/host - --path.procfs=/host/proc - --path.sysfs=/host/sys # Only what the dashboard and alerts use: CPU, memory, root disk. - --collector.disable-defaults - --collector.cpu - --collector.meminfo - --collector.filesystem - --collector.loadavg - --collector.uname volumes: - /:/host:ro,rslave # read-only host view; no Docker socket, not privileged networks: [monitoring] mem_limit: 32m blackbox-exporter: image: quay.io/prometheus/blackbox-exporter:v0.29.1@sha256:ea1c7aa3ef3f307cd03e85f34abb604478ccb90b567fc690da0cd9776da76b13 restart: unless-stopped user: "65534:65534" # image default is root; HTTP probes need no privileges command: ["--config.file=/config/blackbox.yml"] volumes: - ./blackbox/blackbox.yml:/config/blackbox.yml:ro networks: monitoring: probe: # The only private address allowed past the ci.yebilly.me allowlist. ipv4_address: 172.30.90.10 mem_limit: 32m networks: monitoring: web: external: true name: gitea_web probe: external: true name: gitea_probe # defined in deploy/docker-compose.yml; Caddy answers git/ci there volumes: prometheus_data: grafana_data: