Understanding Snipe-IT Backups
Snipe-IT backups include:- Database dump - Complete MySQL/MariaDB database export
- Uploaded files - Asset images, user photos, license files, etc. (in
public/uploads) - Private uploads - Documents requiring authentication (in
storage/private_uploads) - OAuth keys - OAuth private and public keys (in
storage/) - Environment file - Your
.envconfiguration (optional)
Backups are stored as compressed
.zip files with the naming pattern:
snipe-it-YYYY-MM-DD-HH-MM-SS.zipBackup Configuration
Backup settings are configured in your.env file and managed by config/backup.php.
Basic Backup Settings
.env
Email driver for backup notifications. Set to
mail to receive backup status emails.Email address to receive backup success/failure notifications.
Include the
.env file in backups.Important: Your .env contains sensitive credentials. Only enable if backups are stored securely.Allow admins to delete backups via the web interface.
Enable the dangerous data purge feature. Only enable for testing/demo environments.
Maximum execution time for backup operations (in seconds).
Backup Retention Policy
Snipe-IT uses an intelligent retention strategy that keeps more recent backups and gradually thins out older ones:.env
config/backup.php:205-236:
Example Retention Timeline
With default settings:- Days 1-7: All backups kept
- Days 8-23: One backup per day (16 days)
- Days 24-79: One backup per week (8 weeks)
- Days 80-199: One backup per month (4 months)
- After day 200: One backup per year (2 years)
This gives you:
- Recent granular recovery options (hourly/daily)
- Long-term archival with reduced storage
- Automatic cleanup of old backups
What Gets Backed Up
The backup includes these directories and files (fromconfig/backup.php:12-22):
config/backup.php:55-59):
vendor/- PHP dependencies (can be reinstalled)node_modules/- JavaScript dependencies (can be reinstalled)config/- Generated config cache
Creating Backups
Manual Backup via Web Interface
- Navigate to Settings > Backups
- Click Create Backup
- Wait for the backup to complete
- Download the
.zipfile
Manual Backup via Command Line
Run the Artisan command:Automated Backups with Cron
Add this to your crontab to run daily backups at 2 AM:Database-only backups (
--only-db) are much faster and smaller. Run full backups less frequently.Backup Storage Locations
By default, backups are stored in:config/backup.php:100-102:
backup disk is defined in config/filesystems.php and points to storage/app/backups/.
Storing Backups on S3
For production environments, store backups off-site to protect against hardware failure:-
Configure S3 credentials in
.env: -
Update
config/backup.phpdestination disks: - Run the backup - it will be stored both locally and on S3
Backup Notifications
Snipe-IT can send email notifications for backup events (fromconfig/backup.php:123-130):
BackupHasFailedNotification- Backup failedUnhealthyBackupWasFoundNotification- Backup is too old or too largeCleanupHasFailedNotification- Backup cleanup failedBackupWasSuccessfulNotification- Backup succeededHealthyBackupWasFoundNotification- Backup health check passedCleanupWasSuccessfulNotification- Old backups cleaned up
.env
Backup Monitoring
Snipe-IT monitors backup health (fromconfig/backup.php:181-190):
- Maximum Age: Alerts if newest backup is older than 1 day
- Maximum Storage: Alerts if total backup size exceeds 5000 MB
Restoring from Backup
Step 1: Download the Backup
From Settings > Backups, download the backup.zip file you want to restore.
Step 2: Extract the Backup
Step 3: Restore the Database
The database dump is in the extracted files:Step 4: Restore Files
Copy uploaded files back:Step 5: Restore .env (if backed up)
Step 6: Set Permissions
Step 7: Clear Caches
Database Sanitization
For development/testing environments, you can sanitize sensitive data during backup:.env
config/backup.php:240:
Backup Cleanup
Manually trigger cleanup of old backups:.env file and deletes backups that exceed the retention thresholds.
Add to cron for automated cleanup:
Best Practices
Store backups off-site - Use S3 or another cloud storage provider to protect against hardware failure or disasters.
Test restores regularly - A backup is only useful if you can restore from it. Test the restoration process quarterly.
Monitor backup health - Set up the backup monitor cron job and configure email notifications.
Secure backup files - Backups contain sensitive data including your
APP_KEY. Encrypt or restrict access to backup files.Separate database and file backups - Run database backups more frequently (daily) and full backups less often (weekly).
Document your restoration procedure - Keep step-by-step restoration instructions with your disaster recovery plan.
Troubleshooting
”Backup failed” Error
Check the Laravel logs instorage/logs/laravel.log for details. Common causes:
- Insufficient disk space
- Database connection issues
- Permission problems on
storage/app/backups/ - PHP timeout (increase
BACKUP_TIME_LIMIT)
Large Backup Files
If backups are too large:- Run database-only backups more frequently:
php artisan backup:run --only-db - Exclude large files that don’t need backing up
- Compress uploads before backing up
- Increase
BACKUP_PURGE_OLDEST_AT_MEGSif you have sufficient storage
Cannot Download Backup
Ensure:- The web server can read
storage/app/backups/ - PHP’s
max_execution_timeis sufficient for large downloads - PHP’s
memory_limitallows the file to be served
Backup Takes Too Long
Increase the time limit:.env
Automated Backup Script Example
Complete crontab for comprehensive backup automation:Next Steps
Configuration
Configure backup email notifications
Security
Secure your backup files and .env
Installation Guide
Configure cron jobs for automated backups
Configuration
Configure backup settings
