diff options
| author | Tyler Hoang <tyler@tylerhoang.xyz> | 2026-07-09 21:49:56 -0700 |
|---|---|---|
| committer | Tyler Hoang <tyler@tylerhoang.xyz> | 2026-07-09 21:49:56 -0700 |
| commit | 1d043702ef136e8f2e516c5304a57be5718f1f6f (patch) | |
| tree | 9b3ad070f11dad5994c58acd41a15db8043745aa /immich/backup.sh | |
12 services: adguard, ampache, azuracast, flood, glance, glances,
grafana, immich, invidious, jellyfin, openwebui, watchtower
Each service includes a docker-compose.yml, README.md with setup
instructions, and .env.example where applicable.
Diffstat (limited to 'immich/backup.sh')
| -rwxr-xr-x | immich/backup.sh | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/immich/backup.sh b/immich/backup.sh new file mode 100755 index 0000000..91770a9 --- /dev/null +++ b/immich/backup.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +# Paths +UPLOAD_LOCATION="/srv/photos" +BACKUP_PATH="/path/to/local/immich-backup" +REMOTE_HOST="user@remote-host" +REMOTE_BACKUP_PATH="/path/to/remote/immich" + + +### Local + +# Backup Immich database +docker exec -t immich_postgres pg_dumpall --clean --if-exists --username=postgres > "$UPLOAD_LOCATION"/database-backup/immich-database.sql +# For deduplicating backup programs such as Borg or Restic, compressing the content can increase backup size by making it harder to deduplicate. If you are using a different program or still prefer to compress, you can use the following command instead: +# docker exec -t immich_postgres pg_dumpall --clean --if-exists --username=<DB_USERNAME> | /usr/bin/gzip --rsyncable > "$UPLOAD_LOCATION"/database-backup/immich-database.sql.gz + +### Append to local Borg repository +borg create "$BACKUP_PATH/immich-borg::{now}" "$UPLOAD_LOCATION" --exclude "$UPLOAD_LOCATION"/thumbs/ --exclude "$UPLOAD_LOCATION"/encoded-video/ +borg prune --keep-weekly=4 --keep-monthly=3 "$BACKUP_PATH"/immich-borg +borg compact "$BACKUP_PATH"/immich-borg + + +### Append to remote Borg repository +borg create "$REMOTE_HOST:$REMOTE_BACKUP_PATH/immich-borg::{now}" "$UPLOAD_LOCATION" --exclude "$UPLOAD_LOCATION"/thumbs/ --exclude "$UPLOAD_LOCATION"/encoded-video/ +borg prune --keep-weekly=4 --keep-monthly=3 "$REMOTE_HOST:$REMOTE_BACKUP_PATH"/immich-borg +borg compact "$REMOTE_HOST:$REMOTE_BACKUP_PATH"/immich-borg |
