forked from DGNum/infrastructure
feat(kadenios): Fix build of static files and restore cas.eleves.ens.fr for authens
This commit is contained in:
parent
1216a0a780
commit
be128f6c3a
2 changed files with 38 additions and 40 deletions
|
@ -1,11 +0,0 @@
|
|||
diff --git a/src/authens/utils.py b/src/authens/utils.py
|
||||
index 7306506..36063b6 100644
|
||||
--- a/src/authens/utils.py
|
||||
+++ b/src/authens/utils.py
|
||||
@@ -16,7 +16,7 @@ def get_cas_client(request):
|
||||
service_url=urlunparse(
|
||||
(request.scheme, request.get_host(), request.path, "", "", "")
|
||||
),
|
||||
- server_url="https://cas.eleves.ens.fr/",
|
||||
+ server_url="https://cas-eleves.dgnum.eu/",
|
||||
)
|
|
@ -7,7 +7,7 @@
|
|||
}:
|
||||
|
||||
let
|
||||
inherit (lib) mapAttrsToList;
|
||||
inherit (lib) mapAttrsToList optionals;
|
||||
|
||||
port = 9888;
|
||||
|
||||
|
@ -18,45 +18,56 @@ let
|
|||
pkgs.python3.override {
|
||||
packageOverrides = _: _: {
|
||||
inherit (nix-pkgs)
|
||||
authens
|
||||
django-background-tasks
|
||||
django-browser-reload
|
||||
django-bulma-forms
|
||||
django-translated-fields
|
||||
loadcredential
|
||||
;
|
||||
|
||||
authens = nix-pkgs.authens.overridePythonAttrs (_: {
|
||||
patches = [ ./01-authens-cas-url.patch ];
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
pythonEnv = python3.withPackages (ps: [
|
||||
ps.django
|
||||
pythonEnv =
|
||||
{
|
||||
debug ? false,
|
||||
}:
|
||||
python3.withPackages (
|
||||
ps:
|
||||
[
|
||||
ps.django
|
||||
|
||||
ps.gunicorn
|
||||
ps.gunicorn
|
||||
|
||||
ps.markdown
|
||||
ps.numpy
|
||||
ps.networkx
|
||||
ps.psycopg
|
||||
ps.markdown
|
||||
ps.numpy
|
||||
ps.networkx
|
||||
ps.psycopg
|
||||
|
||||
ps.authens
|
||||
ps.django-background-tasks
|
||||
ps.django-bulma-forms
|
||||
ps.django-translated-fields
|
||||
ps.loadcredential
|
||||
]);
|
||||
ps.authens
|
||||
ps.django-background-tasks
|
||||
ps.django-bulma-forms
|
||||
ps.django-translated-fields
|
||||
ps.loadcredential
|
||||
]
|
||||
++ (optionals debug [
|
||||
ps.django-browser-reload
|
||||
ps.django-debug-toolbar
|
||||
])
|
||||
);
|
||||
|
||||
manage = pkgs.writeShellApplication {
|
||||
name = "kadenios-manage";
|
||||
|
||||
runtimeInputs = [ pythonEnv ];
|
||||
runtimeInputs = path ++ [
|
||||
config.systemd.package
|
||||
pkgs.util-linux
|
||||
];
|
||||
|
||||
text = ''
|
||||
MainPID=0
|
||||
eval "$(${lib.getExe' config.systemd.package "systemctl"} show -pMainPID django-kadenios.service)"
|
||||
MainPID=$(systemctl show -p MainPID --value django-kadenios.service)
|
||||
|
||||
${lib.getExe' pkgs.util-linux "nsenter"} -e -a -t "$MainPID" -G follow -S follow python ${sources.kadenios}/manage.py "$@"
|
||||
nsenter -e -a -t "$MainPID" -G follow -S follow python ${sources.kadenios}/manage.py "$@"
|
||||
'';
|
||||
};
|
||||
|
||||
|
@ -65,7 +76,7 @@ let
|
|||
|
||||
src = sources.kadenios;
|
||||
|
||||
nativeBuildInputs = [ pythonEnv ];
|
||||
nativeBuildInputs = [ (pythonEnv { debug = true; }) ];
|
||||
|
||||
configurePhase = ''
|
||||
export KADENIOS_STATIC_ROOT=$out/static
|
||||
|
@ -95,6 +106,8 @@ let
|
|||
KADENIOS_FROM_EMAIL = "Kadenios <vote@infra.dgnum.eu>";
|
||||
KADENIOS_SERVER_EMAIL = "kadenios@infra.dgnum.eu";
|
||||
};
|
||||
|
||||
path = [ (pythonEnv { }) ];
|
||||
in
|
||||
|
||||
{
|
||||
|
@ -118,9 +131,7 @@ in
|
|||
User = "kadenios";
|
||||
};
|
||||
|
||||
inherit environment;
|
||||
|
||||
path = [ pythonEnv ];
|
||||
inherit environment path;
|
||||
|
||||
script = ''
|
||||
python3 ${sources.kadenios}/manage.py migrate
|
||||
|
@ -149,9 +160,7 @@ in
|
|||
WorkingDirectory = sources.kadenios;
|
||||
};
|
||||
|
||||
inherit environment;
|
||||
|
||||
path = [ pythonEnv ];
|
||||
inherit environment path;
|
||||
|
||||
script = ''
|
||||
python3 manage.py process_tasks
|
||||
|
|
Loading…
Reference in a new issue