trails/infrastructure
Ullrich Schäfer 5c4b6fd9af Stop the caddy-502-rate alert firing on every deploy
The journal/planner deploy in cd-apps.yml does `docker compose up -d
journal planner`, which stops the old container and starts the new
one — Caddy keeps forwarding requests during the ~10–30s gap and
returns 502s. The caddy-502-rate alert (threshold > 0 for 2m)
correctly trips, every time.

Two production changes plus a long-broken workflow detail:

- infrastructure/Caddyfile — add `lb_try_duration 30s` /
  `lb_try_interval 250ms` to the journal and planner reverse_proxy
  blocks. Caddy now holds and retries the upstream for up to 30s
  during a restart instead of 502'ing immediately. Real outages
  (upstream unreachable longer than 30s) still 502 and the alert
  still fires for those.
- infrastructure/grafana/provisioning/alerting/alerts.yml — add a
  comment documenting why caddy-502-rate stays at threshold > 0:
  with lb_try_duration in front of it, the alert no longer
  conflates "deploy in flight" with "real outage."
- .github/workflows/cd-apps.yml — fix a long-silent bug: the
  Grafana deploy-annotation step was reading
  GRAFANA_SERVICE_TOKEN from `.env`, but the secrets file we scp
  to /opt/trails-cool is named `app.env`. The token check failed
  silently and the curl was being skipped on every deploy.
  Switching to `app.env` so deploys actually annotate Grafana.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-26 11:51:13 +02:00
..
brouter-host Stop BRouter contention kills under rapid editing 2026-04-24 17:43:15 +02:00
grafana Stop the caddy-502-rate alert firing on every deploy 2026-04-26 11:51:13 +02:00
loki Pass Grafana env vars to Caddy container, fix Loki compactor config 2026-03-27 13:53:56 +01:00
postgres Add pg-boss background job queue with session expiry 2026-04-13 21:17:24 +02:00
prometheus BRouter host observability + docs 2026-04-23 23:10:45 +02:00
promtail Fix journal health check and improve log collection 2026-04-12 15:00:00 +02:00
scripts Add infrastructure: Terraform, Docker Compose, BRouter, CD pipeline (#2) 2026-03-22 13:32:01 +01:00
terraform Add Hetzner vSwitch network for BRouter relocation 2026-04-23 22:43:57 +02:00
.env.example Failover across multiple Overpass upstreams 2026-04-21 07:36:10 +02:00
Caddyfile Stop the caddy-502-rate alert firing on every deploy 2026-04-26 11:51:13 +02:00
docker-compose.yml Rebuild the Journal home around a public feed and flagship marketing 2026-04-24 20:00:23 +02:00
secrets.app.env Cut Planner over to dedicated BRouter host 2026-04-24 17:17:18 +02:00
secrets.infra.env Provision Grafana Pushover contact point 2026-04-24 19:07:04 +02:00