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
searx.sh: install settings at /etc/searx/settings.yml
Markus Heiser59e4026762a8
diff --git a/.config.mk b/.config.mkindex 3349a7602..e03d29056 100644--- a/.config.mk+++ b/.config.mk@@ -6,8 +6,8 @@# Compare your settings here with file .config.sh used by the toolboxing in# utils.-export SEARX_URL=https://searx.me+export SEARX_URL:=$(or ${SEARX_URL},https://searx.me)-export GIT_URL=https://github.com/asciimoo/searx-export DOCS_URL=https://asciimoo.github.io/searx+export DOCS_URL:=$(or ${DOCS_URL},https://asciimoo.github.io/searx)+export GIT_URL:=$(or ${GIT_URL},https://github.com/asciimoo/searx)diff --git a/Makefile b/Makefileindex 0e1816eb5..6cc799f2e 100644--- a/Makefile+++ b/Makefile@@ -26,6 +26,11 @@ help:@echo ' gh-pages - build docs & deploy on gh-pages branch'@echo ' clean - drop builds and environments'@echo ''+ @echo 'environment'+ @echo ' SEARX_URL = $(SEARX_URL)'+ @echo ' GIT_URL = $(GIT_URL)'+ @echo ' DOCS_URL = $(DOCS_URL)'+ @echo ''@$(MAKE) -s -f utils/makefile.include make-help@echo ''@$(MAKE) -s -f utils/makefile.python python-helpdiff --git a/utils/filtron.sh b/utils/filtron.shindex 13bb76751..2d2270812 100755--- a/utils/filtron.sh+++ b/utils/filtron.sh@@ -87,6 +87,8 @@ apache : ${PUBLIC_URL}:install: apache site with a reverse proxy (ProxyPass):remove: apache site ${APACHE_FILTRON_SITE}+filtron rules: ${FILTRON_RULES}+If needed, set PUBLIC_URL of your WEB service in the '${DOT_CONFIG#"$REPO_ROOT/"}' file::PUBLIC_URL : ${PUBLIC_URL}diff --git a/utils/searx.sh b/utils/searx.shindex 942aa07ce..1b9bfd42c 100755--- a/utils/searx.sh+++ b/utils/searx.sh@@ -30,7 +30,7 @@ SEARX_GIT_URL="${SEARX_GIT_URL:-https://github.com/asciimoo/searx.git}"SEARX_GIT_BRANCH="${SEARX_GIT_BRANCH:-master}"SEARX_PYENV="${SERVICE_HOME}/searx-pyenv"SEARX_SRC="${SERVICE_HOME}/searx-src"-SEARX_SETTINGS="${SEARX_SRC}/searx/settings.yml"+SEARX_SETTINGS_PATH="/etc/searx/settings.yml"SEARX_UWSGI_APP="searx.ini"# shellcheck disable=SC2034SEARX_UWSGI_SOCKET="/run/uwsgi/app/searx/socket"@@ -59,7 +59,7 @@ CONFIG_FILES=(# shellcheck disable=SC2034CONFIG_BACKUP_ENCRYPTED=(- "${SEARX_SETTINGS}"+ "${SEARX_SETTINGS_PATH}")# ----------------------------------------------------------------------------@@ -88,6 +88,7 @@ install / remove:user: add/remove service user '$SERVICE_USER' ($SERVICE_HOME):searx-src: clone $SEARX_GIT_URL:pyenv: create/remove virtualenv (python) in $SEARX_PYENV+ :settings: reinstall settings from ${REPO_ROOT}/searx/settings.ymlupdate searxUpdate searx installation ($SERVICE_HOME)activate service@@ -102,6 +103,8 @@ apache:install: apache site with the searx uwsgi app:remove: apache site ${APACHE_FILTRON_SITE}+searx settings: ${SEARX_SETTINGS_PATH}+If needed, set PUBLIC_URL of your WEB service in the '${DOT_CONFIG#"$REPO_ROOT/"}' file::PUBLIC_URL : ${PUBLIC_URL}@@ -145,6 +148,7 @@ main() {user) assert_user ;;pyenv) create_pyenv ;;searx-src) clone_searx ;;+ settings) install_settings ;;*) usage "$_usage"; exit 42;;esac ;;update)@@ -206,7 +210,7 @@ install_all() {wait_keycreate_pyenvwait_key- configure_searx+ install_settingswait_keytest_local_searxwait_key@@ -217,7 +221,6 @@ install_all() {if ask_yn "Do you want to inspect the installation?" Yn; theninspect_servicefi-}update_searx() {@@ -226,45 +229,11 @@ update_searx() {echotee_stderr 0.3 <<EOF | sudo -H -u "${SERVICE_USER}" -i 2>&1 | prefix_stdout "$_service_prefix"cd ${SEARX_SRC}-cp -f ${SEARX_SETTINGS} ${SEARX_SETTINGS}.backup-git stash push -m "BACKUP -- 'update server' at ($(date))"git checkout -B "$SEARX_GIT_BRANCH"git pull-cd ${SEARX_SRC}${SEARX_SRC}/manage.sh update_packagesEOF- configure_searx-- rst_title "${SEARX_SETTINGS}" section- rst_para 'Diff between new setting file (<) and backup (>):'- echo- $DIFF_CMD "${SEARX_SETTINGS}" "${SEARX_SETTINGS}.backup"-- local action- choose_one action "What should happen to the settings file? " \- "keep new configuration" \- "revert to the old configuration (backup file)" \- "start interactiv shell"- case $action in- "keep new configuration")- info_msg "continue using new settings file"- ;;- "revert to the old configuration (backup file)")- tee_stderr 0.1 <<EOF | sudo -H -u "${SERVICE_USER}" -i 2>&1 | prefix_stdout "$_service_prefix"-cp -f ${SEARX_SETTINGS}.backup ${SEARX_SETTINGS}-EOF- ;;- "start interactiv shell")- interactive_shell "${SERVICE_USER}"- ;;- esac- chown "${SERVICE_USER}:${SERVICE_USER}" "${SEARX_SETTINGS}"-- # shellcheck disable=SC2016- rst_para 'Diff between local modified settings (<) and $SEARX_GIT_BRANCH branch (>):'- echo- git_diff- wait_key+ install_settingsuWSGI_restart}@@ -279,8 +248,9 @@ installations that were installed with this script."returnfiremove_searx_uwsgi- wait_keydrop_service_account "${SERVICE_USER}"+ remove_settings+ wait_keyif service_is_available "${PUBLIC_URL}"; thenMSG="** Don't forgett to remove your public site! (${PUBLIC_URL}) **" wait_key 10fi@@ -301,7 +271,7 @@ EOF}clone_is_available() {- [[ -f "$SEARX_SETTINGS" ]]+ [[ -f "$SEARX_SRC/.git/config" ]]}# shellcheck disable=SC2164@@ -314,13 +284,13 @@ clone_searx() {return 42fiexport SERVICE_HOME-- git_clone "$SEARX_GIT_URL" "$SEARX_SRC" \+ git_clone "$REPO_ROOT" "$SEARX_SRC" \"$SEARX_GIT_BRANCH" "$SERVICE_USER"pushd "${SEARX_SRC}" > /dev/nulltee_stderr 0.1 <<EOF | sudo -H -u "${SERVICE_USER}" -i 2>&1 | prefix_stdout "$_service_prefix"cd "${SEARX_SRC}"+git remote set-url origin ${SEARX_GIT_URL}git config user.email "$ADMIN_EMAIL"git config user.name "$ADMIN_NAME"git config --list@@ -328,6 +298,52 @@ EOFpopd > /dev/null}+install_settings() {+ rst_title "${SEARX_SETTINGS_PATH}" section+ if ! clone_is_available; then+ err_msg "you have to install searx first"+ exit 42+ fi+ mkdir -p "$(dirname ${SEARX_SETTINGS_PATH})"++ if [[ ! -f ${SEARX_SETTINGS_PATH} ]]; then+ info_msg "install settings ${REPO_ROOT}/searx/settings.yml"+ info_msg " --> ${SEARX_SETTINGS_PATH}"+ cp "${REPO_ROOT}/searx/settings.yml" "${SEARX_SETTINGS_PATH}"+ configure_searx+ return+ fi++ rst_para "Diff between origin's setting file (-) and current (+):"+ echo+ $DIFF_CMD "${SEARX_SRC}/searx/settings.yml" "${SEARX_SETTINGS_PATH}"++ local action+ choose_one action "What should happen to the settings file? " \+ "keep new configuration" \+ "start interactiv shell"+ case $action in+ "keep new configuration")+ info_msg "continue using new settings file"+ ;;+ "start interactiv shell")+ echo -e "// exit with [${_BCyan}CTRL-D${_creset}]"+ sudo -H -i+ rst_para 'Diff between new setting file (-) and current (+):'+ echo+ $DIFF_CMD "${SEARX_SRC}/searx/settings.yml" "${SEARX_SETTINGS_PATH}"+ wait_key+ ;;+ esac+}++remove_settings() {+ rst_title "remove searx settings" section+ echo+ info_msg "delete ${SEARX_SETTINGS_PATH}"+ rm -f "${SEARX_SETTINGS_PATH}"+}+remove_searx() {rst_title "Drop searx sources" sectionif ask_yn "Do you really want to drop searx sources ($SEARX_SRC)?"; then@@ -381,12 +397,12 @@ EOFconfigure_searx() {rst_title "Configure searx" section- rst_para "Setup searx config located at $SEARX_SETTINGS"+ rst_para "Setup searx config located at $SEARX_SETTINGS_PATH"echo- tee_stderr 0.1 <<EOF | sudo -H -u "${SERVICE_USER}" -i 2>&1 | prefix_stdout "$_service_prefix"+ tee_stderr 0.1 <<EOF | sudo -H -i 2>&1 | prefix_stdout "$_service_prefix"cd ${SEARX_SRC}-sed -i -e "s/ultrasecretkey/$(openssl rand -hex 16)/g" "$SEARX_SETTINGS"-sed -i -e "s/{instance_name}/${SEARX_INSTANCE_NAME}/g" "$SEARX_SETTINGS"+sed -i -e "s/ultrasecretkey/$(openssl rand -hex 16)/g" "$SEARX_SETTINGS_PATH"+sed -i -e "s/{instance_name}/${SEARX_INSTANCE_NAME}/g" "$SEARX_SETTINGS_PATH"EOF}@@ -401,14 +417,15 @@ test_local_searx() {returnfifi+ sed -i -e "s/debug : False/debug : True/g" "$SEARX_SETTINGS_PATH"tee_stderr 0.1 <<EOF | sudo -H -u "${SERVICE_USER}" -i 2>&1 | prefix_stdout "$_service_prefix"+export SEARX_SETTINGS_PATH="${SEARX_SETTINGS_PATH}"cd ${SEARX_SRC}-sed -i -e "s/debug : False/debug : True/g" "$SEARX_SETTINGS"timeout 10 python3 searx/webapp.py &sleep 3curl --location --verbose --head --insecure $SEARX_INTERNAL_URL-sed -i -e "s/debug : True/debug : False/g" "$SEARX_SETTINGS"EOF+ sed -i -e "s/debug : True/debug : False/g" "$SEARX_SETTINGS_PATH"}install_searx_uwsgi() {@@ -437,28 +454,21 @@ deactivate_service() {uWSGI_restart}-git_diff() {- sudo -H -u "${SERVICE_USER}" -i <<EOF-cd ${SEARX_SRC}-git --no-pager diff-EOF-}-enable_debug() {warn_msg "Do not enable debug in production enviroments!!"info_msg "try to enable debug mode ..."- tee_stderr 0.1 <<EOF | sudo -H -u "${SERVICE_USER}" -i 2>&1 | prefix_stdout "$_service_prefix"+ tee_stderr 0.1 <<EOF | sudo -H -i 2>&1 | prefix_stdout "$_service_prefix"cd ${SEARX_SRC}-sed -i -e "s/debug : False/debug : True/g" "$SEARX_SETTINGS"+sed -i -e "s/debug : False/debug : True/g" "$SEARX_SETTINGS_PATH"EOFuWSGI_restart}disable_debug() {info_msg "try to disable debug mode ..."- tee_stderr 0.1 <<EOF | sudo -H -u "${SERVICE_USER}" -i 2>&1 | prefix_stdout "$_service_prefix"+ tee_stderr 0.1 <<EOF | sudo -H -i 2>&1 | prefix_stdout "$_service_prefix"cd ${SEARX_SRC}-sed -i -e "s/debug : True/debug : False/g" "$SEARX_SETTINGS"+sed -i -e "s/debug : True/debug : False/g" "$SEARX_SETTINGS_PATH"EOFuWSGI_restart}@@ -513,7 +523,7 @@ EOFfiif ! service_is_available "${PUBLIC_URL}"; then- err_msg "Public service at ${PUBLIC_URL} is not available!"+ warn_msg "Public service at ${PUBLIC_URL} is not available!"filocal _debug_ondiff --git a/utils/templates/etc/uwsgi/apps-available/searx.ini b/utils/templates/etc/uwsgi/apps-available/searx.iniindex cff47f896..bc62e5864 100644--- a/utils/templates/etc/uwsgi/apps-available/searx.ini+++ b/utils/templates/etc/uwsgi/apps-available/searx.ini@@ -12,6 +12,9 @@ gid = ${SERVICE_GROUP}# chdir to specified directory before apps loadingchdir = ${SEARX_SRC}/searx+# searx configuration (settings.yml)+env = SEARX_SETTINGS_PATH=${SEARX_SETTINGS_PATH}+# disable logging for privacydisable-logging = true