2023-03-07 02:26:07 +02:00
|
|
|
{ config, cluster, depot, lib, tools, ... }:
|
2023-03-06 18:58:29 +02:00
|
|
|
|
|
|
|
let
|
|
|
|
inherit (tools.meta) domain;
|
2023-03-07 02:26:07 +02:00
|
|
|
inherit (depot.reflection) hyprspace;
|
2023-03-06 18:58:29 +02:00
|
|
|
frontendDomain = "consul-remote.internal.${domain}";
|
|
|
|
in
|
|
|
|
|
|
|
|
{
|
|
|
|
services.nginx.virtualHosts.${frontendDomain} = tools.nginx.vhosts.proxy "http://127.0.0.1:8500" // {
|
2023-03-07 02:26:07 +02:00
|
|
|
listenAddresses = lib.singleton hyprspace.addr;
|
2023-03-06 18:58:29 +02:00
|
|
|
enableACME = false;
|
|
|
|
useACMEHost = "internal.${domain}";
|
|
|
|
};
|
|
|
|
|
|
|
|
consul.services.consul-remote = {
|
|
|
|
unit = "consul";
|
|
|
|
mode = "external";
|
|
|
|
definition = {
|
|
|
|
name = "consul-remote";
|
2023-03-07 02:26:07 +02:00
|
|
|
address = hyprspace.addr;
|
2023-03-06 18:58:29 +02:00
|
|
|
port = 443;
|
|
|
|
checks = [
|
|
|
|
{
|
|
|
|
name = "Frontend";
|
|
|
|
id = "service:consul-remote:frontend";
|
2023-03-07 02:26:07 +02:00
|
|
|
http = "https://${hyprspace.addr}/v1/status/leader";
|
2023-03-06 18:58:29 +02:00
|
|
|
tls_server_name = frontendDomain;
|
2023-06-05 21:25:37 +03:00
|
|
|
header.Host = lib.singleton frontendDomain;
|
2023-03-06 18:58:29 +02:00
|
|
|
interval = "60s";
|
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "Backend";
|
|
|
|
id = "service:consul-remote:backend";
|
|
|
|
http = "http://127.0.0.1:8500/v1/status/leader";
|
|
|
|
interval = "30s";
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|