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.
(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 / |
|||
|---|---|---|---|
| Proxmox VE Host | 192.168.50.10 | Hypervisor, |
|
| Immich LXC | 192.168.50.142 | 142 | |
| Syncthing LXC | 192.168.50.135 | Multi- |
135 |
| Vault/Restic LXC | 192.168.50.220 | 220 | |
| NAS | 192.168.50.80 | Restic |
Read-Only Mount-Mount Points imin Vault-Vault LXC
/tank/subvol-142-disk-1 |
/source/immich |
|
/tank/subvol-135-disk-2 |
/source/syncthing-alice |
|
/tank/subvol-135-disk-3 |
/source/syncthing-bob |
|
/tank/subvol-135-disk-4 |
/source/syncthing-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:
/photos→authentifiziertauthenticatedmitwithBenutzeruserphotos-backup/sync-main→authentifiziertauthenticatedmitwithBenutzerusersync-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)habenhavekeinennoNetzwerkzugriffnetworkaufaccessdentoNAS-Backup-Speicher.the NAS backup storage.- Read-
Only-Zugriff:OnlyVault-Access: Vault LXCkanncannotLive-Datenmodifynichtorveränderndeleteoderlivelöschen.data. Immutability:Immutability:--append-onlyaufondemRESTREST-ServerserververhindertpreventsLöschungdeletionvonofSnapshots,snapshotsselbstevenwennif Vaultkompromittiertiswird.compromised.VerschlüsselungEncryption &Integrität:Integrity: ResticverschlüsseltencryptsalleallDatendataundandführtperformskryptografischecryptographicPrü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!