aboutsummaryrefslogtreecommitdiff
path: root/app/backup/deploy/backup-weekly.hcl
diff options
context:
space:
mode:
authorQuentin Dufour <quentin@deuxfleurs.fr>2022-04-15 14:24:41 +0200
committerQuentin Dufour <quentin@deuxfleurs.fr>2022-04-15 14:24:41 +0200
commit83745f737ab5143f7204c2b84425c727266a0d84 (patch)
tree0161ed04562e5c347c5dbe400dbd6d53115254b3 /app/backup/deploy/backup-weekly.hcl
parent8cf1b0c3e44f481abd7e07d0e793bd444a81fe52 (diff)
downloadinfrastructure-83745f737ab5143f7204c2b84425c727266a0d84.tar.gz
infrastructure-83745f737ab5143f7204c2b84425c727266a0d84.zip
Deployment on Nomad
Diffstat (limited to 'app/backup/deploy/backup-weekly.hcl')
-rw-r--r--app/backup/deploy/backup-weekly.hcl55
1 files changed, 55 insertions, 0 deletions
diff --git a/app/backup/deploy/backup-weekly.hcl b/app/backup/deploy/backup-weekly.hcl
new file mode 100644
index 0000000..9c1a0b0
--- /dev/null
+++ b/app/backup/deploy/backup-weekly.hcl
@@ -0,0 +1,55 @@
+job "backup_weekly" {
+ datacenters = ["dc1"]
+ type = "batch"
+
+ priority = "60"
+
+ periodic {
+ cron = "@weekly"
+ // Do not allow overlapping runs.
+ prohibit_overlap = true
+ }
+
+ group "backup-psql" {
+ task "main" {
+ driver = "docker"
+
+ config {
+ image = "superboum/backup-psql-docker:kldrj9xlbda1s4v963jhpgardg6qczgl"
+ volumes = [
+ // Mount a cache on the hard disk to avoid filling the SSD
+ "/mnt/storage/tmp_bckp_psql:/mnt/cache"
+ ]
+ }
+
+ template {
+ data = <<EOH
+CACHE_DIR=/mnt/cache
+AWS_BUCKET=backups-pgbasebackup
+AWS_ENDPOINT=s3.deuxfleurs.shirokumo.net
+AWS_ACCESS_KEY_ID={{ key "secrets/backup/psql/aws_access_key_id" }}
+AWS_SECRET_ACCESS_KEY={{ key "secrets/backup/psql/aws_secret_access_key" }}
+CRYPT_PUBLIC_KEY={{ key "secrets/backup/psql/crypt_public_key" }}
+PSQL_HOST=psql-proxy.service.2.cluster.deuxfleurs.fr
+PSQL_USER={{ key "secrets/postgres/keeper/pg_repl_username" }}
+PGPASSWORD={{ key "secrets/postgres/keeper/pg_repl_pwd" }}
+EOH
+
+ destination = "secrets/env_vars"
+ env = true
+ }
+
+ resources {
+ cpu = 200
+ memory = 200
+ }
+
+ restart {
+ attempts = 2
+ interval = "30m"
+ delay = "15s"
+ mode = "fail"
+ }
+ }
+ }
+}