From da90ba721e626511f4bd9c45188b71563bc5a11b Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Thu, 9 Jan 2025 19:56:35 -0800 Subject: [PATCH] ttrss: Add management of postgresql daemon in a shared manner - This allows ttrss to disabled postgresql if it is not needed by any other app and enable postgresql if it is disabled and ttrss is being enabled. Tests: - When disabling ttrss and it is the last app using postgresql, it will be disabled too. - When disabling ttrss and it is not the last app using postgresql, it will not be disabled too. - When enabling ttrss if postgresql is disabled, it will be enabled too. Signed-off-by: Sunil Mohan Adapa Reviewed-by: James Valleroy --- plinth/modules/ttrss/__init__.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/plinth/modules/ttrss/__init__.py b/plinth/modules/ttrss/__init__.py index a5900e9cf..35850c8cd 100644 --- a/plinth/modules/ttrss/__init__.py +++ b/plinth/modules/ttrss/__init__.py @@ -7,7 +7,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, SharedDaemon from plinth.modules.apache.components import Webserver from plinth.modules.backups.components import BackupRestore from plinth.modules.firewall.components import Firewall @@ -85,8 +85,11 @@ class TTRSSApp(app_module.App): last_updated_version=5) self.add(webserver) - daemon = Daemon('daemon-ttrss', 'tt-rss') - self.add(daemon) + daemon1 = SharedDaemon('shared-daemon-ttrss-postgresql', 'postgresql') + self.add(daemon1) + + daemon2 = Daemon('daemon-ttrss', 'tt-rss') + self.add(daemon2) users_and_groups = UsersAndGroups('users-and-groups-ttrss', groups=groups) @@ -98,6 +101,7 @@ class TTRSSApp(app_module.App): def enable(self): """Enable components and API access.""" + super().enable() privileged.enable_api_access() # Try to set the domain to one of the available TLS domains @@ -107,8 +111,6 @@ class TTRSSApp(app_module.App): domain = next(names.get_available_tls_domains(), None) privileged.set_domain(domain) - super().enable() - def setup(self, old_version): """Install and configure the app.""" privileged.pre_setup()