Merge branch 'main' into task/BIT-3492-tier2-contributing-codeowners
This commit is contained in:
commit
a98f4934b5
4 files changed
+143
No files matched your search
@@ -66,6 +66,7 @@ curl -sS "http://127.0.0.1:3310/search?site=andebol.net&limit=5"
|
||||
|
||||
## Related docs
|
||||
|
||||
- `docs/runbooks/NEWS_PLATFORM_INCIDENT_RUNBOOK_BIT3915.md` — incident response (stall, lag, escalation)
|
||||
- `docs/AGGREGATOR_ARCHITECTURE.md` — long-term schema and phased plan
|
||||
- `docs/WRITER_PIPELINE_ANDEBOL.md` — pipeline commands and metrics
|
||||
- `docs/writer-tools.md` — bridge writer API
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
Automated health monitoring and alerting for the news-platform services on **CT 222** (`news-project-test`, **10.10.50.140**).
|
||||
**BIT-746** adds a **must-not-fail inventory**, optional **public URL** probing, optional **bridge deep** checks, and an **escalation runbook**: `docs/runbooks/NEWS_PLATFORM_MONITORING_ALERTS_BIT746.md`.
|
||||
**BIT-3915** adds **pipeline incident** coverage (aggregator stall, lag signals, escalation): `docs/runbooks/NEWS_PLATFORM_INCIDENT_RUNBOOK_BIT3915.md`.
|
||||
**Runbook index:** `docs/runbooks/README.md` (links deployment, smoke script, and company-wide **paperclip** runbooks).
|
||||
|
||||
Fleet-wide LXC context (confirm on metal): **paperclip** repo `docs/environments/03-lxc.md`.
|
||||
|
||||
@@ -0,0 +1,140 @@
|
||||
# News platform — incident response (aggregator, lag, escalation) — BIT-3915
|
||||
|
||||
Operational incident guide for the **news-platform** stack (Astro SSR, Fastify bridge, headless WordPress, optional **writer-pipeline** aggregator). Default deployment context: **LXC CT 222** (`news-project-test`, **10.10.50.140**, VLAN 1050) — confirm VMID/IP against the current inventory in the **paperclip** meta-repo (`docs/environments/03-lxc.md`).
|
||||
|
||||
## How this runbook fits
|
||||
|
||||
| Topic | Canonical doc |
|
||||
|--------|----------------|
|
||||
| HTTP health checks, systemd units, Ntfy alerts, first response on service down | [`NEWS_PLATFORM_MONITORING_ALERTS_BIT746.md`](./NEWS_PLATFORM_MONITORING_ALERTS_BIT746.md) and [`../monitoring.md`](../monitoring.md) |
|
||||
| Aggregator API, store paths, bridge `AGGREGATOR_URL` | [`../AGGREGATOR_OPERATIONS.md`](../AGGREGATOR_OPERATIONS.md) |
|
||||
| Ingest, shortlist, metrics file | [`../WRITER_PIPELINE_ANDEBOL.md`](../WRITER_PIPELINE_ANDEBOL.md) |
|
||||
| Deploy order and NPM | [`../deployment.md`](../deployment.md) |
|
||||
|
||||
Use **this** document when the site is **partially** healthy (localhost checks pass) but **editorial pipeline signals** are wrong: stale aggregator data, missing candidates, or **lag** between real-world news and what writers see.
|
||||
|
||||
---
|
||||
|
||||
## 1. Severity quick matrix
|
||||
|
||||
| Symptom | User impact | Typical owner | First doc |
|
||||
|---------|-------------|---------------|-----------|
|
||||
| Customer URL returns 5xx/timeout while CT checks pass | **High** — public outage | DevOps + edge (NPM/TLS/DNS) | [BIT-746 runbook](./NEWS_PLATFORM_MONITORING_ALERTS_BIT746.md) § *public_page* |
|
||||
| Bridge / frontend / WordPress / Redis failing on CT | **High** | DevOps | `docs/monitoring.md` + BIT-746 |
|
||||
| **Aggregator** up but **no new items** for a site; writers only see WordPress | **Medium** — pipeline degradation | DevOps or on-call engineer | §2 below |
|
||||
| **Lag** — items exist but **ingestedAt** is old vs breaking news | **Medium** | Same + editorial triage | §3 below |
|
||||
|
||||
---
|
||||
|
||||
## 2. Aggregator stall — detection and recovery
|
||||
|
||||
### 2.1 What “stalled” means
|
||||
|
||||
The **aggregator HTTP** process (default **`:3310`**) answers `/health`, but at least one of these is true:
|
||||
|
||||
- `GET /stats` shows **flat** counts for the affected `site` over multiple hours while sources are known to publish.
|
||||
- `GET /shortlist?site=…&limit=10` returns **no** or **only very old** items (compare `ingestedAt` / `publishedAt` in JSON to wall clock).
|
||||
- Bridge `GET /writers/:id/candidates` responses show **`candidate_source`** dominated by **`wordpress`** where **`aggregator`** or **`mixed`** was expected (requires `AGGREGATOR_URL` set on the bridge — see [`AGGREGATOR_OPERATIONS.md`](../AGGREGATOR_OPERATIONS.md)).
|
||||
|
||||
### 2.2 Detection (on the LXC or dev host)
|
||||
|
||||
Replace host/port if your deployment overrides `AGGREGATOR_HOST` / `AGGREGATOR_PORT`.
|
||||
|
||||
```bash
|
||||
# Liveness + resolved store path
|
||||
curl -fsS "http://127.0.0.1:3310/health" | jq .
|
||||
|
||||
# Totals and per-site counts (repeat twice, ~5 min apart, while news is expected)
|
||||
curl -fsS "http://127.0.0.1:3310/stats" | jq .
|
||||
|
||||
# Newest shortlist for the site (inspect timestamps)
|
||||
curl -fsS "http://127.0.0.1:3310/shortlist?site=andebol.net&limit=15" | jq '.[:3] | .[] | {title, publishedAt, ingestedAt}'
|
||||
|
||||
# Optional: compare bridge candidates mix (needs auth context on your env)
|
||||
# curl -fsS "http://127.0.0.1:3200/writers/<agentId>/candidates" | jq '{candidate_source, aggregator_total_items}'
|
||||
```
|
||||
|
||||
Also inspect **ingest logs**: if ingest runs only from cron/systemd, check the last successful run time vs schedule in [`AGGREGATOR_OPERATIONS.md`](../AGGREGATOR_OPERATIONS.md) § *Suggested scheduling*.
|
||||
|
||||
### 2.3 Common causes
|
||||
|
||||
| Cause | Clues | Recovery |
|
||||
|-------|--------|----------|
|
||||
| Aggregator process not running | `/health` connection refused | Start the supervised process (`npm run aggregator` after `npm run build` in `writer-pipeline/`, or your **systemd/PM2** unit if installed). |
|
||||
| Stale process, memory wedge | `/health` OK but `/stats` frozen; high RSS | Restart aggregator process; re-run §2.2. |
|
||||
| **Ingest** not executed | Store file old `mtime`; `/stats` unchanged | `POST /ingest?site=<site>` (see [`AGGREGATOR_OPERATIONS.md`](../AGGREGATOR_OPERATIONS.md)); fix cron/timer if missing. |
|
||||
| Bad or blocked RSS upstream | Errors in ingest logs; one feed down | Per-feed isolation — see [`WRITER_PIPELINE_ANDEBOL.md`](../WRITER_PIPELINE_ANDEBOL.md) § *Fallback behaviour*; adjust `*.sources.json` (`maxItems`, URL). |
|
||||
| Bridge not wired to aggregator | Candidates never show `aggregator` | Set **`AGGREGATOR_URL`** on bridge; restart **news-bridge**; verify with bridge health/deep check. |
|
||||
|
||||
### 2.4 Recovery checklist (ordered)
|
||||
|
||||
1. Confirm **which site** (`andebol.net`, etc.) and **config file** (`writer-pipeline/config/<site>.sources.json`).
|
||||
2. `curl` **§2.2** — capture **before** snapshots (for the incident thread).
|
||||
3. **Restart** aggregator if the process is wedged; verify `/health` again.
|
||||
4. Run **`POST /ingest?site=…`** once; re-check `/stats` and `/shortlist`.
|
||||
5. If still flat, open **`writer-pipeline/var/metrics.jsonl`** tail for `errors` from the last cycle (see pipeline doc).
|
||||
6. If bridge integration suspected, `curl` bridge **`/health?checks=true`** (Redis/WordPress path).
|
||||
7. Post **evidence** (commands + short JSON excerpts) in the Paperclip issue before closing.
|
||||
|
||||
---
|
||||
|
||||
## 3. Lag monitoring and alerts
|
||||
|
||||
### 3.1 Definitions
|
||||
|
||||
- **Ingest lag:** difference between **latest `publishedAt`** among shortlisted items and **wall clock**, or between consecutive successful **`POST /ingest`** completions (whichever you can measure from logs).
|
||||
- **Writer lag:** time from item entering the shortlist to editorial action — operational, not only technical.
|
||||
|
||||
### 3.2 Signals already available
|
||||
|
||||
| Signal | Where |
|
||||
|--------|--------|
|
||||
| Per-cycle token estimates and **`metrics.errors`** | `writer-pipeline/var/metrics.jsonl` ([`WRITER_PIPELINE_ANDEBOL.md`](../WRITER_PIPELINE_ANDEBOL.md)) |
|
||||
| Aggregator freshness | `/shortlist`, `/search?…&max_age_hours=`, `/stats` |
|
||||
| Stack latency / dependency health | Bridge `GET /health?checks=true` ([`../monitoring.md`](../monitoring.md)) |
|
||||
| Scheduled health and **Ntfy** | `news-healthcheck.timer` + `/etc/news-platform/healthcheck.env` |
|
||||
|
||||
### 3.3 Alerting (MVP vs future)
|
||||
|
||||
- **Today:** BIT-746-style checks prove **process up** and **HTTP paths**; they do **not** assert “RSS fresh within N minutes.” For lag-specific paging, either extend `deploy/scripts/healthcheck.sh` with a small **aggregator freshness** probe (curl `/stats` or `/shortlist` and compare timestamps to thresholds) or add a **dedicated systemd timer** that runs a script in-repo (prefer committing the script under `deploy/scripts/` with documentation here).
|
||||
- **When adding probes:** keep **timeouts** aligned with `docs/monitoring.md` (avoid hammering external RSS from tight timers).
|
||||
|
||||
---
|
||||
|
||||
## 4. Incident escalation
|
||||
|
||||
### 4.1 Technical ladder (news-platform)
|
||||
|
||||
Align with [BIT-746 escalation](./NEWS_PLATFORM_MONITORING_ALERTS_BIT746.md): **DevOps** first on CT222, **CTO** for architecture / blast radius, **CEO** for customer-visible sustained outage or security suspicion.
|
||||
|
||||
Add for **aggregator / writer-pipeline**:
|
||||
|
||||
| Situation | Action |
|
||||
|-----------|--------|
|
||||
| Single failed ingest; self-heals on retry | Log in issue; no escalation. |
|
||||
| Repeated ingest errors or copyright/licensing uncertainty | Pause automated ingest for the suspect feed; involve **editorial** + **CTO**. |
|
||||
| Data corruption suspicion on `aggregated-items.json` | Stop aggregator; take a **file backup**; restore from known good or re-ingest; involve **CTO** before destructive deletes. |
|
||||
|
||||
### 4.2 Paperclip and queue hygiene
|
||||
|
||||
- **Operational work** (deploy, timers, secrets) should leave **evidence** in the linked issue (commands, `journalctl` excerpts, commit SHA).
|
||||
- If a run was stuck in **`queued`** with an empty `startedAt` for extended time, automation may **`release`** the lock per [BIT-517](/BIT/issues/BIT-517) §3a — the assignee can **`checkout`** again when ready; do not treat the pulse comment alone as a rollback of technical state.
|
||||
|
||||
---
|
||||
|
||||
## 5. Acceptance mapping (BIT-3915)
|
||||
|
||||
| Requirement | Section |
|
||||
|---------------|---------|
|
||||
| Aggregator stall **detection** and **recovery** | §2 |
|
||||
| **Lag** monitoring and **alerts** (signals + MVP vs extensions) | §3 |
|
||||
| Incident **escalation** procedures | §4 |
|
||||
|
||||
---
|
||||
|
||||
## References
|
||||
|
||||
- [BIT-3915](/BIT/issues/BIT-3915) — parent tracking issue
|
||||
- [BIT-746](/BIT/issues/BIT-746) — monitoring / Ntfy runbook
|
||||
- [BIT-709](/BIT/issues/BIT-709) — aggregator epic
|
||||
- [BIT-743](/BIT/issues/BIT-743) — incident that motivated public-page checks
|
||||
@@ -6,6 +6,7 @@ Operational procedures for this repository. For company-wide runbooks (Paperclip
|
||||
|
||||
| Topic | Where |
|
||||
|-------|--------|
|
||||
| **Incident response — aggregator stall, lag, escalation (BIT-3915)** | [`NEWS_PLATFORM_INCIDENT_RUNBOOK_BIT3915.md`](./NEWS_PLATFORM_INCIDENT_RUNBOOK_BIT3915.md) |
|
||||
| **Monitoring alerts & escalation (BIT-746)** — health checks, Ntfy, first response on CT 222 | [`NEWS_PLATFORM_MONITORING_ALERTS_BIT746.md`](./NEWS_PLATFORM_MONITORING_ALERTS_BIT746.md) |
|
||||
|
||||
## Related documentation & checks
|
||||
|
||||
Reference in new issue
Block a user