From e2a0c40e6bf3919e6cef6ed1789251b30367dc11 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Sun, 15 Nov 2020 19:27:57 +0100 Subject: Script to backup Consul KV store --- app/deployment/backup.hcl | 67 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 app/deployment/backup.hcl (limited to 'app/deployment') diff --git a/app/deployment/backup.hcl b/app/deployment/backup.hcl new file mode 100644 index 0000000..8b5162c --- /dev/null +++ b/app/deployment/backup.hcl @@ -0,0 +1,67 @@ +job "backup_periodic" { + datacenters = ["dc1"] + + type = "batch" + + periodic { + // Launch every hour + cron = "0 * * * * *" + + // Do not allow overlapping runs. + prohibit_overlap = true + } + + task "backup-consul" { + driver = "docker" + + config { + image = "lxpz/backup_consul:9" + volumes = [ + "secrets/id_ed25519:/root/.ssh/id_ed25519", + "secrets/id_ed25519.pub:/root/.ssh/id_ed25519.pub", + "secrets/known_hosts:/root/.ssh/known_hosts" + ] + network_mode = "host" + } + + env { + CONSUL_HTTP_ADDR = "http://consul.service.2.cluster.deuxfleurs.fr:8500" + } + + template { + data = <