misc: add uwsgi spooler (#50723)

This commit is contained in:
Lauréline Guérin 2021-02-09 10:07:52 +01:00
parent 24296826b1
commit cd5d93ca52
No known key found for this signature in database
GPG Key ID: 1FAB9B9B4F93D473
6 changed files with 24 additions and 2 deletions

16
chrono/utils/spooler.py Normal file
View File

@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
# chrono - agendas 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/chrono.dirs vendored
View File

@ -1,5 +1,6 @@
/etc/chrono
/usr/lib/chrono
/var/lib/chrono/collectstatic
/var/lib/chrono/spooler
/var/lib/chrono/tenants
/var/log/chrono

1
debian/chrono.init vendored
View File

@ -38,6 +38,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

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

3
debian/control vendored
View File

@ -10,7 +10,8 @@ Architecture: all
Depends: ${misc:Depends}, ${python3:Depends},
python3-django (>= 1:1.11),
python3-gadjo,
python3-requests
python3-requests,
python3-uwsgidecorators
Recommends: python3-django-mellon
Description: Agendas System (Python 3 module)

2
debian/uwsgi.ini vendored
View File

@ -12,6 +12,8 @@ http-socket = /run/chrono/chrono.sock
chmod-socket = 666
vacuum = true
spooler-processes = 3
spooler-python-import = chrono.utils.spooler
# every five minutes
cron = -5 -1 -1 -1 -1 /usr/bin/chrono-manage tenant_command cancel_events --all-tenants -v0
cron = -5 -1 -1 -1 -1 /usr/bin/chrono-manage tenant_command send_email_notifications --all-tenants -v0