14. System Administration
Restore Procedures
This guide provides detailed instructions on how to restore the system from a backup in case of issues or data loss.
⚠️ Important
Before proceeding with a restore, make sure you have:
- ✓ SSH access to the server
- ✓ Administrator permissions
- ✓ A valid backup to restore from
- ✓ Sufficient time to complete the operation
Step 1: Identify the Backup to Restore
# List all available backups
ls -lah /home/achille616/backups/cnc-ecommerce/
# Example output:
# CNC-Simulator-Italia_2025-12-18-02-00-00.zip (full backup)
# CNC-Simulator-Italia_2025-12-18-06-00-00.zip (DB only)
# CNC-Simulator-Italia_2025-12-18-12-00-00.zip (DB only)
Step 2: Extract the Backup
# Create temporary folder
mkdir -p /tmp/backup-restore
# Extract backup
cd /tmp/backup-restore
unzip /home/achille616/backups/cnc-ecommerce/BACKUP_NAME.zip
Step 3A: Database Restore
# Database is in db-dumps/*.sql or *.sql.gz
# If compressed:
gunzip db-dumps/mysql-*.sql.gz
# Restore database with credentials from .env:
cd /var/www/cnc-ecommerce
mysql -u $(grep DB_USERNAME .env | cut -d '=' -f2) \
-p$(grep DB_PASSWORD .env | cut -d '=' -f2) \
$(grep DB_DATABASE .env | cut -d '=' -f2) < /tmp/backup-restore/db-dumps/mysql-*.sql
Step 3B: Files Restore
# Restore storage (uploads, user files)
cp -r /tmp/backup-restore/storage/app/public/* /var/www/cnc-ecommerce/storage/app/public/
# Restore .env file (if needed)
# WARNING: Check differences first!
diff /tmp/backup-restore/.env /var/www/cnc-ecommerce/.env
# If OK:
# cp /tmp/backup-restore/.env /var/www/cnc-ecommerce/.env
