postgres/upgrade.nomad.hcl

52 lines
1.1 KiB
HCL
Raw Normal View History

2023-11-30 21:23:11 +01:00
[[ $c := merge .pg.upgrade . -]]
2023-12-21 23:15:47 +01:00
job "[[ .instance ]]-upgrade" {
2023-11-30 21:23:11 +01:00
[[ template "common/job_start.tpl" $c ]]
type = "batch"
meta {
# Force job to be different for each execution
run_uuid = "${uuidv4()}"
}
group "upgrade" {
volume "data" {
type = [[ .pg.volumes.data.type | toJSON ]]
source = [[ .pg.volumes.data.source | toJSON ]]
[[- if ne .pg.volumes.data.type "host" ]]
access_mode = "single-node-writer"
attachment_mode = "file-system"
[[- end ]]
per_alloc = true
}
2023-12-21 23:15:47 +01:00
task "[[ .instance ]]-upgrade" {
2023-11-30 21:23:11 +01:00
driver = [[ $c.nomad.driver | toJSON ]]
config {
image = [[ $c.image | toJSON ]]
readonly_rootfs = true
}
env {
PG_FROM = [[ $c.from | toJSON ]]
PG_TO = [[ $c.to | toJSON ]]
PG_DO_UPGRADE = [[ $c.do_upgrade | toJSON ]]
}
[[ template "common/file_env.tpl" $c ]]
2023-11-30 21:23:11 +01:00
volume_mount {
volume = "data"
destination = "/data"
}
[[ template "common/resources.tpl" $c.resources ]]
}
}
}