Disaster Recovery¶
Procedures for backup, restore, and recovery of the Freeze Design webshop.
Backup Strategy¶
Automated Backups¶
Daily automated backups are configured:
- Database: PostgreSQL dump to S3
- Media files: Synced to S3
- Configuration: In Git repository
Backup Schedule¶
| Component | Frequency | Retention |
|---|---|---|
| Database | Daily 3:00 AM | 30 days |
| Media files | Continuous | 90 days |
| Logs | Daily | 14 days |
Database Backup¶
Manual Backup¶
# Create backup
docker exec postgres pg_dump -U freezedesign freezedesign | \
gzip > backup_$(date +%Y%m%d_%H%M%S).sql.gz
# Upload to S3
aws s3 cp backup_*.sql.gz s3://freezedesign-backups/database/
Verify Backup¶
# List recent backups
aws s3 ls s3://freezedesign-backups/database/ --human-readable
# Download and check
aws s3 cp s3://freezedesign-backups/database/latest.sql.gz ./
gunzip -c latest.sql.gz | head -50
Database Restore¶
Full Restore¶
Production Warning
This will overwrite all existing data!
# Download backup
aws s3 cp s3://freezedesign-backups/database/backup.sql.gz ./
# Stop application
docker-compose stop backend celery
# Restore database
gunzip -c backup.sql.gz | docker exec -i postgres psql -U freezedesign freezedesign
# Restart application
docker-compose start backend celery
# Verify
curl https://api.freezedesign.nl/api/products/ | jq '.count'
Point-in-Time Recovery¶
For PostgreSQL WAL-based recovery:
Media Files Recovery¶
Restore from S3¶
# Sync media files
aws s3 sync s3://freezedesign-media/ /app/media/
# Set permissions
chown -R www-data:www-data /app/media/
Application Recovery¶
Redeploy Application¶
# Pull latest images
docker-compose pull
# Restart services
docker-compose up -d
# Run migrations
docker exec backend python manage.py migrate
# Verify health
curl https://api.freezedesign.nl/api/health/
Recovery Testing¶
Monthly recovery tests:
- Restore database to test environment
- Restore media files
- Verify application functionality
- Document any issues
Contact List¶
| Role | Contact |
|---|---|
| On-call developer | +31 6 xxxx xxxx |
| Database admin | dba@freezedesign.nl |
| Cloud provider support | AWS Support Case |