Files
XikaandCursor ca8bec5ca3
ai-news-writer-ci / test (pull_request) Successful in 32s
ci(staging): deploy after CI on main; pull triggering branch (BIT-21911)
Staging deploy previously chained only off develop CI and hard-coded git
pull develop. Remote develop was missing or protected while PR #18 merged to
main. Watch develop and main; set STAGING_GIT_BRANCH from workflow_run or
dispatch ref; align rollback push and pull with the same branch.

Docs: DEPLOYMENT runbook diagram and manual-dispatch notes.
Co-authored-by: Cursor <[email protected]>
2026-05-12 12:05:48 +00:00
..

ai-news-writer — Runbooks & Ops Index

Operational reference for the AI News Writer service (Node.js / PM2 / LXC). CTID: 223 | Domain: ainews.bitreport.pt | Gitea: BitReport.pt/ai-news-writer

Related: Paperclip BIT-353 — CT 223 / ai-news-writer epic.


Deploy & Rollback

Runbook Purpose
DEPLOYMENT.md (BIT-14770) Day-to-day deployment: pipeline overview, staging/prod promote flow, zero-downtime strategy, env configs
ROLLBACK.md (BIT-14770) Rollback procedures: decision tree, failure modes, recovery paths (RB-1 through RB-5)
DEPLOY_LXC.md First-time LXC container provisioning and secrets injection

Quick reference — all commands documented in the root README.md:

Action Command
Create LXC container tools/proxmox/create_ai_news_writer_lxc.sh on Proxmox node
Deploy (pull + restart) npm run deploy:lxc
Start via PM2 npm run pm2:start
Smoke test npm run verify:deploy -- <url>
Full ops check npm run ops:check

Verification

# Health endpoint (listen mode required)
curl https://ainews.bitreport.pt/health

# RSS feed probe
npm run rss:test

# WordPress connectivity
npm run wp:test

502 / Service Recovery

  1. SSH into CTID 223 (ai-news-writer-dev)
  2. Check PM2: pm2 list && pm2 logs ai-news-writer --lines 50
  3. Restart: pm2 restart ai-news-writer
  4. If dead after restart: npm run deploy:lxc -- --with-ops-check

Configuration

File Purpose
.env Secrets (OpenAI key, WP credentials, admin token) — never commit; see root .env.example
config/sources.json RSS feed URLs (copy from config/sources.example.json for new installs)
config/social.json X / Twitter queries
config/sites/ WordPress targets
ecosystem.config.cjs PM2 app definition

Architecture Overview

See README.md — Architecture section for the full pipeline: RSS → Crawler → AI Writer → WordPress publisher.

Backup & Disaster Recovery

Comprehensive backup and recovery procedures for the AI News Writer service.

Runbook Purpose
BACKUP_STRATEGY.md (BIT-4285) RTO/RPO targets, backup frequency, retention policy, offsite storage
BACKUP_TESTING.md Manual backup creation, restore procedures, test schedule (weekly/monthly/quarterly)
DISASTER_RECOVERY.md Recovery procedures for 4 scenarios: data corruption, service crash, container loss, complete failure

Quick Links:

  • Weekly Test: Run ./tools/backup-article-index.sh every Monday @ 10:00 UTC
  • Monthly Restore Test: Restore from backup to verify integrity
  • Quarterly Full Recovery: Full production recovery test (planned downtime)
  • Manual Backup: Anytime: ./tools/backup-article-index.sh

Cross-references