Skip to content

Technical guide · Overview

Page status: Active

NutsNews Backend Backup And Restore Baseline

This documents the backup and restore policy for ramideltoro/nutsnews-backend before any production backend state is stored on 65.75.201.18.

Visual overview

Primary diagram

System map

This documents the backup and restore policy for ramideltoro/nutsnews-backend before any production backend state is stored on 65.75.201.18.

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

Diagram is not rendered yet.

View as text
NutsNews Backend Backup And Restore Baseline

This documents the backup and restore policy for ramideltoro/nutsnews-backend before any production backend state is stored on 65.75.201.18.

flowchart TB
  accTitle: NutsNews Backend Backup And Restore Baseline
  accDescr {
    This documents the backup and restore policy for ramideltoro/nutsnews-backend before any production backend state is stored on 65.75.201.18.
  }
  A["NutsNews Backend Backup And Restore Baseline"] --> B["NUTSNEWS_BACKEND_BACKUP_RESTORE.md"]
  B --> C["Auto-generated placeholder diagram"]

NutsNews Backend Backup And Restore Baseline

Fullscreen diagram view.

NutsNews Backend Backup And Restore Baseline

Section titled “NutsNews Backend Backup And Restore Baseline”

This documents the backup and restore policy for ramideltoro/nutsnews-backend before any production backend state is stored on 65.75.201.18.

The backend host has no deployed app runtime, upload storage, or production backend app state yet. It does have host baseline, Caddy, dashboard, backup-status state, and a private PostgreSQL restore/failover target covered by the service-aware backup matrix. The worker-uplift RabbitMQ broker is now provisioned as durable transport; its live message store is intentionally excluded from normal Restic snapshots, while non-secret topology/config and RabbitMQ recovery evidence are included.

The backend repo source of truth is:

docs/backend-backup-service-matrix.json

Backups must survive VPS loss. Provider snapshots are supplemental only and must not be the sole recovery mechanism for application data, database state, credentials, or operational evidence.

Data classInitial ownerBackup requirement
Backend app code/configGitHub repositoriesGit remotes are source of truth
Runtime env/secretsGitHub Environment secrets or documented secret storeSecret names documented; values excluded from restic
Host and reverse proxy configBackend repo through Ansible plus restic evidenceRecreate from repo and protected apply; restore selected state as needed
Ops dashboard/status metadataBackend host collectorsBacked up for incident evidence and exposed in dashboard/reporting
Application uploads/local stateFuture backend issueOff-server backups required before production use
PostgreSQL dataBackend issue #13Host state is covered by service-aware restic paths; staging Supabase restore drills prove database restore readiness before production use
RabbitMQ brokerBackend worker-uplift runtimeNon-secret config, topology, Compose, and recovery evidence are backed up; live /var/lib/nutsnews/rabbitmq message-store snapshots require a stopped or quiesced broker and are excluded from normal Restic jobs
LogsHost retention plus future off-server policyRetain enough for troubleshooting without unbounded raw logs

Until a workload-specific issue chooses different values:

Backup typeRetention
Daily14
Weekly8
Monthly12
Yearly2

Before production traffic or production data depends on this backend host:

  1. Restore the latest backup to an isolated path or non-production host.
  2. Verify ownership and permissions.
  3. For database backups, run the backend PostgreSQL failover drill in restore-staging mode and verify /var/lib/nutsnews/postgres/status.json.
  4. Confirm the restored data satisfies the documented RPO/RTO.
  5. Record snapshot ID, restore target, validation commands, and result in the relevant issue or PR.

Backup credentials live in the production-backend GitHub Environment. Do not commit backup credentials, repository passwords, provider keys, database dumps, or restore artifacts.

Required secret names:

  • RESTIC_REPOSITORY
  • RESTIC_PASSWORD
  • provider credentials for NUTSNEWS_BACKEND_RESTIC_PROVIDER, currently AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY for s3

The protected apply writes a root-only systemd environment file. Status JSON is world-readable for observability and contains no secret values.

The backend protected apply installs:

  • /usr/local/sbin/nutsnews-backup
  • /etc/nutsnews-backup/service-matrix.json
  • /etc/nutsnews-backup/restic.env with mode 0600
  • /var/lib/nutsnews/backups/
  • nutsnews-backup.service and .timer
  • nutsnews-backup-verify.service and .timer
  • nutsnews-restore-drill.service and .timer

Manual runs use the fixed Backend Backup Maintenance workflow with only these actions:

  • status
  • backup
  • verify
  • restore-drill

Mutating actions require confirm_target=backend.nutsnews.com and the production-backend approval gate.

The runner writes:

FileMeaning
/var/lib/nutsnews/backups/last-backup.jsonlatest backup freshness, snapshot id, included paths, quota status
/var/lib/nutsnews/backups/last-verification.jsonlatest restic check result
/var/lib/nutsnews/backups/last-restore-verification.jsonlightweight restore-drill result
/var/lib/nutsnews/postgres/status.jsonPostgreSQL restore/failover readiness and latest staging restore drill result
/var/lib/nutsnews/rabbitmq-recovery/last-definition-export.jsonlatest sanitized RabbitMQ definition export result
/var/lib/nutsnews/rabbitmq-recovery/last-clean-rebuild-drill.jsonlatest disposable empty-broker rebuild drill result
/var/lib/nutsnews/rabbitmq-recovery/last-stopped-volume-restore-drill.jsonlatest disposable stopped-volume restore drill result

The health report and loopback-only ops dashboard expose backup failure, stale backup, unverified latest snapshot, and storage/quota warning as separate signals.

PostgreSQL-specific restore flow is documented in NutsNews Backend PostgreSQL Failover Target. RabbitMQ-specific rebuild, stopped-volume restore, and upgrade procedures are documented in Worker-Uplift RabbitMQ Recovery.

  1. Provision or recover the host.
  2. Apply baseline configuration through the protected backend workflow.
  3. Restore secrets through the documented secret store.
  4. Restore stateful data from encrypted off-server backups.
  5. For RabbitMQ, rebuild from the pinned image, config, topology, and protected credentials unless a stopped/quiesced broker snapshot was deliberately captured for message-store restore.
  6. Run workload-specific integrity checks.
  7. Reconcile RabbitMQ queue gaps from backend PostgreSQL outbox and reconciliation state.
  8. Verify health endpoints, dashboard status, and logs.
  9. Route traffic only after verification passes.