diff --git a/app/cryptpad/deploy/backup.hcl b/app/cryptpad/deploy/backup.hcl new file mode 100644 index 0000000..99dee2f --- /dev/null +++ b/app/cryptpad/deploy/backup.hcl @@ -0,0 +1,57 @@ +job "cryptpad_backup" { + datacenters = ["neptune"] + type = "batch" + + priority = "60" + + periodic { + cron = "@daily" + // Do not allow overlapping runs. + prohibit_overlap = true + } + + group "backup-cryptpad" { + constraint { + attribute = "${attr.unique.hostname}" + operator = "=" + value = "courgette" + } + + task "main" { + driver = "docker" + + config { + image = "restic/restic:0.12.1" + entrypoint = [ "/bin/sh", "-c" ] + args = [ "restic backup /cryptpad && 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/storage/cryptpad:/cryptpad" + ] + } + + template { + data = < {} +}: + +with pkgs; mkShell { + nativeBuildInputs = [ + nomad + docker-compose + python39Packages.pip + python39Packages.ldap + python39Packages.consul + python39Packages.passlib + ]; +} +