making grafana work

This commit is contained in:
quitte 2024-04-29 15:09:56 +02:00
parent 795e3db47f
commit 7526b9273b
2 changed files with 47 additions and 18 deletions

View file

@ -83,6 +83,7 @@
./modules/hedgedoc.nix ./modules/hedgedoc.nix
./modules/padlist.nix ./modules/padlist.nix
./modules/nextcloud.nix ./modules/nextcloud.nix
./modules/monitoring.nix
./modules/vaultwarden.nix ./modules/vaultwarden.nix
./modules/forgejo ./modules/forgejo
./modules/kanboard.nix ./modules/kanboard.nix

View file

@ -1,23 +1,51 @@
{ config, pkgs, ... }: { config, pkgs, ... }:
let let
domain = "monitoring.${config.networking.domain}"; domain = "monitoring.${config.networking.domain}";
in { in
# grafana configuration {
services.grafana = { # grafana configuration
enable = true; services.grafana = {
port = 2342; enable = true;
}; settings = {
server = {
services.prometheus = { inherit domain;
enable = true; http_addr = "127.0.0.1";
port = 9001; http_port = 2342;
};
database = {
type = "postgres";
user = "grafana";
host = "/run/postgresql";
};
}; };
# nginx reverse proxy
services.nginx.virtualHosts.${domain} = { };
locations."/" = {
proxyPass = "http://localhost:${toString config.services.grafana.port}"; services.postgresql = {
proxyWebsockets = true; enable = true;
}; ensureUsers = [
{
name = "grafana";
ensurePermissions = {
"DATABASE grafana" = "ALL PRIVILEGES";
};
}
];
ensureDatabases = [ "grafana" ];
};
services.prometheus = {
enable = true;
port = 9001;
};
# nginx reverse proxy
services.nginx.virtualHosts.${domain} = {
locations."/" = {
proxyPass = "http://localhost:${toString config.services.grafana.port}";
proxyWebsockets = true;
}; };
};
} }