From b6605aa8bcd93d0f5703e555e00fe6654f034214 Mon Sep 17 00:00:00 2001 From: Ian Fijolek Date: Tue, 17 Dec 2024 16:05:48 -0800 Subject: [PATCH] Add push gateway and tasks for running backups on system backup jobs --- backups/backup.nomad | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/backups/backup.nomad b/backups/backup.nomad index 8c1a133..1bb3ec0 100644 --- a/backups/backup.nomad +++ b/backups/backup.nomad @@ -74,14 +74,14 @@ job "backup%{ if batch_node != null }-oneoff-${batch_node}%{ endif }" { image = "iamthefij/restic-scheduler:0.4.2" ports = ["metrics"] args = [ + "--push-gateway", + "http://pushgateway.nomad:9091", %{ if batch_node != null ~} "-once", "-$${NOMAD_META_task}", "$${NOMAD_META_job_name}", "--snapshot", "$${NOMAD_META_snapshot}", - "--push-gateway", - "http://pushgateway.nomad:9091", %{ endif ~} "$${NOMAD_TASK_DIR}/node-jobs.hcl", ] @@ -89,19 +89,29 @@ job "backup%{ if batch_node != null }-oneoff-${batch_node}%{ endif }" { action "unlockenv" { command = "sh" - args = ["-c", "/bin/resticscheduler -once -unlock all $${NOMAD_TASK_DIR}/node-jobs.hcl"] + args = ["-c", "/bin/restic-scheduler -once -unlock all $${NOMAD_TASK_DIR}/node-jobs.hcl"] } action "unlocktmpl" { - command = "/bin/resticscheduler" + command = "/bin/restic-scheduler" args = ["-once", "-unlock", "all", "{{ env 'NOMAD_TASK_DIR' }}/node-jobs.hcl"] } action "unlockhc" { - command = "/bin/resticscheduler" + command = "/bin/restic-scheduler" args = ["-once", "-unlock", "all", "/local/node-jobs.hcl"] } + action "backupall" { + command = "/bin/restic-scheduler" + args = ["-once", "-backup", "all", "/local/node-jobs.hcl"] + } + + action "backupallenv" { + command = "sh" + args = ["-c", "/bin/restic-scheduler -once -backup all $${NOMAD_TASK_DIR}/node-jobs.hcl"] + } + env = { RCLONE_CHECKERS = "2" RCLONE_TRANSFERS = "2"