2023-08-31 01:55:45 +03:00
|
|
|
{ config, cluster, depot, lib, ... }:
|
2023-03-06 18:58:29 +02:00
|
|
|
|
|
|
|
let
|
2023-08-31 01:55:45 +03:00
|
|
|
inherit (depot.lib.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
|
|
|
|
|
|
|
|
{
|
2023-08-31 01:55:45 +03:00
|
|
|
services.nginx.virtualHosts.${frontendDomain} = depot.lib.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";
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|