version: "3.3"

services:
  backup:
    image: mazzolino/restic
    container_name: restic
    hostname: null_machine
    environment:
      RUN_ON_STARTUP: "true"
      BACKUP_CRON: "0 */12 * * *"
      RESTIC_REPOSITORY: /restic
      RESTIC_PASSWORD: hQ94gkU8DY6BomsUh8LMGHMSRPUNn9dmNJwxnZgW5dkoFZkMZ
      RESTIC_BACKUP_SOURCES: /mnt/volumes
      RESTIC_COMPRESSION: auto 
      RESTIC_BACKUP_ARGS: >-
        --tag restic-null-machine 
        --verbose
      RESTIC_FORGET_ARGS: >- 
        --keep-last 3
        --keep-daily 1
        --keep-weekly 2
        --keep-monthly 1
      TZ: Europe/Copenhagen
    volumes:
      - where_to_backup:/restic 
      - where_to_restore:/tmp-for-restore
      - /srv/madplan:/mnt/volumes/madplan:ro
      - /srv/bazarr:/mnt/volumes/bazarr:ro
      - /srv/gitea:/mnt/volumes/gitea:ro
      - /srv/gitea_runner:/mnt/volumes/gitea_runner:ro
      - /srv/mastodon:/mnt/volumes/mastodon:ro
      - /srv/plex:/mnt/volumes/plex:ro
      - /srv/pseudotv:/mnt/volumes/pseudotv:ro
      - /srv/znc:/mnt/volumes/znc:ro
      - /srv/bitbot:/mnt/volumes/bitbot:ro
      - /srv/syncthing:/mnt/volumes/syncthing:ro

    security_opt:
      - no-new-privileges:true

  prune:
    image: mazzolino/restic
    container_name: restic-prune
    hostname: null_machine
    environment:
      RUN_ON_STARTUP: "true"
      PRUNE_CRON: "0 0 4 * * *"
      RESTIC_REPOSITORY: /restic
      RESTIC_PASSWORD: hQ94gkU8DY6BomsUh8LMGHMSRPUNn9dmNJwxnZgW5dkoFZkMZ
      TZ: Europe/Copenhagen
    security_opt:
      - no-new-privileges:true

  check:
    image: mazzolino/restic
    container_name: restic-check
    hostname: null_machine
    environment:
      RUN_ON_STARTUP: "true"
      CHECK_CRON: "0 15 5 * * *"
      RESTIC_CHECK_ARGS: >-
        --read-data-subset=10%
      RESTIC_REPOSITORY: /restic
      RESTIC_PASSWORD: hQ94gkU8DY6BomsUh8LMGHMSRPUNn9dmNJwxnZgW5dkoFZkMZ
      TZ: Europe/Copenhagen
    security_opt:
      - no-new-privileges:true


volumes:
  where_to_backup:
    driver: local
    driver_opts:
      type: none
      device: /home/null/shares/disk2/backup/restic_backup
      o: bind
  where_to_restore:
    driver: local
    driver_opts:
      type: none
      device: /home/null/shares/disk2/backup/restic_restore
      o: bind