This guide covers database and file backup procedures, automated backup setup, and restore processes to protect your Growstack CRM 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:
mysqldump -u username -p database_name > backup_$(date +%Y%m%d).sql
With Compression:
mysqldump -u username -p database_name | gzip > backup_$(date +%Y%m%d).sql.gz
Method 3: Laravel Artisan
Backup Command:
php artisan db:backup
Or use package:
php artisan backup:run
Automated Database Backup
Cron Job Setup
Create Backup Script:
#!/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 -delete
Add to Crontab:
0 2 * * * /path/to/backup-script.sh
File 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:
scp -r user@server:/path/to/files /local/backup/
With Compression:
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:
#!/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 -delete
Add to Crontab:
0 3 * * * /path/to/file-backup-script.sh
Automated Backups
Backup Solutions
Option 1: Laravel Backup Package
Install:
composer require spatie/laravel-backup
Configure:
// config/backup.php
'backup' => [
'destination' => [
'disks' => ['local', 's3'],
],
],
Schedule:
// 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:
mysql -u username -p database_name < backup.sql
From Compressed:
gunzip < backup.sql.gz | mysql -u username -p database_name
Method 3: Laravel Artisan
Restore:
php artisan db:restore backup.sql
File 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:
tar -xzf backup.tar.gz -C /restore/path/
Copy Files:
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
← All GrowStack – CRM Software for Sales, Customer Management & Business Growth documentation