SearXNG is a free internet metasearch engine which aggregates results from various search services and databases. Users are neither tracked nor profiled.
Python bingbravedegoogleduckduckgogooglemetasearchprivacypythonqwantsearchsearch-enginesearxsearxngstartpageyahoo
utils/lib.sh: make uWSGI installation available for all distros
Markus Heiserd5917cc029e2
diff --git a/Makefile b/Makefileindex 1504072a5..f62db2f03 100644--- a/Makefile+++ b/Makefile@@ -84,11 +84,11 @@ test.pylint: pyenvinstall$(call cmd,pylint,searx/testing.py)test.sh:- shellcheck -x utils/lxc.shshellcheck -x utils/lib.shshellcheck -x utils/filtron.shshellcheck -x utils/searx.shshellcheck -x utils/morty.sh+ shellcheck -x utils/lxc.shshellcheck -x .config.shtest.pep8: pyenvinstalldiff --git a/utils/lib.sh b/utils/lib.shindex f74187f47..39b9134d0 100755--- a/utils/lib.sh+++ b/utils/lib.sh@@ -692,18 +692,37 @@ apache_dissable_site() {# -----uWSGI_SETUP="${uWSGI_SETUP:=/etc/uwsgi}"+uWSGI_USER=+uWSGI_GROUP=++# How distros manage uWSGI apps is very different. From uWSGI POV read:+# - https://uwsgi-docs.readthedocs.io/en/latest/Management.htmlcase $DIST_ID-$DIST_VERS inubuntu-*|debian-*)# init.d --> /usr/share/doc/uwsgi/README.Debian.gz+ # For uWSGI debian uses the LSB init process, this might be changed+ # one day, see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=833067uWSGI_APPS_AVAILABLE="${uWSGI_SETUP}/apps-available"uWSGI_APPS_ENABLED="${uWSGI_SETUP}/apps-enabled";;arch-*)# systemd --> /usr/lib/systemd/system/[email protected]- uWSGI_APPS_AVAILABLE="${uWSGI_SETUP}"+ # For uWSGI archlinux uses systemd template units, see+ # - http://0pointer.de/blog/projects/instances.html+ # - https://uwsgi-docs.readthedocs.io/en/latest/Systemd.html#one-service-per-app-in-systemd+ uWSGI_APPS_AVAILABLE="${uWSGI_SETUP}/apps-archlinux"uWSGI_APPS_ENABLED="${uWSGI_SETUP}";;+ fedora-*)+ # systemd --> /usr/lib/systemd/system/uwsgi.service+ # The unit file starts uWSGI in emperor mode (/etc/uwsgi.ini), see+ # - https://uwsgi-docs.readthedocs.io/en/latest/Emperor.html+ uWSGI_APPS_AVAILABLE="${uWSGI_SETUP}/apps-available"+ uWSGI_APPS_ENABLED="${uWSGI_SETUP}.d"+ uWSGI_USER="uwsgi"+ uWSGI_GROUP="uwsgi"+ ;;*)info_msg "$DIST_ID-$DIST_VERS: uWSGI not yet implemented";;@@ -723,10 +742,25 @@ uWSGI_restart() {case $DIST_ID-$DIST_VERS inubuntu-*|debian-*)+ # the 'service' method seems broken in that way, that it (re-)starts+ # the whole uwsgi process.service uwsgi restart "${CONF%.*}";;arch-*)- systemctl restart "uwsgi@${CONF%.*}"+ # restart systemd template instance+ if uWSGI_app_available "${CONF}"; then+ systemctl restart "uwsgi@${CONF%.*}"+ else+ info_msg "in systemd template mode: ${CONF} not installed (nothing to restart)"+ fi+ ;;+ fedora-*)+ # in emperor mode, just touch the file to restart+ if uWSGI_app_enabled "${CONF}"; then+ touch "${uWSGI_APPS_ENABLED}/${CONF}"+ else+ info_msg "in uWSGI emperor mode: ${CONF} not installed (nothing to restart)"+ fi;;*)err_msg "$DIST_ID-$DIST_VERS: uWSGI not yet implemented"@@ -765,7 +799,7 @@ uWSGI_install_app() {root root 644uWSGI_enable_app "${pos_args[1]}"uWSGI_restart "${pos_args[1]}"- info_msg "installed uWSGI app: ${pos_args[1]}"+ info_msg "uWSGI app: ${pos_args[1]} is installed"}uWSGI_remove_app() {@@ -797,6 +831,10 @@ uWSGI_app_enabled() {systemctl -q is-enabled "uwsgi@${CONF%.*}"exit_val=$?;;+ fedora-*)+ [[ -f "${uWSGI_APPS_ENABLED}/${CONF}" ]]+ exit_val=$?+ ;;*)# FIXMEerr_msg "$DIST_ID-$DIST_VERS: uWSGI not yet implemented"@@ -821,14 +859,22 @@ uWSGI_enable_app() {case $DIST_ID-$DIST_VERS inubuntu-*|debian-*)mkdir -p "${uWSGI_APPS_ENABLED}"- pushd "${uWSGI_APPS_ENABLED}" >/dev/null- rm -f "$CONF"- ln -s "${uWSGI_APPS_AVAILABLE}/${CONF}" .- popd >/dev/null+ rm -f "${uWSGI_APPS_ENABLED}/${CONF}"+ ln -s "${uWSGI_APPS_AVAILABLE}/${CONF}" "${uWSGI_APPS_ENABLED}/${CONF}"info_msg "enabled uWSGI app: ${CONF} (restart required)";;arch-*)- systemctl enable "uwsgi@${CONF%.*}"+ mkdir -p "${uWSGI_APPS_ENABLED}"+ rm -f "${uWSGI_APPS_ENABLED}/${CONF}"+ ln -s "${uWSGI_APPS_AVAILABLE}/${CONF}" "${uWSGI_APPS_ENABLED}/${CONF}"+ info_msg "enabled uWSGI app: ${CONF} (restart required)"+ ;;+ fedora-*)+ mkdir -p "${uWSGI_APPS_ENABLED}"+ rm -f "${uWSGI_APPS_ENABLED}/${CONF}"+ ln -s "${uWSGI_APPS_AVAILABLE}/${CONF}" "${uWSGI_APPS_ENABLED}/${CONF}"+ chown "${uWSGI_USER}:${uWSGI_GROUP}" "${uWSGI_APPS_ENABLED}/${CONF}"+ info_msg "enabled uWSGI app: ${CONF}";;*)# FIXME@@ -843,7 +889,7 @@ uWSGI_disable_app() {local CONF="$1"if [[ -z $CONF ]]; then- err_msg "uWSGI_enable_app: missing arguments"+ err_msg "uWSGI_disable_app: missing arguments"return 42fi@@ -856,6 +902,11 @@ uWSGI_disable_app() {arch-*)systemctl stop "uwsgi@${CONF%.*}"systemctl disable "uwsgi@${CONF%.*}"+ rm -f "${uWSGI_APPS_ENABLED}/${CONF}"+ ;;+ fedora-*)+ # in emperor mode, just remove the app.ini file+ rm -f "${uWSGI_APPS_ENABLED}/${CONF}";;*)# FIXMEdiff --git a/utils/lxc.sh b/utils/lxc.shindex 8020b1346..502f25366 100755--- a/utils/lxc.sh+++ b/utils/lxc.sh@@ -344,7 +344,7 @@ add_subordinate_ids() {del_subordinate_ids() {local out- local exit_value+ local exit_valif grep "root:${HOST_USER_ID}:1" /etc/subuid -qs; then# TODO: root user is always in use by process 1, how can we remove subordinates?info_msg "remove lxd permission to map ${HOST_USER_ID}'s user/group id through"diff --git a/utils/morty.sh b/utils/morty.shindex 37ee87edf..1ce15608f 100755--- a/utils/morty.sh+++ b/utils/morty.sh@@ -96,6 +96,11 @@ To activate morty in searx, add result_proxy to your settings.yml::result_proxy:url : ${PUBLIC_URL_MORTY}/+ server:+ ...+ image_proxy : True # Proxying image results through searx+ ...+further read: ${DOCS_URL}/admin/morty.htmlEOFdiff --git a/utils/searx.sh b/utils/searx.shindex 2bf26bba4..c6f58b6a9 100755--- a/utils/searx.sh+++ b/utils/searx.sh@@ -43,6 +43,9 @@ case $DIST_ID ingit build-essential libxslt-dev zlib1g-dev libffi-dev libssl-dev ";;arch) # pacman packages+ # FIXME:+ # - /usr/lib/uwsgi/http_plugin.so: cannot open shared object file: No such file or directory !!!+ # - /usr/lib/uwsgi/systemd_logger_plugin.so: cannot open shared object file: No such file or directory !!!SEARX_PACKAGES="\python python-pip python-lxml python-babel \uwsgi uwsgi-plugin-python \diff --git a/utils/templates/etc/uwsgi/apps-archlinux/searx.ini b/utils/templates/etc/uwsgi/apps-archlinux/searx.ininew file mode 100644index 000000000..08873cf0f--- /dev/null+++ b/utils/templates/etc/uwsgi/apps-archlinux/searx.ini@@ -0,0 +1,66 @@+[uwsgi]++# uWSGI core+# ----------+#+# https://uwsgi-docs.readthedocs.io/en/latest/Options.html#uwsgi-core++# Who will run the code+uid = ${SERVICE_USER}+gid = ${SERVICE_GROUP}++# chdir to specified directory before apps loading+chdir = ${SEARX_SRC}/searx++# searx configuration (settings.yml)+env = SEARX_SETTINGS_PATH=${SEARX_SETTINGS_PATH}++# disable logging for privacy+logger = systemd+disable-logging = false++# The right granted on the created socket+chmod-socket = 666++# Plugin to use and interpretor config+single-interpreter = true++# enable master process+master = true++# load apps in each worker instead of the master+lazy-apps = true++# load uWSGI plugins+plugin = python,http,systemd_logger++# By default the Python plugin does not initialize the GIL. This means your+# app-generated threads will not run. If you need threads, remember to enable+# them with enable-threads. Running uWSGI in multithreading mode (with the+# threads options) will automatically enable threading support. This *strange*+# default behaviour is for performance reasons.+enable-threads = true+++# plugin: python+# --------------+#+# https://uwsgi-docs.readthedocs.io/en/latest/Options.html#plugin-python++# load a WSGI module+module = searx.webapp++# set PYTHONHOME/virtualenv+virtualenv = ${SEARX_PYENV}++# add directory (or glob) to pythonpath+pythonpath = ${SEARX_SRC}+++# plugin http+# -----------+#+# https://uwsgi-docs.readthedocs.io/en/latest/Options.html#plugin-http++# Native HTTP support: https://uwsgi-docs.readthedocs.io/en/latest/HTTP.html+http = ${SEARX_INTERNAL_URL}