Skip to main content

nself backup

nself backup — ɳSelf documentation.

Backup operations: create, list, restore, verify, prune, config, status, init-key.

Synopsis

nself backup <subcommand> [flags] [args]

Description

nself backup covers the full life cycle of project backups: full Postgres dumps, write-ahead-log (WAL) checkpoints, MinIO object snapshots, configuration metadata, and combined backups. Backups can be encrypted with age (one keypair per project) and pruned by retention policy.

Subcommands include create (one-shot full or incremental), list (filter by remote, environment, age), restore (from any backup ID or latest, with point-in-time recovery and partial restore options), verify (checksum or full restore-test in a disposable container), and prune (apply daily/weekly/monthly retention).

backup config --install-cron installs systemd timers for full backups, WAL checkpoints, prune cycles, and weekly verify drills so an operator can hand off to automation.

Subcommands

NameDescription
createCreate a new backup
listList available backups
restore <backup-id|latest>Restore from a backup
verify <backup-id|latest>Verify backup integrity
pruneRemove old backups by retention policy
configView or install backup configuration (systemd timers)
statusShow backup subsystem status
init-keyGenerate age encryption keypair for backups

Flags

backup create

FlagDefaultDescription
--typefullBackup type: full, wal, metadata, minio, all
--remote""Remote name override
--encryptfalseForce encryption on
--no-encryptfalseForce encryption off
--tag""Human label for this backup
--dry-runfalsePreview only

backup list

FlagDefaultDescription
--remote""Filter by remote name
--env""Filter by environment
--since""Show backups newer than duration (e.g. 24h, 7d)
--formattableOutput format: table or json

backup restore <backup-id\|latest>

FlagDefaultDescription
--to""Restore to alternate directory
--only""Restore subset: pg, minio, metadata (comma-separated)
--point-in-time""ISO8601 timestamp for PITR
--decrypt-key""Path to age identity file
--yesfalseSkip confirmation

backup verify <backup-id\|latest>

FlagDefaultDescription
--restore-testfalseSpin up test container and restore
--cleanuptrueRemove test container after verify
--keepfalseKeep test container for inspection

backup prune

FlagDefaultDescription
--dry-runfalsePreview only
--keep-daily7Keep last N daily backups
--keep-weekly4Keep last N weekly backups
--keep-monthly12Keep last N monthly backups
--format""Output format: json

backup config

FlagDefaultDescription
--format""Output format: json
--install-cronfalseInstall systemd timers for backup, WAL, prune, verify
--full-at03:00Full backup time UTC (HH:MM) when --install-cron
--wal-every15mWAL checkpoint interval when --install-cron
--prune-at04:00Prune time UTC (HH:MM) when --install-cron
--verify-onSunWeekly restore-test day when --install-cron
--verify-at05:00Weekly restore-test time UTC when --install-cron
--remote""Override configured remote when --install-cron
--unit-dir/etc/systemd/systemSystemd unit directory when --install-cron
--dry-runfalsePrint unit files without writing when --install-cron

backup status

FlagDefaultDescription
--format""Output format: json

Examples

# Generate the age keypair before first encrypted backup
nself backup init-key

# Create a full encrypted backup tagged for traceability
nself backup create --type full --encrypt --tag pre-deploy

# List backups newer than a week, JSON for piping
nself backup list --since 7d --format json

# Restore latest backup, restoring only Postgres data
nself backup restore latest --only pg --yes

# Verify the latest backup with a real restore-test container
nself backup verify latest --restore-test

# Install systemd timers so backups run automatically
sudo nself backup config --install-cron --full-at 02:30

See Also