Merge pull request #73 from Ma27/fix-port-collision

update: 2025.8.2 -> 2025.8.3; fix port collisions
This commit is contained in:
Maximilian Bosch 2025-09-18 08:30:15 +02:00 committed by GitHub
commit 4c626ed84c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 105 additions and 13 deletions

8
flake.lock generated
View file

@ -3,16 +3,16 @@
"authentik-src": { "authentik-src": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1757951234, "lastModified": 1758035356,
"narHash": "sha256-4RU/mllgqoykXqeO67iodmhsgIrJqow0LitaQGLKS8Q=", "narHash": "sha256-DkvxDwHCfSqEpZ9rRXNR8MP0Mz/y1kHAr38exrHQ39c=",
"owner": "goauthentik", "owner": "goauthentik",
"repo": "authentik", "repo": "authentik",
"rev": "28ff5614006ceea21b2633da8c675eb75c6bacdd", "rev": "680feaefa17934471a6b33ebc35caf5b64120404",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "goauthentik", "owner": "goauthentik",
"ref": "version/2025.8.2", "ref": "version/2025.8.3",
"repo": "authentik", "repo": "authentik",
"type": "github" "type": "github"
} }

View file

@ -42,7 +42,7 @@
}; };
authentik-src = { authentik-src = {
# change version string in outputs as well when updating # change version string in outputs as well when updating
url = "github:goauthentik/authentik/version/2025.8.2"; url = "github:goauthentik/authentik/version/2025.8.3";
flake = false; flake = false;
}; };
}; };
@ -67,7 +67,7 @@
... ...
}: }:
let let
authentik-version = "2025.8.2"; # to pass to the drvs of some components authentik-version = "2025.8.3"; # to pass to the drvs of some components
in in
{ {
systems = import inputs.systems; systems = import inputs.systems;

View file

@ -103,12 +103,40 @@ in
``` ```
''; '';
}; };
worker = {
listenHTTP = mkOption {
type = types.str;
default = "[::1]:9001";
description = ''
Listen address for the HTTP server of the worker.
Overrides the default listen setting that's also used by the server.
'';
};
listenMetrics = mkOption {
type = types.str;
default = "[::1]:9301";
description = ''
Listen address for the metrics server of the worker.
Overrides the default listen setting that's also used by the server.
'';
};
};
}; };
# LDAP oupost # LDAP oupost
authentik-ldap = { authentik-ldap = {
enable = mkEnableOption "authentik LDAP outpost"; enable = mkEnableOption "authentik LDAP outpost";
listenMetrics = mkOption {
type = types.str;
default = "[::1]:9302";
description = ''
Listen address for the metrics server of the LDAP outpost.
Overrides the default listen setting that's also used by the server.
'';
};
environmentFile = mkOption { environmentFile = mkOption {
type = types.nullOr pathToSecret; type = types.nullOr pathToSecret;
default = null; default = null;
@ -132,6 +160,31 @@ in
authentik-proxy = { authentik-proxy = {
enable = mkEnableOption "authentik Proxy outpost"; enable = mkEnableOption "authentik Proxy outpost";
listenMetrics = mkOption {
type = types.str;
default = "[::1]:9303";
description = ''
Listen address for the metrics server of the proxy outpost.
Overrides the default listen setting that's also used by the server.
'';
};
listenHTTPS = mkOption {
type = types.str;
default = "[::1]:9004";
description = ''
Listen address for the HTTPS server of the proxy outpost.
Overrides the default listen setting that's also used by the server.
'';
};
listenHTTP = mkOption {
type = types.str;
default = "[::1]:9005";
description = ''
Listen address for the HTTP server of the proxy outpost.
Overrides the default listen setting that's also used by the server.
'';
};
environmentFile = mkOption { environmentFile = mkOption {
type = types.nullOr pathToSecret; type = types.nullOr pathToSecret;
default = null; default = null;
@ -155,6 +208,15 @@ in
authentik-radius = { authentik-radius = {
enable = mkEnableOption "authentik RADIUS outpost"; enable = mkEnableOption "authentik RADIUS outpost";
listenMetrics = mkOption {
type = types.str;
default = "[::1]:9306";
description = ''
Listen address for the metrics server of the RADIUS outpost.
Overrides the default listen setting that's also used by the server.
'';
};
environmentFile = mkOption { environmentFile = mkOption {
type = types.nullOr pathToSecret; type = types.nullOr pathToSecret;
default = null; default = null;
@ -263,13 +325,15 @@ in
systemd.services = { systemd.services = {
authentik-migrate = { authentik-migrate = {
requiredBy = [ "authentik.service" ];
requires = lib.optionals cfg.createDatabase [ "postgresql.service" ]; requires = lib.optionals cfg.createDatabase [ "postgresql.service" ];
wants = [ "network-online.target" ]; wants = [ "network-online.target" ];
after = [ "network-online.target" ] ++ lib.optionals cfg.createDatabase [ "postgresql.service" ]; after = [ "network-online.target" ] ++ lib.optionals cfg.createDatabase [ "postgresql.service" ];
before = [ "authentik.service" ]; before = [ "authentik.service" "authentik-migrate.service" ];
restartTriggers = [ config.environment.etc."authentik/config.yml".source ]; restartTriggers = [ config.environment.etc."authentik/config.yml".source ];
environment = mkMerge [ environment { TZ = tz; } ]; environment = mkMerge [
environment
{ TZ = tz; }
];
serviceConfig = mkMerge [ serviceConfig = mkMerge [
serviceDefaults serviceDefaults
{ {
@ -289,7 +353,6 @@ in
]; ];
}; };
authentik-worker = { authentik-worker = {
requiredBy = [ "authentik.service" ];
wants = [ "network-online.target" ]; wants = [ "network-online.target" ];
after = [ "network-online.target" ]; after = [ "network-online.target" ];
before = [ "authentik.service" ]; before = [ "authentik.service" ];
@ -297,7 +360,14 @@ in
preStart = '' preStart = ''
ln -svf ${config.services.authentik.authentikComponents.staticWorkdirDeps}/* /run/authentik/ ln -svf ${config.services.authentik.authentikComponents.staticWorkdirDeps}/* /run/authentik/
''; '';
environment = mkMerge [ environment { TZ = tz; } ]; environment = mkMerge [
environment
{
TZ = tz;
AUTHENTIK_LISTEN__LISTEN_HTTP = cfg.worker.listenHTTP;
AUTHENTIK_LISTEN__LISTEN_METRICS = cfg.worker.listenMetrics;
}
];
serviceConfig = mkMerge [ serviceConfig = mkMerge [
serviceDefaults serviceDefaults
{ {
@ -318,10 +388,15 @@ in
authentik = { authentik = {
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
wants = [ "network-online.target" ]; wants = [ "network-online.target" ];
requires = [
"authentik-migrate.service"
"authentik-worker.service"
];
after = [ after = [
"network-online.target" "network-online.target"
"redis-authentik.service" "redis-authentik.service"
] ++ (lib.optionals cfg.createDatabase [ "postgresql.service" ]); ]
++ (lib.optionals cfg.createDatabase [ "postgresql.service" ]);
restartTriggers = [ config.environment.etc."authentik/config.yml".source ]; restartTriggers = [ config.environment.etc."authentik/config.yml".source ];
preStart = '' preStart = ''
ln -svf ${cfg.authentikComponents.staticWorkdirDeps}/* /var/lib/authentik/ ln -svf ${cfg.authentikComponents.staticWorkdirDeps}/* /var/lib/authentik/
@ -329,7 +404,10 @@ in
mkdir -p ${cfg.settings.storage.media.file.path} mkdir -p ${cfg.settings.storage.media.file.path}
''} ''}
''; '';
environment = mkMerge [ environment { TZ = tz; } ]; environment = mkMerge [
environment
{ TZ = tz; }
];
serviceConfig = mkMerge [ serviceConfig = mkMerge [
serviceDefaults serviceDefaults
{ {
@ -374,6 +452,7 @@ in
"network-online.target" "network-online.target"
"authentik.service" "authentik.service"
]; ];
environment.AUTHENTIK_LISTEN__METRICS = cfg.listenMetrics;
serviceConfig = { serviceConfig = {
RuntimeDirectory = "authentik-ldap"; RuntimeDirectory = "authentik-ldap";
UMask = "0027"; UMask = "0027";
@ -400,6 +479,11 @@ in
"network-online.target" "network-online.target"
"authentik.service" "authentik.service"
]; ];
environment = {
AUTHENTIK_LISTEN__METRICS = cfg.listenMetrics;
AUTHENTIK_LISTEN__HTTP = cfg.listenHTTP;
AUTHENTIK_LISTEN__HTTPS = cfg.listenHTTPS;
};
serviceConfig = { serviceConfig = {
RuntimeDirectory = "authentik-proxy"; RuntimeDirectory = "authentik-proxy";
UMask = "0027"; UMask = "0027";
@ -426,6 +510,7 @@ in
"network-online.target" "network-online.target"
"authentik.service" "authentik.service"
]; ];
environment.AUTHENTIK_LISTEN__METRICS = cfg.listenMetrics;
serviceConfig = { serviceConfig = {
RuntimeDirectory = "authentik-radius"; RuntimeDirectory = "authentik-radius";
UMask = "0027"; UMask = "0027";

View file

@ -91,5 +91,12 @@ pkgs.nixosTest {
machine.succeed("su - alice -c 'firefox http://localhost/' >&2 &") machine.succeed("su - alice -c 'firefox http://localhost/' >&2 &")
machine.wait_for_text("authentik") machine.wait_for_text("authentik")
machine.screenshot("5_nginx_proxies_requests") machine.screenshot("5_nginx_proxies_requests")
with subtest("metrics & worker"):
machine.wait_for_open_port(9300)
machine.wait_for_open_port(9301)
print(machine.succeed("curl -L localhost:9300/metrics | grep authentik_outpost_connection | grep 'Embedded'"))
print(machine.succeed("curl -L localhost:9301/metrics | grep authentik_tasks_total"))
''; '';
} }