# Backup System - Quick Reference Card ## 🚀 Quick Commands ```bash # Setup (first time only) bash scripts/backup/setup.sh # Daily operations npm run backup:full # Full backup npm run backup:content # Content only (quick) npm run backup:verify # Check health # Emergency npm run backup:list # Show all backups npm run backup:restore # Restore (interactive) ``` --- ## 📁 Directory Structure ``` backups/ ├── daily/ # Last 7 days ├── weekly/ # Last 4 weeks ├── monthly/ # Last 3 months ├── pre-deploy/ # Last 10 deployments ├── incremental/ # Last 72 hours └── safety/ # Pre-restore backups (30 days) ``` --- ## ⏰ Automated Schedule | When | What | Retention | |------|------|-----------| | **Daily 2:00 AM** | Full backup | 7 days | | **Every 6 hours** | Incremental (content) | 72 hours | | **Sunday 3:00 AM** | Cleanup old backups | Auto | | **Daily 9:00 AM** | Verify backup health | N/A | --- ## 🔧 Setup Automation ### Linux/macOS ```bash crontab -e # See scripts/backup/cron.example for template ``` ### Windows ```powershell # Run as Administrator .\scripts\backup\windows-tasks.ps1 ``` --- ## 🆘 Emergency Restore ```bash # 1. List backups npm run backup:list # 2. Restore from specific backup npm run backup:restore backups/daily/full-backup-2026-03-21.tar.gz # 3. Verify and rebuild npm install npm run build npm run test ``` --- ## ✅ Health Check ```bash # Quick status npm run backup:verify # Check what's in a backup tar -tzf backups/daily/latest-full.tar.gz | less # Check backup age ls -lht backups/daily/ ``` --- ## 📋 Pre-Deployment Checklist - [ ] Run config backup: `npm run backup:config` - [ ] Verify backup created: `ls -lht backups/pre-deploy/` - [ ] Note backup location for potential rollback - [ ] Proceed with deployment --- ## 🔐 What Gets Backed Up ✅ **Included:** - `src/` - All source code - `public/` - Public assets - `src/content/` - Blog posts, content - Config files (astro, tailwind, etc.) - `.env` - Environment variables - `package.json` - Dependencies ❌ **Excluded:** - `node_modules/` - Reinstallable - `dist/` - Build artifacts - `.astro/` - Build cache - `test-results/` - Test outputs - `.git/` - Version control --- ## 🚨 Alert Thresholds | Condition | Action | |-----------|--------| | Latest backup > 24h | ⚠️ Warning | | Latest backup > 48h | 🚨 Critical | | Corrupted backup | 🚨 Critical | | Storage > 80% | ⚠️ Cleanup needed | | Storage > 5GB | ⚠️ Review retention | --- ## 🛠️ Troubleshooting ### Backup fails ```bash df -h # Check disk space ls -la backups/ # Check permissions npm run backup:verify # Verify system ``` ### Restore fails ```bash tar -tzf backup.tar.gz # Verify integrity npm run backup:verify backup.tar.gz ``` ### Missing files after restore ```bash tar -tzf backup.tar.gz | grep "filename" ``` --- ## 📞 Emergency Contacts | Issue | Contact | |-------|---------| | Backup system failure | DevOps Lead | | Cannot restore | Tech Lead | | Disk space full | Platform Admin | | Corrupted backup | DevOps Lead | --- ## 📚 Documentation - **Full strategy:** `.agents/devops-engineer/BACKUP_STRATEGY.md` - **Scripts README:** `scripts/backup/README.md` - **Deployment:** `DEPLOYMENT.md` --- ## 💡 Best Practices 1. ✅ **Test restores monthly** - Verify backups work 2. ✅ **Always backup before deployment** - Safety first 3. ✅ **Monitor backup health** - Check verification output 4. ✅ **Keep multiple backup types** - Redundancy 5. ✅ **Secure environment files** - Encrypt if needed --- **Last Updated:** 2026-03-21 **Version:** 1.0