Skip to content

Commit

Permalink
nixos/netbird: fix port conflict on metrics endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
TheRealGramdalf committed Nov 18, 2024
1 parent 76e882d commit af24957
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 14 deletions.
2 changes: 2 additions & 0 deletions nixos/doc/manual/release-notes/rl-2411.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
- `authelia` has been upgraded to version 4.38. This version brings several features and improvements which are detailed in the [release blog post](https://www.authelia.com/blog/4.38-release-notes/).
This release also deprecates some configuration keys which are likely to be removed in version 5.0.0.

- `netbird` has been updated to 0.32.0. This adds a built-in relay server which is not yet supported by the NixOS module, as well as a metrics endpoint for both the management and signal services. The default metrics port for the `signal` service has been changed from `9090` to `9091` to prevent a port conflict with the management server. This can be changed by overriding their respective `extraOptions` as needed. Refer to the [release notes](https://github.com/netbirdio/netbird/releases/tag/v0.32.0) and [this pull request](https://github.com/NixOS/nixpkgs/pull/354032#issuecomment-2480925927) for more information.

- `compressDrv` can compress selected files in a derivation. `compressDrvWeb` compresses files for common web server usage (`.gz` with `zopfli`, `.br` with `brotli`).

- [`hardware.display`](#opt-hardware.display.edid.enable) is a new module implementing workarounds for misbehaving monitors
Expand Down
41 changes: 27 additions & 14 deletions nixos/modules/services/networking/netbird/signal.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ let
mkOption
;

inherit (lib.types) enum port str;
inherit (lib.types) listOf enum port str;

inherit (utils) escapeSystemdExecArgs;

Expand All @@ -41,6 +41,17 @@ in
description = "Internal port of the signal server.";
};

extraOptions = mkOption {
type = listOf str;
default = [ "--metrics-port 9091" ];
description = ''
Additional options given to netbird-signal as commandline arguments.
*Due to the recent addition of a metrics endpoint, this sets the metrics listen port
to `9091` to avoid a port conflict with netbird-signal*
'';
};

logLevel = mkOption {
type = enum [
"ERROR"
Expand All @@ -59,19 +70,21 @@ in
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
# Log to stdout
"--log-file"
"console"
# Log level
"--log-level"
cfg.logLevel
]
++ cfg.extraOptions;

Restart = "always";
RuntimeDirectory = "netbird-mgmt";
Expand Down

0 comments on commit af24957

Please sign in to comment.