miniflux: Add management of postgresql daemon in a shared manner

- This allows miniflux to disabled postgresql if it is not needed by any other
app and enable postgresql if it is disabled and miniflux is being enabled.

Tests:

- When disabling miniflux and it is the last app using postgresql, it will be
disabled too.

- When disabling miniflux and it is not the last app using postgresql, it will
not be disabled too.

- When enabling miniflux if postgresql is disabled, it will be enabled too.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2025-01-09 19:49:02 -08:00 committed by James Valleroy
parent ea134d5777
commit 763b555e83
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808

View File

@ -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, SharedDaemon
from plinth.modules.apache.components import Webserver
from plinth.modules.backups.components import BackupRestore
from plinth.modules.firewall.components import Firewall
@ -74,6 +74,10 @@ class MinifluxApp(app_module.App):
urls=['https://{host}/miniflux/'])
self.add(webserver)
daemon = SharedDaemon('shared-daemon-miniflus-postgresql',
'postgresql')
self.add(daemon)
daemon = Daemon('daemon-miniflux', 'miniflux',
listen_ports=[(8788, 'tcp4'), (8788, 'tcp6')])
self.add(daemon)