تخطَّ إلى المحتوى

Backup Restore

هذا المحتوى غير متوفر بلغتك بعد.

Protect your data with regular, tested backups.

Install the backup plugin for scheduled, automated backups:

Terminal window
nself plugin install backup
nself build && nself restart

Configure 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/MinIO
Terminal window
nself db dump

Writes 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.

Terminal window
nself db restore .nself/backups/myproject_20260328_020000.sql

The restore command:

  1. Stops application services (keeps Postgres running)
  2. Drops and recreates the target database
  3. Restores from the dump file
  4. 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

Home | _Sidebar