From 0d208b73945fccad5f0c01d191a95c6860458b6e Mon Sep 17 00:00:00 2001 From: Ian Fijolek Date: Thu, 16 Nov 2023 12:18:01 -0800 Subject: [PATCH] Add dummy backup job to keep backup task running on all hosts Otherwise, if a client is not running any stateful services, the task will fail and Nomad will eventually stop retrying. If a service gets relocated to the host, the task is not restarted. This makes sure the task will cover moved services and make it more easy to determine that backups are healthy. --- backups/backup.nomad | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/backups/backup.nomad b/backups/backup.nomad index c8f87d1..ac178c5 100644 --- a/backups/backup.nomad +++ b/backups/backup.nomad @@ -136,6 +136,24 @@ ${file("${module_path}/${job_file}")} {{ end -}} {{ end -}} %{ endfor ~} + +# Dummy job to keep task healthy on node without any stateful services +job "Dummy" { + schedule = "0 0 1 1 0" + + config { + repo = "/local/dummy-repo" + passphrase = env("BACKUP_PASSPHRASE") + } + + backup { + paths = ["/local/node-jobs.hcl"] + } + + forget { + KeepLast = 1 + } +} EOF destination = "local/node-jobs.hcl" }