Univention Bugzilla – Bug 46532
ucsschool43 HTTP-API import: stretch dropped gunicorn start script
Last modified: 2018-03-14 13:11:56 CET
Debian Stretch dropped gunicorn start scripts. Gunicorn must run for the HTTP-API. From /usr/share/doc/gunicorn/NEWS.Debian.gz: gunicorn (19.6.0-3) unstable; urgency=medium The /etc/gunicorn.d (and related usr/sbin/gunicorn{,3}-debian) scripts were removed in 19.6.0-3 due to inflexibility, lack of documentation, not adopted/supported upstream, did not work with virtualenvs, etc. They were dropped prior to the stretch release to avoid having to support it for another full release. Users relying on this feature should invoke gunicorn manually. For an example systemd .service file, please see the ``gunicorn-mysite.service`` file in the gunicorn-examples package or a process manager such as runit, etc.
Created attachment 9445 [details] systemd unit file This seems to work. (Tested by putting it directly into /lib/systemd/system/, no packaging done.)
[4.3 3f5796db] Bug #46532: create systemd service unit for gunicorn ucs-school-import (16.0.1-6)
DB migrations are missing.
(In reply to Daniel Tröder from comment #3) > DB migrations are missing. Wrong bug (should have been Bug #46533).
(OK): code change (service file is ok; commit is incomplete; see below) OK: functional change OK: tests (gunicorn + celery are running after installation) From service file: > ExecStart=/usr/bin/gunicorn --workers=4 --bind=127.0.0.1:8000 --timeout=60 \ ucsschool.http_api.app.wsgi:application --name ucs-school-import --user root \ --group root What timeout is exactly meant by "--timeout"? The command line help is not very specific? > -t INT, --timeout INT > Workers silent for more than this many seconds are > killed and restarted. [30] Does this mean, that long-running imports that take longer than 60 seconds are killed by gunicorn? → REOPEN During installation: [...] Joinscript 40ucs-school-import-http-api.inst finished with exitcode 0 celery-worker-ucsschool-import.service is not a native service, redirecting to systemd-sysv-install. Executing: /lib/systemd/systemd-sysv-install is-enabled celery-worker-ucsschool-import Failed to get unit file state for gunicorn.service: No such file or directory gunicorn.service is a disabled or a static unit not running, not starting it. Trigger für python-support (1.0.15.18.201403132013) werden verarbeitet ... [...] --- a/ucs-school-import/debian/ucs-school-import-http-api.postinst +++ b/ucs-school-import/debian/ucs-school-import-http-api.postinst @@ -43,7 +43,7 @@ univention-config-registry set ucsschool/import/generate/import/group?true call_joinscript 40ucs-school-import-http-api.inst systemctl daemon-reload -for SERVICE in rabbitmq-server celery-worker-ucsschool-import postgresql gunicorn apache2; +for SERVICE in rabbitmq-server celery-worker-ucsschool-import postgresql ucs-school-import-http-api apache2; do deb-systemd-invoke restart "$SERVICE.service" done Applied this patch and a similar patch to the join script to test the installation. Package: ucs-school-import Version: 16.0.1-9A~4.3.0.201803112249 Branch: ucs_4.3-0 Scope: ucs-school-4.3
(In reply to Sönke Schwardt-Krummrich from comment #5) > From service file: > > ExecStart=/usr/bin/gunicorn --workers=4 --bind=127.0.0.1:8000 --timeout=60 \ > ucsschool.http_api.app.wsgi:application --name ucs-school-import --user > root \ > --group root > > What timeout is exactly meant by "--timeout"? The command line help is not > very specific? > > > -t INT, --timeout INT > > Workers silent for more than this many seconds are > > killed and restarted. [30] > > Does this mean, that long-running imports that take longer than 60 seconds > are killed by gunicorn? > → REOPEN It does indeed mean, that requests that take longer than 60s will be aborted with HTTP 50x (probably 502 or 504). The import job is however not run by Gunicorn, but by a Celery worker. IMHO we could remove the timeout completely / lower it to its default of 30s, as it is only relevant during dry-run, but there AJAX keeps making a new connection every second. But in the spirit of a quick QA, I don't change the package now.
(In reply to Daniel Tröder from comment #6) > (In reply to Sönke Schwardt-Krummrich from comment #5) > > Does this mean, that long-running imports that take longer than 60 seconds > > are killed by gunicorn? > > → REOPEN > It does indeed mean, that requests that take longer than 60s will be aborted > with HTTP 50x (probably 502 or 504). The import job is however not run by > Gunicorn, but by a Celery worker. → OK > IMHO we could remove the timeout completely / lower it to its default of > 30s, as it is only relevant during dry-run, but there AJAX keeps making a > new connection every second. But in the spirit of a quick QA, I don't change > the package now. → :-) I really appreciate this move.
UCS@school 4.3 v1 has been released. https://docs.software-univention.de/release-notes-ucsschool-4.3v1-de.html If this error occurs again, please clone this bug.