diff --git a/services/postgres.hcl b/services/postgres.hcl index d6d29b9..14f5058 100644 --- a/services/postgres.hcl +++ b/services/postgres.hcl @@ -10,6 +10,7 @@ job "postgres" { to = 9187 } port "admin" { } + port "backup_healthckeck" { } } task "postgres" { @@ -105,6 +106,25 @@ EOH ] } } + + task "backup" { + driver = "docker" + + config { + image = "prodrigestivill/postgres-backup-local" + ports = [ "backup_healthckeck" ] + volumes = [ "/data/compute/appdata/pgbackup:/backups" ] + } + + env { + POSTGRES_DB = "${NOMAD_HOST_db}" + POSTGRES_USER = "postgres" + POSTGRES_PASSWORD = "${var.default_password}" + POSTGRES_CLUSTER = "TRUE" + POSTGRES_EXTRA_OPTS = "" + HEALTHCHECK_PORT = "${NOMAD_PORT_backup_healthckeck}" + } + } } }