diff --git a/roles/setup_hosted_services/defaults/main.yml b/roles/setup_hosted_services/defaults/main.yml index 0085a06..2353b84 100644 --- a/roles/setup_hosted_services/defaults/main.yml +++ b/roles/setup_hosted_services/defaults/main.yml @@ -36,9 +36,14 @@ qnap: docker_compose_directory: /etc/docker-compose # path on qnap where backups are stored backups_dir: /mnt/mergerfs/backups - + # path where photoprism photos are stored photoprism_dir: /mnt/mergerfs/photoprism +dockervolumebackup: + image: ghcr.io/chatton/docker-volume-backup + tag: pr-20 + config_directory: /etc/docker-volume-backup + # dashy related config dashy: destination_dir: /etc/config/dashy diff --git a/roles/setup_hosted_services/handlers/main.yml b/roles/setup_hosted_services/handlers/main.yml index 8958ee0..f3e7048 100644 --- a/roles/setup_hosted_services/handlers/main.yml +++ b/roles/setup_hosted_services/handlers/main.yml @@ -5,3 +5,6 @@ - name: restart-olivetin shell: docker restart olivetin + +- name: restart-docker-volume-backup + shell: docker restart docker-volume-backup diff --git a/roles/setup_hosted_services/tasks/main.yml b/roles/setup_hosted_services/tasks/main.yml index b6974bf..edd06ae 100644 --- a/roles/setup_hosted_services/tasks/main.yml +++ b/roles/setup_hosted_services/tasks/main.yml @@ -32,6 +32,7 @@ with_items: - "{{dashy.destination_dir}}" - "{{olivetin.destination_dir}}" + - "{{dockervolumebackup.config_directory}}" - name: Dashy | Config Files copy: @@ -47,6 +48,13 @@ notify: - restart-olivetin +- name: Docker Volume Backup | Config Files + template: + src: "docker-volume-backup/config.j2" + dest: "{{dockervolumebackup.config_directory}}/config.yml" + notify: + - restart-docker-volume-backup + - name: Install python dependencies (requests) pip: name: requests diff --git a/roles/setup_hosted_services/templates/docker-volume-backup.j2 b/roles/setup_hosted_services/templates/docker-volume-backup.j2 index efbb928..f1a86a0 100644 --- a/roles/setup_hosted_services/templates/docker-volume-backup.j2 +++ b/roles/setup_hosted_services/templates/docker-volume-backup.j2 @@ -5,17 +5,8 @@ services: docker-volume-backup: container_name: docker-volume-backup restart: always - image: ghcr.io/chatton/docker-volume-backup:v0.3.0 - command: - - periodic-backups - - --cron - - "0 3 * * *" - - --host-path - - /mnt/mergerfs/backups/ - - --retention-days - - "7" - - --modes - - "filesystem,s3" + image: {{dockervolumebackup.image}}:{{dockervolumebackup.tag}} + command: periodic-backups environment: AWS_ACCESS_KEY_ID: {{ docker_volume_backup.aws_access_key_id }} AWS_SECRET_ACCESS_KEY: {{ docker_volume_backup.aws_secret_access_key }} @@ -27,3 +18,4 @@ services: - /var/run/docker.sock:/var/run/docker.sock - {{qnap.backups_dir}}:/backups - /tmp:/tmp + - {{dockervolumebackup.config_directory}}/config.yml:{{dockervolumebackup.config_directory}}/config.yml diff --git a/roles/setup_hosted_services/templates/docker-volume-backup/config.j2 b/roles/setup_hosted_services/templates/docker-volume-backup/config.j2 index 7ce7bc0..f02784e 100644 --- a/roles/setup_hosted_services/templates/docker-volume-backup/config.j2 +++ b/roles/setup_hosted_services/templates/docker-volume-backup/config.j2 @@ -2,31 +2,33 @@ periodic_backups: - name: "Nightly Volume Backups" schedule: "0 3 * * *" + schedule_key: {{ backups.schedule_keys.nightly }} backups: - name: "Nightly backup to local filesystem" type: "filesystem" - host_path: {{ qnap.backups_dir }} - schedule_key: {{ backups.schedule_keys.nightly }} + filesystem_options: + host_path: {{ qnap.backups_dir }} - name: "Backup to iDrive E2" type: "s3" - schedule_key: {{ backups.schedule_keys.nightly }} - s3_credentials: + s3_options: + host_path: {{ qnap.backups_dir }} aws_access_key_id: {{ docker_volume_backup.aws_access_key_id }} aws_secret_access_key: {{ docker_volume_backup.aws_secret_access_key }} aws_default_region: {{ docker_volume_backup.aws_default_region }} aws_bucket: {{ docker_volume_backup.aws_bucket }} aws_endpoint: {{ docker_volume_backup.aws_endpoint }} - name: "Monthly Volume Backups" - schedule: "0 3 * * *" + schedule: "0 0 1 * *" + schedule_key: {{ backups.schedule_keys.monthly }} backups: - name: "Monthly backup to local filesystem" type: "filesystem" - host_path: {{ qnap.backups_dir }} - schedule_key: {{ backups.schedule_keys.monthly }} + filesystem_options: + host_path: {{ qnap.backups_dir }} - name: "Backup to iDrive E2" type: "s3" - schedule_key: {{ backups.schedule_keys.monthly }} - s3_credentials: + s3_options: + host_path: {{ qnap.backups_dir }} aws_access_key_id: {{ docker_volume_backup.aws_access_key_id }} aws_secret_access_key: {{ docker_volume_backup.aws_secret_access_key }} aws_default_region: {{ docker_volume_backup.aws_default_region }} diff --git a/roles/setup_hosted_services/templates/gitea.j2 b/roles/setup_hosted_services/templates/gitea.j2 index 29868d7..b56a98c 100644 --- a/roles/setup_hosted_services/templates/gitea.j2 +++ b/roles/setup_hosted_services/templates/gitea.j2 @@ -5,6 +5,7 @@ services: gitea: labels: ie.cianhatton.backup.enabled: "true" + ie.cianhatton.backup.key: "{{backups.schedule_keys.nightly}}" image: gitea/gitea:1.16.9 container_name: gitea environment: diff --git a/roles/setup_hosted_services/templates/linkding.j2 b/roles/setup_hosted_services/templates/linkding.j2 index 67bc0e4..bda2c92 100644 --- a/roles/setup_hosted_services/templates/linkding.j2 +++ b/roles/setup_hosted_services/templates/linkding.j2 @@ -4,6 +4,7 @@ services: linkding: labels: ie.cianhatton.backup.enabled: "true" + ie.cianhatton.backup.key: "{{backups.schedule_keys.nightly}}" container_name: "linkding" image: sissbruecker/linkding:latest ports: diff --git a/roles/setup_hosted_services/templates/mariadb.j2 b/roles/setup_hosted_services/templates/mariadb.j2 index 1d72ec1..9f60fa4 100644 --- a/roles/setup_hosted_services/templates/mariadb.j2 +++ b/roles/setup_hosted_services/templates/mariadb.j2 @@ -4,6 +4,7 @@ services: mariadb: labels: ie.cianhatton.backup.enabled: "true" + ie.cianhatton.backup.key: "{{backups.schedule_keys.nightly}}" container_name: mariadb image: mariadb hostname: mariadb diff --git a/roles/setup_hosted_services/templates/mealie.j2 b/roles/setup_hosted_services/templates/mealie.j2 index aaa2ded..64a52cb 100644 --- a/roles/setup_hosted_services/templates/mealie.j2 +++ b/roles/setup_hosted_services/templates/mealie.j2 @@ -4,6 +4,7 @@ services: mealie: labels: ie.cianhatton.backup.enabled: "true" + ie.cianhatton.backup.key: "{{backups.schedule_keys.nightly}}" container_name: mealie image: hkotel/mealie:latest restart: unless-stopped diff --git a/roles/setup_hosted_services/templates/nextcloud.j2 b/roles/setup_hosted_services/templates/nextcloud.j2 index 1f1153a..af97104 100644 --- a/roles/setup_hosted_services/templates/nextcloud.j2 +++ b/roles/setup_hosted_services/templates/nextcloud.j2 @@ -4,6 +4,7 @@ services: nextcloud: labels: ie.cianhatton.backup.enabled: "true" + ie.cianhatton.backup.key: "{{backups.schedule_keys.nightly}}" image: nextcloud container_name: nextcloud restart: unless-stopped diff --git a/roles/setup_hosted_services/templates/nginx-proxy-manager.j2 b/roles/setup_hosted_services/templates/nginx-proxy-manager.j2 index fe358f4..5bdfc3a 100644 --- a/roles/setup_hosted_services/templates/nginx-proxy-manager.j2 +++ b/roles/setup_hosted_services/templates/nginx-proxy-manager.j2 @@ -4,6 +4,7 @@ services: nginx-proxy-manager: labels: ie.cianhatton.backup.enabled: "true" + ie.cianhatton.backup.key: "{{backups.schedule_keys.nightly}}" image: jlesage/nginx-proxy-manager container_name: nginx-proxy-manager restart: unless-stopped diff --git a/roles/setup_hosted_services/templates/overseerr.j2 b/roles/setup_hosted_services/templates/overseerr.j2 index 7556377..768d10f 100644 --- a/roles/setup_hosted_services/templates/overseerr.j2 +++ b/roles/setup_hosted_services/templates/overseerr.j2 @@ -4,6 +4,7 @@ services: overseerr: labels: ie.cianhatton.backup.enabled: "true" + ie.cianhatton.backup.key: "{{backups.schedule_keys.nightly}}" image: sctx/overseerr:latest container_name: overseerr ports: diff --git a/roles/setup_hosted_services/templates/plex.j2 b/roles/setup_hosted_services/templates/plex.j2 index 60a75c2..60bcb1f 100644 --- a/roles/setup_hosted_services/templates/plex.j2 +++ b/roles/setup_hosted_services/templates/plex.j2 @@ -4,6 +4,7 @@ services: plex: labels: ie.cianhatton.backup.enabled: "true" + ie.cianhatton.backup.key: "{{backups.schedule_keys.monthly}}" image: lscr.io/linuxserver/plex:latest container_name: plex ports: diff --git a/roles/setup_hosted_services/templates/uptime-kuma.j2 b/roles/setup_hosted_services/templates/uptime-kuma.j2 index c73b3e5..c1cc3e9 100644 --- a/roles/setup_hosted_services/templates/uptime-kuma.j2 +++ b/roles/setup_hosted_services/templates/uptime-kuma.j2 @@ -4,6 +4,7 @@ services: uptime-kuma: labels: ie.cianhatton.backup.enabled: "true" + ie.cianhatton.backup.key: "{{backups.schedule_keys.nightly}}" image: louislam/uptime-kuma:1 container_name: uptime-kuma volumes: diff --git a/roles/setup_hosted_services/templates/vpn-stack.j2 b/roles/setup_hosted_services/templates/vpn-stack.j2 index 90aad9c..addb373 100644 --- a/roles/setup_hosted_services/templates/vpn-stack.j2 +++ b/roles/setup_hosted_services/templates/vpn-stack.j2 @@ -34,6 +34,7 @@ services: qbittorrent: labels: ie.cianhatton.backup.enabled: "true" + ie.cianhatton.backup.key: "{{backups.schedule_keys.nightly}}" depends_on: - surfshark @@ -53,6 +54,7 @@ services: radarr: labels: ie.cianhatton.backup.enabled: "true" + ie.cianhatton.backup.key: "{{backups.schedule_keys.nightly}}" depends_on: - surfshark image: lscr.io/linuxserver/radarr:latest @@ -74,6 +76,7 @@ services: image: lscr.io/linuxserver/sonarr:latest labels: ie.cianhatton.backup.enabled: "true" + ie.cianhatton.backup.key: "{{backups.schedule_keys.nightly}}" container_name: sonarr network_mode: service:surfshark environment: @@ -89,6 +92,7 @@ services: jackett: labels: ie.cianhatton.backup.enabled: "true" + ie.cianhatton.backup.key: "{{backups.schedule_keys.nightly}}" depends_on: - surfshark image: lscr.io/linuxserver/jackett:latest