modules/hyprspace: enable metrics
This commit is contained in:
parent
e0569ac31e
commit
f3495beea7
1 changed files with 20 additions and 0 deletions
|
@ -27,11 +27,14 @@ let
|
||||||
runConfig = "/run/hyprspace.yml";
|
runConfig = "/run/hyprspace.yml";
|
||||||
nameservers = lib.unique config.networking.nameservers;
|
nameservers = lib.unique config.networking.nameservers;
|
||||||
in {
|
in {
|
||||||
|
links.hyprspaceMetrics.protocol = "http";
|
||||||
|
|
||||||
networking.hosts = lib.mapAttrs' (k: v: lib.nameValuePair v.hyprspace.addr [k "${k}.hypr"]) hyprspaceCapableNodes;
|
networking.hosts = lib.mapAttrs' (k: v: lib.nameValuePair v.hyprspace.addr [k "${k}.hypr"]) hyprspaceCapableNodes;
|
||||||
age.secrets.hyprspace-key = {
|
age.secrets.hyprspace-key = {
|
||||||
file = ../../secrets/hyprspace-key- + "${hostName}.age";
|
file = ../../secrets/hyprspace-key- + "${hostName}.age";
|
||||||
mode = "0400";
|
mode = "0400";
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.services.hyprspace = {
|
systemd.services.hyprspace = {
|
||||||
enable = true;
|
enable = true;
|
||||||
after = [ "network-online.target" ];
|
after = [ "network-online.target" ];
|
||||||
|
@ -43,6 +46,7 @@ in {
|
||||||
${pkgs.replace-secret}/bin/replace-secret '@HYPRSPACEPRIVATEKEY@' "${privateKeyFile}" ${runConfig}
|
${pkgs.replace-secret}/bin/replace-secret '@HYPRSPACEPRIVATEKEY@' "${privateKeyFile}" ${runConfig}
|
||||||
chmod 0400 ${runConfig}
|
chmod 0400 ${runConfig}
|
||||||
'';
|
'';
|
||||||
|
environment.HYPRSPACE_METRICS_PORT = config.links.hyprspaceMetrics.portStr;
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Group = "wheel";
|
Group = "wheel";
|
||||||
Restart = "on-failure";
|
Restart = "on-failure";
|
||||||
|
@ -71,12 +75,28 @@ in {
|
||||||
IPAddressAllow = nameservers;
|
IPAddressAllow = nameservers;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
networking.firewall = {
|
networking.firewall = {
|
||||||
allowedTCPPorts = [ listenPort ];
|
allowedTCPPorts = [ listenPort ];
|
||||||
allowedUDPPorts = [ listenPort ];
|
allowedUDPPorts = [ listenPort ];
|
||||||
trustedInterfaces = [ "hyprspace" ];
|
trustedInterfaces = [ "hyprspace" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
environment.systemPackages = [
|
environment.systemPackages = [
|
||||||
hyprspace
|
hyprspace
|
||||||
];
|
];
|
||||||
|
|
||||||
|
services.grafana-agent.settings.metrics.configs = lib.singleton {
|
||||||
|
name = "metrics-hyprspace";
|
||||||
|
scrape_configs = lib.singleton {
|
||||||
|
job_name = "hyprspace";
|
||||||
|
static_configs = lib.singleton {
|
||||||
|
targets = lib.singleton config.links.hyprspaceMetrics.tuple;
|
||||||
|
labels = {
|
||||||
|
instance = hostName;
|
||||||
|
peer_id = myNode.hyprspace.id;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue