summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Heiser <markus.heiser@darmarIT.de>2021-10-30 16:12:57 +0000
committerGitHub <noreply@github.com>2021-10-30 16:12:57 +0000
commit8f18c69f7ab387de18679b46c3d29365310b44d4 (patch)
treec2fcc45ca5a7ff37b52f94eecedcff0968355c86
parent46fde2e98e0fd55e947c3d9c1663f22e3d34bf1e (diff)
parentdb6a4d13e7ebe08a5df4fe6f99b0ef87aac94cc8 (diff)
Merge pull request #446 from return42/searxng-brand
[brand] SearXNG environment variables & /utils scripts
-rw-r--r--docs/admin/engines/settings.rst2
-rw-r--r--docs/admin/installation-apache.rst2
-rw-r--r--docs/admin/installation-nginx.rst8
-rw-r--r--docs/admin/installation-uwsgi.rst14
-rw-r--r--docs/conf.py4
-rw-r--r--docs/dev/lxcdev.rst2
-rw-r--r--docs/dev/makefile.rst2
-rwxr-xr-xmanage8
-rw-r--r--utils/brand.env2
-rw-r--r--utils/build_env.py2
-rwxr-xr-xutils/filtron.sh32
-rwxr-xr-xutils/lib_install.sh14
-rwxr-xr-xutils/morty.sh16
-rwxr-xr-xutils/searx.sh166
-rw-r--r--utils/templates/etc/httpd/sites-available/searxng.conf:filtron (renamed from utils/templates/etc/httpd/sites-available/searx.conf:filtron)0
-rw-r--r--utils/templates/etc/httpd/sites-available/searxng.conf:uwsgi (renamed from utils/templates/etc/httpd/sites-available/searx.conf:uwsgi)4
-rw-r--r--utils/templates/etc/nginx/default.apps-available/searxng.conf:filtron (renamed from utils/templates/etc/nginx/default.apps-available/searx.conf:filtron)6
-rw-r--r--utils/templates/etc/uwsgi/apps-archlinux/searxng.ini (renamed from utils/templates/etc/uwsgi/apps-archlinux/searx.ini)0
-rw-r--r--utils/templates/etc/uwsgi/apps-archlinux/searxng.ini:socket (renamed from utils/templates/etc/uwsgi/apps-archlinux/searx.ini:socket)0
-rw-r--r--utils/templates/etc/uwsgi/apps-available/searxng.ini (renamed from utils/templates/etc/uwsgi/apps-available/searx.ini)0
-rw-r--r--utils/templates/etc/uwsgi/apps-available/searxng.ini:socket (renamed from utils/templates/etc/uwsgi/apps-available/searx.ini:socket)0
21 files changed, 173 insertions, 111 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 <make buildenv>`, needs to
rebuild instance's environment :ref:`utils/brand.env <make buildenv>`.
-``base_url`` : :ref:`buildenv SEARX_URL <make buildenv>`
+``base_url`` : :ref:`buildenv SEARXNG_URL <make buildenv>`
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 <make buildenv>`)
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/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/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/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 <settings global server>` (aka
+- ``SEARXNG_URL`` from :ref:`server.base_url <settings global server>` (aka
``PUBLIC_URL``)
- ``SEARXNG_BIND_ADDRESS`` from :ref:`server.bind_address <settings global server>`
- ``SEARXNG_PORT`` from :ref:`server.port <settings global server>`
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
)
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..fa661ab8b 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=(
@@ -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,9 +285,19 @@ 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
+
+ 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(){
@@ -560,7 +584,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..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
@@ -513,7 +527,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..79cd2f26d 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}}"
@@ -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
@@ -141,7 +141,8 @@ usage() {
cat <<EOF
usage::
$(basename "$0") shell
- $(basename "$0") install [all|init-src|dot-config|user|searx-src|pyenv|uwsgi|packages|settings|buildhost]
+ $(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]
@@ -154,7 +155,6 @@ shell
start interactive shell from user ${SERVICE_USER}
install / remove
:all: complete (de-) installation of searx service
- :check: check the SearXNG installation
:user: add/remove service user '$SERVICE_USER' ($SERVICE_HOME)
:dot-config: copy ./config.sh to ${SEARX_SRC}
:searx-src: clone $GIT_URL
@@ -164,6 +164,10 @@ install / remove
:settings: reinstall settings from ${SEARXNG_SETTINGS_PATH}
:packages: install needed packages from OS package manager
: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
@@ -213,18 +217,28 @@ main() {
;;
*) usage "$_usage"; exit 42;;
esac ;;
- install)
+ reinstall)
+ rst_title "re-install $SERVICE_NAME" part
sudo_or_exit
case $2 in
- check)
- rst_title "SearXNG (check installation)" part
- verify_continue_install
- sudo -H -u "${SERVICE_USER}" "${SEARX_PYENV}/bin/python" "utils/searxng_check.py"
+ all)
+ remove_all
+ install_all
;;
+ *) usage "$_usage"; exit 42;;
+ esac ;;
+ install)
+ sudo_or_exit
+ case $2 in
all)
rst_title "SearXNG (install)" part
install_all
;;
+ check)
+ rst_title "SearXNG (check installation)" part
+ verify_continue_install
+ install_check
+ ;;
user)
rst_title "SearXNG (install user)"
verify_continue_install
@@ -352,6 +366,42 @@ install_all() {
fi
}
+install_check() {
+ if service_account_is_available "$SERVICE_USER"; then
+ info_msg "Service account $SERVICE_USER exists."
+ else
+ err_msg "Service account $SERVICE_USER does not exists!"
+ fi
+
+ if pyenv_is_available; then
+ info_msg "~$SERVICE_USER: python environment is available."
+ else
+ err_msg "~$SERVICE_USER: python environment is not available!"
+ fi
+
+ if clone_is_available; then
+ info_msg "~$SERVICE_USER: SearXNG software is installed."
+ else
+ err_msg "~$SERVICE_USER: Missing SearXNG software!"
+ fi
+
+ if uWSGI_app_enabled "$SEARXNG_UWSGI_APP"; then
+ info_msg "uWSGI app $SEARXNG_UWSGI_APP is enabled."
+ else
+ err_msg "uWSGI app $SEARXNG_UWSGI_APP not enabled!"
+ fi
+
+ uWSGI_app_available "$SEARXNG_UWSGI_APP" \
+ || 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"
+ warn_msg "you need to reinstall $SERVICE_USER --> $0 reinstall all"
+ fi
+}
+
update_searx() {
rst_title "Update SearXNG instance"
@@ -367,7 +417,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 +779,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 +811,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 +820,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 +830,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 +839,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() {
@@ -851,33 +901,7 @@ sourced ${DOT_CONFIG} :
EOF
install_log_searx_instance
- if service_account_is_available "$SERVICE_USER"; then
- info_msg "Service account $SERVICE_USER exists."
- else
- err_msg "Service account $SERVICE_USER does not exists!"
- fi
-
- if pyenv_is_available; then
- info_msg "~$SERVICE_USER: python environment is available."
- else
- err_msg "~$SERVICE_USER: python environment is not available!"
- fi
-
- if clone_is_available; then
- info_msg "~$SERVICE_USER: SearXNG software is installed."
- else
- 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."
- else
- err_msg "uWSGI app $SEARX_UWSGI_APP not enabled!"
- fi
-
- uWSGI_app_available "$SEARX_UWSGI_APP" \
- || err_msg "uWSGI app $SEARX_UWSGI_APP not available!"
-
+ install_check
if in_container; then
lxc_suite_info
else
@@ -955,9 +979,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 +1003,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 +1049,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 +1067,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 +1084,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 +1096,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
index 379d47e24..379d47e24 100644
--- a/utils/templates/etc/httpd/sites-available/searx.conf:filtron
+++ b/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
index ef702de3a..aabc125ae 100644
--- a/utils/templates/etc/httpd/sites-available/searx.conf:uwsgi
+++ b/utils/templates/etc/httpd/sites-available/searxng.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
-<Location ${SEARX_URL_PATH}>
+<Location ${SEARXNG_URL_PATH}>
<IfModule mod_security2.c>
SecRuleEngine Off
diff --git a/utils/templates/etc/nginx/default.apps-available/searx.conf:filtron b/utils/templates/etc/nginx/default.apps-available/searxng.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/searxng.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/;
}
diff --git a/utils/templates/etc/uwsgi/apps-archlinux/searx.ini b/utils/templates/etc/uwsgi/apps-archlinux/searxng.ini
index dcb7d1a7d..dcb7d1a7d 100644
--- a/utils/templates/etc/uwsgi/apps-archlinux/searx.ini
+++ b/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
index 580600072..580600072 100644
--- a/utils/templates/etc/uwsgi/apps-archlinux/searx.ini:socket
+++ b/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
index 440c2e97d..440c2e97d 100644
--- a/utils/templates/etc/uwsgi/apps-available/searx.ini
+++ b/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
index 08c98cf61..08c98cf61 100644
--- a/utils/templates/etc/uwsgi/apps-available/searx.ini:socket
+++ b/utils/templates/etc/uwsgi/apps-available/searxng.ini:socket