Compare commits

...

10 commits

Author SHA1 Message Date
deceivedhornet
2c6dfbdb09 Disable healthcheck for Unraid 2026-01-12 23:07:46 -05:00
deceivedhornet
d421392e97 Create immich-db-dump.sh 2026-01-12 23:07:31 -05:00
deceivedhornet
291f4adad4 Upgrade postgres vectorchord to 0.4.3 and rename network 2026-01-11 17:27:30 -05:00
deceivedhornet
c936c7c645 Sync with nextcloud 2026-01-11 17:26:59 -05:00
deceivedhornet
7298153fc7 Create backup_immich.bat 2026-01-11 17:26:40 -05:00
deceivedhornet
09b7d0bcee do local and remote backups 2025-11-19 02:35:41 -05:00
deceivedhornet
f51a0f47fe Add immich-photos to restic 2025-11-18 03:19:04 -05:00
deceivedhornet
6c1ba18bf2 simple restic, seems to work 2025-11-18 02:34:53 -05:00
deceivedhornet
f28d9781ff tried autorestic, no success 2025-11-18 02:34:43 -05:00
deceivedhornet
279f26c23d kopia init 2025-11-18 01:15:10 -05:00
10 changed files with 222 additions and 11 deletions

5
.gitignore vendored
View file

@ -1,3 +1,8 @@
.env
swag
filebrowser-docker
autorestic/config/.autorestic.lock.yml
.nextcloudsync.log
.sync_cd2c53ad47df.db
.sync_cd2c53ad47df.db-shm
.sync_cd2c53ad47df.db-wal

2
Desktop.ini Normal file
View file

@ -0,0 +1,2 @@
[.ShellClassInfo]
IconResource=C:\Program Files\Nextcloud\nextcloud.exe,1

View file

@ -0,0 +1,26 @@
version: 2
locations:
home:
from:
- /data/installers
# Or multiple
# from:
# - /foo
# - /bar
to:
- hdd
backends:
# remote:
# type: s3
# path: 's3.amazonaws.com/bucket_name'
# key: some-random-password-198rc79r8y1029c8yfewj8f1u0ef87yh198uoieufy
# env:
# AWS_ACCESS_KEY_ID: account_id
# AWS_SECRET_ACCESS_KEY: account_key
hdd:
type: local
path: /repo/autorestic_repo
key: 'if not key is set it will be generated for you'

View file

@ -0,0 +1,26 @@
services:
autorestic:
image: cupcakearmy/autorestic
container_name: autorestic
hostname: autorestic-backup
# We mount the autorestic config file into the container.
# We mount the data you want to back up (E:\installers) into the container at /data/installers.
# We mount the repository location (G:\autorestic-backups) into the container at /repo/autorestic_repo.
# We use a named volume for the restic cache for persistence and performance.
volumes:
- ./config:/config
- e:/installers:/data/installers:ro
- g:/autorestic-backups:/repo/autorestic_repo
- autorestic_cache:/root/.cache/restic
# Pass secrets as environment variables.
environment:
- RESTIC_PASSWORD=YOUR_STRONG_REPOSITORY_PASSWORD
# This command will automatically run backups, checks, and prunes
# based on the cron schedules defined in your .autorestic.yml
command: >
/bin/sh -c "while true; do autorestic --config /config/.autorestic.yml cron; sleep 3600; done"
restart: unless-stopped
# Define the named volume for the cache
volumes:
autorestic_cache:

View file

@ -0,0 +1,3 @@
# This is actually added as a hook to backrest
docker exec -t immich_postgres pg_dumpall -c -U $DB_USERNAME > /tmp/immich-dump.sql

View file

@ -0,0 +1,15 @@
:: Backup Immich Photos to Islensku
D:\restic\restic_0.18.1_windows_amd64.exe ^
--password-file=D:\restic\pwd_restic_repo.txt ^
-r rest:https://backup138.dawsonst.ca/immich-photos-d ^
backup ^
D:\immich-photos
:: Backup Immich Photos to Boss
D:\restic\restic_0.18.1_windows_amd64.exe ^
--password-file=D:\restic\pwd_restic_repo.txt ^
-r rest:http://192.168.68.53:7378/immich-photos ^
backup ^
D:\immich-photos
pause

View file

@ -25,13 +25,13 @@ services:
ports:
- '2283:2283'
networks:
- caddy-network
- immich-net
depends_on:
- redis
- database
restart: always
healthcheck:
disable: false
disable: true
immich-machine-learning:
container_name: immich_machine_learning
@ -46,7 +46,7 @@ services:
env_file:
- .env
networks:
- caddy-network
- immich-net
restart: always
healthcheck:
disable: false
@ -57,12 +57,12 @@ services:
healthcheck:
test: redis-cli ping || exit 1
networks:
- caddy-network
- immich-net
restart: always
database:
container_name: immich_postgres
image: ghcr.io/immich-app/postgres:14-vectorchord0.4.1-pgvectors0.2.0
image: ghcr.io/immich-app/postgres:14-vectorchord0.4.3-pgvectors0.2.0
environment:
POSTGRES_PASSWORD: ${DB_PASSWORD}
POSTGRES_USER: ${DB_USERNAME}
@ -73,14 +73,14 @@ services:
volumes:
# Do not edit the next line. If you want to change the database storage location on your system, edit the value of DB_DATA_LOCATION in the .env file
- ${DB_DATA_LOCATION}:/var/lib/postgresql/data
shm_size: 1gb
networks:
- caddy-network
- immich-net
restart: always
networks:
caddy-network:
immich-net:
external: true
# driver: bridge
volumes:
model-cache:

View file

@ -0,0 +1,78 @@
# Run once: docker compose -f docker-compose-init.yml up --build --force-recreate
services:
kopia_init:
image: kopia/kopia:latest
container_name: kopia_init
# Use the passwords from .env
environment:
- KOPIA_REPOSITORY_PASSWORD=${KOPIA_REPOSITORY_PASSWORD}
- PUID=1000
- PGID=1000
# Volumes MUST match the server setup so the repository is initialized in the correct place.
volumes:
- kopia_config:/app/config
- kopia_cache:/app/cache
- kopia_logs:/app/logs
- g:/kopia-backups:/app/repository # CRITICAL: This is where the repo will be created
# --- YOUR SOURCE DATA ---
# Maps your host's E:\installers and H:\immich-photos to specific paths inside the container.
# ':ro' (read-only) is a safety best practice.
- e:/installers:/source/installers:ro
- h:/immich-photos:/source/immich-photos:ro
# Override the default Kopia ENTRYPOINT to use the standard shell.
entrypoint: /bin/sh
# This command now runs 4 steps sequentially:
# 1. Create the repository.
# 2. Connect to it (so subsequent commands work).
# 3. SET POLICY for /source/installers (12h interval + retention).
# 4. SET POLICY for /source/immich-photos (12h interval + retention).
command:
- -c
- |
# 1. Create the Kopia Repository
echo 'Creating new Kopia repository at /app/repository...'
kopia repository create filesystem \
--path=/app/repository \
--password=${KOPIA_REPOSITORY_PASSWORD} \
&& \
# 2. Explicitly connect to the repository non-interactively.
# This is CRITICAL for the policy commands to work.
echo 'Connecting to repository non-interactively...' && \
kopia repository connect filesystem \
--path=/app/repository \
--password=${KOPIA_REPOSITORY_PASSWORD} \
&& \
# 3. SET POLICY for installers (Schedule: 12h)
# This does NOT run a snapshot. It just saves the schedule.
echo 'Setting 12-hour schedule for /source/installers...' && \
kopia policy set /source/installers \
--snapshot-interval 12h \
--keep-daily 7 \
--keep-weekly 4 \
--keep-monthly 12 \
--password=${KOPIA_REPOSITORY_PASSWORD} \
&& \
# 4. SET POLICY for immich-photos (Schedule: 12h)
echo 'Setting 12-hour schedule for /source/immich-photos...' && \
kopia policy set /source/immich-photos \
--snapshot-interval 12h \
--keep-daily 7 \
--keep-weekly 4 \
--keep-monthly 12 \
--password=${KOPIA_REPOSITORY_PASSWORD}
echo 'Initialization complete. Repository created and policies set.'
# Do not restart since it's a one-off command
restart: "no"
# Re-using the same Docker-managed volumes
volumes:
kopia_config:
kopia_cache:
kopia_logs:

View file

@ -24,14 +24,15 @@ services:
- kopia_logs:/app/logs
# --- YOUR BACKUP DESTINATION ---
# Maps your host's F:\test_backup to /app/repository inside the container.
# Maps your host's G:\kopia-backups to /app/repository inside the container.
# Kopia will write its backup data here.
- f:/test_backup:/app/repository
- g:/kopia-backups:/app/repository
# --- YOUR SOURCE DATA ---
# Maps your host's E:\installers to /source/installers inside the container.
# Maps your host's E:\installers and H:\immich-photos to /source/installers inside the container.
# ':ro' (read-only) is a safety best practice.
- e:/installers:/source/installers:ro
- h:/immich-photos:/source/immich-photos:ro
command:
- server
@ -39,6 +40,7 @@ services:
- --ui
- --address=0.0.0.0:51515
- --insecure
- --password=${KOPIA_REPOSITORY_PASSWORD}
- --server-username=${KOPIA_SERVER_USERNAME}
- --server-password=${KOPIA_SERVER_PASSWORD}
restart: unless-stopped

54
restic/docker-compose.yml Normal file
View file

@ -0,0 +1,54 @@
# init REPOSITORY 1 with
# docker run --rm -e RESTIC_PASSWORD=yourpassword -v G:/restic-backups:/backup restic/restic init --repo /backup
services:
restic-backup:
image: restic/restic:latest
container_name: restic-backup
environment:
# --- REPOSITORY 1: REMOTE REST SERVER ---
- RESTIC_REPOSITORY_REMOTE=${RESTIC_REPOSITORY_REMOTE}
- RESTIC_PASSWORD_REMOTE=${RESTIC_PASSWORD_REMOTE}
# --- REPOSITORY 2: LOCAL FOLDER ---
- RESTIC_REPOSITORY_LOCAL=${RESTIC_REPOSITORY_LOCAL}
- RESTIC_PASSWORD_LOCAL=${RESTIC_PASSWORD_LOCAL}
volumes:
# Data to backup (Read-Only)
- F:/roms/megadrive:/data/roms:ro
- H:/immich-photos:/data/immich-photos:ro
# REPOSITORY 1: Local Backup Folder
- G:/restic-backups:/backup
entrypoint: >
sh -c "while true; do \
\
echo '--- Starting Remote Backup ---' && \
export RESTIC_REPOSITORY=$RESTIC_REPOSITORY_REMOTE && \
export RESTIC_PASSWORD=$RESTIC_PASSWORD_REMOTE && \
restic backup /data/roms && \
\
echo '--- Starting Remote Prune ---' && \
restic forget --prune --keep-daily 7 --keep-weekly 4 --keep-monthly 12 --keep-yearly 0; \
\
echo '--- Starting Local Backup ---' && \
export RESTIC_REPOSITORY=$RESTIC_REPOSITORY_LOCAL && \
export RESTIC_PASSWORD=$RESTIC_PASSWORD_LOCAL && \
restic backup /data/roms && \
\
echo '--- Starting Local Prune ---' && \
restic forget --prune --keep-daily 7 --keep-weekly 4 --keep-monthly 12 --keep-yearly 0; \
\
echo '--- Cleanup and Sleep ---' && \
unset RESTIC_REPOSITORY && \
unset RESTIC_PASSWORD && \
echo '--- Backup Cycle Complete. Sleeping... ---' && \
sleep 43200; \
done"
restart: unless-stopped
# restic backup /data/roms /data/immich-photos &&
# restic backup /data/roms /data/immich-photos &&