From 8c4999eabd89e1e85dc815cc853b26e8cf3b91e5 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Tue, 12 Jul 2022 13:25:59 -0700 Subject: [PATCH] config: Set volatile logging by default This reduces the number of writes to the disk improving disk longevity and IO performance. Note that systemd-journald is already very reasonable with how often it writes to the disk. It's flush interval is 5 minutes. Most users of FreedomBox are not expected to see logs. Those that see the logs do so for debugging purposes. Debugging can still be done if reboot does not occur. Users can change the logging mode to 'persistent' before debugging issues that require reboot. This makes debugging harder for non-reproducible bugs, but is, at present, considered an acceptable compromise. Tests: - On a fresh container, with the patch applied, config page shows 'volatile' as the logging mode. - On an container with changes not applied, start freedombox service. Then apply the patch and restart service. config app setup will be run. Config page shows 'volatile' as the logging mode. Signed-off-by: Sunil Mohan Adapa Reviewed-by: James Valleroy --- plinth/modules/config/__init__.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plinth/modules/config/__init__.py b/plinth/modules/config/__init__.py index 0de181ce9..45a78dacd 100644 --- a/plinth/modules/config/__init__.py +++ b/plinth/modules/config/__init__.py @@ -19,6 +19,8 @@ from plinth.modules.names.components import DomainType from plinth.package import Packages from plinth.signals import domain_added +from . import privileged + _description = [ _('Here you can set some general configuration options ' 'like hostname, domain name, webserver home page etc.') @@ -40,7 +42,7 @@ class ConfigApp(app_module.App): app_id = 'config' - _version = 3 + _version = 4 can_be_disabled = False @@ -195,6 +197,9 @@ def setup(helper, old_version=None): app.setup(old_version) _migrate_home_page_config() + if old_version <= 3: + privileged.set_logging_mode('volatile') + # systemd-journald is socket activated, it may not be running and it does # not support reload. actions.superuser_run('service', ['try-restart', 'systemd-journald'])