searx: Fix issue with uwsgi crashing

Latest version of uwsgi in Debian crashes when trying to auto load plugins for
an unknown option. Workaround uwsgi crashing by disabling auto load explicitly.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2018-05-07 21:50:20 +05:30 committed by James Valleroy
parent e1ab5b7131
commit c1d2e0e1db
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808
2 changed files with 23 additions and 5 deletions

View File

@ -20,6 +20,7 @@ Configuration helper for searx.
"""
import argparse
import augeas
import os
import secrets
import shutil
@ -31,6 +32,8 @@ from plinth.utils import gunzip
SETTINGS_FILE = '/etc/searx/settings.yml'
UWSGI_FILE = '/etc/uwsgi/apps-available/searx.ini'
def parse_arguments():
"""Return parsed command line arguments as dictionary."""
@ -64,10 +67,22 @@ def _copy_uwsgi_configuration():
"""
example_config = ('/usr/share/doc/searx/examples/'
'uwsgi/apps-available/searx.ini')
destination = '/etc/uwsgi/apps-available/'
if not os.path.exists(UWSGI_FILE):
shutil.copy(example_config, os.path.dirname(UWSGI_FILE))
if not os.path.exists(os.path.join(destination, 'searx.ini')):
shutil.copy(example_config, destination)
def _update_uwsgi_configuration():
"""Fix uwsgi configuration.
uwsgi 2.0.15-debian crashes when trying to autoload.
"""
aug = augeas.Augeas(
flags=augeas.Augeas.NO_LOAD + augeas.Augeas.NO_MODL_AUTOLOAD)
aug.set('/augeas/load/inifile/lens', 'Puppet.lns')
aug.set('/augeas/load/inifile/incl[last() + 1]', UWSGI_FILE)
aug.load()
aug.set('/files/etc/uwsgi/apps-available/searx.ini/uwsgi/autoload', 'false')
aug.save()
def _generate_secret_key(settings):
@ -119,6 +134,7 @@ def write_settings(settings):
def subcommand_setup(_):
"""Post installation actions for Searx"""
_copy_uwsgi_configuration()
_update_uwsgi_configuration()
action_utils.webserver_enable('proxy_uwsgi', kind='module')
if not os.path.exists(SETTINGS_FILE):

View File

@ -31,7 +31,7 @@ from .manifest import clients
clients = clients
version = 1
version = 2
managed_services = ['searx']
@ -80,7 +80,9 @@ def setup(helper, old_version=None):
"""Install and configure the module."""
helper.install(managed_packages)
helper.call('post', actions.superuser_run, 'searx', ['setup'])
helper.call('post', actions.superuser_run, 'searx', ['enable'])
if not old_version:
helper.call('post', actions.superuser_run, 'searx', ['enable'])
global service
if service is None:
service = service_module.Service(managed_services[0], name, ports=[