2023-12-30 11:01:06 +01:00
|
|
|
{ config, ... }:
|
|
|
|
let
|
|
|
|
root_host = "grimmauld.de";
|
|
|
|
grafana_host = "grafana.${root_host}";
|
|
|
|
grafana_port = 8082;
|
|
|
|
in {
|
|
|
|
age.secrets.grafana_admin_pass = {
|
|
|
|
file = ../secrets/grafana_admin_pass.age;
|
|
|
|
owner = "grafana";
|
|
|
|
group = "grafana";
|
|
|
|
mode = "0600";
|
|
|
|
};
|
|
|
|
|
|
|
|
security.acme.certs."${root_host}".extraDomainNames = [ grafana_host ];
|
|
|
|
services.grafana = {
|
|
|
|
enable = true;
|
|
|
|
settings = {
|
|
|
|
security = {
|
|
|
|
admin_user = "admin";
|
|
|
|
admin_email = "admin@${root_host}";
|
|
|
|
admin_password = "$__file{${config.age.secrets.grafana_admin_pass.path}}";
|
|
|
|
};
|
|
|
|
server = {
|
2023-12-30 13:09:30 +01:00
|
|
|
domain = grafana_host;
|
|
|
|
root_url = "https://${grafana_host}";
|
2023-12-30 11:01:06 +01:00
|
|
|
http_port = grafana_port;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
services.nginx = {
|
|
|
|
enable = true;
|
|
|
|
virtualHosts."${grafana_host}" = {
|
|
|
|
serverName = grafana_host;
|
|
|
|
forceSSL = true;
|
|
|
|
useACMEHost = root_host;
|
|
|
|
locations."/" = {
|
|
|
|
proxyPass = "http://127.0.0.1:${builtins.toString config.services.grafana.settings.server.http_port}";
|
2023-12-30 13:09:30 +01:00
|
|
|
proxyWebsockets = true;
|
2023-12-30 11:01:06 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|