feat: Phase 13 — off-site backup with rclone + crypt encryption
Run Tests / Secret Detection (pull_request) Failing after 6m45s
Run Tests / Backend Tests (pull_request) Failing after 3m2s
Run Tests / Frontend Tests (pull_request) Failing after 30s

Adds cloud sync extension to the daily backup script using rclone
with client-side AES-256 encryption. Includes interactive setup
script for configuring OneDrive, Google Drive, or any rclone provider.

- scripts/setup-rclone.sh: interactive NAS rclone installer + config
- scripts/cloud-backup.sh: sourced by backup.sh when CLOUD_ENABLED=true
- backup.sh: cloud sync step runs after local backup

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Gan, Jimmy
2026-05-06 01:21:41 +08:00
parent 0a497ca0f1
commit dd64420de1
4 changed files with 261 additions and 4 deletions
+13
View File
@@ -11,6 +11,14 @@ ERRORS=0
[ -f "$SCRIPT_DIR/.env" ] && source "$SCRIPT_DIR/.env"
# Source cloud backup extension (Phase 13 — Off-site Backup)
CLOUD_ENABLED="${CLOUD_ENABLED:-false}"
if [ "$CLOUD_ENABLED" = "true" ]; then
RCLONE_CONFIG_DIR="${RCLONE_CONFIG_DIR:-$SCRIPT_DIR/rclone}"
CLOUD_RETENTION_DAYS="${CLOUD_RETENTION_DAYS:-30}"
source "$SCRIPT_DIR/scripts/cloud-backup.sh"
fi
mkdir -p "$BACKUP_DIR"
log() { echo "[$(date '+%Y-%m-%d %H:%M:%S')] $1"; }
@@ -66,6 +74,11 @@ find "$BACKUP_DIR" -type f \( -name "*.sql" -o -name "*.tar.gz" \) -mtime +$RETE
# Summary
log "=== Backup finished ($ERRORS errors) ==="
# Off-site cloud sync
if [ "$CLOUD_ENABLED" = "true" ] && type cloud_backup &>/dev/null; then
cloud_backup || ERRORS=$((ERRORS + CLOUD_ERRORS))
fi
if [ $ERRORS -gt 0 ]; then
notify "🔴 *NAS Backup FAILED* ($DATE)
$ERRORS error(s) — check logs"