diff --git a/spec/focus/grafana.nix b/spec/focus/grafana.nix new file mode 100644 index 00000000..bd667368 --- /dev/null +++ b/spec/focus/grafana.nix @@ -0,0 +1,36 @@ +{ config +, ... }: { + services.grafana = { + enable = true; + dataDir = "/nix/persist/service/grafana"; + settings = { + server = { + http_addr = "127.0.0.1"; + http_port = 3000; + domain = "sf.514fpv.io"; + root_url = "https://sf.514fpv.io:8086/dash"; + serve_from_sub_path = true; + }; + }; + }; + + services.prometheus = { + enable = true; + port = 9001; + exporters = { + node = { + enable = true; + enabledCollectors = [ "systemd" ]; + port = 9002; + }; + }; + }; + + services.nginx.virtualHosts."sf.514fpv.io".locations."/dash/" = { + proxyPass = "http://${toString config.services.grafana.settings.server.http_addr}:${toString config.services.grafana.settings.server.http_port}"; + proxyWebsockets = true; + recommendedProxySettings = true; + }; + + global.fs.zfs.mountpoints."/nix/persist/service/grafana" = "service/grafana"; +} diff --git a/spec/focus/nginx.nix b/spec/focus/nginx.nix index 7c8bb5e7..38c33ba0 100644 --- a/spec/focus/nginx.nix +++ b/spec/focus/nginx.nix @@ -17,6 +17,14 @@ useACMEHost = ".sf.514fpv.io"; extraConfig = "return 444;"; }; + + "sf.514fpv.io" = { + addSSL = true; + useACMEHost = "sf.514fpv.io"; + locations."/" = { + return = "307 https://sf.514fpv.io:8086/dash/"; + }; + }; }; };