switch to grafana

This commit is contained in:
twoneis 2025-02-23 15:26:58 +01:00
parent e16ccb1ac1
commit 202c7aed6c
5 changed files with 33 additions and 28 deletions

View file

@ -2,7 +2,7 @@
conf = { conf = {
ssh.enable = true; ssh.enable = true;
nginx.enable = true; nginx.enable = true;
netdata.enable = true; grafana.enable = true;
mail.enable = false; # broken mail.enable = false; # broken
website.enable = true; website.enable = true;
fedi.enable = true; fedi.enable = true;

View file

@ -9,11 +9,11 @@ in {
./fonts ./fonts
./games ./games
./git ./git
./grafana
./home ./home
./layout ./layout
./mail ./mail
./matrix ./matrix
./netdata
./networking ./networking
./nginx ./nginx
./niri ./niri

View file

@ -0,0 +1,30 @@
{ lib, pkgs, config, ... }: let
inherit (lib) mkIf;
inherit (config) conf;
cfg = config.services.grafana.settings.server;
in mkIf conf.grafana.enable {
services.nginx = {
virtualHosts = {
"grafana.twoneis.site" = {
useACMEHost = "twoneis.site";
forceSSL = true;
locations."/" = {
proxyPass = "http://${toString cfg.http_addr}:${toString cfg.http_port}";
proxyWebsockets = true;
recommendedProxySettings = true;
};
};
};
};
services.grafana = {
enable = true;
settings = {
server = {
http_addr = "127.0.0.1";
http_port = 3000;
domain = "grafana.twoneis.site";
};
};
};
}

View file

@ -1,25 +0,0 @@
{ lib, pkgs, config, ... }: let
inherit (lib) mkIf;
inherit (config) conf;
in mkIf conf.netdata.enable {
services.nginx = {
virtualHosts = {
"netdata.twoneis.site" = {
useACMEHost = "twoneis.site";
forceSSL = true;
locations."/".proxyPass = "http://localhost:19999";
};
};
};
services.netdata = {
enable = true;
package = pkgs.netdata.override { withCloudUI = true; };
config = {
global = {
"memory mode" = "ram";
"error log" = "syslog";
};
};
};
}

View file

@ -18,7 +18,7 @@ in {
# Generally server options # Generally server options
ssh.enable = mkEnableOption "Install my public key to allow accessing this machine via ssh."; ssh.enable = mkEnableOption "Install my public key to allow accessing this machine via ssh.";
nginx.enable = mkEnableOption "Enable nginx. All the following options expect this to be enabled."; nginx.enable = mkEnableOption "Enable nginx. All the following options expect this to be enabled.";
netdata.enable = mkEnableOption "Enable netdata metrics tool."; grafana.enable = mkEnableOption "Enable grafana dashboarding tool.";
mail.enable = mkEnableOption "Enable mail server."; mail.enable = mkEnableOption "Enable mail server.";
website.enable = mkEnableOption "Serve website through nginx."; website.enable = mkEnableOption "Serve website through nginx.";
fedi.enable = mkEnableOption "Host a fedi server on this machine."; fedi.enable = mkEnableOption "Host a fedi server on this machine.";