Appearance
Backup and Restore
This guide covers database and file backup procedures, automated backup setup, and restore processes to protect your OmniSuite CMS installation.
Table of Contents
Overview
Why Backup?
- ✅ Protect against data loss
- ✅ Recover from errors
- ✅ Restore after updates
- ✅ Disaster recovery
- ✅ Migration support
What to Backup
Critical Data:
- Database (all tables)
- Uploaded files
- Configuration files
- Custom code
- Environment files
Database Backup
Manual Backup Methods
Method 1: cPanel phpMyAdmin
Access phpMyAdmin:
- Log in to cPanel
- Click phpMyAdmin
Select Database:
- Choose your database
- Click database name
Export:
- Click Export tab
- Select Quick or Custom
- Choose format: SQL
- Click Go
Download:
- File downloads
- Save securely
- Name with date
Method 2: Command Line (MySQL)
Using mysqldump:
bash
mysqldump -u username -p database_name > backup_$(date +%Y%m%d).sqlWith Compression:
bash
mysqldump -u username -p database_name | gzip > backup_$(date +%Y%m%d).sql.gzMethod 3: Laravel Artisan
Backup Command:
bash
php artisan db:backupOr use package:
bash
php artisan backup:runAutomated Database Backup
Cron Job Setup
Create Backup Script:
bash
#!/bin/bash
DATE=$(date +%Y%m%d_%H%M%S)
mysqldump -u username -p'password' database_name > /backups/db_$DATE.sql
gzip /backups/db_$DATE.sql
find /backups -name "db_*.sql.gz" -mtime +7 -deleteAdd to Crontab:
bash
0 2 * * * /path/to/backup-script.shFile Backup
What Files to Backup
Critical Files
Configuration:
.envfileconfig/directory- Custom configurations
Uploaded Content:
storage/app/public/- Media files
- User uploads
Custom Code:
- Custom modules
- Modified templates
- Custom components
Manual File Backup
Method 1: FTP/SFTP
Connect via FTP:
- Use FTP client
- Connect to server
Download Files:
- Download entire directory
- Or selective files
- Save locally
Method 2: Command Line (SCP)
Copy Files:
bash
scp -r user@server:/path/to/files /local/backup/With Compression:
bash
tar -czf backup.tar.gz /path/to/files
scp backup.tar.gz user@server:/backup/Method 3: cPanel File Manager
Access File Manager:
- Log in to cPanel
- Click File Manager
Select Files:
- Navigate to directory
- Select files/folders
Compress:
- Right-click → Compress
- Choose format (ZIP)
- Download archive
Automated File Backup
Backup Script
Create Script:
bash
#!/bin/bash
DATE=$(date +%Y%m%d_%H%M%S)
tar -czf /backups/files_$DATE.tar.gz \
/path/to/storage \
/path/to/config \
/path/to/.env
find /backups -name "files_*.tar.gz" -mtime +7 -deleteAdd to Crontab:
bash
0 3 * * * /path/to/file-backup-script.shAutomated Backups
Backup Solutions
Option 1: Laravel Backup Package
Install:
bash
composer require spatie/laravel-backupConfigure:
php
// config/backup.php
'backup' => [
'destination' => [
'disks' => ['local', 's3'],
],
],Schedule:
php
// app/Console/Kernel.php
$schedule->command('backup:run')->daily();Option 2: Server-Level Backup
cPanel Backup:
- Enable automatic backups
- Configure in cPanel
- Set retention period
VPS Backup:
- Use backup service
- Configure automated backups
- Set schedule
Backup Schedule
Recommended Schedule
Daily Backups:
- Database: Daily
- Files: Daily
- Full: Weekly
Retention:
- Daily: 7 days
- Weekly: 4 weeks
- Monthly: 12 months
Restore Procedures
Database Restore
Method 1: phpMyAdmin
Access phpMyAdmin:
- Log in to cPanel
- Click phpMyAdmin
Select Database:
- Choose database
- Click database name
Import:
- Click Import tab
- Choose file
- Click Go
Verify:
- Check tables
- Verify data
- Test application
Method 2: Command Line
Restore:
bash
mysql -u username -p database_name < backup.sqlFrom Compressed:
bash
gunzip < backup.sql.gz | mysql -u username -p database_nameMethod 3: Laravel Artisan
Restore:
bash
php artisan db:restore backup.sqlFile Restore
Method 1: FTP/SFTP
Connect:
- Use FTP client
- Connect to server
Upload Files:
- Upload backup files
- Overwrite existing
- Set permissions
Method 2: Command Line
Extract Archive:
bash
tar -xzf backup.tar.gz -C /restore/path/Copy Files:
bash
cp -r /backup/files/* /path/to/application/Full Restore Process
Step-by-Step
Stop Application:
- Put in maintenance mode
- Stop services if needed
Restore Database:
- Import database backup
- Verify import
Restore Files:
- Restore file backup
- Set permissions
Update Configuration:
- Update
.envif needed - Clear cache
- Update
Verify:
- Test application
- Check functionality
- Remove maintenance mode
Backup Best Practices
Backup Strategy
Regular Backups:
- Daily automated backups
- Before major changes
- Before updates
Multiple Locations:
- Local storage
- Remote storage
- Cloud storage
Test Restores:
- Test restore process
- Verify backups work
- Document procedures
Storage
Secure Storage:
- Encrypt backups
- Secure access
- Off-site storage
Organize Backups:
- Name with dates
- Organize by type
- Keep logs
Retention Policy:
- Define retention
- Automate cleanup
- Archive important
Monitoring
Monitor Backups:
- Check backup logs
- Verify success
- Alert on failure
Regular Review:
- Review backup logs
- Check storage space
- Update procedures
Troubleshooting
Backup Fails
Solutions:
- Check disk space
- Verify permissions
- Check database access
- Review error logs
- Test manually
Restore Fails
Solutions:
- Verify backup file
- Check file integrity
- Verify database access
- Check permissions
- Review error messages
Related Documentation
Last Updated: [Date will be updated during final review]