2024-03-26 14:13:35 +01:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}: {
|
|
|
|
# grafana configuration
|
|
|
|
services.grafana = {
|
|
|
|
enable = true;
|
2024-03-26 14:37:02 +01:00
|
|
|
settings.server = {
|
2024-03-26 14:35:54 +01:00
|
|
|
domain = "grafana.lillianviolet.dev";
|
|
|
|
http_port = 2342;
|
|
|
|
http_addr = "127.0.0.1";
|
|
|
|
};
|
2024-03-26 14:34:28 +01:00
|
|
|
provision = {
|
2024-03-26 14:52:15 +01:00
|
|
|
datasources.settings = {
|
|
|
|
apiVersion = 1;
|
|
|
|
datasources = [
|
|
|
|
{
|
|
|
|
name = "Prometheus";
|
|
|
|
type = "prometheus";
|
|
|
|
access = "proxy";
|
|
|
|
url = "http://localhost:${toString config.services.prometheus.port}";
|
|
|
|
isDefault = true;
|
|
|
|
}
|
|
|
|
# {
|
|
|
|
# name = "Loki";
|
|
|
|
# type = "loki";
|
|
|
|
# access = "proxy";
|
|
|
|
# url = "http://localhost:${config.services.loki.port}";
|
|
|
|
# isDefault = true;
|
|
|
|
# }
|
|
|
|
];
|
|
|
|
};
|
2024-03-26 14:34:28 +01:00
|
|
|
};
|
2024-03-26 14:13:35 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
# nginx reverse proxy
|
2024-03-26 14:40:05 +01:00
|
|
|
services.nginx.virtualHosts.${config.services.grafana.settings.server.domain} = {
|
2024-03-26 14:13:35 +01:00
|
|
|
## Force HTTP redirect to HTTPS
|
|
|
|
forceSSL = true;
|
|
|
|
## LetsEncrypt
|
|
|
|
enableACME = true;
|
|
|
|
locations."/" = {
|
2024-03-26 14:52:15 +01:00
|
|
|
proxyPass = "http://${toString config.services.grafana.settings.server.http_addr}:${toString config.services.grafana.settings.server.http_port}";
|
2024-03-26 14:13:35 +01:00
|
|
|
proxyWebsockets = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|