Add push gateway and tasks for running backups on system backup jobs

This commit is contained in:
IamTheFij 2024-12-17 16:05:48 -08:00
parent ae6fe918ef
commit b6605aa8bc

View File

@ -74,14 +74,14 @@ job "backup%{ if batch_node != null }-oneoff-${batch_node}%{ endif }" {
image = "iamthefij/restic-scheduler:0.4.2" image = "iamthefij/restic-scheduler:0.4.2"
ports = ["metrics"] ports = ["metrics"]
args = [ args = [
"--push-gateway",
"http://pushgateway.nomad:9091",
%{ if batch_node != null ~} %{ if batch_node != null ~}
"-once", "-once",
"-$${NOMAD_META_task}", "-$${NOMAD_META_task}",
"$${NOMAD_META_job_name}", "$${NOMAD_META_job_name}",
"--snapshot", "--snapshot",
"$${NOMAD_META_snapshot}", "$${NOMAD_META_snapshot}",
"--push-gateway",
"http://pushgateway.nomad:9091",
%{ endif ~} %{ endif ~}
"$${NOMAD_TASK_DIR}/node-jobs.hcl", "$${NOMAD_TASK_DIR}/node-jobs.hcl",
] ]
@ -89,19 +89,29 @@ job "backup%{ if batch_node != null }-oneoff-${batch_node}%{ endif }" {
action "unlockenv" { action "unlockenv" {
command = "sh" 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" { action "unlocktmpl" {
command = "/bin/resticscheduler" command = "/bin/restic-scheduler"
args = ["-once", "-unlock", "all", "{{ env 'NOMAD_TASK_DIR' }}/node-jobs.hcl"] args = ["-once", "-unlock", "all", "{{ env 'NOMAD_TASK_DIR' }}/node-jobs.hcl"]
} }
action "unlockhc" { action "unlockhc" {
command = "/bin/resticscheduler" command = "/bin/restic-scheduler"
args = ["-once", "-unlock", "all", "/local/node-jobs.hcl"] 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 = { env = {
RCLONE_CHECKERS = "2" RCLONE_CHECKERS = "2"
RCLONE_TRANSFERS = "2" RCLONE_TRANSFERS = "2"