diff --git a/actions/radicale b/actions/radicale index 05d0b7b67..517d658af 100755 --- a/actions/radicale +++ b/actions/radicale @@ -22,13 +22,20 @@ Configuration helper for Radicale. import argparse import augeas +import os import subprocess from distutils.version import LooseVersion as LV from plinth import action_utils CONFIG_FILE = '/etc/radicale/config' + 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') @@ -79,6 +86,14 @@ def subcommand_setup(_): action_utils.service_restart('radicale') 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): """Sets the radicale rights type to a particular value""" diff --git a/data/etc/apache2/conf-available/radicale2-freedombox.conf b/data/etc/apache2/conf-available/radicale2-freedombox.conf index 2219e1846..d3501f622 100644 --- a/data/etc/apache2/conf-available/radicale2-freedombox.conf +++ b/data/etc/apache2/conf-available/radicale2-freedombox.conf @@ -17,8 +17,8 @@ Redirect 301 /.well-known/caldav /radicale/ Include includes/freedombox-auth-ldap.conf Require valid-user - ProxyPass http://localhost:5232/ - ProxyPassReverse http://localhost:5232/ + ProxyPass unix:/run/uwsgi/app/radicale/socket|uwsgi://radicale/ + ProxyPassReverse unix:/run/uwsgi/app/radicale/socket|uwsgi://radicale/ RequestHeader set X-Script-Name /radicale/ RequestHeader set X-Remote-User expr=%{REMOTE_USER} diff --git a/plinth/modules/radicale/__init__.py b/plinth/modules/radicale/__init__.py index be2564213..4b3653b8d 100644 --- a/plinth/modules/radicale/__init__.py +++ b/plinth/modules/radicale/__init__.py @@ -35,7 +35,7 @@ service = None managed_services = ['radicale'] -managed_packages = ['radicale'] +managed_packages = ['radicale', 'uwsgi', 'uwsgi-plugin-python3'] name = _('Radicale')