postgres/example/upgrade.nomad.hcl

71 lines
1.1 KiB
HCL

job "postgres-upgrade" {
datacenters = ["dc1"]
region = "global"
type = "batch"
meta {
# Force job to be different for each execution
run_uuid = "${uuidv4()}"
}
group "upgrade" {
volume "data" {
type = "csi"
source = "postgres-data"
access_mode = "single-node-writer"
attachment_mode = "file-system"
per_alloc = true
}
task "postgres-upgrade" {
driver = "docker"
config {
image = "danielberteaud/pg-major-upgrade:latest"
readonly_rootfs = true
}
env {
PG_FROM = ""
PG_TO = ""
PG_DO_UPGRADE = false
}
# Use a template block instead of env {} so we can fetch values from vault
template {
data = <<_EOT
LANG=fr_FR.utf8
TZ=Europe/Paris
_EOT
destination = "secrets/.env"
perms = 400
env = true
}
volume_mount {
volume = "data"
destination = "/data"
}
resources {
cpu = 1000
memory = 1024
}
}
}
}