1
Fork 0

move to gunicorn

I didn't manage to get the uwsgi python plugin to work. It complained
about unrecognized argument `--module`.
This commit is contained in:
Motiejus Jakštys 2024-01-13 17:40:12 +02:00
parent c291c5e0c9
commit af7647dd95
2 changed files with 11 additions and 19 deletions

View File

@ -16,7 +16,7 @@ SECRET_KEY = 'django-insecure-$e2!=equ(efm0e%f9&t+xjtz0)$*$@pw%rnjdqcl8f@5o5hw!l
DEBUG = _DEBUG
ALLOWED_HOSTS = []
ALLOWED_HOSTS = ["127.0.0.1"]
INTERNAL_IPS = ["127.0.0.1"]

View File

@ -31,12 +31,7 @@
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs {inherit system;};
uwsgiPort = 8001;
uwsgi = pkgs.uwsgi.override {
plugins = ["python3"];
python3 = pkgs.python3;
};
gunicornPort = 8001;
appDeps = with pkgs; [
python3Packages.django_5
@ -80,8 +75,8 @@
"${pkgs.zopfli}/bin/zopfli {} && ${pkgs.brotli}/bin/brotli {}"
'';
};
packages.e11sync-uwsgi = pkgs.stdenv.mkDerivation {
name = "e11sync-uwsgi";
packages.e11sync-gunicorn = pkgs.stdenv.mkDerivation {
name = "e11sync-gunicorn";
propagatedBuildInputs = [runtimeDeps];
nativeBuildInputs = [pkgs.makeWrapper];
src = self;
@ -89,16 +84,13 @@
buildPhase = ''
mkdir -p $out;
cp -r ${self}/app $out
makeWrapper ${uwsgi}/bin/uwsgi $out/bin/entrypoint-uwsgi \
--add-flags '\
--chdir='"$out"'/app \
--module=e11sync.wsgi:application \
--master \
--http-socket=127.0.0.1:${toString uwsgiPort} \
--processes=5 \
--harakiri=20 \
--max-requests=10000 \
--vacuum'
makeWrapper ${pkgs.python3Packages.gunicorn}/bin/gunicorn $out/bin/entrypoint \
--chdir $out/app \
--set E11SYNC_DEBUG "" \
--set E11SYNC_COMPRESS_OFFLINE 1 \
--set GEOIP_PATH "${geoip}" \
--add-flags e11sync.wsgi \
--add-flags --bind=127.0.0.1:${toString gunicornPort}
'';
};