Skip to content

Simple guide · Overview

Page status: Active

NutsNews Backend Recovery Workflows

This page documents the fixed-purpose recovery workflows for

Visual overview

Primary diagram

System map

This page documents the fixed-purpose recovery workflows for

Render the repository-owned system map when you need it.

Diagram is not rendered yet.

View as text
NutsNews Backend Recovery Workflows

This page documents the fixed-purpose recovery workflows for

flowchart TD
  accTitle: NutsNews Backend Recovery Workflows
  accDescr {
    This page documents the fixed-purpose recovery workflows for
  }
  A[Recovery workflow triggered] --> B{Action selected}
  B -->|diagnostics| C[Collect host, service, and backup diagnostics]
  B -->|backup-status| D[Read service-aware backup status]
  B -->|Mutating action| E[Run in check mode]
  C --> F[Upload `backend-recovery-report`]
  D --> F
  E --> G{Mode + confirm target valid?}
  G -->|no| H[Block and return remediation instructions]
  G -->|yes| I[Run protected apply]
  I --> J[Write `/var/lib/nutsnews/recovery/last-recovery.json`]
  J --> K[Expose state as `recovery_last_run` in backend health report]
  F --> L[Operator reviews evidence]
  H --> L
  K --> L

NutsNews Backend Recovery Workflows

Fullscreen diagram view.

This documents the fixed-purpose recovery workflows for ramideltoro/nutsnews-backend and backend.nutsnews.com.

Routine backend recovery runs through GitHub Actions. Operators should not use ad hoc SSH mutation unless there is a documented break-glass incident.

The primary workflow is:

.github/workflows/backend-recovery.yml

The runner is:

scripts/backend_recovery_workflow.py

The workflow accepts only fixed choices. It does not accept arbitrary remote commands, service names, shell scripts, Ansible tags, paths, or user supplied snippets.

Read-only:

ActionPurpose
diagnosticsCollect fixed host, service, Caddy, Alloy, backup, metrics, dashboard, and recovery-status diagnostics.
backup-statusRead the service-aware backup status report.

Mutating, protected:

ActionScope
trigger-backupStart nutsnews-backup.service.
trigger-restore-drillStart nutsnews-restore-drill.service.
reload-caddyValidate Caddy config and reload caddy.
restart-caddyValidate Caddy config and restart caddy.
restart-alloyValidate Alloy config and restart alloy.
restart-fail2banRestart fail2ban.
refresh-metricsStart nutsnews-metrics-textfile.service.
refresh-ops-dashboardStart nutsnews-ops-dashboard-collect.service.

Package updates and reboots remain in Backend Controlled Maintenance. Broad host configuration changes remain in Protected Backend Ansible Apply.

Every recovery run uses the protected production-backend GitHub Environment.

For mutating recovery:

  1. Run the same action with mode=check.
  2. Review the uploaded backend-recovery-report artifact.
  3. Run mode=apply only when check mode passes.
  4. Set confirm_target=backend.nutsnews.com.
  5. Approve the protected environment deployment.

Read-only diagnostics and backup-status do not require confirmation text.

Mutating applies write:

/var/lib/nutsnews/recovery/last-recovery.json

That state records action, mode, result, actor, workflow URL, timestamps, and a sanitized error string when present. It intentionally omits secrets, command output, environment values, private keys, tokens, and database URLs.

The backend health report exposes this state as recovery_last_run.

Static and unit validation live in the backend repo:

Terminal window
python3 scripts/validate_recovery_workflows.py
python3 -m unittest tests.test_backend_recovery_workflow
python3 -m unittest tests.test_backend_health_report
actionlint .github/workflows/backend-recovery.yml

Live non-mutating validation uses mode=check only.