Guide Backup Restore - nself-org/cli GitHub Wiki
Protect your data with regular, tested backups.
Install the backup plugin for scheduled, automated backups:
nself plugin install backup
nself build && nself restartConfigure schedule and retention in .env:
BACKUP_SCHEDULE=0 2 * * * # daily at 2am
BACKUP_RETENTION_DAYS=30 # keep 30 days
BACKUP_S3_BUCKET=my-backup-bucket # optional: upload to S3/MinIOnself db dumpWrites a pg_dump file to .nself/backups/ with a timestamped filename.
Configure in .env (or .env.secrets):
BACKUP_S3_ENDPOINT=https://s3.amazonaws.com
BACKUP_S3_BUCKET=my-backups
BACKUP_S3_ACCESS_KEY=AKIAIOSFODNN7EXAMPLE
BACKUP_S3_SECRET_KEY=<secret>Compatible with AWS S3, MinIO, Cloudflare R2, Backblaze B2, and any S3-compatible provider.
nself db restore .nself/backups/myproject_20260328_020000.sqlThe restore command:
- Stops application services (keeps Postgres running)
- Drops and recreates the target database
- Restores from the dump file
- Restarts services
Important: Test your restores regularly. Untested backups are not backups.
- Backup job runs successfully (check logs:
nself logs backup) - Backup files appear in
.nself/backups/or S3 bucket - Restoration test succeeds on a staging instance
- Retention policy removes old files as expected
- plugin-backup, backup plugin reference
- cmd-db, db command reference
- Guide-Production-Deployment, server setup