From baf8fe481e88bfa65ba315b8a4f9de2f7c1c85ba Mon Sep 17 00:00:00 2001 From: Max Date: Mon, 6 Mar 2023 00:27:29 +0100 Subject: [PATCH] cluster/services/patroni: register with consul --- cluster/services/patroni/worker.nix | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/cluster/services/patroni/worker.nix b/cluster/services/patroni/worker.nix index be6e50f..72b5a9e 100644 --- a/cluster/services/patroni/worker.nix +++ b/cluster/services/patroni/worker.nix @@ -72,4 +72,17 @@ in }; environmentFiles = lib.mapAttrs (n: _: config.age.secrets.${n}.path) vars.patroni.passwords; }; + + consul.services.patroni = { + mode = "external"; + definition.service = rec { + name = "patroni"; + address = getMeshIp vars.hostName; + port = cluster.config.links.patroni-pg-internal.port; + checks = lib.singleton { + interval = "5s"; + http = "http://${address}:${cluster.config.links.patroni-api.portStr}"; + }; + }; + }; }