1

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 DEBUG = _DEBUG
ALLOWED_HOSTS = [] ALLOWED_HOSTS = ["127.0.0.1"]
INTERNAL_IPS = ["127.0.0.1"] INTERNAL_IPS = ["127.0.0.1"]

View File

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