Initial grafana setup
This commit is contained in:
parent
da721924e4
commit
519e907278
3 changed files with 84 additions and 0 deletions
63
applications/grafana.nix
Normal file
63
applications/grafana.nix
Normal file
|
@ -0,0 +1,63 @@
|
|||
{lib, ...}:
|
||||
with lib; let
|
||||
name = "grafana-server";
|
||||
cfg = config.server.grafana;
|
||||
in {
|
||||
imports = [
|
||||
./acme.nix
|
||||
./dns.nix
|
||||
];
|
||||
|
||||
options.services.skynet.grafana = {
|
||||
enable = mkEnableOption "Grafana Server";
|
||||
|
||||
host = {
|
||||
ip = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
name = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
};
|
||||
|
||||
ip = mkOption {
|
||||
type = types.str;
|
||||
default = cfg.host.ip;
|
||||
};
|
||||
|
||||
port = mkOption {
|
||||
type = types.port;
|
||||
default = 4444;
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
services.grafana = {
|
||||
enable = true;
|
||||
domain = "grafana.skynet.ie";
|
||||
port = cfg.port;
|
||||
addr = cfg.host.ip;
|
||||
};
|
||||
|
||||
services.nginx.virtualHosts."${name}.skynet.ie" = {
|
||||
forceSSL = true;
|
||||
useACMEHost = "skynet";
|
||||
locations."/" = {
|
||||
proxyPass = "https://localhost:${toString cfg.port}";
|
||||
proxyWebsockets = true;
|
||||
};
|
||||
};
|
||||
|
||||
skynet_dns.records = [
|
||||
{
|
||||
record = "${name}";
|
||||
r_type = "CNAME";
|
||||
value = cfg.host.name;
|
||||
}
|
||||
];
|
||||
|
||||
skynet_acme.domains = [
|
||||
"${name}.skynet.ie"
|
||||
];
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue