refactor: finish decoupling the library functions from config

This commit is contained in:
oddlama 2023-07-01 01:11:58 +02:00
parent 68bb9731d3
commit 80e7c1bdbf
No known key found for this signature in database
GPG key ID: 14EFE510775FE39A
59 changed files with 984 additions and 786 deletions

View file

@ -0,0 +1,53 @@
{
config,
lib,
nodes,
utils,
...
}: let
sentinelCfg = nodes.sentinel.config;
influxdbDomain = "influxdb.${sentinelCfg.repo.secrets.local.personalDomain}";
influxdbPort = 8086;
in {
microvm.mem = 1024;
meta.wireguard-proxy.sentinel.allowedTCPPorts = [influxdbPort];
nodes.sentinel = {
networking.providedDomains.influxdb = influxdbDomain;
services.nginx = {
upstreams.influxdb = {
servers."${config.services.influxdb2.settings.http-bind-address}" = {};
extraConfig = ''
zone influxdb 64k;
keepalive 2;
'';
};
virtualHosts.${influxdbDomain} = {
forceSSL = true;
useACMEWildcardHost = true;
oauth2.enable = true;
oauth2.allowedGroups = ["access_influxdb"];
locations."/" = {
proxyPass = "http://influxdb";
proxyWebsockets = true;
extraConfig = ''
satisfy any;
${lib.concatMapStrings (ip: "allow ${ip};\n") sentinelCfg.meta.wireguard.proxy-sentinel.server.reservedAddresses}
deny all;
'';
};
};
};
};
services.influxdb2 = {
enable = true;
settings = {
reporting-disabled = true;
http-bind-address = "${config.meta.wireguard.proxy-sentinel.ipv4}:${toString influxdbPort}";
};
};
systemd.services.influxdb2.after = ["sys-subsystem-net-devices-${utils.escapeSystemdPath "proxy-sentinel"}.device"];
}