Migrate postgres

This commit is contained in:
Quentin 2020-12-25 12:16:18 +01:00
parent 4f23adfbb9
commit 48db0185a4

View file

@ -9,6 +9,11 @@ job "postgres" {
} }
group "postgres" { group "postgres" {
network {
port "psql_proxy_port" { static = 5432 }
port "psql_port" { static = 5433 }
}
task "sentinel" { task "sentinel" {
driver = "docker" driver = "docker"
@ -40,21 +45,14 @@ job "postgres" {
"--cluster-name", "pissenlit", "--cluster-name", "pissenlit",
"--store-backend", "consul", "--store-backend", "consul",
"--store-endpoints", "http://consul.service.2.cluster.deuxfleurs.fr:8500", "--store-endpoints", "http://consul.service.2.cluster.deuxfleurs.fr:8500",
"--port", "5432", "--port", "${NOMAD_PORT_psql_proxy_port}",
"--listen-address", "0.0.0.0" "--listen-address", "0.0.0.0"
] ]
port_map { ports = [ "psql_proxy_port" ]
psql_proxy_port = 5432
}
} }
resources { resources {
memory = 100 memory = 100
network {
port "psql_proxy_port" {
static = 5432
}
}
} }
service { service {
@ -93,34 +91,23 @@ job "postgres" {
"--pg-repl-username", "${PG_REPL_USER}", "--pg-repl-username", "${PG_REPL_USER}",
"--pg-repl-password", "${PG_REPL_PWD}", "--pg-repl-password", "${PG_REPL_PWD}",
"--pg-listen-address", "${attr.unique.network.ip-address}", "--pg-listen-address", "${attr.unique.network.ip-address}",
"--pg-port", "5433", "--pg-port", "${NOMAD_PORT_psql_port}",
"--pg-bin-path", "/usr/lib/postgresql/9.6/bin/" "--pg-bin-path", "/usr/lib/postgresql/9.6/bin/"
] ]
port_map { ports = [ "psql_port" ]
psql_port = 5433
}
volumes = [ volumes = [
"/mnt/ssd/postgres:/mnt/persist" "/mnt/ssd/postgres:/mnt/persist"
] ]
} }
artifact {
source = "http://127.0.0.1:8500/v1/kv/configuration/postgres/keeper/env.tpl?raw"
destination = "secrets/env.tpl"
mode = "file"
}
template { template {
source = "secrets/env.tpl" data = file("../config/configuration/postgres/keeper/env.tpl")
destination = "secrets/env" destination = "secrets/env"
env = true env = true
} }
resources { resources {
memory = 500 memory = 500
network {
port "psql_port" {
static = "5433"
}
}
} }
service { service {