chore: add migration helper scripts + cutover plan doc

R510 -> R730XD/Proxmox migration helpers (consistent DB dumps, B2/Kopia snapshot refresh, cutover final backup) plus the previously-untracked gitea-portainer-registry cutover plan under docs/.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
ginnoir
2026-06-17 23:27:55 -05:00
co-authored by Claude Opus 4.8
parent 4ede8c483a
commit c5d487effe
4 changed files with 1930 additions and 0 deletions
+43
View File
@@ -0,0 +1,43 @@
#!/usr/bin/env bash
#
# Pre-migration: make the Kopia -> B2 snapshots current AND complete.
#
# 1) waits for the running migration-backup.sh to finish (avoid /config read contention)
# 2) supplements the logical DB dumps the nightly job omits (nextcloud, immich) and
# replaces the empty bookstack dump, using the complete set from migration-backup.sh
# 3) runs the existing Kopia snapshot pipeline -> fresh B2 snapshot of /config + dumps + labdata
#
# Run ON valhalla as ginnoir: nohup bash ~/refresh-b2-snapshot.sh > ~/refresh-b2-snapshot.out 2>&1 &
#
set -uo pipefail
log(){ printf '[%s] %s\n' "$(date +%H:%M:%S)" "$*"; }
# 1. wait for the migration backup to complete
log "waiting for migration-backup.sh to finish..."
while pgrep -f 'migration-backup.sh' >/dev/null 2>&1; do sleep 15; done
log "migration backup finished"
# locate newest migration backup db dir and newest official dump dir
MIG_DB="$(ls -1dt /storage1/migration-backup/*/db 2>/dev/null | head -1)"
DUMPS="$(ls -1dt /config/backup/dumps/*/ 2>/dev/null | head -1)"
log "migration db dir: ${MIG_DB:-<none>}"
log "official dump dir: ${DUMPS:-<none>}"
# 2. supplement the dumps the nightly job misses (raw datadirs already cover them in /config,
# but this gives B2 a complete logical-dump layer too)
if [ -n "${MIG_DB:-}" ] && [ -n "${DUMPS:-}" ]; then
for f in nextcloud-postgres.sql.gz immich-postgres.sql.gz mariadb_bookstack.sql.gz; do
if [ -s "$MIG_DB/$f" ]; then
sudo cp -f "$MIG_DB/$f" "$DUMPS/$f" && log "supplemented $f ($(du -h "$DUMPS/$f" | cut -f1))"
else
log "WARN: $MIG_DB/$f missing/empty — not supplemented"
fi
done
log "dump dir now:"; ls -lh "$DUMPS"
fi
# 3. fresh Kopia -> B2 snapshot (same pipeline cron uses)
log "running Kopia snapshot to B2..."
docker exec backup_scheduler sh /scripts/backup-run-snapshots.sh 2>&1
log "DONE — verify with: docker exec kopia sh -c 'KOPIA_PASSWORD=\$KOPIA_REPOSITORY_PASSWORD kopia snapshot list --all' | tail"