diff options
| -rw-r--r-- | hosts/sagittarius/web/observability.nix | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/hosts/sagittarius/web/observability.nix b/hosts/sagittarius/web/observability.nix index cebeac0..451ca58 100644 --- a/hosts/sagittarius/web/observability.nix +++ b/hosts/sagittarius/web/observability.nix @@ -1,4 +1,4 @@ -{ ... }: +{ config, ... }: let otel-prometheus-exporter-port = 4316; in @@ -90,4 +90,40 @@ in } ]; }; + + services.grafana = { + enable = true; + settings = { + server = { + http_addr = "127.0.0.1"; + http_port = 9001; + domain = "sorre.xyz"; + root_url = "https://sorre.xyz/grafana"; + serve_from_sub_path = true; + }; + }; + provision = { + enable = true; + datasources.settings = { + prune = true; + datasources = [ + { + type = "prometheus"; + name = "prometheus"; + url = "http://localhost:${toString config.services.prometheus.port}"; + } + ]; + }; + }; + }; + + services.nginx.virtualHosts."sorre.xyz" = { + forceSSL = true; + enableACME = true; + locations."/grafana/" = { + proxyPass = "http://${toString config.services.grafana.settings.server.http_addr}:${toString config.services.grafana.settings.server.http_port}"; + proxyWebsockets = true; + recommendedProxySettings = true; + }; + }; } |
