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 <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2022-07-12 13:25:59 -07:00 committed by James Valleroy
parent 80a203bd23
commit 8c4999eabd
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808

View File

@ -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'])