job "backup_daily" { datacenters = ["dc1"] type = "batch" priority = "60" periodic { cron = "@daily" // Do not allow overlapping runs. prohibit_overlap = true } group "backup-dovecot" { constraint { attribute = "${attr.unique.hostname}" operator = "=" value = "digitale" } task "main" { driver = "docker" config { image = "restic/restic:0.12.1" entrypoint = [ "/bin/sh", "-c" ] args = [ "restic backup /mail && restic forget --keep-within 1m1d --keep-within-weekly 3m --keep-within-monthly 1y && restic prune --max-unused 50% --max-repack-size 2G && restic check" ] volumes = [ "/mnt/ssd/mail:/mail" ] } template { data = < $NOMAD_ALLOC_DIR/consul.json" ] } env { CONSUL_HTTP_ADDR = "http://consul.service.2.cluster.deuxfleurs.fr:8500" } resources { cpu = 200 memory = 200 } restart { attempts = 2 interval = "30m" delay = "15s" mode = "fail" } } task "restic-backup" { driver = "docker" config { image = "restic/restic:0.12.1" entrypoint = [ "/bin/sh", "-c" ] args = [ "restic backup $NOMAD_ALLOC_DIR/consul.json && restic forget --keep-within 1m1d --keep-within-weekly 3m --keep-within-monthly 1y && restic prune --max-unused 50% --max-repack-size 2G && restic check" ] } template { data = <