2020-07-05 21:15:05 +00:00
|
|
|
job "postgres" {
|
2019-06-01 14:02:49 +00:00
|
|
|
datacenters = ["dc1"]
|
|
|
|
type = "system"
|
2020-07-05 21:15:05 +00:00
|
|
|
priority = 90
|
2019-06-01 14:02:49 +00:00
|
|
|
|
2019-07-11 20:29:35 +00:00
|
|
|
update {
|
2021-03-07 16:07:35 +00:00
|
|
|
max_parallel = 1
|
|
|
|
health_check = "checks"
|
|
|
|
min_healthy_time = "2m"
|
|
|
|
healthy_deadline = "5m"
|
|
|
|
progress_deadline = "10m"
|
|
|
|
auto_revert = true
|
2019-07-11 20:29:35 +00:00
|
|
|
}
|
|
|
|
|
2019-06-01 14:02:49 +00:00
|
|
|
group "postgres" {
|
2020-12-25 11:16:18 +00:00
|
|
|
network {
|
|
|
|
port "psql_proxy_port" { static = 5432 }
|
|
|
|
port "psql_port" { static = 5433 }
|
|
|
|
}
|
|
|
|
|
2019-06-01 14:02:49 +00:00
|
|
|
task "sentinel" {
|
|
|
|
driver = "docker"
|
|
|
|
|
|
|
|
config {
|
2021-03-07 16:07:35 +00:00
|
|
|
image = "superboum/amd64_postgres:v4"
|
2020-10-27 22:25:30 +00:00
|
|
|
network_mode = "host"
|
2019-06-01 14:02:49 +00:00
|
|
|
readonly_rootfs = false
|
|
|
|
command = "/usr/local/bin/stolon-sentinel"
|
|
|
|
args = [
|
|
|
|
"--cluster-name", "pissenlit",
|
|
|
|
"--store-backend", "consul",
|
|
|
|
"--store-endpoints", "http://consul.service.2.cluster.deuxfleurs.fr:8500",
|
|
|
|
]
|
|
|
|
}
|
|
|
|
resources {
|
|
|
|
memory = 100
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
task "proxy" {
|
|
|
|
driver = "docker"
|
|
|
|
|
|
|
|
config {
|
2021-03-07 16:07:35 +00:00
|
|
|
image = "superboum/amd64_postgres:v4"
|
2020-10-27 22:25:30 +00:00
|
|
|
network_mode = "host"
|
2019-06-01 14:02:49 +00:00
|
|
|
readonly_rootfs = false
|
|
|
|
command = "/usr/local/bin/stolon-proxy"
|
|
|
|
args = [
|
|
|
|
"--cluster-name", "pissenlit",
|
|
|
|
"--store-backend", "consul",
|
|
|
|
"--store-endpoints", "http://consul.service.2.cluster.deuxfleurs.fr:8500",
|
2020-12-25 11:16:18 +00:00
|
|
|
"--port", "${NOMAD_PORT_psql_proxy_port}",
|
2021-03-07 10:43:46 +00:00
|
|
|
"--listen-address", "0.0.0.0",
|
2021-03-07 16:07:35 +00:00
|
|
|
"--stop-listening", "false",
|
|
|
|
"--store-timeout", "120s"
|
2019-06-01 14:02:49 +00:00
|
|
|
]
|
2020-12-25 11:16:18 +00:00
|
|
|
ports = [ "psql_proxy_port" ]
|
2019-06-01 14:02:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
resources {
|
|
|
|
memory = 100
|
|
|
|
}
|
|
|
|
|
|
|
|
service {
|
|
|
|
tags = ["sql"]
|
|
|
|
port = "psql_proxy_port"
|
|
|
|
address_mode = "host"
|
|
|
|
name = "psql-proxy"
|
|
|
|
check {
|
|
|
|
type = "tcp"
|
|
|
|
port = "psql_proxy_port"
|
|
|
|
interval = "60s"
|
|
|
|
timeout = "5s"
|
|
|
|
check_restart {
|
|
|
|
limit = 3
|
|
|
|
grace = "10m"
|
|
|
|
ignore_warnings = false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
task "keeper" {
|
|
|
|
driver = "docker"
|
|
|
|
|
|
|
|
config {
|
2021-03-07 16:07:35 +00:00
|
|
|
image = "superboum/amd64_postgres:v4"
|
2020-10-27 22:25:30 +00:00
|
|
|
network_mode = "host"
|
2019-06-01 14:02:49 +00:00
|
|
|
readonly_rootfs = false
|
|
|
|
command = "/usr/local/bin/stolon-keeper"
|
|
|
|
args = [
|
|
|
|
"--cluster-name", "pissenlit",
|
|
|
|
"--store-backend", "consul",
|
|
|
|
"--store-endpoints", "http://consul.service.2.cluster.deuxfleurs.fr:8500",
|
|
|
|
"--data-dir", "/mnt/persist",
|
|
|
|
"--pg-su-password", "${PG_SU_PWD}",
|
|
|
|
"--pg-repl-username", "${PG_REPL_USER}",
|
|
|
|
"--pg-repl-password", "${PG_REPL_PWD}",
|
|
|
|
"--pg-listen-address", "${attr.unique.network.ip-address}",
|
2020-12-25 11:16:18 +00:00
|
|
|
"--pg-port", "${NOMAD_PORT_psql_port}",
|
2019-06-01 14:02:49 +00:00
|
|
|
"--pg-bin-path", "/usr/lib/postgresql/9.6/bin/"
|
|
|
|
]
|
2020-12-25 11:16:18 +00:00
|
|
|
ports = [ "psql_port" ]
|
2019-06-01 14:02:49 +00:00
|
|
|
volumes = [
|
|
|
|
"/mnt/ssd/postgres:/mnt/persist"
|
|
|
|
]
|
|
|
|
}
|
2020-12-25 11:16:18 +00:00
|
|
|
|
2019-06-01 14:02:49 +00:00
|
|
|
template {
|
2021-01-16 16:07:01 +00:00
|
|
|
data = file("../config/keeper/env.tpl")
|
2019-06-01 14:02:49 +00:00
|
|
|
destination = "secrets/env"
|
|
|
|
env = true
|
|
|
|
}
|
|
|
|
|
|
|
|
resources {
|
|
|
|
memory = 500
|
|
|
|
}
|
|
|
|
|
|
|
|
service {
|
|
|
|
tags = ["sql"]
|
|
|
|
port = "psql_port"
|
|
|
|
address_mode = "host"
|
2021-02-24 13:54:18 +00:00
|
|
|
name = "psql-keeper"
|
2019-06-01 14:02:49 +00:00
|
|
|
check {
|
|
|
|
type = "tcp"
|
|
|
|
port = "psql_port"
|
|
|
|
interval = "60s"
|
|
|
|
timeout = "5s"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|