radicale: Switch to uwsgi for radicale 2.x

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
James Valleroy 2019-01-13 14:41:54 -05:00
parent 64036e2066
commit 72b59c0190
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808
3 changed files with 18 additions and 3 deletions

View File

@ -22,13 +22,20 @@ Configuration helper for Radicale.
import argparse import argparse
import augeas import augeas
import os
import subprocess import subprocess
from distutils.version import LooseVersion as LV from distutils.version import LooseVersion as LV
from plinth import action_utils from plinth import action_utils
CONFIG_FILE = '/etc/radicale/config' CONFIG_FILE = '/etc/radicale/config'
DEFAULT_FILE = '/etc/default/radicale' DEFAULT_FILE = '/etc/default/radicale'
UWSGI_FILE = '/etc/uwsgi/apps-available/radicale.ini'
UWSGI_LINK = '/etc/uwsgi/apps-enabled/radicale.ini'
VERSION_2 = LV('2') VERSION_2 = LV('2')
@ -79,6 +86,14 @@ def subcommand_setup(_):
action_utils.service_restart('radicale') action_utils.service_restart('radicale')
action_utils.webserver_enable(_get_web_config(current_version)) action_utils.webserver_enable(_get_web_config(current_version))
# Enable uwsgi for radicale 2.x. Do this after radicale is
# started, so it creates the necessary folders.
if current_version and current_version >= VERSION_2:
if not os.path.exists(UWSGI_LINK):
os.symlink(UWSGI_FILE, UWSGI_LINK)
action_utils.webserver_enable('proxy_uwsgi', kind='module')
action_utils.service_restart('uwsgi')
def subcommand_configure(arguments): def subcommand_configure(arguments):
"""Sets the radicale rights type to a particular value""" """Sets the radicale rights type to a particular value"""

View File

@ -17,8 +17,8 @@ Redirect 301 /.well-known/caldav /radicale/
Include includes/freedombox-auth-ldap.conf Include includes/freedombox-auth-ldap.conf
Require valid-user Require valid-user
ProxyPass http://localhost:5232/ ProxyPass unix:/run/uwsgi/app/radicale/socket|uwsgi://radicale/
ProxyPassReverse http://localhost:5232/ ProxyPassReverse unix:/run/uwsgi/app/radicale/socket|uwsgi://radicale/
RequestHeader set X-Script-Name /radicale/ RequestHeader set X-Script-Name /radicale/
RequestHeader set X-Remote-User expr=%{REMOTE_USER} RequestHeader set X-Remote-User expr=%{REMOTE_USER}
</Location> </Location>

View File

@ -35,7 +35,7 @@ service = None
managed_services = ['radicale'] managed_services = ['radicale']
managed_packages = ['radicale'] managed_packages = ['radicale', 'uwsgi', 'uwsgi-plugin-python3']
name = _('Radicale') name = _('Radicale')