cluster/services/patroni: use integrated consul service registration
This commit is contained in:
parent
6826ac254d
commit
29c37f7a54
1 changed files with 4 additions and 30 deletions
|
@ -40,7 +40,10 @@ in
|
||||||
raft = false;
|
raft = false;
|
||||||
softwareWatchdog = true;
|
softwareWatchdog = true;
|
||||||
settings = {
|
settings = {
|
||||||
consul.host = "127.0.0.1:8500";
|
consul = {
|
||||||
|
host = "127.0.0.1:8500";
|
||||||
|
register_service = true;
|
||||||
|
};
|
||||||
bootstrap.dcs = {
|
bootstrap.dcs = {
|
||||||
ttl = 30;
|
ttl = 30;
|
||||||
loop_wait = 10;
|
loop_wait = 10;
|
||||||
|
@ -72,33 +75,4 @@ in
|
||||||
};
|
};
|
||||||
environmentFiles = lib.mapAttrs (n: _: config.age.secrets.${n}.path) vars.patroni.passwords;
|
environmentFiles = lib.mapAttrs (n: _: config.age.secrets.${n}.path) vars.patroni.passwords;
|
||||||
};
|
};
|
||||||
|
|
||||||
consul.services.patroni = {
|
|
||||||
mode = "external";
|
|
||||||
definition = rec {
|
|
||||||
name = "patroni";
|
|
||||||
address = getMeshIp vars.hostName;
|
|
||||||
port = cluster.config.links.patroni-pg-internal.port;
|
|
||||||
checks = [
|
|
||||||
{
|
|
||||||
name = "Patroni API";
|
|
||||||
id = "service:patroni";
|
|
||||||
interval = "5s";
|
|
||||||
http = "http://${address}:${cluster.config.links.patroni-api.portStr}/liveness";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
name = "Patroni Leader";
|
|
||||||
id = "service:patroni:leader";
|
|
||||||
interval = "5s";
|
|
||||||
http = "http://${address}:${cluster.config.links.patroni-api.portStr}/leader";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
name = "PostgreSQL";
|
|
||||||
id = "service:patroni:postgres";
|
|
||||||
interval = "120s";
|
|
||||||
tcp = "${address}:${cluster.config.links.patroni-pg-internal.portStr}";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue