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
|
let
|
||||||
inherit (lib) mapAttrsToList;
|
inherit (lib) mapAttrsToList optionals;
|
||||||
|
|
||||||
port = 9888;
|
port = 9888;
|
||||||
|
|
||||||
|
@ -18,19 +18,23 @@ let
|
||||||
pkgs.python3.override {
|
pkgs.python3.override {
|
||||||
packageOverrides = _: _: {
|
packageOverrides = _: _: {
|
||||||
inherit (nix-pkgs)
|
inherit (nix-pkgs)
|
||||||
|
authens
|
||||||
django-background-tasks
|
django-background-tasks
|
||||||
|
django-browser-reload
|
||||||
django-bulma-forms
|
django-bulma-forms
|
||||||
django-translated-fields
|
django-translated-fields
|
||||||
loadcredential
|
loadcredential
|
||||||
;
|
;
|
||||||
|
|
||||||
authens = nix-pkgs.authens.overridePythonAttrs (_: {
|
|
||||||
patches = [ ./01-authens-cas-url.patch ];
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
pythonEnv = python3.withPackages (ps: [
|
pythonEnv =
|
||||||
|
{
|
||||||
|
debug ? false,
|
||||||
|
}:
|
||||||
|
python3.withPackages (
|
||||||
|
ps:
|
||||||
|
[
|
||||||
ps.django
|
ps.django
|
||||||
|
|
||||||
ps.gunicorn
|
ps.gunicorn
|
||||||
|
@ -45,18 +49,25 @@ let
|
||||||
ps.django-bulma-forms
|
ps.django-bulma-forms
|
||||||
ps.django-translated-fields
|
ps.django-translated-fields
|
||||||
ps.loadcredential
|
ps.loadcredential
|
||||||
]);
|
]
|
||||||
|
++ (optionals debug [
|
||||||
|
ps.django-browser-reload
|
||||||
|
ps.django-debug-toolbar
|
||||||
|
])
|
||||||
|
);
|
||||||
|
|
||||||
manage = pkgs.writeShellApplication {
|
manage = pkgs.writeShellApplication {
|
||||||
name = "kadenios-manage";
|
name = "kadenios-manage";
|
||||||
|
|
||||||
runtimeInputs = [ pythonEnv ];
|
runtimeInputs = path ++ [
|
||||||
|
config.systemd.package
|
||||||
|
pkgs.util-linux
|
||||||
|
];
|
||||||
|
|
||||||
text = ''
|
text = ''
|
||||||
MainPID=0
|
MainPID=$(systemctl show -p MainPID --value django-kadenios.service)
|
||||||
eval "$(${lib.getExe' config.systemd.package "systemctl"} show -pMainPID 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;
|
src = sources.kadenios;
|
||||||
|
|
||||||
nativeBuildInputs = [ pythonEnv ];
|
nativeBuildInputs = [ (pythonEnv { debug = true; }) ];
|
||||||
|
|
||||||
configurePhase = ''
|
configurePhase = ''
|
||||||
export KADENIOS_STATIC_ROOT=$out/static
|
export KADENIOS_STATIC_ROOT=$out/static
|
||||||
|
@ -95,6 +106,8 @@ let
|
||||||
KADENIOS_FROM_EMAIL = "Kadenios <vote@infra.dgnum.eu>";
|
KADENIOS_FROM_EMAIL = "Kadenios <vote@infra.dgnum.eu>";
|
||||||
KADENIOS_SERVER_EMAIL = "kadenios@infra.dgnum.eu";
|
KADENIOS_SERVER_EMAIL = "kadenios@infra.dgnum.eu";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
path = [ (pythonEnv { }) ];
|
||||||
in
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -118,9 +131,7 @@ in
|
||||||
User = "kadenios";
|
User = "kadenios";
|
||||||
};
|
};
|
||||||
|
|
||||||
inherit environment;
|
inherit environment path;
|
||||||
|
|
||||||
path = [ pythonEnv ];
|
|
||||||
|
|
||||||
script = ''
|
script = ''
|
||||||
python3 ${sources.kadenios}/manage.py migrate
|
python3 ${sources.kadenios}/manage.py migrate
|
||||||
|
@ -149,9 +160,7 @@ in
|
||||||
WorkingDirectory = sources.kadenios;
|
WorkingDirectory = sources.kadenios;
|
||||||
};
|
};
|
||||||
|
|
||||||
inherit environment;
|
inherit environment path;
|
||||||
|
|
||||||
path = [ pythonEnv ];
|
|
||||||
|
|
||||||
script = ''
|
script = ''
|
||||||
python3 manage.py process_tasks
|
python3 manage.py process_tasks
|
||||||
|
|
Loading…
Reference in a new issue