misc: add uwsgi spooler (#50891)

This commit is contained in:
Valentin Deniaud 2021-02-17 10:54:20 +01:00
parent 38ba201a5f
commit a6f2a755e1
7 changed files with 25 additions and 2 deletions

15
combo/utils/spooler.py Normal file
View File

@ -0,0 +1,15 @@
# combo - content management system
# Copyright (C) 2021 Entr'ouvert
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

1
debian/combo.dirs vendored
View File

@ -4,3 +4,4 @@
/var/lib/combo/collectstatic
/var/lib/combo/tenants
/var/log/combo
/var/lib/combo/spooler

1
debian/combo.init vendored
View File

@ -39,6 +39,7 @@ GROUP=$NAME
DAEMON_ARGS=${DAEMON_ARGS:-"--pidfile=$PIDFILE
--uid $USER --gid $GROUP
--ini /etc/$NAME/uwsgi.ini
--spooler /var/lib/$NAME/spooler/
--daemonize /var/log/uwsgi.$NAME.log"}
# Load the VERBOSE setting and other rcS variables

View File

@ -21,6 +21,7 @@ case "$1" in
chown $USER:$GROUP /var/log/$NAME
chown $USER:$GROUP /var/lib/$NAME/collectstatic
chown $USER:$GROUP /var/lib/$NAME/tenants
chown $USER:$GROUP /var/lib/$NAME/spooler
# create a secret file
SECRET_FILE=$CONFIG_DIR/secret
if [ ! -f $SECRET_FILE ]; then

View File

@ -10,7 +10,8 @@ User=%p
Group=%p
ExecStartPre=/usr/bin/combo-manage migrate_schemas --noinput --verbosity 1
ExecStartPre=/usr/bin/combo-manage collectstatic --noinput
ExecStart=/usr/bin/uwsgi --ini /etc/%p/uwsgi.ini
ExecStartPre=/bin/mkdir -p /var/lib/combo/spooler/%m/
ExecStart=/usr/bin/uwsgi --ini /etc/%p/uwsgi.ini --spooler /var/lib/combo/spooler/%m/
ExecReload=/bin/kill -HUP $MAINPID
KillSignal=SIGQUIT
TimeoutStartSec=0

3
debian/control vendored
View File

@ -41,7 +41,8 @@ Depends: ${misc:Depends},
python3-psycopg2,
python3-django-mellon (>= 1.13),
uwsgi,
uwsgi-plugin-python3
uwsgi-plugin-python3,
python3-uwsgidecorators
Recommends: nginx
Suggests: postgresql
Breaks: python-combo (<< 2.34.post2)

3
debian/uwsgi.ini vendored
View File

@ -12,6 +12,9 @@ http-socket = /run/combo/combo.sock
chmod-socket = 666
vacuum = true
spooler-processes = 3
spooler-python-import = combo.utils.spooler
master = true
enable-threads = true
harakiri = 120