From 203dfe739d2931ddf84b2b7d06170c8f08b1e26d Mon Sep 17 00:00:00 2001 From: Adithya Nair Date: Sun, 27 Oct 2024 18:37:05 +0530 Subject: [PATCH] rico1: add grafana --- hosts/rico1/services/apps/blocky.nix | 2 +- hosts/rico1/services/apps/default.nix | 1 + hosts/rico1/services/apps/grafana.nix | 33 +++++++++++++++++++++++++++ 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 hosts/rico1/services/apps/grafana.nix diff --git a/hosts/rico1/services/apps/blocky.nix b/hosts/rico1/services/apps/blocky.nix index ab28600..5b43117 100644 --- a/hosts/rico1/services/apps/blocky.nix +++ b/hosts/rico1/services/apps/blocky.nix @@ -77,7 +77,7 @@ in "alertmanager.labs.adtya.xyz" = "10.10.10.11"; "blocky.labs.adtya.xyz" = "10.10.10.11"; "frp.labs.adtya.xyz" = "10.10.10.10"; - "grafana.labs.adtya.xyz" = "10.10.10.10"; + "grafana.labs.adtya.xyz" = "10.10.10.11"; "loki.labs.adtya.xyz" = "10.10.10.11"; "prometheus.labs.adtya.xyz" = "10.10.10.10"; "transmission.labs.adtya.xyz" = "10.10.10.14"; diff --git a/hosts/rico1/services/apps/default.nix b/hosts/rico1/services/apps/default.nix index a32782c..b772e72 100644 --- a/hosts/rico1/services/apps/default.nix +++ b/hosts/rico1/services/apps/default.nix @@ -5,6 +5,7 @@ _: { ./wiki.nix ./alertmanager.nix ./blocky.nix + ./grafana.nix ./loki ../../../shared/prometheus-exporters.nix ../../../shared/promtail.nix diff --git a/hosts/rico1/services/apps/grafana.nix b/hosts/rico1/services/apps/grafana.nix new file mode 100644 index 0000000..4e4c3e6 --- /dev/null +++ b/hosts/rico1/services/apps/grafana.nix @@ -0,0 +1,33 @@ +_: +let + inherit (import ../../../shared/caddy-helpers.nix) logFormat; + domainName = "grafana.labs.adtya.xyz"; +in +{ + services = { + caddy = { + virtualHosts."${domainName}" = { + logFormat = logFormat domainName; + extraConfig = '' + reverse_proxy 127.0.0.1:9091 + ''; + }; + }; + grafana = { + enable = true; + settings = { + server = { + domain = domainName; + http_addr = "127.0.0.1"; + http_port = 9091; + }; + analytics = { + enable = false; + }; + panels = { + disable_sanitize_html = true; + }; + }; + }; + }; +}