Files
homelab-configs/DEPLOYMENT_CHECKLIST.md
T
jgitta 2625cf36d2 Add: Nextcloud Backblaze B2 backup solution - automated daily backups
- Complete backup script for native Nextcloud (MySQL + files)
- Systemd service and timer for daily automated backups at 2 AM
- Backblaze B2 integration with secure credential storage
- Incremental backup support with 30-day retention
- zstd compression for 40-70% storage reduction
- Comprehensive documentation and deployment guides
- Successfully tested with first backup: 203MB DB + 1.3GB files
- Cost-optimized: ~/bin/bash.01-0.02/month for 1.5GB data

Deployment Details:
- Installed B2 CLI via pipx
- Created backup directories at /opt/nextcloud-backup/
- Configured systemd timer for daily execution at 2 AM
- First backup verified in B2 bucket: jg-nextcloud
- Automated scheduling enabled and tested

Documentation includes:
- Deployment report with complete setup details
- Quick start guide for future deployments
- Comprehensive technical reference
- Troubleshooting procedures
- File manifest and index
2026-04-25 18:00:07 -05:00

10 KiB

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/:
    ls -la /opt/nextcloud-backup/
    
  • Service file exists:
    ls -la /etc/systemd/system/nextcloud-backup.*
    
  • Config directory exists:
    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:
    # 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:
    sudo test -f /etc/nextcloud-backup/b2-credentials.env && echo "✓ Found"
    
  • Check Nextcloud config exists:
    sudo test -f /opt/nextcloud-backup/.env && echo "✓ Found"
    
  • Verify B2 CLI is installed:
    b2 version
    
  • Test B2 authentication:
    b2 authorize-account <YOUR_ACCOUNT_ID> <YOUR_APP_KEY>
    b2 account-info
    

🧪 Testing Phase

Dry-Run Test (No Upload)

  • Run dry-run test:
    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:
    sudo /opt/nextcloud-backup/nextcloud-backup-to-backblaze.sh incremental
    
  • Monitor output for success
  • Check logs:
    sudo tail -50 /opt/nextcloud-backup/.backups/logs/backup_*.log
    
  • Verify backup was successful
  • Check B2 for uploaded files:
    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:
    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:
    sudo systemctl enable nextcloud-backup.timer
    
  • Start the timer:
    sudo systemctl start nextcloud-backup.timer
    
  • Check status:
    sudo systemctl status nextcloud-backup.timer
    
  • Should show: active (waiting)

Verify Timer Configuration

  • View timer status:
    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:
    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:
    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:
    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:
    b2 list-file-names nextcloud-backups nextcloud-backups/ | head -10
    

🛡️ Security Verification

Credential Security

  • B2 credentials file permissions (should be 600):
    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):
    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:
    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:
    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:
    b2 list-file-names nextcloud-backups nextcloud-backups/ | grep "db"
    
  • Download a database backup:
    b2 download-file-by-id nextcloud-backups <FILE_ID> ~/test-db.sql.zst
    
  • Verify it decompresses:
    zstd -t ~/test-db.sql.zst
    
  • (DON'T actually restore, just verify it works)

Practice File Restore

  • List available file backups:
    b2 list-file-names nextcloud-backups nextcloud-backups/ | grep "files"
    
  • Download one:
    b2 download-file-by-id nextcloud-backups <FILE_ID> ~/test-files.tar.zst
    
  • Verify it extracts:
    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 <ID> <KEY>
  • 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

sudo /opt/nextcloud-backup/nextcloud-backup-to-backblaze.sh status

View Logs

sudo journalctl -u nextcloud-backup.service -n 50
sudo tail -f /opt/nextcloud-backup/.backups/logs/backup_*.log

Manual Backup

sudo /opt/nextcloud-backup/nextcloud-backup-to-backblaze.sh incremental

Timer Status

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.