From 06c35a0533d57967e08e86a8a65184a723d403e2 Mon Sep 17 00:00:00 2001 From: stuebinm Date: Sun, 18 Apr 2021 00:07:04 +0200 Subject: copy grafana to flora --- hosts/chaski/services/grafana.nix | 3 +++ hosts/flora/configuration.nix | 1 + hosts/flora/services/grafana.nix | 41 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 45 insertions(+) create mode 100644 hosts/flora/services/grafana.nix diff --git a/hosts/chaski/services/grafana.nix b/hosts/chaski/services/grafana.nix index d520b20..affa4ec 100644 --- a/hosts/chaski/services/grafana.nix +++ b/hosts/chaski/services/grafana.nix @@ -28,6 +28,7 @@ }; }; + services.nginx.enable = true; services.nginx.virtualHosts."scrape.stuebinm.eu" = { locations."/" = { proxyPass = "http://localhost:5000"; @@ -36,4 +37,6 @@ enableACME = true; forceSSL = true; }; + + networking.firewall.allowedTCPPorts = [ 80 443 ]; } diff --git a/hosts/flora/configuration.nix b/hosts/flora/configuration.nix index d45175e..6aac996 100644 --- a/hosts/flora/configuration.nix +++ b/hosts/flora/configuration.nix @@ -9,6 +9,7 @@ ./services/pleroma.nix ./services/cgit.nix ./services/surveys.nix + ./services/grafana.nix #./services/picarones.nix ]; diff --git a/hosts/flora/services/grafana.nix b/hosts/flora/services/grafana.nix new file mode 100644 index 0000000..15fd254 --- /dev/null +++ b/hosts/flora/services/grafana.nix @@ -0,0 +1,41 @@ +{ config, pkgs, ... }: + +{ + services.prometheus = { + enable = true; + port = 9001; + scrapeConfigs = [ { + job_name = "lmucast-docker"; + static_configs = [ { + targets = [ "cast.itunes.uni-muenchen.de:9101" ]; + } ]; + } ]; + }; + + services.grafana = { + enable = true; + port = 5000; + addr = "[::]"; + rootUrl = "https://scrape.stuebinm.eu/"; + auth.anonymous.enable = true; + provision = { + enable = true; + datasources = [ { + name = "lmucast"; + type = "prometheus"; + url = "http://localhost:9001"; + } ]; + }; + }; + + services.nginx.virtualHosts."scrape.stuebinm.eu" = { + locations."/" = { + proxyPass = "http://localhost:5000"; + proxyWebsockets = true; + }; + enableACME = true; + forceSSL = true; + }; + + networking.firewall.allowedTCPPorts = [ 80 443 ]; +} -- cgit v1.2.3