Skip to main content
Snipe-IT includes built-in backup functionality powered by the Spatie Laravel Backup package. This feature creates comprehensive backups of your database and critical files.

Understanding Snipe-IT Backups

Snipe-IT backups include:
  1. Database dump - Complete MySQL/MariaDB database export
  2. Uploaded files - Asset images, user photos, license files, etc. (in public/uploads)
  3. Private uploads - Documents requiring authentication (in storage/private_uploads)
  4. OAuth keys - OAuth private and public keys (in storage/)
  5. Environment file - Your .env configuration (optional)
Backups are stored as compressed .zip files with the naming pattern: snipe-it-YYYY-MM-DD-HH-MM-SS.zip

Backup Configuration

Backup settings are configured in your .env file and managed by config/backup.php.

Basic Backup Settings

.env
string
default:"null"
Email driver for backup notifications. Set to mail to receive backup status emails.
string
Email address to receive backup success/failure notifications.
boolean
default:"true"
Include the .env file in backups.Important: Your .env contains sensitive credentials. Only enable if backups are stored securely.
boolean
default:"false"
Allow admins to delete backups via the web interface.
boolean
default:"false"
Enable the dangerous data purge feature. Only enable for testing/demo environments.
integer
default:"600"
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
This configuration is defined in 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 (from config/backup.php:12-22):
The backup excludes (from 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

  1. Navigate to Settings > Backups
  2. Click Create Backup
  3. Wait for the backup to complete
  4. Download the .zip file

Manual Backup via Command Line

Run the Artisan command:
Or use the underlying Laravel Backup command:

Automated Backups with Cron

Add this to your crontab to run daily backups at 2 AM:
For weekly full backups (database + files) every Sunday at 3 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:
This is configured in config/backup.php:100-102:
The 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:
  1. Configure S3 credentials in .env:
  2. Update config/backup.php destination disks:
  3. Run the backup - it will be stored both locally and on S3

Backup Notifications

Snipe-IT can send email notifications for backup events (from config/backup.php:123-130):
  • BackupHasFailedNotification - Backup failed
  • UnhealthyBackupWasFoundNotification - Backup is too old or too large
  • CleanupHasFailedNotification - Backup cleanup failed
  • BackupWasSuccessfulNotification - Backup succeeded
  • HealthyBackupWasFoundNotification - Backup health check passed
  • CleanupWasSuccessfulNotification - Old backups cleaned up
Configure the notification email:
.env

Backup Monitoring

Snipe-IT monitors backup health (from config/backup.php:181-190):
This monitors:
  • Maximum Age: Alerts if newest backup is older than 1 day
  • Maximum Storage: Alerts if total backup size exceeds 5000 MB
Run the monitor manually:
Or add to cron for automated monitoring:

Restoring from Backup

Always test your backup restoration procedure in a non-production environment first.

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
This is configured in config/backup.php:240:
Sanitized backups remove or anonymize sensitive data and cannot be used to restore a production environment.

Backup Cleanup

Manually trigger cleanup of old backups:
This applies the retention policy defined in your .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 in storage/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:
  1. Run database-only backups more frequently: php artisan backup:run --only-db
  2. Exclude large files that don’t need backing up
  3. Compress uploads before backing up
  4. Increase BACKUP_PURGE_OLDEST_AT_MEGS if you have sufficient storage

Cannot Download Backup

Ensure:
  • The web server can read storage/app/backups/
  • PHP’s max_execution_time is sufficient for large downloads
  • PHP’s memory_limit allows the file to be served

Backup Takes Too Long

Increase the time limit:
.env
Or run backups via CLI cron instead of the web interface to avoid web server timeouts.

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