From 48db0185a45e8682ab7dac53e836d6114c54b35e Mon Sep 17 00:00:00 2001 From: Quentin Date: Fri, 25 Dec 2020 12:16:18 +0100 Subject: [PATCH] Migrate postgres --- app/deployment/postgres.hcl | 35 +++++++++++------------------------ 1 file changed, 11 insertions(+), 24 deletions(-) diff --git a/app/deployment/postgres.hcl b/app/deployment/postgres.hcl index d178491..388c65e 100644 --- a/app/deployment/postgres.hcl +++ b/app/deployment/postgres.hcl @@ -9,6 +9,11 @@ job "postgres" { } group "postgres" { + network { + port "psql_proxy_port" { static = 5432 } + port "psql_port" { static = 5433 } + } + task "sentinel" { driver = "docker" @@ -40,21 +45,14 @@ job "postgres" { "--cluster-name", "pissenlit", "--store-backend", "consul", "--store-endpoints", "http://consul.service.2.cluster.deuxfleurs.fr:8500", - "--port", "5432", + "--port", "${NOMAD_PORT_psql_proxy_port}", "--listen-address", "0.0.0.0" ] - port_map { - psql_proxy_port = 5432 - } + ports = [ "psql_proxy_port" ] } resources { memory = 100 - network { - port "psql_proxy_port" { - static = 5432 - } - } } service { @@ -93,34 +91,23 @@ job "postgres" { "--pg-repl-username", "${PG_REPL_USER}", "--pg-repl-password", "${PG_REPL_PWD}", "--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/" ] - port_map { - psql_port = 5433 - } + ports = [ "psql_port" ] volumes = [ "/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 { - source = "secrets/env.tpl" + data = file("../config/configuration/postgres/keeper/env.tpl") destination = "secrets/env" env = true } resources { memory = 500 - network { - port "psql_port" { - static = "5433" - } - } } service {