From 3e0533954f94996882c304081b1bd4f65f56643a Mon Sep 17 00:00:00 2001 From: Ian Fijolek Date: Thu, 3 Aug 2023 10:36:42 -0700 Subject: [PATCH] Add authelia backup job --- services/backups/jobs/authelia.hcl | 50 ++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 services/backups/jobs/authelia.hcl diff --git a/services/backups/jobs/authelia.hcl b/services/backups/jobs/authelia.hcl new file mode 100644 index 0000000..ad4647c --- /dev/null +++ b/services/backups/jobs/authelia.hcl @@ -0,0 +1,50 @@ +job "authelia" { + schedule = "@daily" + + config { + repo = "rclone::ftp,env_auth:/nomad/authelia" + passphrase = env("BACKUP_PASSPHRASE") + } + + task "Create local authelia dir" { + pre_script { + on_backup = "mkdir -p /local/authelia" + } + } + + task "Backup database" { + mysql "Backup database" { + hostname = env("MYSQL_HOST") + port = env("MYSQL_PORT") + database = "authelia" + username = env("MYSQL_USER") + password = env("MYSQL_PASSWORD") + no_tablespaces = true + dump_to = "/local/authelia/dump.sql" + } + } + + backup { + paths = ["/local/authelia"] + + backup_opts { + Host = "nomad" + } + + restore_opts { + Host = ["nomad"] + # Because path is absolute + Target = "/" + } + } + + forget { + KeepLast = 2 + KeepHourly = 24 + KeepDaily = 30 + KeepWeekly = 8 + KeepMonthly = 6 + KeepYearly = 2 + Prune = true + } +}