diff --git a/restic/docker-compose.yml b/restic/docker-compose.yml index 4f65a8c..47641ee 100644 --- a/restic/docker-compose.yml +++ b/restic/docker-compose.yml @@ -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 services: @@ -6,17 +6,49 @@ services: image: restic/restic:latest container_name: restic-backup environment: - - RESTIC_REPOSITORY=/backup - - RESTIC_PASSWORD=yourpassword + # --- 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: - - E:/installers:/data/installers:ro + # 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 - restic backup /data/installers && - restic backup /data/immich-photos && - restic forget --prune --keep-last 7; - sleep 43200; + 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 &&