components: drop celery, package manage.py instead

This commit is contained in:
WilliButz 2024-02-21 21:59:49 +01:00
parent 8edfcf318a
commit d85dacb6c2
No known key found for this signature in database
GPG key ID: AB05DF703EB9DC70
5 changed files with 21 additions and 18 deletions

View file

@ -1,13 +0,0 @@
{ authentikComponents
, makeWrapper
, runCommandLocal
}:
runCommandLocal "authentik-celery" {
nativeBuildInputs = [ makeWrapper ];
} ''
mkdir -vp $out/bin
ln -sv ${authentikComponents.pythonEnv}/bin/celery $out/bin/celery
wrapProgram $out/bin/celery \
--prefix PYTHONPATH : ${authentikComponents.staticWorkdirDeps}
''

View file

@ -29,7 +29,7 @@ pkgs.lib.makeScope pkgs.newScope (final:
inherit authentik-src; inherit authentik-src;
}; };
# worker # worker
celery = final.callPackage ./celery.nix { manage = final.callPackage ./manage.nix {
}; };
in in
{ {
@ -41,7 +41,7 @@ pkgs.lib.makeScope pkgs.newScope (final:
gopkgs gopkgs
staticWorkdirDeps staticWorkdirDeps
migrate migrate
celery; manage;
}; };
inherit authentik-src authentik-version; inherit authentik-src authentik-version;
} }

16
components/manage.nix Normal file
View file

@ -0,0 +1,16 @@
{ authentik-src
, authentikComponents
, makeWrapper
, runCommandLocal
}:
runCommandLocal "authentik-manage" {
nativeBuildInputs = [ makeWrapper ];
} ''
mkdir -vp $out/bin
cp -v ${authentik-src}/manage.py $out/bin/manage.py
wrapProgram $out/bin/manage.py \
--prefix PATH : ${authentikComponents.pythonEnv}/bin \
--prefix PYTHONPATH : ${authentikComponents.staticWorkdirDeps}
''

View file

@ -58,7 +58,7 @@
imports = [ ./module.nix ]; imports = [ ./module.nix ];
services.authentik.authentikComponents = pkgs.lib.mkDefault (withSystem pkgs.stdenv.hostPlatform.system ( services.authentik.authentikComponents = pkgs.lib.mkDefault (withSystem pkgs.stdenv.hostPlatform.system (
{ config, ... }: { config, ... }:
{ inherit (config.packages) celery staticWorkdirDeps migrate pythonEnv frontend gopkgs docs; } { inherit (config.packages) manage staticWorkdirDeps migrate pythonEnv frontend gopkgs docs; }
)); ));
}; };
@ -92,7 +92,7 @@
gopkgs gopkgs
staticWorkdirDeps staticWorkdirDeps
migrate migrate
celery; manage;
# terraform provider # terraform provider
terraform-provider-authentik = inputs.nixpkgs-23-05.legacyPackages.${system}.buildGo118Module rec { terraform-provider-authentik = inputs.nixpkgs-23-05.legacyPackages.${system}.buildGo118Module rec {

View file

@ -165,7 +165,7 @@ in
DynamicUser = true; DynamicUser = true;
User = "authentik"; User = "authentik";
# TODO maybe make this configurable # TODO maybe make this configurable
ExecStart = "${cfg.authentikComponents.celery}/bin/celery -A authentik.root.celery worker -Ofair --max-tasks-per-child=1 --autoscale 3,1 -E -B -s /tmp/celerybeat-schedule -Q authentik,authentik_scheduled,authentik_events"; ExecStart = "${cfg.authentikComponents.manage}/bin/manage.py worker";
EnvironmentFile = mkIf (cfg.environmentFile != null) [ cfg.environmentFile ]; EnvironmentFile = mkIf (cfg.environmentFile != null) [ cfg.environmentFile ];
LoadCredential = mkIf (cfg.nginx.enable && cfg.nginx.enableACME) [ LoadCredential = mkIf (cfg.nginx.enable && cfg.nginx.enableACME) [
"${cfg.nginx.host}.pem:${config.security.acme.certs.${cfg.nginx.host}.directory}/fullchain.pem" "${cfg.nginx.host}.pem:${config.security.acme.certs.${cfg.nginx.host}.directory}/fullchain.pem"