homelab-nomad/services/backups/jobs/consul.hcl

34 lines
607 B
HCL
Raw Normal View History

2022-11-04 16:39:08 +00:00
job "consul" {
2022-07-28 05:04:22 +00:00
schedule = "0 * * * *"
2022-07-22 03:24:50 +00:00
config {
2022-07-28 05:04:22 +00:00
repo = "rclone::ftp,env_auth:/nomad/consul"
2022-07-22 03:24:50 +00:00
passphrase = env("BACKUP_PASSPHRASE")
}
task "Use consul snapshots" {
pre_script {
on_backup = "mkdir -p /local/consul"
}
pre_script {
on_backup = "consul snapshot save /local/consul/backup.snap"
}
post_script {
on_restore = "consul snapshot restore /local/consul/backup.snap"
}
}
backup {
paths = ["/local/consul"]
# Because path is absolute
restore_opts {
Target = "/"
}
}
forget {
KeepLast = 2
Prune = true
}
}