From 68effd5eda7a0e47ffddf5ed328d412251b12ebc Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Mon, 11 Oct 2021 19:55:53 +0200 Subject: [PATCH 1/6] [brand] SearXNG - bash env PYLINT_SEARXNG_DISABLE_OPTION Signed-off-by: Markus Heiser --- manage | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/manage b/manage index 457115ce4..daa7171da 100755 --- a/manage +++ b/manage @@ -33,7 +33,7 @@ while IFS= read -r line; do YAMLLINT_FILES+=("$line") done <<< "$(git ls-files './tests/*.yml' './searx/*.yml' './utils/templates/etc/searxng/*.yml')" -PYLINT_SEARX_DISABLE_OPTION="\ +PYLINT_SEARXNG_DISABLE_OPTION="\ I,C,R,\ W0105,W0212,W0511,W0603,W0613,W0621,W0702,W0703,W1401,\ E1136" @@ -70,7 +70,7 @@ py.: build : Build python packages at ./${PYDIST} clean : delete virtualenv and intermediate py files pyenv.: - install : developer install of searx into virtualenv + install : developer install of SearXNG into virtualenv uninstall : uninstall developer installation cmd ... : run command ... in virtualenv OK : test if virtualenv is OK @@ -620,13 +620,13 @@ test.pylint() { build_msg TEST "[pylint] searx/engines" python ${PYLINT_OPTIONS} ${PYLINT_VERBOSE} \ - --disable="${PYLINT_SEARX_DISABLE_OPTION}" \ + --disable="${PYLINT_SEARXNG_DISABLE_OPTION}" \ --additional-builtins="${PYLINT_ADDITIONAL_BUILTINS_FOR_ENGINES}" \ searx/engines build_msg TEST "[pylint] searx tests" python ${PYLINT_OPTIONS} ${PYLINT_VERBOSE} \ - --disable="${PYLINT_SEARX_DISABLE_OPTION}" \ + --disable="${PYLINT_SEARXNG_DISABLE_OPTION}" \ --ignore=searx/engines \ searx tests ) From a9fc4885f2d4ab3fba8fd9fbaa0386090250bd11 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Mon, 11 Oct 2021 19:59:34 +0200 Subject: [PATCH 2/6] [brand] SearXNG - bash env SEARXNG_URL Signed-off-by: Markus Heiser --- docs/admin/engines/settings.rst | 2 +- docs/conf.py | 4 ++-- docs/dev/makefile.rst | 2 +- utils/brand.env | 2 +- utils/build_env.py | 2 +- utils/filtron.sh | 2 +- utils/lib_install.sh | 14 +++++++------- utils/morty.sh | 2 +- utils/searx.sh | 4 ++-- .../etc/httpd/sites-available/searx.conf:uwsgi | 4 ++-- .../default.apps-available/searx.conf:filtron | 6 +++--- 11 files changed, 22 insertions(+), 22 deletions(-) diff --git a/docs/admin/engines/settings.rst b/docs/admin/engines/settings.rst index 7a354afee..c67b45669 100644 --- a/docs/admin/engines/settings.rst +++ b/docs/admin/engines/settings.rst @@ -109,7 +109,7 @@ Global Settings Changing a value tagged by :ref:`buildenv `, needs to rebuild instance's environment :ref:`utils/brand.env `. -``base_url`` : :ref:`buildenv SEARX_URL ` +``base_url`` : :ref:`buildenv SEARXNG_URL ` The base URL where SearXNG is deployed. Used to create correct inbound links. If you change the value, don't forget to rebuild instance's environment (:ref:`utils/brand.env `) diff --git a/docs/conf.py b/docs/conf.py index da36db88a..4828679e8 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -14,7 +14,7 @@ copyright = '2021 SearXNG team, 2015-2021 Adam Tauber, Noémi Ványi' author = '2021 SearXNG team, 2015-2021 Adam Tauber' release, version = VERSION_STRING, VERSION_STRING -SEARX_URL = get_setting('server.base_url') or 'https://example.org/searxng' +SEARXNG_URL = get_setting('server.base_url') or 'https://example.org/searxng' ISSUE_URL = get_setting('brand.issue_url') DOCS_URL = get_setting('brand.docs_url') PUBLIC_INSTANCES = get_setting('brand.public_instances') @@ -58,7 +58,7 @@ extlinks['pull-searx'] = ('https://github.com/searx/searx/pull/%s', 'PR ') # links to custom brand extlinks['origin'] = (GIT_URL + '/blob/' + GIT_BRANCH + '/%s', 'git://') extlinks['patch'] = (GIT_URL + '/commit/%s', '#') -extlinks['search'] = (SEARX_URL + '/%s', '#') +extlinks['search'] = (SEARXNG_URL + '/%s', '#') extlinks['docs'] = (DOCS_URL + '/%s', 'docs: ') extlinks['pypi'] = ('https://pypi.org/project/%s', 'PyPi: ') extlinks['man'] = ('https://manpages.debian.org/jump?q=%s', '') diff --git a/docs/dev/makefile.rst b/docs/dev/makefile.rst index 1db3ed703..6e563b1bd 100644 --- a/docs/dev/makefile.rst +++ b/docs/dev/makefile.rst @@ -107,7 +107,7 @@ The ``make buildenv`` target will update the *build environment* in: Tasks running outside of an *installed instance*, need the following settings from the YAML configuration: -- ``SEARX_URL`` from :ref:`server.base_url ` (aka +- ``SEARXNG_URL`` from :ref:`server.base_url ` (aka ``PUBLIC_URL``) - ``SEARXNG_BIND_ADDRESS`` from :ref:`server.bind_address ` - ``SEARXNG_PORT`` from :ref:`server.port ` diff --git a/utils/brand.env b/utils/brand.env index 5cc2af35b..31afce53c 100644 --- a/utils/brand.env +++ b/utils/brand.env @@ -1,4 +1,4 @@ -export SEARX_URL='' +export SEARXNG_URL='' export SEARXNG_PORT='8888' export SEARXNG_BIND_ADDRESS='127.0.0.1' export GIT_URL='https://github.com/searxng/searxng' diff --git a/utils/build_env.py b/utils/build_env.py index cd2fc2d04..709da6815 100644 --- a/utils/build_env.py +++ b/utils/build_env.py @@ -28,7 +28,7 @@ def _env(*arg, **kwargs): name_val = [ - ('SEARX_URL' , 'server.base_url'), + ('SEARXNG_URL' , 'server.base_url'), ('SEARXNG_PORT' , 'server.port'), ('SEARXNG_BIND_ADDRESS' , 'server.bind_address'), diff --git a/utils/filtron.sh b/utils/filtron.sh index eb34b2413..e4a4d32e8 100755 --- a/utils/filtron.sh +++ b/utils/filtron.sh @@ -560,7 +560,7 @@ This installs a reverse proxy (ProxyPass) into nginx site (${NGINX_FILTRON_SITE} # shellcheck disable=SC2034 SEARX_SRC=$("${REPO_ROOT}/utils/searx.sh" --getenv SEARX_SRC) # shellcheck disable=SC2034 - SEARX_URL_PATH=$("${REPO_ROOT}/utils/searx.sh" --getenv SEARX_URL_PATH) + SEARXNG_URL_PATH=$("${REPO_ROOT}/utils/searx.sh" --getenv SEARXNG_URL_PATH) nginx_install_app --variant=filtron "${NGINX_FILTRON_SITE}" info_msg "testing public url .." diff --git a/utils/lib_install.sh b/utils/lib_install.sh index 4fd63b830..4a251c096 100755 --- a/utils/lib_install.sh +++ b/utils/lib_install.sh @@ -116,9 +116,9 @@ install_log_searx_instance() { echo -e "---- SearXNG instance setup ${_BBlue}(status: $(install_searx_get_state))${_creset}" echo -e " SEARXNG_SETTINGS_PATH : ${_BBlue}${SEARXNG_SETTINGS_PATH}${_creset}" - echo -e " SSEARX_PYENV : ${_BBlue}${SEARX_PYENV}${_creset}" + echo -e " SEARX_PYENV : ${_BBlue}${SEARX_PYENV}${_creset}" echo -e " SEARX_SRC : ${_BBlue}${SEARX_SRC:-none}${_creset}" - echo -e " SEARX_URL : ${_BBlue}${SEARX_URL:-none}${_creset}" + echo -e " SEARXNG_URL : ${_BBlue}${SEARXNG_URL:-none}${_creset}" if in_container; then # searx is listening on 127.0.0.1 and not available from outside container @@ -184,17 +184,17 @@ install_searx_get_state(){ # shellcheck source=utils/brand.env source "${REPO_ROOT}/utils/brand.env" -# SEARX_URL aka PUBLIC_URL: the public URL of the instance (e.g. -# "https://example.org/searx"). The value is taken from environment $SEARX_URL +# SEARXNG_URL aka PUBLIC_URL: the public URL of the instance (e.g. +# "https://example.org/searx"). The value is taken from environment $SEARXNG_URL # in ./utils/brand.env. This variable is a empty string if server.base_url in # the settings.yml is set to 'false'. -SEARX_URL="${SEARX_URL:-http://$(uname -n)}" +SEARXNG_URL="${SEARXNG_URL:-http://$(uname -n)}" if in_container; then # hint: Linux containers do not have DNS entries, lets use IPs - SEARX_URL="http://$(primary_ip)" + SEARXNG_URL="http://$(primary_ip)" fi -PUBLIC_URL="${SEARX_URL}" +PUBLIC_URL="${SEARXNG_URL}" source_dot_config diff --git a/utils/morty.sh b/utils/morty.sh index 60220df02..fdbe2b54e 100755 --- a/utils/morty.sh +++ b/utils/morty.sh @@ -513,7 +513,7 @@ This installs a reverse proxy (ProxyPass) into nginx site (${NGINX_MORTY_SITE})" # shellcheck disable=SC2034 SEARX_SRC=$("${REPO_ROOT}/utils/searx.sh" --getenv SEARX_SRC) # shellcheck disable=SC2034 - SEARX_URL_PATH=$("${REPO_ROOT}/utils/searx.sh" --getenv SEARX_URL_PATH) + SEARXNG_URL_PATH=$("${REPO_ROOT}/utils/searx.sh" --getenv SEARXNG_URL_PATH) nginx_install_app "${NGINX_MORTY_SITE}" info_msg "testing public url .." diff --git a/utils/searx.sh b/utils/searx.sh index e3393835c..00ee93010 100755 --- a/utils/searx.sh +++ b/utils/searx.sh @@ -14,9 +14,9 @@ source "${REPO_ROOT}/utils/lib_install.sh" SEARX_INTERNAL_HTTP="${SEARXNG_BIND_ADDRESS}:${SEARXNG_PORT}" -SEARX_URL_PATH="${SEARX_URL_PATH:-$(echo "${PUBLIC_URL}" \ +SEARXNG_URL_PATH="${SEARXNG_URL_PATH:-$(echo "${PUBLIC_URL}" \ | sed -e 's,^.*://[^/]*\(/.*\),\1,g')}" -[[ "${SEARX_URL_PATH}" == "${PUBLIC_URL}" ]] && SEARX_URL_PATH=/ +[[ "${SEARXNG_URL_PATH}" == "${PUBLIC_URL}" ]] && SEARXNG_URL_PATH=/ SERVICE_NAME="searx" SERVICE_USER="${SERVICE_USER:-${SERVICE_NAME}}" diff --git a/utils/templates/etc/httpd/sites-available/searx.conf:uwsgi b/utils/templates/etc/httpd/sites-available/searx.conf:uwsgi index ef702de3a..aabc125ae 100644 --- a/utils/templates/etc/httpd/sites-available/searx.conf:uwsgi +++ b/utils/templates/etc/httpd/sites-available/searx.conf:uwsgi @@ -5,10 +5,10 @@ LoadModule proxy_module ${APACHE_MODULES}/mod_proxy.so LoadModule proxy_uwsgi_module ${APACHE_MODULES}/mod_proxy_uwsgi.so # LoadModule setenvif_module ${APACHE_MODULES}/mod_setenvif.so -# SetEnvIf Request_URI "${SEARX_URL_PATH}" dontlog +# SetEnvIf Request_URI "${SEARXNG_URL_PATH}" dontlog # CustomLog /dev/null combined env=dontlog - + SecRuleEngine Off diff --git a/utils/templates/etc/nginx/default.apps-available/searx.conf:filtron b/utils/templates/etc/nginx/default.apps-available/searx.conf:filtron index a89aa38b3..e25461c47 100644 --- a/utils/templates/etc/nginx/default.apps-available/searx.conf:filtron +++ b/utils/templates/etc/nginx/default.apps-available/searx.conf:filtron @@ -1,6 +1,6 @@ # https://example.org/searx -location ${SEARX_URL_PATH} { +location ${SEARXNG_URL_PATH} { proxy_pass http://127.0.0.1:4004/; proxy_set_header Host \$host; @@ -8,9 +8,9 @@ location ${SEARX_URL_PATH} { proxy_set_header X-Real-IP \$remote_addr; proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for; proxy_set_header X-Scheme \$scheme; - proxy_set_header X-Script-Name ${SEARX_URL_PATH}; + proxy_set_header X-Script-Name ${SEARXNG_URL_PATH}; } -location ${SEARX_URL_PATH}/static/ { +location ${SEARXNG_URL_PATH}/static/ { alias ${SEARX_SRC}/searx/static/; } From 2b1252148d083eb47382733980ec069ef20dcfb6 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Mon, 11 Oct 2021 21:20:22 +0200 Subject: [PATCH 3/6] [brand] SearXNG - nginx & apache searxng.conf, uwsgi searxng.conf Signed-off-by: Markus Heiser --- docs/admin/installation-apache.rst | 2 +- docs/admin/installation-nginx.rst | 8 +- docs/admin/installation-uwsgi.rst | 14 ++-- docs/dev/lxcdev.rst | 2 +- utils/filtron.sh | 4 +- utils/searx.sh | 80 +++++++++---------- ...earx.conf:filtron => searxng.conf:filtron} | 0 .../{searx.conf:uwsgi => searxng.conf:uwsgi} | 0 ...earx.conf:filtron => searxng.conf:filtron} | 0 .../apps-archlinux/{searx.ini => searxng.ini} | 0 .../{searx.ini:socket => searxng.ini:socket} | 0 .../apps-available/{searx.ini => searxng.ini} | 0 .../{searx.ini:socket => searxng.ini:socket} | 0 13 files changed, 55 insertions(+), 55 deletions(-) rename utils/templates/etc/httpd/sites-available/{searx.conf:filtron => searxng.conf:filtron} (100%) rename utils/templates/etc/httpd/sites-available/{searx.conf:uwsgi => searxng.conf:uwsgi} (100%) rename utils/templates/etc/nginx/default.apps-available/{searx.conf:filtron => searxng.conf:filtron} (100%) rename utils/templates/etc/uwsgi/apps-archlinux/{searx.ini => searxng.ini} (100%) rename utils/templates/etc/uwsgi/apps-archlinux/{searx.ini:socket => searxng.ini:socket} (100%) rename utils/templates/etc/uwsgi/apps-available/{searx.ini => searxng.ini} (100%) rename utils/templates/etc/uwsgi/apps-available/{searx.ini:socket => searxng.ini:socket} (100%) diff --git a/docs/admin/installation-apache.rst b/docs/admin/installation-apache.rst index 4ec085825..c15e3f5a0 100644 --- a/docs/admin/installation-apache.rst +++ b/docs/admin/installation-apache.rst @@ -482,7 +482,7 @@ Restart service .. code:: sh sudo -H systemctl restart httpd - sudo -H touch /etc/uwsgi.d/searx.ini + sudo -H touch /etc/uwsgi.d/searxng.ini disable logs diff --git a/docs/admin/installation-nginx.rst b/docs/admin/installation-nginx.rst index 4f58299ee..1d982bc8f 100644 --- a/docs/admin/installation-nginx.rst +++ b/docs/admin/installation-nginx.rst @@ -146,12 +146,12 @@ Started wiki`_ is always a good resource *to keep in the pocket*. .. group-tab:: Ubuntu / debian - Create configuration at ``/etc/nginx/sites-available/searx`` and place a + Create configuration at ``/etc/nginx/sites-available/searxng`` and place a symlink to sites-enabled: .. code:: sh - sudo -H ln -s /etc/nginx/sites-available/searx /etc/nginx/sites-enabled/searx + sudo -H ln -s /etc/nginx/sites-available/searxng /etc/nginx/sites-enabled/searxng .. group-tab:: Arch Linux @@ -160,7 +160,7 @@ Started wiki`_ is always a good resource *to keep in the pocket*. .. group-tab:: Fedora / RHEL - Create configuration at ``/etc/nginx/conf.d/searx`` and place a + Create configuration at ``/etc/nginx/conf.d/searxng`` and place a symlink to sites-enabled: .. _nginx searx via filtron plus morty: @@ -365,7 +365,7 @@ Restart service: .. code:: sh sudo -H systemctl restart nginx - sudo -H touch /etc/uwsgi.d/searx.ini + sudo -H touch /etc/uwsgi.d/searxng.ini Disable logs diff --git a/docs/admin/installation-uwsgi.rst b/docs/admin/installation-uwsgi.rst index e4b35dfc2..1fb24ca8f 100644 --- a/docs/admin/installation-uwsgi.rst +++ b/docs/admin/installation-uwsgi.rst @@ -35,10 +35,10 @@ recommend two methods `systemd.unit`_ template files as described here `One service per app in systemd`_. There is one `systemd unit template`_ and one `uwsgi ini file`_ per uWSGI-app - placed at dedicated locations. Take archlinux and a searx.ini as example:: + placed at dedicated locations. Take archlinux and a searxng.ini as example:: unit template --> /usr/lib/systemd/system/uwsgi@.service - uwsgi ini files --> /etc/uwsgi/searx.ini + uwsgi ini files --> /etc/uwsgi/searxng.ini The SearXNG app can be maintained as know from common systemd units:: @@ -54,12 +54,12 @@ The `uWSGI Emperor`_ mode which fits for maintaining a large range of uwsgi apps systemd unit. The Emperor service will scan specific directories for `uwsgi ini file`_\s (also know as *vassals*). If a *vassal* is added, removed or the timestamp is modified, a corresponding action takes place: a new uWSGI - instance is started, reload or stopped. Take Fedora and a searx.ini as + instance is started, reload or stopped. Take Fedora and a searxng.ini as example:: - to start a new SearXNG instance create --> /etc/uwsgi.d/searx.ini - to reload the instance edit timestamp --> touch /etc/uwsgi.d/searx.ini - to stop instance remove ini --> rm /etc/uwsgi.d/searx.ini + to start a new SearXNG instance create --> /etc/uwsgi.d/searxng.ini + to reload the instance edit timestamp --> touch /etc/uwsgi.d/searxng.ini + to stop instance remove ini --> rm /etc/uwsgi.d/searxng.ini Distributors ============ @@ -80,7 +80,7 @@ do similar for the uWSGI infrastructure (with less comfort), the folders are:: The `uwsgi ini file`_ is enabled by a symbolic link:: - ln -s /etc/uwsgi/apps-available/searx.ini /etc/uwsgi/apps-enabled/ + ln -s /etc/uwsgi/apps-available/searxng.ini /etc/uwsgi/apps-enabled/ From debian's documentation (``/usr/share/doc/uwsgi/README.Debian.gz``): You could control specific instance(s) by issuing:: diff --git a/docs/dev/lxcdev.rst b/docs/dev/lxcdev.rst index 49a2df6c8..e13667c0b 100644 --- a/docs/dev/lxcdev.rst +++ b/docs/dev/lxcdev.rst @@ -284,7 +284,7 @@ With the command above, we stopped the SearXNG uWSGI-App in the archlinux container. The uWSGI-App for the archlinux dsitros is configured in -:origin:`utils/templates/etc/uwsgi/apps-archlinux/searx.ini`, from where at +:origin:`utils/templates/etc/uwsgi/apps-archlinux/searxng.ini`, from where at least you should attend the settings of ``uid``, ``chdir``, ``env`` and ``http``:: diff --git a/utils/filtron.sh b/utils/filtron.sh index e4a4d32e8..e9fc79c87 100755 --- a/utils/filtron.sh +++ b/utils/filtron.sh @@ -46,8 +46,8 @@ GO_VERSION="go1.17.2" GO_PKG_URL="https://golang.org/dl/${GO_VERSION}.linux-amd64.tar.gz" GO_TAR=$(basename "$GO_PKG_URL") -APACHE_FILTRON_SITE="searx.conf" -NGINX_FILTRON_SITE="searx.conf" +APACHE_FILTRON_SITE="searxng.conf" +NGINX_FILTRON_SITE="searxng.conf" # shellcheck disable=SC2034 CONFIG_FILES=( diff --git a/utils/searx.sh b/utils/searx.sh index 00ee93010..3f50646e3 100755 --- a/utils/searx.sh +++ b/utils/searx.sh @@ -29,7 +29,7 @@ GIT_BRANCH="${GIT_BRANCH:-master}" SEARX_PYENV="${SERVICE_HOME}/searx-pyenv" SEARX_SRC="${SERVICE_HOME}/searx-src" SEARXNG_SETTINGS_PATH="/etc/searxng/settings.yml" -SEARX_UWSGI_APP="searx.ini" +SEARXNG_UWSGI_APP="searxng.ini" # shellcheck disable=SC2034 SEARX_UWSGI_SOCKET="/run/uwsgi/app/searx/socket" @@ -125,7 +125,7 @@ APACHE_SEARX_SITE="searx.conf" # shellcheck disable=SC2034 CONFIG_FILES=( - "${uWSGI_APPS_AVAILABLE}/${SEARX_UWSGI_APP}" + "${uWSGI_APPS_AVAILABLE}/${SEARXNG_UWSGI_APP}" ) # shellcheck disable=SC2034 @@ -367,7 +367,7 @@ pip install -U pyyaml pip install -U -e . EOF install_settings - uWSGI_restart "$SEARX_UWSGI_APP" + uWSGI_restart "$SEARXNG_UWSGI_APP" } remove_all() { @@ -729,30 +729,30 @@ EOF } install_searx_uwsgi() { - rst_title "Install SearXNG's uWSGI app (searx.ini)" section + rst_title "Install SearXNG's uWSGI app (searxng.ini)" section echo install_uwsgi - uWSGI_install_app "$SEARX_UWSGI_APP" + uWSGI_install_app "$SEARXNG_UWSGI_APP" } remove_searx_uwsgi() { - rst_title "Remove SearXNG's uWSGI app (searx.ini)" section + rst_title "Remove SearXNG's uWSGI app (searxng.ini)" section echo - uWSGI_remove_app "$SEARX_UWSGI_APP" + uWSGI_remove_app "$SEARXNG_UWSGI_APP" } activate_service() { rst_title "Activate SearXNG (service)" section echo - uWSGI_enable_app "$SEARX_UWSGI_APP" - uWSGI_restart "$SEARX_UWSGI_APP" + uWSGI_enable_app "$SEARXNG_UWSGI_APP" + uWSGI_restart "$SEARXNG_UWSGI_APP" } deactivate_service() { rst_title "De-Activate SearXNG (service)" section echo - uWSGI_disable_app "$SEARX_UWSGI_APP" - uWSGI_restart "$SEARX_UWSGI_APP" + uWSGI_disable_app "$SEARXNG_UWSGI_APP" + uWSGI_restart "$SEARXNG_UWSGI_APP" } enable_image_proxy() { @@ -761,7 +761,7 @@ enable_image_proxy() { cd ${SEARX_SRC} sed -i -e "s/image_proxy: false/image_proxy: true/g" "$SEARXNG_SETTINGS_PATH" EOF - uWSGI_restart "$SEARX_UWSGI_APP" + uWSGI_restart "$SEARXNG_UWSGI_APP" } disable_image_proxy() { @@ -770,7 +770,7 @@ disable_image_proxy() { cd ${SEARX_SRC} sed -i -e "s/image_proxy: true/image_proxy: false/g" "$SEARXNG_SETTINGS_PATH" EOF - uWSGI_restart "$SEARX_UWSGI_APP" + uWSGI_restart "$SEARXNG_UWSGI_APP" } enable_debug() { @@ -780,7 +780,7 @@ enable_debug() { cd ${SEARX_SRC} sed -i -e "s/debug: false/debug: true/g" "$SEARXNG_SETTINGS_PATH" EOF - uWSGI_restart "$SEARX_UWSGI_APP" + uWSGI_restart "$SEARXNG_UWSGI_APP" } disable_debug() { @@ -789,7 +789,7 @@ disable_debug() { cd ${SEARX_SRC} sed -i -e "s/debug: true/debug: false/g" "$SEARXNG_SETTINGS_PATH" EOF - uWSGI_restart "$SEARX_UWSGI_APP" + uWSGI_restart "$SEARXNG_UWSGI_APP" } set_result_proxy() { @@ -869,14 +869,14 @@ EOF err_msg "~$SERVICE_USER: Missing SearXNG software!" fi - if uWSGI_app_enabled "$SEARX_UWSGI_APP"; then - info_msg "uWSGI app $SEARX_UWSGI_APP is enabled." + if uWSGI_app_enabled "$SEARXNG_UWSGI_APP"; then + info_msg "uWSGI app $SEARXNG_UWSGI_APP is enabled." else - err_msg "uWSGI app $SEARX_UWSGI_APP not enabled!" + err_msg "uWSGI app $SEARXNG_UWSGI_APP not enabled!" fi - uWSGI_app_available "$SEARX_UWSGI_APP" \ - || err_msg "uWSGI app $SEARX_UWSGI_APP not available!" + uWSGI_app_available "$SEARXNG_UWSGI_APP" \ + || err_msg "uWSGI app $SEARXNG_UWSGI_APP not available!" if in_container; then lxc_suite_info @@ -955,9 +955,9 @@ excessively bot queries." apache_install_site --variant=uwsgi "${APACHE_SEARX_SITE}" - rst_title "Install SearXNG's uWSGI app (searx.ini)" section + rst_title "Install SearXNG's uWSGI app (searxng.ini)" section echo - uWSGI_install_app --variant=socket "$SEARX_UWSGI_APP" + uWSGI_install_app --variant=socket "$SEARXNG_UWSGI_APP" if ! service_is_available "${PUBLIC_URL}"; then err_msg "Public service at ${PUBLIC_URL} is not available!" @@ -979,9 +979,9 @@ This removes apache site ${APACHE_SEARX_SITE}." apache_remove_site "${APACHE_SEARX_SITE}" - rst_title "Remove SearXNG's uWSGI app (searx.ini)" section + rst_title "Remove SearXNG's uWSGI app (searxng.ini)" section echo - uWSGI_remove_app "$SEARX_UWSGI_APP" + uWSGI_remove_app "$SEARXNG_UWSGI_APP" } rst-doc() { @@ -1025,12 +1025,12 @@ rst-doc() { # For uWSGI debian uses the LSB init process, this might be changed # one day, see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=833067 - create ${uWSGI_APPS_AVAILABLE}/${SEARX_UWSGI_APP} - enable: sudo -H ln -s ${uWSGI_APPS_AVAILABLE}/${SEARX_UWSGI_APP} ${uWSGI_APPS_ENABLED}/ - start: sudo -H service uwsgi start ${SEARX_UWSGI_APP%.*} - restart: sudo -H service uwsgi restart ${SEARX_UWSGI_APP%.*} - stop: sudo -H service uwsgi stop ${SEARX_UWSGI_APP%.*} - disable: sudo -H rm ${uWSGI_APPS_ENABLED}/${SEARX_UWSGI_APP} + create ${uWSGI_APPS_AVAILABLE}/${SEARXNG_UWSGI_APP} + enable: sudo -H ln -s ${uWSGI_APPS_AVAILABLE}/${SEARXNG_UWSGI_APP} ${uWSGI_APPS_ENABLED}/ + start: sudo -H service uwsgi start ${SEARXNG_UWSGI_APP%.*} + restart: sudo -H service uwsgi restart ${SEARXNG_UWSGI_APP%.*} + stop: sudo -H service uwsgi stop ${SEARXNG_UWSGI_APP%.*} + disable: sudo -H rm ${uWSGI_APPS_ENABLED}/${SEARXNG_UWSGI_APP} EOF ;; @@ -1043,12 +1043,12 @@ EOF # - http://0pointer.de/blog/projects/instances.html # - https://uwsgi-docs.readthedocs.io/en/latest/Systemd.html#one-service-per-app-in-systemd - create: ${uWSGI_APPS_ENABLED}/${SEARX_UWSGI_APP} - enable: sudo -H systemctl enable uwsgi@${SEARX_UWSGI_APP%.*} - start: sudo -H systemctl start uwsgi@${SEARX_UWSGI_APP%.*} - restart: sudo -H systemctl restart uwsgi@${SEARX_UWSGI_APP%.*} - stop: sudo -H systemctl stop uwsgi@${SEARX_UWSGI_APP%.*} - disable: sudo -H systemctl disable uwsgi@${SEARX_UWSGI_APP%.*} + create: ${uWSGI_APPS_ENABLED}/${SEARXNG_UWSGI_APP} + enable: sudo -H systemctl enable uwsgi@${SEARXNG_UWSGI_APP%.*} + start: sudo -H systemctl start uwsgi@${SEARXNG_UWSGI_APP%.*} + restart: sudo -H systemctl restart uwsgi@${SEARXNG_UWSGI_APP%.*} + stop: sudo -H systemctl stop uwsgi@${SEARXNG_UWSGI_APP%.*} + disable: sudo -H systemctl disable uwsgi@${SEARXNG_UWSGI_APP%.*} EOF ;; @@ -1060,9 +1060,9 @@ EOF # The unit file starts uWSGI in emperor mode (/etc/uwsgi.ini), see # - https://uwsgi-docs.readthedocs.io/en/latest/Emperor.html - create: ${uWSGI_APPS_ENABLED}/${SEARX_UWSGI_APP} - restart: sudo -H touch ${uWSGI_APPS_ENABLED}/${SEARX_UWSGI_APP} - disable: sudo -H rm ${uWSGI_APPS_ENABLED}/${SEARX_UWSGI_APP} + create: ${uWSGI_APPS_ENABLED}/${SEARXNG_UWSGI_APP} + restart: sudo -H touch ${uWSGI_APPS_ENABLED}/${SEARXNG_UWSGI_APP} + disable: sudo -H rm ${uWSGI_APPS_ENABLED}/${SEARXNG_UWSGI_APP} EOF ;; @@ -1072,7 +1072,7 @@ EOF echo -e "\n.. START searx uwsgi-appini $DIST_NAME" echo ".. code:: bash" echo - eval "echo \"$(< "${TEMPLATES}/${uWSGI_APPS_AVAILABLE}/${SEARX_UWSGI_APP}")\"" | prefix_stdout " " + eval "echo \"$(< "${TEMPLATES}/${uWSGI_APPS_AVAILABLE}/${SEARXNG_UWSGI_APP}")\"" | prefix_stdout " " echo -e "\n.. END searx uwsgi-appini $DIST_NAME" ) diff --git a/utils/templates/etc/httpd/sites-available/searx.conf:filtron b/utils/templates/etc/httpd/sites-available/searxng.conf:filtron similarity index 100% rename from utils/templates/etc/httpd/sites-available/searx.conf:filtron rename to utils/templates/etc/httpd/sites-available/searxng.conf:filtron diff --git a/utils/templates/etc/httpd/sites-available/searx.conf:uwsgi b/utils/templates/etc/httpd/sites-available/searxng.conf:uwsgi similarity index 100% rename from utils/templates/etc/httpd/sites-available/searx.conf:uwsgi rename to utils/templates/etc/httpd/sites-available/searxng.conf:uwsgi diff --git a/utils/templates/etc/nginx/default.apps-available/searx.conf:filtron b/utils/templates/etc/nginx/default.apps-available/searxng.conf:filtron similarity index 100% rename from utils/templates/etc/nginx/default.apps-available/searx.conf:filtron rename to utils/templates/etc/nginx/default.apps-available/searxng.conf:filtron diff --git a/utils/templates/etc/uwsgi/apps-archlinux/searx.ini b/utils/templates/etc/uwsgi/apps-archlinux/searxng.ini similarity index 100% rename from utils/templates/etc/uwsgi/apps-archlinux/searx.ini rename to utils/templates/etc/uwsgi/apps-archlinux/searxng.ini diff --git a/utils/templates/etc/uwsgi/apps-archlinux/searx.ini:socket b/utils/templates/etc/uwsgi/apps-archlinux/searxng.ini:socket similarity index 100% rename from utils/templates/etc/uwsgi/apps-archlinux/searx.ini:socket rename to utils/templates/etc/uwsgi/apps-archlinux/searxng.ini:socket diff --git a/utils/templates/etc/uwsgi/apps-available/searx.ini b/utils/templates/etc/uwsgi/apps-available/searxng.ini similarity index 100% rename from utils/templates/etc/uwsgi/apps-available/searx.ini rename to utils/templates/etc/uwsgi/apps-available/searxng.ini diff --git a/utils/templates/etc/uwsgi/apps-available/searx.ini:socket b/utils/templates/etc/uwsgi/apps-available/searxng.ini:socket similarity index 100% rename from utils/templates/etc/uwsgi/apps-available/searx.ini:socket rename to utils/templates/etc/uwsgi/apps-available/searxng.ini:socket From 38482739de32ee6a6a41763c5b992c1ad689eb2e Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Fri, 29 Oct 2021 18:09:44 +0200 Subject: [PATCH 4/6] [mod] utils/searx.sh - check a SearXNG installation Signed-off-by: Markus Heiser --- utils/searx.sh | 74 +++++++++++++++++++++++++++----------------------- 1 file changed, 40 insertions(+), 34 deletions(-) diff --git a/utils/searx.sh b/utils/searx.sh index 3f50646e3..baac48a90 100755 --- a/utils/searx.sh +++ b/utils/searx.sh @@ -141,7 +141,7 @@ usage() { cat < Date: Fri, 29 Oct 2021 20:54:30 +0200 Subject: [PATCH 5/6] [mod] utils/searx.sh - apache, nginx & uwsgi check old 'searx' installations Signed-off-by: Markus Heiser --- utils/filtron.sh | 9 +++++++++ utils/searx.sh | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/utils/filtron.sh b/utils/filtron.sh index e9fc79c87..1b33e6277 100755 --- a/utils/filtron.sh +++ b/utils/filtron.sh @@ -274,6 +274,15 @@ install_check() { else info_msg "golang $(go_version) is installed (min needed is: $GO_VERSION)" fi + + if [ -f "${APACHE_SITES_AVAILABLE}/searx.conf" ]; then + warn_msg "old searx.conf apache site exists" + fi + + if [ -f "${NGINX_APPS_AVAILABLE}/searx.conf" ]; then + warn_msg "old searx.conf nginx site exists" + fi + } go_version(){ diff --git a/utils/searx.sh b/utils/searx.sh index baac48a90..3528f1da2 100755 --- a/utils/searx.sh +++ b/utils/searx.sh @@ -382,6 +382,10 @@ install_check() { || err_msg "uWSGI app $SEARXNG_UWSGI_APP not available!" sudo -H -u "${SERVICE_USER}" "${SEARX_PYENV}/bin/python" "utils/searxng_check.py" + + if uWSGI_app_available 'searx.ini'; then + warn_msg "old searx.ini uWSGI app exists" + fi } update_searx() { From db6a4d13e7ebe08a5df4fe6f99b0ef87aac94cc8 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Sat, 30 Oct 2021 16:06:14 +0200 Subject: [PATCH 6/6] [mod] searx, filtron & morty scripts: add 'reinstall all' command Signed-off-by: Markus Heiser --- utils/filtron.sh | 17 ++++++++++++++++- utils/morty.sh | 14 ++++++++++++++ utils/searx.sh | 14 ++++++++++++++ 3 files changed, 44 insertions(+), 1 deletion(-) diff --git a/utils/filtron.sh b/utils/filtron.sh index 1b33e6277..fa661ab8b 100755 --- a/utils/filtron.sh +++ b/utils/filtron.sh @@ -64,6 +64,7 @@ usage() { usage:: $(basename "$0") shell $(basename "$0") install [all|user|rules] + $(basename "$0") reinstall all $(basename "$0") update [filtron] $(basename "$0") remove [all] $(basename "$0") activate [service] @@ -77,9 +78,12 @@ shell start interactive shell from user ${SERVICE_USER} install / remove :all: complete setup of filtron service - :check: check the filtron installation :user: add/remove service user '$SERVICE_USER' ($SERVICE_HOME) :rules: reinstall filtron rules $FILTRON_RULES +install + :check: check the filtron installation +reinstall: + :all: runs 'install/remove all' update filtron Update filtron installation ($SERVICE_HOME) activate service @@ -133,6 +137,16 @@ main() { ;; *) usage "$_usage"; exit 42;; esac ;; + reinstall) + rst_title "re-install $SERVICE_NAME" part + sudo_or_exit + case $2 in + all) + remove_all + install_all + ;; + *) usage "$_usage"; exit 42;; + esac ;; install) rst_title "$SERVICE_NAME" part sudo_or_exit @@ -271,6 +285,7 @@ install_check() { if [[ "${GO_VERSION}" > "$(go_version)" ]]; then warn_msg "golang ($(go_version)) needs to be $GO_VERSION at least" + warn_msg "you need to reinstall $SERVICE_USER --> $0 reinstall all" else info_msg "golang $(go_version) is installed (min needed is: $GO_VERSION)" fi diff --git a/utils/morty.sh b/utils/morty.sh index fdbe2b54e..e1481016f 100755 --- a/utils/morty.sh +++ b/utils/morty.sh @@ -49,6 +49,7 @@ usage() { usage:: $(basename "$0") shell $(basename "$0") install [all|check|user] + $(basename "$0") reinstall all $(basename "$0") update [morty] $(basename "$0") remove [all] $(basename "$0") activate [service] @@ -66,6 +67,8 @@ install / remove :user: add/remove service user '$SERVICE_USER' ($SERVICE_HOME) install :check: check the morty installation +reinstall: + :all: runs 'install/remove all' update morty Update morty installation ($SERVICE_HOME) activate service @@ -145,6 +148,16 @@ main() { ;; *) usage "$_usage"; exit 42;; esac ;; + reinstall) + rst_title "re-install $SERVICE_NAME" part + sudo_or_exit + case $2 in + all) + remove_all + install_all + ;; + *) usage "$_usage"; exit 42;; + esac ;; install) rst_title "$SERVICE_NAME" part sudo_or_exit @@ -286,6 +299,7 @@ install_check() { if [[ "${GO_VERSION}" > "$(go_version)" ]]; then warn_msg "golang ($(go_version)) needs to be $GO_VERSION at least" + warn_msg "you need to reinstall $SERVICE_USER --> $0 reinstall all" else info_msg "golang $(go_version) is installed (min needed is: $GO_VERSION)" fi diff --git a/utils/searx.sh b/utils/searx.sh index 3528f1da2..79cd2f26d 100755 --- a/utils/searx.sh +++ b/utils/searx.sh @@ -142,6 +142,7 @@ usage() { usage:: $(basename "$0") shell $(basename "$0") install [all|check|init-src|dot-config|user|searx-src|pyenv|uwsgi|packages|settings|buildhost] + $(basename "$0") reinstall all $(basename "$0") update [searx] $(basename "$0") remove [all|user|pyenv|searx-src] $(basename "$0") activate [service] @@ -165,6 +166,8 @@ install / remove :buildhost: install packages from OS package manager needed by buildhosts install :check: check the SearXNG installation +reinstall: + :all: runs 'install/remove all' update searx Update SearXNG installation ($SERVICE_HOME) activate service @@ -214,6 +217,16 @@ main() { ;; *) usage "$_usage"; exit 42;; esac ;; + reinstall) + rst_title "re-install $SERVICE_NAME" part + sudo_or_exit + case $2 in + all) + remove_all + install_all + ;; + *) usage "$_usage"; exit 42;; + esac ;; install) sudo_or_exit case $2 in @@ -385,6 +398,7 @@ install_check() { if uWSGI_app_available 'searx.ini'; then warn_msg "old searx.ini uWSGI app exists" + warn_msg "you need to reinstall $SERVICE_USER --> $0 reinstall all" fi }