From f97a0ccd16427b9b4a14a7db5854ddcba7439c39 Mon Sep 17 00:00:00 2001 From: stupidcomputer Date: Mon, 28 Oct 2024 00:10:19 -0500 Subject: [PATCH] add grafana --- boxes/copernicus/services/default.nix | 1 + boxes/copernicus/services/grafana.nix | 14 ++++++++++++++ boxes/netbox/default.nix | 1 + boxes/netbox/grafana-bridge.nix | 16 ++++++++++++++++ 4 files changed, 32 insertions(+) create mode 100644 boxes/copernicus/services/grafana.nix create mode 100644 boxes/netbox/grafana-bridge.nix diff --git a/boxes/copernicus/services/default.nix b/boxes/copernicus/services/default.nix index 777283e..f539ace 100644 --- a/boxes/copernicus/services/default.nix +++ b/boxes/copernicus/services/default.nix @@ -4,5 +4,6 @@ imports = [ ./photoprism.nix ./wireguard.nix + ./grafana.nix ]; } diff --git a/boxes/copernicus/services/grafana.nix b/boxes/copernicus/services/grafana.nix new file mode 100644 index 0000000..c3d3b58 --- /dev/null +++ b/boxes/copernicus/services/grafana.nix @@ -0,0 +1,14 @@ +{ lib, config, pkgs, ...}: + +{ + services.grafana = { + enable = true; + settings = { + server = { + http_addr = "10.100.0.2"; + http_port = 9802; + domain = "grafana.beepboop.systems"; + }; + }; + }; +} diff --git a/boxes/netbox/default.nix b/boxes/netbox/default.nix index 67e67e5..48cd055 100644 --- a/boxes/netbox/default.nix +++ b/boxes/netbox/default.nix @@ -18,6 +18,7 @@ ./franklincce.nix ./wireguard.nix ./photoprism-bridge.nix + ./grafana-bridge.nix ]; nix = { diff --git a/boxes/netbox/grafana-bridge.nix b/boxes/netbox/grafana-bridge.nix new file mode 100644 index 0000000..83ce201 --- /dev/null +++ b/boxes/netbox/grafana-bridge.nix @@ -0,0 +1,16 @@ +{ lib, config, pkgs, ... }: +{ + services.nginx.virtualHosts."grafana.beepboop.systems" = { + forceSSL = true; + enableACME = true; + locations."/" = { + proxyPass = "http://10.100.0.2:9802"; + proxyWebsockets = true; + extraConfig = '' + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header Host $host; + proxy_buffering off; + ''; + }; + }; +}