Skip to main content

Restic - High-Availability Backup Strategie für Immich und Syncthing

High-Availability

Überblick

Backup

Dies Strategyist forein Immichsauberes, andgenerisches SyncthingTemplate einer bewährten, einfachen Backup-Strategie mit einem dedizierten Vault-LXC und Restic mit REST-Server.

Separate Repositories für unterschiedliche Dienste, einfache User-Schleife, direktes Pruning – minimale Komplexität, maximale Zuverlässigkeit.

(SimplifiedVereinfachte & Practicalpraktische Edition – Genericgenerisches Template)

Overview

This is a clean, generic template of a proven, simple backup strategy using a dedicated Vault LXC and Restic with REST server.
Separate repositories for different services, easy user looping, and direct pruning — minimal complexity, maximum reliability.

InfrastructureInfrastruktur (Example Beispiel-Layout)

Host / ServiceDienst Example Beispiel-IP RoleRolle Example Beispiel-CTID
Proxmox VE Host 192.168.50.10 Hypervisor, ZFS storageZFS-Speicher -
Immich LXC 192.168.50.142 ProductionProduktive Immich applicationImmich-Anwendung 142
Syncthing LXC 192.168.50.135 Multi-user Syncthing instanceUser-Syncthing-Instanz 135
Vault/Restic LXC 192.168.50.220 Backup controllerBackup-Controller 220
NAS 192.168.50.80 Restic REST serverREST-Server (listeninglauscht onauf 10.20.20.80) -

Read-Only Mount Mount-Points inim Vault Vault-LXC

Example ZFS Beispiel-ZFS-Dataset onauf Host Mount Mount-Point inim Vault Vault-LXC PurposeZweck
/tank/subvol-142-disk-1 /source/immich Immich library/uploadsImmich-Bibliothek/Uploads
/tank/subvol-135-disk-2 /source/syncthing-alice Syncthing userSyncthing-Benutzer Alice
/tank/subvol-135-disk-3 /source/syncthing-bob Syncthing userSyncthing-Benutzer Bob
/tank/subvol-135-disk-4 /source/syncthing-charlie Syncthing userSyncthing-Benutzer Charlie

ConfiguredKonfiguriert onauf Proxmoxdem hostProxmox-Host withmit read-only mountsMounts (ro=1).

Restic REST REST-Server onauf dem NAS (10.20.20.80:8000)

TwoZwei separate repositories:Repositories:

  • /photosauthenticatedauthentifiziert withmit userBenutzer photos-backup
  • /sync-mainauthenticatedauthentifiziert withmit userBenutzer sync-backup

--append-only iswird notnicht used,verwendet, allowingdamit theder backupBackup-Client clientdas toPruning handledirekt pruning directly.übernimmt.

GenericGenerisches Backup Script Backup-Script-Template

PlacePlatziere thisdieses inScript theim Vault Vault-LXC asunter /root/backup-mountpoints.sh:

#!/bin/bash
# SimpleEinfaches backupBackup-Script-Template script template forfür Immich + multi-user Multi-User-Syncthing
# --- CONFIGURATION:KONFIGURATION: IMMICH ---
IMMICH_REPO="rest:http://photos-backup:StrongPhotoPass2025@10.20.20.80:8000/photos"
IMMICH_PASS="StrongPhotoPass2025"
# --- CONFIGURATION:KONFIGURATION: SYNCTHING ---
SYNC_REPO="rest:http://sync-backup:StrongSyncPass2025@10.20.20.80:8000/sync-main"
SYNC_PASS="StrongSyncPass2025"

echo "--- Backup Started:gestartet: $(date) ---"

# ==========================================
# 1. IMMICH BACKUP
# ==========================================
echo "Backing upSichere Immich..."
RESTIC_PASSWORD=$IMMICH_PASS restic -r $IMMICH_REPO backup /source/immich \
    --host immich-server --tag "auto" --verbose

# Prune Immich repoImmich-Repo
RESTIC_PASSWORD=$IMMICH_PASS restic -r $IMMICH_REPO forget \
    --keep-last 3 --keep-daily 7 --keep-weekly 4 --prune

# ==========================================
# 2. SYNCTHING BACKUP
# ==========================================
echo "BackingSichere up Syncthing Users.Syncthing-Benutzer..."
USERS=("alice" "bob" "charlie")
for USER in "${USERS[@]}"; do
    echo "ProcessingBearbeite $USER..."
    RESTIC_PASSWORD=$SYNC_PASS restic -r $SYNC_REPO backup "/source/syncthing-$USER" \
        --host syncthing-server --tag "user:$USER" --verbose
done

# Prune Syncthing repoSyncthing-Repo (onceeinmalig forfür allalle users)Benutzer)
RESTIC_PASSWORD=$SYNC_PASS restic -r $SYNC_REPO forget \
    --keep-last 3 --keep-daily 7 --keep-weekly 4 --prune

echo "--- Backup Finished:abgeschlossen: $(date) ---"

Security hardening:Sicherheitshärtung:

chmod 700 /root/backup-mountpoints.sh
chown root:root /root/backup-mountpoints.sh

AutomationAutomatisierung & SchedulingZeitplanung

Crontab inim Vault Vault-LXC (crontab -e):

0 3 * * * /root/backup-all.mountpoints.sh >> /var/log/restic-backup.log 2>&1

Log rotationLog-Rotation (/etc/logrotate.d/restic):

/var/log/restic-backup.log {
    daily
    rotate 14
    compress
    missingok
    notifempty
}

Security ModelSicherheitsmodell

  • Isolation:Isolation: Production containersProduktions-Container (Immich & Syncthing) havehaben nokeinen networkNetzwerkzugriff accessauf toden the NAS backup storage.NAS-Backup-Speicher.
  • Read-OnlyOnly-Zugriff: Access: Vault Vault-LXC cannotkann modifyLive-Daten ornicht deleteverändern liveoder data.löschen.
  • Immutability:Immutability: --append-only onauf RESTdem serverREST-Server preventsverhindert deletionLöschung ofvon snapshotsSnapshots, evenselbst ifwenn Vault iskompromittiert compromised.wird.
  • EncryptionVerschlüsselung & Integrity:Integrität: Restic encryptsverschlüsselt allalle dataDaten andund performsführt cryptographickryptografische checks.Prüfungen durch.

Recovery ExamplesWiederherstellungs-Beispiele

# ListImmich-Snapshots Immich snapshotsauflisten
RESTIC_PASSWORD=StrongPhotoPass2025 restic -r rest:http://photos-backup:...@10.20.20.80:8000/photos snapshots

# RestoreNeueste latestImmich-Version Immichwiederherstellen
RESTIC_PASSWORD=StrongPhotoPass2025 restic -r ... restore latest --target /tmp/restore-immich

# ListNur onlySnapshots Bob'svon snapshotsBob auflisten
RESTIC_PASSWORD=StrongSyncPass2025 restic -r ... snapshots --tag user:bob

# RestoreBob-Daten Bob's datawiederherstellen
RESTIC_PASSWORD=StrongSyncPass2025 restic -r ... restore latest --tag user:bob --target /tmp/restore-bob

ThisDieses templateTemplate preservesbewahrt thedie simplicityEinfachheit andund effectivenessWirksamkeit ofdeines yourfunktionierenden workingSetups, setuphält whileaber keepingalle allBezeichner identifiersgenerisch genericund andsicher. secure.Kopieren, Copy,anpassen adapt,und andsicher deploy confidently!einsetzen!