SafariDesk Backup and Restore
SafariDesk production backups must cover:- PostgreSQL database
- Uploaded files
.env- Release version or image tag
What Must Be Backed Up
Do not rely on container filesystems for persistence.
Backup Script
Create a backup:db container and uses the actual container environment:
/mnt/safaridesk through the backend container.
Custom Backup Directory
SetBACKUP_DIR to write backups somewhere else:
Back Up .env
The script does not copy .env.
Back it up separately using your secret-management or server-backup process.
Manual example:
- Django secrets
- Database password
- SMTP password
- OAuth secrets
- AI provider keys
- License key
- Stripe keys
- Twilio credentials
Verify a Backup
List backup files:Restore Database Only
Stop background processing before restore:Restore Database and Uploads
Stop services that can write data:Restore Behavior
The restore script:- Runs
psqlinside thedbcontainer. - Reads the SQL backup from the host.
- Optionally clears
/mnt/safaridesk/*inside the backend container. - Extracts the uploads archive into
/mnt/safaridesk.
- Upload restore replaces current upload contents.
- Database restore imports into the current database.
- Test restore before relying on the process for production incidents.
Restore to a New Host
- Install Docker and Docker Compose.
- Clone the SafariDesk monorepo.
- Restore the production
.env. - Confirm
SAFARIDESK_IMAGE_TAGmatches the backup. - Start database and Redis:
- Restore database and uploads:
- Start the full stack:
- Collect static files:
- Verify:
Backup Before Updates
Always back up before:- Pulling a new release
- Running migrations
- Changing image tags
- Changing database settings
- Changing upload storage
- Running large data imports
Backup Scheduling
The repository does not install a scheduler by default. Use host cron, systemd timers, or your infrastructure backup tool. Example cron entry:- Object storage
- Encrypted backup server
- Managed backup service
- Company disaster-recovery storage
Retention
Choose a retention policy before production use. Example:- Hourly backups for 24 hours
- Daily backups for 14 days
- Weekly backups for 8 weeks
- Monthly backups for 12 months
Restore Checklist
- Correct backup files selected.
.envrestored.SAFARIDESK_IMAGE_TAGmatches the backup.- Current database backed up before restore.
- Write services stopped.
- Database restored.
- Uploads restored if needed.
- Services restarted.
- Static files collected.
- Health checks pass.
- Login works.
- Uploads open.
- Worker and beat are running.

