Verified Commit c1d2e0e1 authored by Sunil Mohan Adapa's avatar Sunil Mohan Adapa Committed by James Valleroy

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's avatarSunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy's avatarJames Valleroy <jvalleroy@mailbox.org>
parent e1ab5b71
......@@ -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):
......
......@@ -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=[
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment