services: prometheus: switch over to dedicated subdomain instead of subpath
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

Signed-off-by: Christoph Heiss <christoph@c8h4.io>
This commit is contained in:
Christoph Heiss 2024-07-07 17:04:03 +02:00
parent 0daabd8768
commit 893ceb1687
Signed by: c8h4
GPG key ID: 73D5E7FDEE3DE49A
2 changed files with 15 additions and 3 deletions

Binary file not shown.

View file

@ -1,10 +1,11 @@
{ my, secrets, ... }: { config, my, secrets, ... }:
{ let fqdn = "prometheus.${my.domain}";
in {
services.prometheus = { services.prometheus = {
enable = true; enable = true;
checkConfig = "syntax-only"; checkConfig = "syntax-only";
webExternalUrl = "http://${my.homelab.fqdn}/prometheus"; webExternalUrl = "https://${fqdn}";
listenAddress = "[::1]"; listenAddress = "[::1]";
scrapeConfigs = [ scrapeConfigs = [
{ {
@ -65,4 +66,15 @@
} }
]; ];
}; };
services.nginx.virtualHosts.${fqdn} = let cfg = config.services.prometheus;
in {
forceSSL = true;
useACMEHost = my.domain;
kTLS = true;
locations."/" = {
proxyPass = "http://${cfg.listenAddress}:${toString cfg.port}";
proxyWebsockets = true;
};
};
} }