debian: use uwsgi to serve app (#29297)

This commit is contained in:
Emmanuel Cazenave 2020-09-03 15:10:26 +02:00
parent a137632a16
commit b31754c4ae
7 changed files with 107 additions and 16 deletions

45
debian/authentic2-multitenant-uwsgi.ini vendored Normal file
View File

@ -0,0 +1,45 @@
[uwsgi]
auto-procname = true
procname-prefix-spaced = authentic2-multitenant
strict = true
plugin = python3
single-interpreter = true
module = authentic2.wsgi:application
need-app = true
http-socket = /run/authentic2-multitenant/authentic2-multitenant.sock
chmod-socket = 666
vacuum = true
master = true
enable-threads = true
harakiri = 120
processes = 500
plugin = cheaper_busyness
cheaper-algo = busyness
cheaper = 5
cheaper-initial = 10
cheaper-overload = 5
cheaper-step = 10
cheaper-busyness-multiplier = 30
cheaper-busyness-min = 20
cheaper-busyness-max = 70
cheaper-busyness-backlog-alert = 16
cheaper-busyness-backlog-step = 2
max-requests = 500
max-worker-lifetime = 7200
buffer-size = 32768
py-tracebacker = /run/authentic2-multitenant/py-tracebacker.sock.
stats = /run/authentic2-multitenant/stats.sock
ignore-sigpipe = true
if-file = /etc/authentic2-multitenant/uwsgi-local.ini
include = /etc/authentic2-multitenant/uwsgi-local.ini
endif =

View File

@ -1,3 +1,4 @@
debian/multitenant/authentic2-multitenant-manage /usr/bin
debian/multitenant/config.py /etc/authentic2-multitenant
debian/multitenant/debian_config.py /usr/lib/authentic2-multitenant
debian/authentic2-multitenant-uwsgi.ini /etc/authentic2-multitenant

View File

@ -10,18 +10,16 @@ User=authentic-multitenant
Group=authentic-multitenant
ExecStartPre=/usr/bin/authentic2-multitenant-manage migrate_schemas --noinput
ExecStartPre=/usr/bin/authentic2-multitenant-manage collectstatic --noinput
ExecStart=/usr/bin/gunicorn3 \
--bind unix:/run/%p/%p.sock \
--worker-class=sync \
--workers 5 \
--timeout=60 \
--name %p \
authentic2.wsgi:application
ExecStart=/usr/bin/uwsgi --ini /etc/%p/%p-uwsgi.ini
ExecReload=/bin/kill -HUP $MAINPID
KillSignal=SIGQUIT
TimeoutStartSec=0
PrivateTmp=true
Restart=on-failure
RuntimeDirectory=%p
Type=notify
StandardError=syslog
NotifyAccess=all
[Install]
WantedBy=multi-user.target

45
debian/authentic2-uwsgi.ini vendored Normal file
View File

@ -0,0 +1,45 @@
[uwsgi]
auto-procname = true
procname-prefix-spaced = authentic2
strict = true
plugin = python3
single-interpreter = true
module = authentic2.wsgi:application
need-app = true
http-socket = /run/authentic2/authentic2.sock
chmod-socket = 666
vacuum = true
master = true
enable-threads = true
harakiri = 120
processes = 500
plugin = cheaper_busyness
cheaper-algo = busyness
cheaper = 5
cheaper-initial = 10
cheaper-overload = 5
cheaper-step = 10
cheaper-busyness-multiplier = 30
cheaper-busyness-min = 20
cheaper-busyness-max = 70
cheaper-busyness-backlog-alert = 16
cheaper-busyness-backlog-step = 2
max-requests = 500
max-worker-lifetime = 7200
buffer-size = 32768
py-tracebacker = /run/authentic2/py-tracebacker.sock.
stats = /run/authentic2/stats.sock
ignore-sigpipe = true
if-file = /etc/authentic2/uwsgi-local.ini
include = /etc/authentic2/uwsgi-local.ini
endif =

View File

@ -3,3 +3,4 @@ debian/authentic2-manage /usr/bin
debian/conf/nginx-example.conf /usr/share/authentic2
debian/debian_config.py /usr/lib/authentic2
debian/launch-authentic2.sh /usr/lib/authentic2
debian/authentic2-uwsgi.ini /etc/authentic2

View File

@ -10,18 +10,16 @@ User=authentic2
Group=authentic2
ExecStartPre=/usr/bin/authentic2-manage migrate --noinput
ExecStartPre=/usr/bin/authentic2-manage collectstatic --noinput
ExecStart=/usr/lib/authentic2/launch-authentic2.sh \
--bind unix:/run/%p/%p.sock \
--worker-class=sync \
--workers 5 \
--timeout=60 \
--name %p \
authentic2.wsgi:application
ExecStart=/usr/bin/uwsgi --ini /etc/%p/%p-uwsgi.ini
ExecReload=/bin/kill -HUP $MAINPID
KillSignal=SIGQUIT
TimeoutStartSec=0
PrivateTmp=true
Restart=on-failure
RuntimeDirectory=%p
Type=notify
StandardError=syslog
NotifyAccess=all
[Install]
WantedBy=multi-user.target

7
debian/control vendored
View File

@ -55,7 +55,9 @@ Architecture: all
Depends: ${misc:Depends}, adduser,
python3-authentic2 (= ${binary:Version}),
python3-psycopg2,
gunicorn3, dbconfig-common,
uwsgi,
uwsgi-plugin-python3,
dbconfig-common,
debconf | debconf-2.0, ucf
Recommends: postgresql-client
Suggests: nginx, postgresql
@ -75,7 +77,8 @@ Depends: ${misc:Depends}, adduser,
python3-django-tenant-schemas (>= 1.5.2.1),
python3-hobo,
python3-jwcrypto (>= 0.4.2),
gunicorn3,
uwsgi,
uwsgi-plugin-python3,
debconf | debconf-2.0, ucf
Recommends: postgresql-client
Suggests: nginx, postgresql