mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-13 21:50:33 +03:00
nixos/netbird: fix port conflict on metrics endpoint
This commit is contained in:
parent
76e882d4e7
commit
bfc160a84c
3 changed files with 65 additions and 14 deletions
|
@ -196,6 +196,12 @@ in
|
|||
description = "Internal port of the management server.";
|
||||
};
|
||||
|
||||
metricsPort = mkOption {
|
||||
type = port;
|
||||
default = 9090;
|
||||
description = "Internal port of the metrics server.";
|
||||
};
|
||||
|
||||
extraOptions = mkOption {
|
||||
type = listOf str;
|
||||
default = [ ];
|
||||
|
@ -360,6 +366,13 @@ in
|
|||
}
|
||||
];
|
||||
|
||||
assertions = [
|
||||
{
|
||||
assertion = cfg.port != cfg.metricsPort;
|
||||
message = "The primary listen port cannot be the same as the listen port for the metrics endpoint";
|
||||
}
|
||||
];
|
||||
|
||||
systemd.services.netbird-management = {
|
||||
description = "The management server for Netbird, a wireguard VPN";
|
||||
documentation = [ "https://netbird.io/docs/" ];
|
||||
|
@ -387,6 +400,9 @@ in
|
|||
# Port to listen on
|
||||
"--port"
|
||||
cfg.port
|
||||
# Port the internal prometheus server listens on
|
||||
"--metrics-port"
|
||||
cfg.metricsPort
|
||||
# Log to stdout
|
||||
"--log-file"
|
||||
"console"
|
||||
|
|
|
@ -15,7 +15,12 @@ let
|
|||
mkOption
|
||||
;
|
||||
|
||||
inherit (lib.types) enum port str;
|
||||
inherit (lib.types)
|
||||
listOf
|
||||
enum
|
||||
port
|
||||
str
|
||||
;
|
||||
|
||||
inherit (utils) escapeSystemdExecArgs;
|
||||
|
||||
|
@ -41,6 +46,20 @@ in
|
|||
description = "Internal port of the signal server.";
|
||||
};
|
||||
|
||||
metricsPort = mkOption {
|
||||
type = port;
|
||||
default = 9091;
|
||||
description = "Internal port of the metrics server.";
|
||||
};
|
||||
|
||||
extraOptions = mkOption {
|
||||
type = listOf str;
|
||||
default = [ ];
|
||||
description = ''
|
||||
Additional options given to netbird-signal as commandline arguments.
|
||||
'';
|
||||
};
|
||||
|
||||
logLevel = mkOption {
|
||||
type = enum [
|
||||
"ERROR"
|
||||
|
@ -54,24 +73,38 @@ in
|
|||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
assertions = [
|
||||
{
|
||||
assertion = cfg.port != cfg.metricsPort;
|
||||
message = "The primary listen port cannot be the same as the listen port for the metrics endpoint";
|
||||
}
|
||||
];
|
||||
|
||||
systemd.services.netbird-signal = {
|
||||
after = [ "network.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
|
||||
serviceConfig = {
|
||||
ExecStart = escapeSystemdExecArgs [
|
||||
(getExe' cfg.package "netbird-signal")
|
||||
"run"
|
||||
# Port to listen on
|
||||
"--port"
|
||||
cfg.port
|
||||
# Log to stdout
|
||||
"--log-file"
|
||||
"console"
|
||||
# Log level
|
||||
"--log-level"
|
||||
cfg.logLevel
|
||||
];
|
||||
ExecStart = escapeSystemdExecArgs (
|
||||
[
|
||||
(getExe' cfg.package "netbird-signal")
|
||||
"run"
|
||||
# Port to listen on
|
||||
"--port"
|
||||
cfg.port
|
||||
# Port the internal prometheus server listens on
|
||||
"--metrics-port"
|
||||
cfg.metricsPort
|
||||
# Log to stdout
|
||||
"--log-file"
|
||||
"console"
|
||||
# Log level
|
||||
"--log-level"
|
||||
cfg.logLevel
|
||||
]
|
||||
++ cfg.extraOptions
|
||||
);
|
||||
|
||||
Restart = "always";
|
||||
RuntimeDirectory = "netbird-mgmt";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue