job "pgbackup" { type = "batch" periodic { # Note: To avoid issues with daylight savings, avoid scheduling jobs at 2am +/- 1 hour cron = "* 04 * * *" # Every day at 4am time_zone = "Australia/Melbourne" prohibit_overlap = true } group "pgbackup" { service { connect { sidecar_service { proxy { upstreams { destination_name = "postgres" local_bind_port = 5432 } } } } } task "pgbackup" { driver = "docker" config { image = "postgres:latest" command = "/bin/bash" args = ["-c", "pg_dumpall -h localhost -U postgres > /backup/all_databases.sql"] volumes = ["secrets/postgres_password:/run/secrets/postgres_password"] } user = "1000" volume_mount { volume = "unraid_database_dump" destination = "/backup" read_only = false } env { PGPASSFILE = "/run/secrets/postgres_password" } template { data = <