From 72f9319138edb97373d7b2df5b3c41e6d1beb3c8 Mon Sep 17 00:00:00 2001 From: Petru Paler Date: Mon, 15 Jan 2024 13:05:53 +0000 Subject: [PATCH] Postgres backup cronjob. --- services/postgres-backup.hcl | 37 ++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 services/postgres-backup.hcl diff --git a/services/postgres-backup.hcl b/services/postgres-backup.hcl new file mode 100644 index 0000000..abc8507 --- /dev/null +++ b/services/postgres-backup.hcl @@ -0,0 +1,37 @@ +job "postgres-backup" { + datacenters = ["alo"] + type = "batch" + + periodic { + cron = "22 22 * * * *" + prohibit_overlap = true + } + + group "db" { + task "backup" { + driver = "raw_exec" + + config { + command = "/bin/sh" + args = [ "local/script.sh" ] + } + + template { + destination = "local/script.sh" + data = < /data/compute/appdata/db-backups/postgresql/backup.sql + EOH + } + + template { + destination = "secrets/file.env" + env = true + data = <