postgres/example/postgres-upgrade.nomad.hcl

75 lines
1.5 KiB
HCL

job "postgres-upgrade" {
datacenters = ["dc1"]
region = "global"
priority = 80
type = "batch"
meta {
# Force job to be different for each execution
run_uuid = "${uuidv4()}"
}
# Postgres upgrader not explicitely enabled
# Add a constraint to ensure it can't run
constraint {
attribute = "${attr.kernel.name}"
value = "nonexistant"
}
group "upgrade" {
volume "backup" {
source = "postgres-backup"
type = "csi"
access_mode = "multi-node-multi-writer"
attachment_mode = "file-system"
}
volume "data" {
source = "postgres-data"
type = "csi"
access_mode = "single-node-writer"
attachment_mode = "file-system"
per_alloc = true
}
network {
mode = "bridge"
}
task "upgrade" {
driver = "docker"
config {
image = "danielberteaud/postgres-major-upgrade:latest"
force_pull = true
readonly_rootfs = true
}
env {
PG_FROM = ""
PG_TO = ""
PG_INITDB_OPTS = "--data-checksum --encoding UTF-8 "
PG_UPGRADE_OPTS = "--new-options=-c --new-options=shared_preload_libraries=vectors.so --clone "
DO_PG_UPGRADE = "false"
}
volume_mount {
volume = "data"
destination = "/data"
}
resources {
cpu = 1000
memory = 1024
}
}
}
}