Files
news-platform/docs/runbooks/NEWS_PLATFORM_MONITORING_ALERTS_BIT746.md
José Alves cba153cfc1
Tests / bridge tests (push) Successful in 29s
Tests / writer-pipeline tests (push) Successful in 30s
Tests / frontend lib tests (push) Successful in 31s
Tests / writer-pipeline tests (pull_request) Successful in 28s
Tests / bridge tests (pull_request) Successful in 28s
Tests / frontend lib tests (pull_request) Successful in 26s
fix(docs): update CT222 IP from 10.10.50.140 to 10.10.50.204 — BIT-24053
CT222 news-project-test changed IP following DHCP re-lease (BIT-24050
emergency fix). IP is now static at 10.10.50.204 via systemd-networkd.
Update all doc references, deploy script post-install notes, and
wordpress/README direct-access URLs.

Paperclip-Agent: Tiago Neves (devops; id 5d084b36-f38f-42a5-a92a-520005afda4f)
Paperclip-Issue: BIT-24053
Paperclip-Run: 9c69919d-4c21-48b0-8eb7-2b9745bed65c
2026-06-01 13:12:36 +00:00

4.9 KiB

News platform — monitoring alerts and escalation (BIT-746)

Follow-up to incident BIT-743 (public /noticias unavailable while internal checks looked fine). This runbook applies to CT 222 (news-project-test, 10.10.50.204) and the news-platform stack deployed under /opt/news-platform.

Must-not-fail inventory (MVP)

Signal What it protects Schedule Timeout Where to see state
bridge API + integration with WordPress/Redis Every 3 min (news-healthcheck.timer) 10 s journalctl -u news-healthcheck
bridge_deep (optional) Same stack, deep JSON (?checks=true) Same 10 s Same
frontend Astro SSR process Same 10 s Same
wordpress WP REST (/wp-json/wp/v2/) Same 10 s Same
public_page (optional) Customer path (e.g. https://…/noticias) — proxy, TLS, SSR Same 20 s Same
news-* systemd Crash / exit loops (NRestarts threshold) Same n/a Same + systemctl status news-bridge
[email protected] Immediate push when a unit fails (OnFailure) On failure n/a journalctl -u 'news-alert@*'

Canonical technical detail: docs/monitoring.md in the news-platform repo.

Alert channel: self-hosted Ntfy topic (NTFY_URL in /etc/news-platform/healthcheck.env). No NTFY_URL → failures are logged only (no push).

Plain-text 503 — «Serviço temporariamente indisponível.» (/, /noticias, …)

Cause (code): frontend/src/pages/noticias.astro and index.astro call resolveSsrBridge() (frontend/src/lib/bridge.ts). That helper must reach GET ${bridge_endpoint}/health (default http://127.0.0.1:3200/health on the CT, overridable with BRIDGE_INTERNAL_URL). Any network error, timeout (2s), or non-2xx response throws in production → Astro returns 503 with the PT string from ui-i18n (service_unavailable).

Not a WordPress-only failure: if the Fastify bridge process is down, Nginx still proxies /api/* to :3200 and browsers see 502 on /api/health, while SSR pages show 503 as above.

Recovery on the LXC (paths from docs/deployment.md; run as root):

systemctl status news-bridge news-frontend nginx --no-pager
curl -sS -o /dev/null -w 'bridge_health:%{http_code}\n' --max-time 5 http://127.0.0.1:3200/health
curl -sS -o /dev/null -w 'frontend:%{http_code}\n' --max-time 5 http://127.0.0.1:4321/health.json
systemctl enable --now news-bridge news-frontend
systemctl restart news-bridge && sleep 2 && systemctl restart news-frontend

If units are missing, (re)install from repo: deploy/scripts/deploy.sh on a checkout under /opt/news-platform. Confirm /etc/news-platform/bridge.env and frontend.env exist (deploy/systemd/*.example).

When an alert fires — first response (DevOps)

  1. Note host (HOSTNAME in the alert body) and the failed check names.
  2. On the LXC, open recent logs:
    journalctl -u news-healthcheck --since "30 min ago" -n 80
  3. For bridge / wordpress / bridge_deep:
    journalctl -u news-bridge -n 120 and curl -sS 'http://127.0.0.1:3200/health?checks=true' | head -c 2000
  4. For frontend:
    journalctl -u news-frontend -n 120 and curl -sS -o /dev/null -w '%{http_code}\n' http://127.0.0.1:4321/health.json
  5. For public_page failing while localhost checks pass: suspect edge (NPM, DNS, TLS, CDN, or upstream routing). Validate from a host outside the CT: curl -fsSIL "$PUBLIC_PAGE_URL" and compare with NPM / DNS records in docs/deployment.md and company inventory docs.
  6. Restore service using deploy/scripts/deploy.sh or targeted systemctl restart after root cause is understood; avoid blind restarts on production without a snapshot/backup window.

Escalation

Situation Action
Single component restart clears the alert Document in the issue thread; no escalation.
Repeated failures after fix, data risk, or unclear blast radius CTO (Peter Spark) — architecture / app ownership.
Customer-visible outage, security suspicion, or no DevOps coverage CEO + CTO after a short factual summary (what failed, what was tried, current user impact).

Evidence before closing BIT-746-class work

  • Log line showing an intentional test notification or curl POST to the Ntfy topic with a test payload, or screenshot from the Ntfy client.
  • Example test (replace topic and token):
    curl -fsS -H 'Title: news-platform monitor test' -d 'BIT-746 verification' "$NTFY_URL"

References

  • docs/monitoring.md — architecture and install steps
  • Parent incident context: BIT-743
  • LXC / VLAN inventory: docs/environments/03-lxc.md in the paperclip meta-repo (confirm VMID/IP on metal before changes)