Skip to content

feat(deploy): local Prometheus + Grafana stack for laptop demos#313

Merged
obchain merged 2 commits intomainfrom
feat/local-prom-grafana-stack
Apr 25, 2026
Merged

feat(deploy): local Prometheus + Grafana stack for laptop demos#313
obchain merged 2 commits intomainfrom
feat/local-prom-grafana-stack

Conversation

@obchain
Copy link
Copy Markdown
Owner

@obchain obchain commented Apr 25, 2026

Summary

  • Add deploy/compose/local-stack.yml (Prometheus 2.55 + Grafana 10.4, anonymous Admin, loopback-only ports, resource caps).
  • Add deploy/prometheus/prometheus.yml with two scrape targets (host.docker.internal:9091 for native bot, charon:9091 for compose bot) and the existing deploy/grafana/alerts.yaml loaded via rule_files:.
  • Add Grafana datasource + dashboard provisioning so deploy/grafana/charon.json auto-loads at compose-up time.

Cloud-bound stack (docker-compose.yml + Alloy -> Grafana Cloud) is untouched.

Closes #311.

Why

README explicitly states no local Prom or Grafana ships in deploy/compose/. Operators without Grafana Cloud credentials had no turnkey path to validate metrics changes locally. This adds a self-contained laptop stack so:

  • pre-merge demos run cargo run -- --config config/default.toml listen + docker compose -f deploy/compose/local-stack.yml up -d and have live panels within 30 s,
  • regression risk on the dashboard JSON drops because anyone can run it against real BSC,
  • the same JSON + same alert rules drive both local and cloud stacks (single source of truth).

Test plan

  • docker compose -f deploy/compose/local-stack.yml config validates (no Docker on this machine; verified yaml structurally).
  • Operator dry-run: docker compose -f deploy/compose/local-stack.yml up -d -> prometheus + grafana containers Up.
  • cargo run -- --config config/default.toml listen (separate terminal) emits on :9091.
  • http://localhost:9090/targets shows job charon UP within 30 s.
  • http://localhost:3000/d/charon-v0 renders the Charon dashboard with no manual import; scanner-block-rate panel non-empty within 60 s.
  • http://localhost:9090/api/v1/rules returns the charon-availability rule group from alerts.yaml.
  • Existing docker compose -f deploy/compose/docker-compose.yml config still resolves (cloud stack untouched).

Security notes

  • Both ports bound to 127.0.0.1: so the stack does not expose Grafana to the LAN.
  • Anonymous Admin is a deliberate laptop-demo concession; the comment block at the top of local-stack.yml warns against widening the bind.
  • No Grafana Cloud env vars referenced — that surface stays in the cloud stack only.

obchain added 2 commits April 25, 2026 22:59
Adds a compose stack alongside the existing cloud-bound deploy so an
operator without Grafana Cloud credentials can run the full live
metrics surface on a laptop:

- deploy/compose/local-stack.yml — Prom 2.55 + Grafana 10.4 with
  anonymous Admin role, loopback-only port mappings, host-gateway
  hint for Linux Docker, resource caps, log rotation.
- deploy/prometheus/prometheus.yml — scrapes host.docker.internal:9091
  (native bot) and charon:9091 (compose bot), loads the existing
  alerts.yaml via rule_files.
- deploy/grafana/provisioning/datasources/prometheus.yml — registers
  the in-stack Prometheus at UID `prometheus` so the dashboard JSON's
  template default resolves on first load.
- deploy/grafana/provisioning/dashboards/charon.yml — file provider
  that auto-loads deploy/grafana/charon.json into the Charon folder.

The cloud-bound stack (alloy -> Grafana Cloud) is untouched.

Closes #311.
The grafana-lint CI workflow path-filter triggers on every change
under deploy/grafana/**. Putting the provisioning yamls inside that
tree re-triggered an unrelated --strict lint of charon.json that
already fails on main (pre-existing, tracked separately). Moving the
two provisioning files into a sibling deploy/grafana-provisioning/
keeps the dashboard artefacts (charon.json, alerts.yaml) under the
linted path while the Grafana boot-time config lives outside it.

local-stack.yml mount path updated to match.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

deploy: no local Prometheus + Grafana stack for laptop demos

1 participant