mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-09-19 04:59:01 +00:00
miniflux: Fix DB connection issues during install/uninstall
Fixes: #2536. Multiple fixes: - When miniflux and postgresql are install simultaneously, miniflux setup may be installed before postgresql is started. - When postgresql is already installed and disabled (due to a previous uninstall), then postgresql may not be running during miniflux package installation (and fail initial DB setup). - When app is being installed while it is disabled, the database may not running and may lead to failure in removing the app database. Tests: - Run functional tests on stable/testing twice in a row. - Install the app without postgresql or miniflux installed. - Disable the app and uninstall it. DB is purged. - Uninstall and re-install (with postgresql is disabled during installed). Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
f9ca06dc5f
commit
60c57b6707
@ -58,7 +58,12 @@ class MinifluxApp(app_module.App):
|
|||||||
login_required=True)
|
login_required=True)
|
||||||
self.add(shortcut)
|
self.add(shortcut)
|
||||||
|
|
||||||
packages = Packages('packages-miniflux', ['miniflux', 'postgresql'])
|
# miniflux package does not depend on postgres. Install postgresql,
|
||||||
|
# start it and only then install miniflux.
|
||||||
|
packages = Packages('packages-miniflux-postgresql', ['postgresql'])
|
||||||
|
self.add(packages)
|
||||||
|
|
||||||
|
packages = Packages('packages-miniflux', ['miniflux'])
|
||||||
self.add(packages)
|
self.add(packages)
|
||||||
|
|
||||||
drop_in_configs = DropinConfigs(
|
drop_in_configs = DropinConfigs(
|
||||||
@ -74,7 +79,7 @@ class MinifluxApp(app_module.App):
|
|||||||
urls=['https://{host}/miniflux/'])
|
urls=['https://{host}/miniflux/'])
|
||||||
self.add(webserver)
|
self.add(webserver)
|
||||||
|
|
||||||
daemon = SharedDaemon('shared-daemon-miniflus-postgresql',
|
daemon = SharedDaemon('shared-daemon-miniflux-postgresql',
|
||||||
'postgresql')
|
'postgresql')
|
||||||
self.add(daemon)
|
self.add(daemon)
|
||||||
|
|
||||||
@ -89,7 +94,17 @@ class MinifluxApp(app_module.App):
|
|||||||
def setup(self, old_version=None):
|
def setup(self, old_version=None):
|
||||||
"""Install and configure the app."""
|
"""Install and configure the app."""
|
||||||
privileged.pre_setup()
|
privileged.pre_setup()
|
||||||
super().setup(old_version)
|
|
||||||
|
# Database needs to be running for successful initialization or upgrade
|
||||||
|
# of miniflux database. 1. The app and database are being freshly
|
||||||
|
# installed. 2. The app is being freshly installed, but database server
|
||||||
|
# is already installed but disabled. 3. The app is being updated to new
|
||||||
|
# version but is currently disabled (DB is installed but disabled or
|
||||||
|
# enabled).
|
||||||
|
with self.get_component(
|
||||||
|
'shared-daemon-miniflux-postgresql').ensure_running():
|
||||||
|
super().setup(old_version)
|
||||||
|
|
||||||
privileged.setup(old_version)
|
privileged.setup(old_version)
|
||||||
if not old_version:
|
if not old_version:
|
||||||
self.enable()
|
self.enable()
|
||||||
@ -97,7 +112,11 @@ class MinifluxApp(app_module.App):
|
|||||||
def uninstall(self):
|
def uninstall(self):
|
||||||
"""De-configure and uninstall the app."""
|
"""De-configure and uninstall the app."""
|
||||||
privileged.uninstall()
|
privileged.uninstall()
|
||||||
super().uninstall()
|
with self.get_component(
|
||||||
|
'shared-daemon-miniflux-postgresql').ensure_running():
|
||||||
|
# Database needs to be running for successful removal miniflux
|
||||||
|
# database.
|
||||||
|
super().uninstall()
|
||||||
|
|
||||||
|
|
||||||
class MinifluxBackupRestore(BackupRestore):
|
class MinifluxBackupRestore(BackupRestore):
|
||||||
|
|||||||
@ -123,8 +123,13 @@ def reset_user_password(username: str, password: secret_str):
|
|||||||
@privileged
|
@privileged
|
||||||
def uninstall():
|
def uninstall():
|
||||||
"""Ensure that the database is removed."""
|
"""Ensure that the database is removed."""
|
||||||
action_utils.debconf_set_selections(
|
action_utils.debconf_set_selections([
|
||||||
['miniflux miniflux/purge boolean true'])
|
'miniflux miniflux/purge boolean true',
|
||||||
|
'miniflux miniflux/dbconfig-install boolean true',
|
||||||
|
'miniflux miniflux/dbconfig-reinstall boolean true'
|
||||||
|
'miniflux miniflux/dbconfig-upgrade boolean true',
|
||||||
|
'miniflux miniflux/dbconfig-remove boolean true',
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
def _get_database_config():
|
def _get_database_config():
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user