Compare commits
3 commits
5d26d45916
...
9f158f15a4
Author | SHA1 | Date | |
---|---|---|---|
9f158f15a4 | |||
549cbdb6c8 | |||
e81aad5619 |
6 changed files with 71 additions and 17 deletions
|
@ -87,8 +87,18 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
ways.monitoring = {
|
ways = {
|
||||||
|
monitoring = {
|
||||||
consulService = "grafana";
|
consulService = "grafana";
|
||||||
extras.locations."/".proxyWebsockets = true;
|
extras.locations."/".proxyWebsockets = true;
|
||||||
};
|
};
|
||||||
|
monitoring-logs = {
|
||||||
|
internal = true;
|
||||||
|
consulService = "loki";
|
||||||
|
extras.extraConfig = ''
|
||||||
|
client_max_body_size 4G;
|
||||||
|
proxy_read_timeout 3600s;
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,7 +70,7 @@ in
|
||||||
{
|
{
|
||||||
name = "Loki";
|
name = "Loki";
|
||||||
uid = "P8E80F9AEF21F6940";
|
uid = "P8E80F9AEF21F6940";
|
||||||
inherit (loki-ingest) url;
|
inherit (cluster.config.ways.monitoring-logs) url;
|
||||||
type = "loki";
|
type = "loki";
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
|
@ -104,4 +104,20 @@ in
|
||||||
querier.max_concurrent = 16;
|
querier.max_concurrent = 16;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
consul.services.loki = {
|
||||||
|
definition = {
|
||||||
|
name = "loki";
|
||||||
|
address = loki-ingest.ipv4;
|
||||||
|
inherit (loki-ingest) port;
|
||||||
|
checks = [
|
||||||
|
{
|
||||||
|
name = "Loki";
|
||||||
|
id = "service:loki:backend";
|
||||||
|
interval = "5s";
|
||||||
|
http = "${loki-ingest.url}/ready";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,9 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
dns.records = lib.mapAttrs'
|
dns.records = lib.mapAttrs'
|
||||||
(_: cfg: lib.nameValuePair cfg.dnsRecord.name ({ ... }: { imports = [ cfg.dnsRecord.value ]; }))
|
(_: cfg: lib.nameValuePair cfg.dnsRecord.name ({ ... }: {
|
||||||
|
imports = [ cfg.dnsRecord.value ];
|
||||||
|
root = cfg.domainSuffix;
|
||||||
|
}))
|
||||||
config.ways;
|
config.ways;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
let
|
let
|
||||||
externalWays = lib.filterAttrs (_: cfg: !cfg.internal) cluster.config.ways;
|
externalWays = lib.filterAttrs (_: cfg: !cfg.internal) cluster.config.ways;
|
||||||
|
|
||||||
|
internalWays = lib.filterAttrs (_: cfg: cfg.internal) cluster.config.ways;
|
||||||
|
|
||||||
consulServiceWays = lib.filterAttrs (_: cfg: cfg.useConsul) cluster.config.ways;
|
consulServiceWays = lib.filterAttrs (_: cfg: cfg.useConsul) cluster.config.ways;
|
||||||
in
|
in
|
||||||
|
|
||||||
|
@ -14,6 +16,7 @@ in
|
||||||
imports = [
|
imports = [
|
||||||
cfg.extras
|
cfg.extras
|
||||||
{
|
{
|
||||||
|
listenAddresses = lib.mkIf cfg.internal [ config.reflection.interfaces.vstub.addr ];
|
||||||
forceSSL = true;
|
forceSSL = true;
|
||||||
enableACME = !cfg.internal && !cfg.wildcard;
|
enableACME = !cfg.internal && !cfg.wildcard;
|
||||||
useACMEHost = lib.mkMerge [
|
useACMEHost = lib.mkMerge [
|
||||||
|
@ -84,7 +87,8 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
consul.services.ways-proxy = {
|
consul.services = {
|
||||||
|
ways-proxy = {
|
||||||
unit = "nginx";
|
unit = "nginx";
|
||||||
mode = "external";
|
mode = "external";
|
||||||
definition = {
|
definition = {
|
||||||
|
@ -98,4 +102,19 @@ in
|
||||||
tags = lib.attrNames externalWays;
|
tags = lib.attrNames externalWays;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
ways-proxy-internal = {
|
||||||
|
unit = "nginx";
|
||||||
|
mode = "external";
|
||||||
|
definition = {
|
||||||
|
name = "ways-proxy-internal";
|
||||||
|
address = config.reflection.interfaces.vstub.addr;
|
||||||
|
port = 443;
|
||||||
|
checks = lib.singleton {
|
||||||
|
interval = "60s";
|
||||||
|
tcp = "127.0.0.1:80";
|
||||||
|
};
|
||||||
|
tags = lib.attrNames internalWays;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ with lib;
|
||||||
description = "DNS record value for this Way.";
|
description = "DNS record value for this Way.";
|
||||||
type = types.deferredModule;
|
type = types.deferredModule;
|
||||||
default = {
|
default = {
|
||||||
consulService = "${name}.ways-proxy";
|
consulService = "${name}.${if config.internal then "ways-proxy-internal" else "ways-proxy"}";
|
||||||
rewrite.type = lib.mkIf config.wildcard "regex";
|
rewrite.type = lib.mkIf config.wildcard "regex";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -57,6 +57,12 @@ with lib;
|
||||||
default = "/.well-known/ways/internal-health-check";
|
default = "/.well-known/ways/internal-health-check";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
url = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
readOnly = true;
|
||||||
|
default = "https://${name}.${config.domainSuffix}";
|
||||||
|
};
|
||||||
|
|
||||||
useConsul = mkOption {
|
useConsul = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
internal = true;
|
internal = true;
|
||||||
|
|
Loading…
Add table
Reference in a new issue