# Nextcloud Backblaze B2 Backup - Deployment Checklist Use this checklist to ensure your backup solution is properly deployed and working. ## ๐Ÿ“‹ Pre-Deployment (Before Running Installer) - [ ] Read `README_NEXTCLOUD_BACKUPS.md` for overview - [ ] Have Backblaze B2 account ready (sign up at backblaze.com) - [ ] Know your Nextcloud installation path (e.g., `/srv/docker/nextcloud`) - [ ] Know your Nextcloud database password - [ ] Have root/sudo access to the system - [ ] Have ~10GB free disk space available - [ ] Ensure internet connectivity for B2 uploads ## ๐Ÿ”ง Installation Phase ### Run Installer - [ ] Run: `sudo ./install-nextcloud-backup.sh` - [ ] Installer completes without errors - [ ] All dependencies are installed - [ ] Directories created in `/opt/nextcloud-backup/` - [ ] systemd files installed ### Verify Installation - [ ] Files exist in `/opt/nextcloud-backup/`: ```bash ls -la /opt/nextcloud-backup/ ``` - [ ] Service file exists: ```bash ls -la /etc/systemd/system/nextcloud-backup.* ``` - [ ] Config directory exists: ```bash ls -la /etc/nextcloud-backup/ ``` ## ๐Ÿ”‘ Configuration Phase ### B2 Credentials (CRITICAL!) - [ ] Go to https://www.backblaze.com/b2/docs/application_keys.html - [ ] Create new Application Key - [ ] Note your Account ID - [ ] Note your Application Key (keep secret!) - [ ] Create bucket named `nextcloud-backups` (or your preference) - [ ] Edit: `sudo nano /etc/nextcloud-backup/b2-credentials.env` - [ ] Fill in: - `B2_ACCOUNT_ID=` your account ID - `B2_APPLICATION_KEY=` your app key - `B2_BUCKET_NAME=` your bucket name - `B2_REGION=` (e.g., us-west-002) - [ ] Save file (Ctrl+X, Y, Enter) - [ ] Check permissions: `sudo ls -la /etc/nextcloud-backup/b2-credentials.env` - Should show: `-rw-------` (600) ### Nextcloud Configuration - [ ] Edit: `sudo nano /opt/nextcloud-backup/.env` - [ ] Find your Nextcloud paths: ```bash # Find docker-compose location find / -name "docker-compose.yml" -path "*nextcloud*" 2>/dev/null # Find data directory find / -type d -name "nextcloud" -path "*/data" 2>/dev/null ``` - [ ] Fill in required fields: - [ ] `NEXTCLOUD_COMPOSE_DIR=` (path to docker-compose directory) - [ ] `NEXTCLOUD_DATA_PATH=` (path to nextcloud data folder) - [ ] `NEXTCLOUD_DB_NAME=` (usually `nextcloud`) - [ ] `NEXTCLOUD_DB_USER=` (usually `nextcloud`) - [ ] `NEXTCLOUD_DB_PASSWORD=` (from docker-compose or .env) - [ ] Review optional settings: - [ ] `BACKUP_RETENTION_DAYS=` (default 30) - [ ] `COMPRESSION=` (default zstd - recommended) - [ ] `BACKUP_RETENTION_DAYS=` (how long to keep backups) - [ ] Save file ### Verify Configurations - [ ] Check B2 credentials file exists and is readable: ```bash sudo test -f /etc/nextcloud-backup/b2-credentials.env && echo "โœ“ Found" ``` - [ ] Check Nextcloud config exists: ```bash sudo test -f /opt/nextcloud-backup/.env && echo "โœ“ Found" ``` - [ ] Verify B2 CLI is installed: ```bash b2 version ``` - [ ] Test B2 authentication: ```bash b2 authorize-account b2 account-info ``` ## ๐Ÿงช Testing Phase ### Dry-Run Test (No Upload) - [ ] Run dry-run test: ```bash sudo DRY_RUN=true /opt/nextcloud-backup/nextcloud-backup-to-backblaze.sh ``` - [ ] Check output for errors - [ ] Verify it shows what WOULD be backed up - [ ] No actual files uploaded to B2 (good!) ### Manual Incremental Backup - [ ] Run actual backup: ```bash sudo /opt/nextcloud-backup/nextcloud-backup-to-backblaze.sh incremental ``` - [ ] Monitor output for success - [ ] Check logs: ```bash sudo tail -50 /opt/nextcloud-backup/.backups/logs/backup_*.log ``` - [ ] Verify backup was successful - [ ] Check B2 for uploaded files: ```bash b2 list-file-names nextcloud-backups nextcloud-backups/ ``` ### Verify Backup Contents - [ ] Backup includes database file: `nextcloud-db-*.sql.zst` - [ ] Backup includes file archive: `nextcloud-files-*.tar.zst` - [ ] File sizes are reasonable (not 0 bytes) - [ ] Timestamps are recent ### Test Status Command - [ ] Run status check: ```bash sudo /opt/nextcloud-backup/nextcloud-backup-to-backblaze.sh status ``` - [ ] Shows last backup info - [ ] Shows B2 bucket contents - [ ] Shows recent backups ## โฐ Scheduler Setup ### Enable Timer - [ ] Enable the systemd timer: ```bash sudo systemctl enable nextcloud-backup.timer ``` - [ ] Start the timer: ```bash sudo systemctl start nextcloud-backup.timer ``` - [ ] Check status: ```bash sudo systemctl status nextcloud-backup.timer ``` - [ ] Should show: `active (waiting)` ### Verify Timer Configuration - [ ] View timer status: ```bash sudo systemctl list-timers nextcloud-backup.timer ``` - [ ] Should show: - Timer: nextcloud-backup.timer - Unit: nextcloud-backup.service - Next trigger time (usually within 24 hours) ### Check Timer Logs - [ ] View system logs: ```bash sudo journalctl -u nextcloud-backup.service -n 20 ``` - [ ] Should show your manual test backups ## ๐Ÿ” Post-Deployment Verification ### Check Backup Execution - [ ] Wait for scheduled time (default 2 AM) OR manually trigger - [ ] Check if backup ran: ```bash sudo journalctl -u nextcloud-backup.service -n 5 ``` - [ ] Should show successful execution ### Monitor First Week - [ ] Day 1: Manual run โœ“ - [ ] Day 2-3: Automatic runs should start appearing in logs - [ ] Day 7: Should have multiple backups in B2 - [ ] Monitor logs daily: ```bash sudo journalctl -u nextcloud-backup.service -n 10 ``` ### Verify B2 Storage - [ ] Check B2 console for uploads - [ ] Verify file sizes make sense - [ ] Confirm no upload errors - [ ] List backups: ```bash b2 list-file-names nextcloud-backups nextcloud-backups/ | head -10 ``` ## ๐Ÿ›ก๏ธ Security Verification ### Credential Security - [ ] B2 credentials file permissions (should be 600): ```bash sudo ls -la /etc/nextcloud-backup/b2-credentials.env ``` - [ ] File NOT readable by other users - [ ] File NOT in git repository - [ ] B2 credentials NOT in logs (check with): ```bash sudo grep -r "B2_ACCOUNT_ID" /opt/nextcloud-backup/ 2>/dev/null ``` ### Service Security - [ ] Service runs as root (necessary for DB dump) - [ ] Service has resource limits - [ ] Service has proper error handling - [ ] Service cleans up temp files ## ๐Ÿ“Š Daily Operations ### Daily Monitoring - [ ] Check backup ran last night: ```bash sudo journalctl -u nextcloud-backup.service -n 1 --since "24 hours ago" ``` - [ ] Look for "SUCCESS" messages - [ ] Check file sizes in B2 ### Weekly Tasks - [ ] Review backup logs: ```bash sudo ls -lh /opt/nextcloud-backup/.backups/logs/ ``` - [ ] Check B2 console for cost estimates - [ ] Verify no error patterns in logs ### Monthly Tasks - [ ] Test restore procedure (practice!) - [ ] Check B2 account for any issues - [ ] Review retention policy (still appropriate?) - [ ] Monitor costs ## ๐Ÿ”„ Restore Testing (IMPORTANT!) ### Practice Database Restore - [ ] List available backups: ```bash b2 list-file-names nextcloud-backups nextcloud-backups/ | grep "db" ``` - [ ] Download a database backup: ```bash b2 download-file-by-id nextcloud-backups ~/test-db.sql.zst ``` - [ ] Verify it decompresses: ```bash zstd -t ~/test-db.sql.zst ``` - [ ] (DON'T actually restore, just verify it works) ### Practice File Restore - [ ] List available file backups: ```bash b2 list-file-names nextcloud-backups nextcloud-backups/ | grep "files" ``` - [ ] Download one: ```bash b2 download-file-by-id nextcloud-backups ~/test-files.tar.zst ``` - [ ] Verify it extracts: ```bash tar --zstd -tf ~/test-files.tar.zst | head -20 ``` ## โš ๏ธ Troubleshooting Checklist If something isn't working: ### Backup Not Running - [ ] Check timer status: `sudo systemctl status nextcloud-backup.timer` - [ ] Check service logs: `sudo journalctl -u nextcloud-backup.service -n 50` - [ ] Verify paths exist: `ls /srv/docker/nextcloud/data` - [ ] Test B2 auth: `b2 account-info` - [ ] Run manual test: `sudo DRY_RUN=true /opt/nextcloud-backup/nextcloud-backup-to-backblaze.sh` ### B2 Upload Fails - [ ] Check B2 credentials: `cat /etc/nextcloud-backup/b2-credentials.env` - [ ] Re-authenticate: `b2 authorize-account ` - [ ] Verify bucket exists: `b2 list-buckets` - [ ] Check account quotas in B2 console ### Database Dump Fails - [ ] Verify DB password in config: `sudo cat /opt/nextcloud-backup/.env | grep DB_PASSWORD` - [ ] Test DB connection manually: `sudo docker-compose ... exec mariadb mysql ...` - [ ] Check DB container is running: `docker ps | grep -i mariadb` ### Permission Denied Errors - [ ] Check script is executable: `ls -la /opt/nextcloud-backup/nextcloud-backup-to-backblaze.sh` - [ ] Check data directory readable: `sudo ls /srv/docker/nextcloud/data` - [ ] Verify running as root: `whoami` (should show root when using sudo) ## โœ… Final Checklist Before considering deployment complete: - [ ] Installer ran successfully - [ ] All configurations edited with real values - [ ] Dry-run test passed - [ ] Manual incremental backup successful - [ ] Files visible in B2 bucket - [ ] Timer enabled and active - [ ] First automatic backup completed - [ ] B2 credentials stored securely - [ ] Restore procedures tested (at least once) - [ ] Monitoring plan in place - [ ] Team aware of backup solution - [ ] Documentation saved/accessible ## ๐Ÿ“ž Quick Reference **Backup Status** ```bash sudo /opt/nextcloud-backup/nextcloud-backup-to-backblaze.sh status ``` **View Logs** ```bash sudo journalctl -u nextcloud-backup.service -n 50 sudo tail -f /opt/nextcloud-backup/.backups/logs/backup_*.log ``` **Manual Backup** ```bash sudo /opt/nextcloud-backup/nextcloud-backup-to-backblaze.sh incremental ``` **Timer Status** ```bash sudo systemctl status nextcloud-backup.timer sudo systemctl list-timers nextcloud-backup.timer ``` ## ๐Ÿ“ž Emergency Contacts If you encounter issues: 1. Check logs: `journalctl -u nextcloud-backup.service -n 100` 2. See troubleshooting in `NEXTCLOUD_BACKBLAZE_SETUP.md` 3. Verify B2 credentials with: `b2 account-info` 4. Test manually: `sudo DRY_RUN=true /opt/nextcloud-backup/nextcloud-backup-to-backblaze.sh` --- **Deployment Date**: _______________ **Deployed By**: _______________ **Status**: [ ] Complete [ ] In Progress [ ] Failed **Notes**: --- **Remember**: Test your restore procedures monthly! A backup that hasn't been tested is not a backup.