diff --git a/services/grafana/default.nix b/services/grafana/default.nix index 8d30cf58..5b1c0137 100644 --- a/services/grafana/default.nix +++ b/services/grafana/default.nix @@ -1,6 +1,7 @@ { config, lib, pkgs, ... }: { + imports = [ ../traefik/grafana.nix ]; services.grafana = { enable = true; settings = { diff --git a/services/traefik/grafana.nix b/services/traefik/grafana.nix new file mode 100644 index 00000000..b4d375a6 --- /dev/null +++ b/services/traefik/grafana.nix @@ -0,0 +1,17 @@ +{ config, lib, pkgs, ... }: + +{ + imports = [ ./default.nix ]; + services.traefik.dynamicConfigOptions = { + http = { + routers.grafana = { + rule = "Host(`grafana.xenia.me.uk`)"; + entryPoints = [ "http" "https" ]; + service = "grafana-webinterface"; + tls = { certResolver = "default"; }; + }; + services.grafana-webinterface.loadBalancer.servers = + [{ url = "http://localhost:3100"; }]; + }; + }; +}