do local and remote backups
This commit is contained in:
parent
f51a0f47fe
commit
09b7d0bcee
1 changed files with 41 additions and 9 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
# init with
|
# init REPOSITORY 1 with
|
||||||
# docker run --rm -e RESTIC_PASSWORD=yourpassword -v G:/restic-backups:/backup restic/restic init --repo /backup
|
# docker run --rm -e RESTIC_PASSWORD=yourpassword -v G:/restic-backups:/backup restic/restic init --repo /backup
|
||||||
|
|
||||||
services:
|
services:
|
||||||
|
|
@ -6,17 +6,49 @@ services:
|
||||||
image: restic/restic:latest
|
image: restic/restic:latest
|
||||||
container_name: restic-backup
|
container_name: restic-backup
|
||||||
environment:
|
environment:
|
||||||
- RESTIC_REPOSITORY=/backup
|
# --- REPOSITORY 1: REMOTE REST SERVER ---
|
||||||
- RESTIC_PASSWORD=yourpassword
|
- 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:
|
volumes:
|
||||||
- E:/installers:/data/installers:ro
|
# Data to backup (Read-Only)
|
||||||
|
- F:/roms/megadrive:/data/roms:ro
|
||||||
- H:/immich-photos:/data/immich-photos:ro
|
- H:/immich-photos:/data/immich-photos:ro
|
||||||
|
|
||||||
|
# REPOSITORY 1: Local Backup Folder
|
||||||
- G:/restic-backups:/backup
|
- G:/restic-backups:/backup
|
||||||
|
|
||||||
entrypoint: >
|
entrypoint: >
|
||||||
sh -c "while true; do
|
sh -c "while true; do \
|
||||||
restic backup /data/installers &&
|
\
|
||||||
restic backup /data/immich-photos &&
|
echo '--- Starting Remote Backup ---' && \
|
||||||
restic forget --prune --keep-last 7;
|
export RESTIC_REPOSITORY=$RESTIC_REPOSITORY_REMOTE && \
|
||||||
sleep 43200;
|
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"
|
done"
|
||||||
|
|
||||||
restart: unless-stopped
|
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