Sync infra config: HA/Zabbix relocation, Immich storage move, new services

Accumulated uncommitted infra changes:
- Caddyfile: repoint HA/Zabbix to 192.168.1.4/.3, add ~20 new site routes
- Immich: move media to /mnt/smsg, enable CUDA ML, mem limits, rewrite backup.sh
- Add service stacks: agap-mcp, anki, family, freshrss, iperf3, kanboard,
  linkwarden, qbittorrent, radicale, syncthing, vikunja, windows
- openwebui: enable API keys; ollama: drop CPU fallback
- seafile/zabbix: extra_hosts entries; matrix: add user juris
- Remove pihole stack and stale wiki/migrate.py
- Ignore marketplace-mcp (standalone repo) and linkwarden runtime data

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LeqyaxJF2nbRXJtae2kNB2
This commit is contained in:
Alvis
2026-07-04 13:28:04 +00:00
parent 4363130163
commit b8efe4732d
51 changed files with 2813 additions and 374 deletions

View File

@@ -1,30 +1,42 @@
#!/usr/bin/env bash
set -euo pipefail
BACKUP_DIR=/mnt/backups/media
DB_BACKUP_DIR="$BACKUP_DIR/backups"
BACKUP_DIR=/mnt/toshiba/backups/media
LOG="$BACKUP_DIR/backup.log"
RETAIN_DAYS=14
VERBOSE=0
mkdir -p "$DB_BACKUP_DIR"
echo "[$(date)] Starting Immich backup" >> "$LOG"
# 1. Database dump (must come before file sync)
DUMP_FILE="$DB_BACKUP_DIR/immich-db-$(date +%Y%m%dT%H%M%S).sql.gz"
docker exec immich_postgres pg_dump --clean --if-exists \
--dbname=immich --username=postgres | gzip > "$DUMP_FILE"
echo "[$(date)] DB dump: $DUMP_FILE" >> "$LOG"
# 2. Rsync critical asset folders (skip thumbs and encoded-video — regeneratable)
for DIR in library upload profile; do
rsync -a --delete /mnt/media/upload/$DIR/ "$BACKUP_DIR/$DIR/" >> "$LOG" 2>&1
echo "[$(date)] Synced $DIR" >> "$LOG"
for arg in "$@"; do
case $arg in
-v|--verbose) VERBOSE=1 ;;
esac
done
# 3. Remove old DB dumps
find "$DB_BACKUP_DIR" -name "immich-db-*.sql.gz" -mtime +$RETAIN_DAYS -delete
echo "[$(date)] Cleaned dumps older than ${RETAIN_DAYS}d" >> "$LOG"
log() { echo "[$(date)] $*" >> "$LOG"; }
say() { [[ $VERBOSE -eq 1 ]] && echo "$*" || true; }
mkdir -p "$BACKUP_DIR"
say ""
say "┌─────────────────────────────────────┐"
say "│ Immich Backup Starting │"
say "└─────────────────────────────────────┘"
say ""
log "Starting Immich backup"
# Rsync critical asset folders (skip thumbs and encoded-video — regeneratable)
RSYNC_OPTS="-a --ignore-existing"
[[ $VERBOSE -eq 1 ]] && RSYNC_OPTS="$RSYNC_OPTS --info=progress2"
for DIR in library upload profile; do
say " Syncing $DIR/ ..."
rsync $RSYNC_OPTS /mnt/smsg/media/upload/$DIR/ "$BACKUP_DIR/$DIR/" 2>&1 | \
tee -a "$LOG" | { [[ $VERBOSE -eq 0 ]] && cat > /dev/null || cat; }
log "Synced $DIR"
say ""
done
touch "$BACKUP_DIR/.last_sync"
echo "[$(date)] Immich backup complete" >> "$LOG"
log "Immich backup complete"
say "✓ Done"
say ""