cluster/services/consul: host remote API on vstub

This commit is contained in:
Max Headroom 2023-10-24 23:41:06 +02:00
parent 4f9680966b
commit 542d7e95f8

View file

@ -1,14 +1,15 @@
{ config, cluster, depot, lib, ... }:
{ depot, lib, ... }:
let
inherit (depot.lib.meta) domain;
inherit (depot.reflection) hyprspace;
frontendDomain = "consul-remote.internal.${domain}";
inherit (depot.reflection.interfaces.vstub) addr;
in
{
services.nginx.virtualHosts.${frontendDomain} = depot.lib.nginx.vhosts.proxy "http://127.0.0.1:8500" // {
listenAddresses = lib.singleton hyprspace.addr;
listenAddresses = lib.singleton addr;
enableACME = false;
useACMEHost = "internal.${domain}";
};
@ -18,13 +19,13 @@ in
mode = "external";
definition = {
name = "consul-remote";
address = hyprspace.addr;
address = addr;
port = 443;
checks = [
{
name = "Frontend";
id = "service:consul-remote:frontend";
http = "https://${hyprspace.addr}/v1/status/leader";
http = "https://${addr}/v1/status/leader";
tls_server_name = frontendDomain;
header.Host = lib.singleton frontendDomain;
interval = "60s";