Skip to main content

Restic: High-Availability Backup Strategy for Immich and Syncthing

Überblick

High-Availability

DiesBackup istStrategy einfor sauberes,Immich generischesand Template 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.

Syncthing

(VereinfachteSimplified & praktischePractical Edition – generischesGeneric Template)

InfrastrukturOverview

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.

Infrastructure (Beispiel-Example Layout)

Host / DienstService Beispiel-Example IP RolleRole Beispiel-Example CTID
Proxmox VE Host 192.168.50.10 Hypervisor, ZFS-SpeicherZFS storage -
Immich LXC 192.168.50.142 ProduktiveProduction Immich-AnwendungImmich application 142
Syncthing LXC 192.168.50.135 Multi-User-Syncthing-Instanzuser Syncthing instance 135
Vault/Restic LXC 192.168.50.220 Backup-ControllerBackup controller 220
NAS 192.168.50.80 Restic REST-ServerREST server (lauschtlistening aufon 10.20.20.80) -

Read-Only Mount-Mount Points imin Vault-Vault LXC

Beispiel-ZFS-Example ZFS Dataset aufon Host Mount-Mount Point imin Vault-Vault LXC ZweckPurpose
/tank/subvol-142-disk-1 /source/immich Immich-Bibliothek/UploadsImmich library/uploads
/tank/subvol-135-disk-2 /source/syncthing-alice Syncthing-BenutzerSyncthing user Alice
/tank/subvol-135-disk-3 /source/syncthing-bob Syncthing-BenutzerSyncthing user Bob
/tank/subvol-135-disk-4 /source/syncthing-charlie Syncthing-BenutzerSyncthing user Charlie

KonfiguriertConfigured aufon demProxmox Proxmox-Hosthost mitwith read-only Mountsmounts (ro=1).

Restic REST-REST Server auf demon NAS (10.20.20.80:8000)

ZweiTwo separate Repositories:repositories:

  • /photosauthentifiziertauthenticated mitwith Benutzeruser photos-backup
  • /sync-mainauthentifiziertauthenticated mitwith Benutzeruser sync-backup

--append-only wirdis nichtnot verwendet,used, damitallowing derthe Backup-Clientbackup dasclient Pruningto direkthandle übernimmt.pruning directly.

GenerischesGeneric Backup-Script-Backup Script Template

PlatzierePlace diesesthis Scriptin imthe Vault-Vault LXC unteras /root/backup-mountpoints.sh:

#!/bin/bash
# EinfachesSimple Backup-Script-Templatebackup fürscript template for Immich + Multi-User-multi-user Syncthing

# --- KONFIGURATION:CONFIGURATION: IMMICH ---
IMMICH_REPO="rest:http://photos-backup:StrongPhotoPass2025@10.20.20.80:8000/photos"
IMMICH_PASS="StrongPhotoPass2025"

# --- KONFIGURATION:CONFIGURATION: SYNCTHING ---
SYNC_REPO="rest:http://sync-backup:StrongSyncPass2025@10.20.20.80:8000/sync-main"
SYNC_PASS="StrongSyncPass2025"

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

# ==========================================
# 1. IMMICH BACKUP
# ==========================================
echo "SichereBacking up 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 "SichereBacking Syncthing-Benutzer.up Syncthing Users..."
USERS=("alice" "bob" "charlie")

for USER in "${USERS[@]}"; do
    echo "BearbeiteProcessing $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 (einmaligonce fürfor alleall Benutzer)users)
RESTIC_PASSWORD=$SYNC_PASS restic -r $SYNC_REPO forget \
    --keep-last 3 --keep-daily 7 --keep-weekly 4 --prune

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

Sicherheitshärtung:Security hardening:

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

AutomatisierungAutomation & ZeitplanungScheduling

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

0 3 * * * /root/backup-mountpoints.all.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
}

SicherheitsmodellSecurity Model

  • Isolation:Isolation: Produktions-ContainerProduction containers (Immich & Syncthing) habenhave keinenno Netzwerkzugriffnetwork aufaccess dento NAS-Backup-Speicher.the NAS backup storage.
  • Read-Only-Zugriff:Only Vault-Access: Vault LXC kanncannot Live-Datenmodify nichtor veränderndelete oderlive löschen.data.
  • Immutability:Immutability: --append-only aufon demREST REST-Serverserver verhindertprevents Löschungdeletion vonof Snapshots,snapshots selbsteven wennif Vault kompromittiertis wird.compromised.
  • VerschlüsselungEncryption & Integrität:Integrity: Restic verschlüsseltencrypts alleall Datendata undand führtperforms kryptografischecryptographic Prüfungen durch.checks.

Wiederherstellungs-BeispieleRecovery Examples

# Immich-SnapshotsList auflistenImmich snapshots
RESTIC_PASSWORD=StrongPhotoPass2025 restic -r rest:http://photos-backup:...@10.20.20.80:8000/photos snapshots

# NeuesteRestore Immich-Versionlatest wiederherstellenImmich
RESTIC_PASSWORD=StrongPhotoPass2025 restic -r ... restore latest --target /tmp/restore-immich

# NurList Snapshotsonly vonBob's Bob auflistensnapshots
RESTIC_PASSWORD=StrongSyncPass2025 restic -r ... snapshots --tag user:bob

# Bob-DatenRestore wiederherstellenBob's data
RESTIC_PASSWORD=StrongSyncPass2025 restic -r ... restore latest --tag user:bob --target /tmp/restore-bob

DiesesThis Templatetemplate bewahrtpreserves diethe Einfachheitsimplicity undand Wirksamkeiteffectiveness deinesof funktionierendenyour Setups,working hältsetup aberwhile allekeeping Bezeichnerall generischidentifiers undgeneric sicher.and Kopieren,secure. anpassenCopy, undadapt, sicherand einsetzen!deploy confidently!