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
This commit is contained in:
2026-04-25 18:00:07 -05:00
commit 2625cf36d2
14 changed files with 3090 additions and 0 deletions
+81
View File
@@ -0,0 +1,81 @@
# Nextcloud Backup Configuration
# Copy this file to /opt/nextcloud-backup/.env and fill in your values
# ============================================================================
# NEXTCLOUD CONFIGURATION
# ============================================================================
# Path to docker-compose directory (where Nextcloud is running)
# Examples: /opt/nextcloud, /srv/docker/nextcloud, etc.
NEXTCLOUD_COMPOSE_DIR=/srv/docker/nextcloud
# Full path to Nextcloud data directory
# This is where user files are stored
NEXTCLOUD_DATA_PATH=/srv/docker/nextcloud/data
# Database configuration
# Get these values from your docker-compose.yml or .env file
NEXTCLOUD_DB_NAME=nextcloud
NEXTCLOUD_DB_USER=nextcloud
NEXTCLOUD_DB_PASSWORD=your_database_password_here
NEXTCLOUD_CONTAINER=nextcloud
# ============================================================================
# BACKUP CONFIGURATION
# ============================================================================
# How many days to keep backups
# Older backups will be automatically deleted
BACKUP_RETENTION_DAYS=30
# Compression algorithm
# Options: zstd (recommended, fastest), gzip, bzip2
COMPRESSION=zstd
# Directory to store local backup metadata and logs
# Make sure there's enough space for logs
BACKUP_DIR=/opt/nextcloud-backup/.backups
# Temporary directory for assembling backups before upload
# Needs enough space for a full database + file archive
# Typically removed after upload
TEMP_DIR=/tmp/nextcloud-backup
# ============================================================================
# BACKUP STRATEGY
# ============================================================================
# Backup type for scheduled backups
# Options: incremental (daily, faster) or full (slower, complete snapshot)
# Default: incremental (recommended)
BACKUP_TYPE=incremental
# Perform test/dry-run (no actual upload)
# Set to 'true' for testing, 'false' for actual backups
DRY_RUN=false
# ============================================================================
# LOGGING & MONITORING
# ============================================================================
# Log level: DEBUG, INFO, WARN, ERROR
LOG_LEVEL=INFO
# Path to log files
LOG_DIR=${BACKUP_DIR}/logs
# Send alerts on failure (requires mail system configured)
# Set to your email address to receive failure notifications
ALERT_EMAIL=admin@example.com
# ============================================================================
# SCHEDULING (only used by systemd timer)
# ============================================================================
# Time for daily backup (24-hour format)
# Examples: 02:00:00 (2 AM), 14:30:00 (2:30 PM)
BACKUP_TIME=02:00:00
# Optional: Weekly full backup schedule
# Format: 'Sun' or 'Mon' etc., leave empty for daily incremental only
FULL_BACKUP_DAY=Sunday