summaryrefslogtreecommitdiff
path: root/hosts/vidhar/prometheus/default.nix
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2022-04-08 22:43:06 +0200
committerGregor Kleen <gkleen@yggdrasil.li>2022-04-08 22:43:06 +0200
commitf2bfb278fbff1d02df0b6a377f3de24881172105 (patch)
treed53a2873aef7a6c54a095252a1f926238cb41375 /hosts/vidhar/prometheus/default.nix
parent43e4a78d9fa8a1dc08158ce4e6b6cf7374fee659 (diff)
downloadnixos-f2bfb278fbff1d02df0b6a377f3de24881172105.tar
nixos-f2bfb278fbff1d02df0b6a377f3de24881172105.tar.gz
nixos-f2bfb278fbff1d02df0b6a377f3de24881172105.tar.bz2
nixos-f2bfb278fbff1d02df0b6a377f3de24881172105.tar.xz
nixos-f2bfb278fbff1d02df0b6a377f3de24881172105.zip
prometheus
Diffstat (limited to 'hosts/vidhar/prometheus/default.nix')
-rw-r--r--hosts/vidhar/prometheus/default.nix30
1 files changed, 29 insertions, 1 deletions
diff --git a/hosts/vidhar/prometheus/default.nix b/hosts/vidhar/prometheus/default.nix
index c60afd11..adcfdae9 100644
--- a/hosts/vidhar/prometheus/default.nix
+++ b/hosts/vidhar/prometheus/default.nix
@@ -26,7 +26,7 @@ in {
26 enable = true; 26 enable = true;
27 27
28 extraFlags = [ 28 extraFlags = [
29 "--enable-feature=remote-write-receiver" 29 "--web.enable-remote-write-receiver"
30 ]; 30 ];
31 31
32 exporters = { 32 exporters = {
@@ -387,5 +387,33 @@ in {
387 AmbientCapabilities = lib.mkForce ["CAP_SYS_ADMIN"]; 387 AmbientCapabilities = lib.mkForce ["CAP_SYS_ADMIN"];
388 }; 388 };
389 }; 389 };
390
391 services.nginx = {
392 upstreams.prometheus = {
393 servers = { "localhost:${config.services.prometheus.port}" = {}; };
394 };
395 virtualHosts."prometheus.vidhar.yggdrasil" = {
396 forceSSl = true;
397 sslCertificate = ./tls.crt;
398 sslCertificateKey = "/run/credentials/nginx.service/prometheus.key";
399 extraConfig = ''
400 ssl_client_certificate ${./ca/ca.crt};
401 ssl_trusted_certificate ${./ca/ca.crt};
402 ssl_verify_client on;
403 '';
404 locations."/" = {
405 proxyPass = "http://prometheus/";
406 proxyWebsockets = true;
407 };
408 };
409 };
410
411 sops.secrets."prometheus.key" = {
412 format = "binary";
413 sopsFile = ./tls.key;
414 };
415 systemd.services.nginx.serviceConfig.LoadCredential = [
416 "prometheus.key:${config.sops.secrets."prometheus.key".path}"
417 ];
390 }; 418 };
391} 419}