Setup grafana
This commit is contained in:
parent
5f49d7ad3f
commit
1d03ffaef9
56
nixos/viridian/services/grafana.nix
Normal file
56
nixos/viridian/services/grafana.nix
Normal file
|
@ -0,0 +1,56 @@
|
|||
{ config, ... }:
|
||||
|
||||
{
|
||||
# Setup grafana our grafana instance.
|
||||
services.grafana = {
|
||||
enable = true;
|
||||
dataDir = "/srv/services/grafana";
|
||||
settings = {
|
||||
server = {
|
||||
http_addr = "127.0.0.1";
|
||||
http_port = 3400;
|
||||
domain = "kanto.dev";
|
||||
root_url = "https://kanto.dev/grafana/";
|
||||
serve_from_sub_path = true;
|
||||
};
|
||||
database = {
|
||||
type = "mysql";
|
||||
name = "grafana";
|
||||
user = "grafana";
|
||||
host = "/var/run/mysqld/mysqld.sock";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# Setup our database for grafana.
|
||||
services.mysql = {
|
||||
ensureUsers = [{
|
||||
name = "grafana";
|
||||
ensurePermissions = {
|
||||
"grafana.*" = "ALL PRIVILEGES";
|
||||
};
|
||||
}];
|
||||
ensureDatabases = [ "grafana" ];
|
||||
};
|
||||
|
||||
# Setup our traefik router.
|
||||
services.traefik.dynamicConfigOptions.http.routers = {
|
||||
grafana = {
|
||||
rule = "Host(`kanto.dev`)";
|
||||
entryPoints = [
|
||||
"websecure"
|
||||
];
|
||||
middlewares = [
|
||||
"admin"
|
||||
];
|
||||
service = "grafana";
|
||||
};
|
||||
};
|
||||
|
||||
# Setup our traefik service.
|
||||
services.traefik.dynamicConfigOptions.http.services = {
|
||||
grafana.loadBalancer.servers = [
|
||||
{ url = "http://127.0.0.1:${toString config.services.grafana.settings.server.http_port}"; }
|
||||
];
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue