2024-01-27 10:19:30 +00:00
|
|
|
{ config, flake, lib, ... }:
|
|
|
|
let
|
2024-01-27 19:24:11 +00:00
|
|
|
# Find element in list config.services.matrix-synapse.settings.listeners
|
|
|
|
# that sets type = "metrics"
|
|
|
|
listenerWithMetrics = lib.findFirst
|
|
|
|
(listener:
|
|
|
|
listener.type == "metrics")
|
|
|
|
(throw "Found no matrix-synapse.settings.listeners.*.type containing string metrics")
|
|
|
|
config.services.matrix-synapse.settings.listeners
|
|
|
|
;
|
|
|
|
synapseMetricsPort = "${toString listenerWithMetrics.port}";
|
2024-01-27 10:19:30 +00:00
|
|
|
in
|
2023-12-06 18:11:45 +00:00
|
|
|
{
|
2023-12-06 18:51:27 +00:00
|
|
|
age.secrets.nachtigall-metrics-nginx-basic-auth = {
|
|
|
|
file = "${flake.self}/secrets/nachtigall-metrics-nginx-basic-auth.age";
|
2023-12-06 18:11:45 +00:00
|
|
|
mode = "600";
|
|
|
|
owner = "nginx";
|
|
|
|
};
|
|
|
|
services.nginx.virtualHosts = {
|
|
|
|
"nachtigall.pub.solar" = {
|
|
|
|
enableACME = true;
|
|
|
|
addSSL = true;
|
|
|
|
basicAuthFile = "${config.age.secrets.nachtigall-metrics-nginx-basic-auth.path}";
|
|
|
|
locations."/metrics" = {
|
|
|
|
proxyPass = "http://127.0.0.1:${toString(config.services.prometheus.exporters.node.port)}";
|
|
|
|
};
|
2024-01-25 19:21:50 +00:00
|
|
|
locations."/_synapse/metrics" = {
|
2024-01-27 19:24:11 +00:00
|
|
|
proxyPass = "http://127.0.0.1:${synapseMetricsPort}";
|
2024-01-25 19:21:50 +00:00
|
|
|
};
|
2023-12-06 18:11:45 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|