modified: ../hosts/services/configuration.nix - change grafana

firewall port
	modified:   grafana.nix - change caddy config to extraConfig
This commit is contained in:
Alexandre LUCAZEAU 2022-06-01 18:25:07 +00:00
parent c2eeb342e9
commit f3c3a48be7
2 changed files with 51 additions and 31 deletions

View File

@ -1,6 +1,7 @@
{ ... }: { { ... }: {
imports = [ imports = [
./hardware-configuration.nix ./hardware-configuration.nix
./firewall-services.nix
../modules/users.nix ../modules/users.nix
../modules/common.nix ../modules/common.nix
../modules/grafana.nix ../modules/grafana.nix

View File

@ -1,35 +1,54 @@
{ config, pkgs, ...}: { config, pkgs, ...}:
let let
caddyDir = "/var/lib/caddy"; caddyDir = "/var/lib/caddy";
in in
{
services.grafana = {
enable = true;
domain = "sup.atlanticaweb";
port = 2342;
addr = "127.0.0.1";
};
services.caddy = {
enable = true;
email = "lucazeau.alexandre@gmail.com";
config = ''
{ {
storage file_system { services.grafana = {
root ${caddyDir} enable = true;
domain = "sup.atlanticaweb.fr";
port = 2342;
addr = "127.0.0.1";
};
services.caddy = {
enable = true;
email = "lucazeau.alexandre@gmail.com";
extraConfig = ''
{
storage file_system {
root ${caddyDir}
}
} }
} https://sup.atlanticaweb.fr:2342 {
https://grafana.atlanticaweb.fr { reverse_proxy http://127.0.0.1:${toString config.services.grafana.port}
reverse_proxy http://127.0.0.1:${toString config.services.grafana.port} }
} '';
''; };
}; services.prometheus = {
users.users.caddy = { enable = true;
group = "caddy"; port = 9001;
uid = config.ids.uids.caddy; exporters = {
home = caddyDir; node = {
createHome = true; enable = true;
extraGroups = [ "users" ]; enabledCollectors = [ "systemd" ];
}; port = 9002;
};
users.groups.caddy.gid = config.ids.uids.caddy; };
scrapeConfigs = [
{
job_name = "services";
static_configs = [{
targets = [ "127.0.0.1:${toString config.services.prometheus.exporters.node.port}" ];
}];
}
];
};
users.users.caddy = {
group = "caddy";
uid = config.ids.uids.caddy;
home = caddyDir;
createHome = true;
extraGroups = [ "users" ];
};
users.groups.caddy.gid = config.ids.uids.caddy;
} }