From b1cc874abb9fa58600d384cc7c521abc70d1daf3 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Tue, 18 Aug 2026 16:26:19 -0700 Subject: [PATCH] apache: Stop installing uwsgi by default Closes: Debian #1144740. - When one of the applications such as bepasty, radicale, or searx need it, then install it. - Reduces the number of dependencies for freedombox package. - Reduces size of the disk image. - Ensures that uwsgi does not run on every freedombox machine. - Apache's proxy_uwsgi module (provided by apache2-bin, apache2) can still be enabled by default because uwsgi is not a dependency for the Apache module and uwsgi socket connections are not attempted until specific configuration is enabled and requests arrive. - Change dependency from uwsgi-core to uwsgi. uwsgi-core does not have init scripts but uwsgi package has init script (but only on trixie and not forky and up). The init script is disabled and masked by bepasty, radicale, and searx apps. So, this should not be a problem. Tests: - On a freshly installed Debian forky and trixie machines, install freedombox deb package built with changes. Installation succeeds. uwsgi is not installed at all. bepasty and radicale can be installed and basic requests to web UI work. uwsgi init script is not started and is masked. - Functional tests for bepasty and radicale work. - On a Trixie machine, setup freedombox from trixie. Then install freedombox deb package with the patch. uwsgi is not marked as manually installed and running unattended-updates will remove it. Install bepasty and uwsgi package is installed and marked as manually installed. - On a Trixie machine, setup freedombox from trixie. Install the bepasty app. Then install freedombox deb package with the patch. uwsgi is marked as manually installed and running unattended-updates will not remove it. Signed-off-by: Sunil Mohan Adapa Reviewed-by: James Valleroy --- plinth/modules/apache/__init__.py | 13 ++++--------- plinth/modules/backups/components.py | 2 +- plinth/modules/backups/tests/test_components.py | 4 ---- plinth/modules/bepasty/__init__.py | 11 ++++++++--- plinth/modules/radicale/__init__.py | 11 ++++++++--- plinth/modules/searx/__init__.py | 12 +++++++++--- 6 files changed, 30 insertions(+), 23 deletions(-) diff --git a/plinth/modules/apache/__init__.py b/plinth/modules/apache/__init__.py index 2de1bcddc..b9ab3c0f4 100644 --- a/plinth/modules/apache/__init__.py +++ b/plinth/modules/apache/__init__.py @@ -69,7 +69,7 @@ from plinth import action_utils from plinth import app as app_module from plinth import cfg from plinth.config import DropinConfigs -from plinth.daemon import Daemon, RelatedDaemon +from plinth.daemon import Daemon from plinth.modules import names from plinth.modules.firewall.components import Firewall from plinth.modules.letsencrypt.components import LetsEncrypt @@ -96,10 +96,9 @@ class ApacheApp(app_module.App): is_essential=True, name=_('Apache HTTP Server')) self.add(info) - packages = Packages('packages-apache', [ - 'apache2', 'php-fpm', 'ssl-cert', 'uwsgi-core', - 'uwsgi-plugin-python3', 'libapache2-mod-auth-openidc' - ]) + packages = Packages( + 'packages-apache', + ['apache2', 'php-fpm', 'ssl-cert', 'libapache2-mod-auth-openidc']) self.add(packages) dropin_configs = DropinConfigs('dropin-configs-apache', [ @@ -134,10 +133,6 @@ class ApacheApp(app_module.App): daemon = Daemon('daemon-apache', 'apache2') self.add(daemon) - # To be able to disable the old uwsgi init.d script. - related_daemon = RelatedDaemon('related-daemon-apache', 'uwsgi') - self.add(related_daemon) - @staticmethod def post_init(): """Perform post initialization operations.""" diff --git a/plinth/modules/backups/components.py b/plinth/modules/backups/components.py index 4a8e020b7..e06a6a012 100644 --- a/plinth/modules/backups/components.py +++ b/plinth/modules/backups/components.py @@ -42,7 +42,7 @@ def _validate_service(service): """Validate a service manifest provided as a dictionary.""" assert isinstance(service['name'], str) assert isinstance(service['type'], str) - assert service['type'] in ('apache', 'uwsgi', 'system') + assert service['type'] in ('apache', 'system') if service['type'] == 'apache': assert service['kind'] in ('config', 'site', 'module') diff --git a/plinth/modules/backups/tests/test_components.py b/plinth/modules/backups/tests/test_components.py index a42829443..1772f0f38 100644 --- a/plinth/modules/backups/tests/test_components.py +++ b/plinth/modules/backups/tests/test_components.py @@ -87,10 +87,6 @@ def test_invalid_directories_and_files(section): None, [], ['service'], - [{ - 'type': 'uwsgi', - 'name': 'service' - }], [{ 'type': 'system', 'name': 'service' diff --git a/plinth/modules/bepasty/__init__.py b/plinth/modules/bepasty/__init__.py index 6d0fa5781..ea814ab1b 100644 --- a/plinth/modules/bepasty/__init__.py +++ b/plinth/modules/bepasty/__init__.py @@ -6,7 +6,7 @@ from django.utils.translation import gettext_lazy as _ from plinth import app as app_module from plinth import frontpage, menu from plinth.config import DropinConfigs -from plinth.daemon import Daemon +from plinth.daemon import Daemon, RelatedDaemon from plinth.modules.apache.components import Webserver from plinth.modules.backups.components import BackupRestore from plinth.modules.firewall.components import Firewall @@ -50,7 +50,7 @@ class BepastyApp(app_module.App): app_id = 'bepasty' - _version = 4 + _version = 5 def __init__(self) -> None: """Create components for the app.""" @@ -72,7 +72,8 @@ class BepastyApp(app_module.App): clients=manifest.clients, tags=info.tags) self.add(shortcut) - packages = Packages('packages-bepasty', ['bepasty']) + packages = Packages('packages-bepasty', + ['bepasty', 'uwsgi', 'uwsgi-plugin-python3']) self.add(packages) dropin_configs = DropinConfigs('dropin-configs-bepasty', [ @@ -97,6 +98,10 @@ class BepastyApp(app_module.App): **manifest.backup) self.add(backup_restore) + # To be able to disable the old uwsgi init.d script. + related_daemon = RelatedDaemon('related-daemon-bepasty', 'uwsgi') + self.add(related_daemon) + def setup(self, old_version): """Install and configure the app.""" super().setup(old_version) diff --git a/plinth/modules/radicale/__init__.py b/plinth/modules/radicale/__init__.py index 7eab78db5..f21f4bdaf 100644 --- a/plinth/modules/radicale/__init__.py +++ b/plinth/modules/radicale/__init__.py @@ -10,7 +10,7 @@ from django.utils.translation import gettext_lazy as _ from plinth import app as app_module from plinth import cfg, frontpage, menu from plinth.config import DropinConfigs -from plinth.daemon import Daemon +from plinth.daemon import Daemon, RelatedDaemon from plinth.modules.apache.components import Webserver from plinth.modules.backups.components import BackupRestore from plinth.modules.firewall.components import Firewall @@ -42,7 +42,7 @@ class RadicaleApp(app_module.App): app_id = 'radicale' - _version = 6 + _version = 7 def __init__(self) -> None: """Create components for the app.""" @@ -66,7 +66,8 @@ class RadicaleApp(app_module.App): tags=info.tags, login_required=True) self.add(shortcut) - packages = Packages('packages-radicale', ['radicale'], + packages = Packages('packages-radicale', + ['radicale', 'uwsgi', 'uwsgi-plugin-python3'], rerun_setup_on_upgrade=True) self.add(packages) @@ -94,6 +95,10 @@ class RadicaleApp(app_module.App): **manifest.backup) self.add(backup_restore) + # To be able to disable the old uwsgi init.d script. + related_daemon = RelatedDaemon('related-daemon-radicale', 'uwsgi') + self.add(related_daemon) + def enable(self): """Fix missing directories before enabling radicale.""" privileged.fix_paths() diff --git a/plinth/modules/searx/__init__.py b/plinth/modules/searx/__init__.py index 7b13e67ef..e81e0ade9 100644 --- a/plinth/modules/searx/__init__.py +++ b/plinth/modules/searx/__init__.py @@ -8,7 +8,7 @@ from django.utils.translation import gettext_lazy as _ from plinth import app as app_module from plinth import frontpage, menu from plinth.config import DropinConfigs -from plinth.daemon import Daemon +from plinth.daemon import Daemon, RelatedDaemon from plinth.modules.apache.components import Webserver from plinth.modules.backups.components import BackupRestore from plinth.modules.firewall.components import Firewall @@ -31,7 +31,7 @@ class SearxApp(app_module.App): app_id = 'searx' - _version = 7 + _version = 8 def __init__(self) -> None: """Create components for the app.""" @@ -59,7 +59,9 @@ class SearxApp(app_module.App): # Include libjs-bootstrap to prevent accidental uninstall (see # issue #2298). - packages = Packages('packages-searx', ['searx', 'libjs-bootstrap']) + packages = Packages( + 'packages-searx', + ['searx', 'libjs-bootstrap', 'uwsgi', 'uwsgi-plugin-python3']) self.add(packages) dropin_configs = DropinConfigs('dropin-configs-searx', [ @@ -91,6 +93,10 @@ class SearxApp(app_module.App): **manifest.backup) self.add(backup_restore) + # To be able to disable the old uwsgi init.d script. + related_daemon = RelatedDaemon('related-daemon-searx', 'uwsgi') + self.add(related_daemon) + def set_shortcut_login_required(self, login_required): """Change the login_required property of shortcut.""" self.get_component('shortcut-searx').login_required = login_required