Compare commits
10 commits
ad0f20f17a
...
2c6dfbdb09
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2c6dfbdb09 | ||
|
|
d421392e97 | ||
|
|
291f4adad4 | ||
|
|
c936c7c645 | ||
|
|
7298153fc7 | ||
|
|
09b7d0bcee | ||
|
|
f51a0f47fe | ||
|
|
6c1ba18bf2 | ||
|
|
f28d9781ff | ||
|
|
279f26c23d |
10 changed files with 222 additions and 11 deletions
5
.gitignore
vendored
5
.gitignore
vendored
|
|
@ -1,3 +1,8 @@
|
||||||
.env
|
.env
|
||||||
swag
|
swag
|
||||||
filebrowser-docker
|
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
2
Desktop.ini
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
[.ShellClassInfo]
|
||||||
|
IconResource=C:\Program Files\Nextcloud\nextcloud.exe,1
|
||||||
26
autorestic/config/.autorestic.yml
Normal file
26
autorestic/config/.autorestic.yml
Normal 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'
|
||||||
26
autorestic/docker-compose.yml
Normal file
26
autorestic/docker-compose.yml
Normal 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:
|
||||||
3
immich-app-islensku/immich-db-dump.sh
Normal file
3
immich-app-islensku/immich-db-dump.sh
Normal 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
|
||||||
15
immich-app/backup_immich.bat
Normal file
15
immich-app/backup_immich.bat
Normal 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
|
||||||
|
|
@ -25,13 +25,13 @@ services:
|
||||||
ports:
|
ports:
|
||||||
- '2283:2283'
|
- '2283:2283'
|
||||||
networks:
|
networks:
|
||||||
- caddy-network
|
- immich-net
|
||||||
depends_on:
|
depends_on:
|
||||||
- redis
|
- redis
|
||||||
- database
|
- database
|
||||||
restart: always
|
restart: always
|
||||||
healthcheck:
|
healthcheck:
|
||||||
disable: false
|
disable: true
|
||||||
|
|
||||||
immich-machine-learning:
|
immich-machine-learning:
|
||||||
container_name: immich_machine_learning
|
container_name: immich_machine_learning
|
||||||
|
|
@ -46,7 +46,7 @@ services:
|
||||||
env_file:
|
env_file:
|
||||||
- .env
|
- .env
|
||||||
networks:
|
networks:
|
||||||
- caddy-network
|
- immich-net
|
||||||
restart: always
|
restart: always
|
||||||
healthcheck:
|
healthcheck:
|
||||||
disable: false
|
disable: false
|
||||||
|
|
@ -57,12 +57,12 @@ services:
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: redis-cli ping || exit 1
|
test: redis-cli ping || exit 1
|
||||||
networks:
|
networks:
|
||||||
- caddy-network
|
- immich-net
|
||||||
restart: always
|
restart: always
|
||||||
|
|
||||||
database:
|
database:
|
||||||
container_name: immich_postgres
|
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:
|
environment:
|
||||||
POSTGRES_PASSWORD: ${DB_PASSWORD}
|
POSTGRES_PASSWORD: ${DB_PASSWORD}
|
||||||
POSTGRES_USER: ${DB_USERNAME}
|
POSTGRES_USER: ${DB_USERNAME}
|
||||||
|
|
@ -73,14 +73,14 @@ services:
|
||||||
volumes:
|
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
|
# 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
|
- ${DB_DATA_LOCATION}:/var/lib/postgresql/data
|
||||||
|
shm_size: 1gb
|
||||||
networks:
|
networks:
|
||||||
- caddy-network
|
- immich-net
|
||||||
restart: always
|
restart: always
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
caddy-network:
|
immich-net:
|
||||||
external: true
|
external: true
|
||||||
# driver: bridge
|
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
model-cache:
|
model-cache:
|
||||||
|
|
|
||||||
78
kopia/docker-compose-init.yml
Normal file
78
kopia/docker-compose-init.yml
Normal 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:
|
||||||
|
|
@ -24,14 +24,15 @@ services:
|
||||||
- kopia_logs:/app/logs
|
- kopia_logs:/app/logs
|
||||||
|
|
||||||
# --- YOUR BACKUP DESTINATION ---
|
# --- 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.
|
# Kopia will write its backup data here.
|
||||||
- f:/test_backup:/app/repository
|
- g:/kopia-backups:/app/repository
|
||||||
|
|
||||||
# --- YOUR SOURCE DATA ---
|
# --- 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.
|
# ':ro' (read-only) is a safety best practice.
|
||||||
- e:/installers:/source/installers:ro
|
- e:/installers:/source/installers:ro
|
||||||
|
- h:/immich-photos:/source/immich-photos:ro
|
||||||
|
|
||||||
command:
|
command:
|
||||||
- server
|
- server
|
||||||
|
|
@ -39,6 +40,7 @@ services:
|
||||||
- --ui
|
- --ui
|
||||||
- --address=0.0.0.0:51515
|
- --address=0.0.0.0:51515
|
||||||
- --insecure
|
- --insecure
|
||||||
|
- --password=${KOPIA_REPOSITORY_PASSWORD}
|
||||||
- --server-username=${KOPIA_SERVER_USERNAME}
|
- --server-username=${KOPIA_SERVER_USERNAME}
|
||||||
- --server-password=${KOPIA_SERVER_PASSWORD}
|
- --server-password=${KOPIA_SERVER_PASSWORD}
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
|
||||||
54
restic/docker-compose.yml
Normal file
54
restic/docker-compose.yml
Normal 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 &&
|
||||||
Loading…
Add table
Add a link
Reference in a new issue