[install scripts] rename SEARX_<name> variables to SEARXNG_<name>

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
Markus Heiser 2022-05-27 18:41:08 +02:00
parent 0cf5310933
commit 81bba44869
12 changed files with 159 additions and 142 deletions

View file

@ -4,7 +4,7 @@
#
# This file should be edited only ones just before the installation of any
# service is done. After the installation of the searx service a copy of this
# file is placed into the $SEARX_SRC of the instance, e.g.::
# file is placed into the $SEARXNG_SRC of the instance, e.g.::
#
# /usr/local/searx/searx-src/.config.sh
#
@ -24,7 +24,7 @@
# $ ./utils/searx.sh --help
# ---- SearXNG instance setup (already installed)
# SEARXNG_SETTINGS_PATH : /etc/searxng/settings.yml
# SEARX_SRC : /usr/local/searx/searx-src
# SEARXNG_SRC : /usr/local/searx/searx-src
#
# [1] https://docs.searxng.org/admin/engines/settings.html

View file

@ -1,4 +1,4 @@
.. template evaluated by: ./utils/searx.sh docs
.. template evaluated by: ./utils/searx.sh doc
.. hint: all dollar-names are variables, dollar sign itself is quoted by: \\$
.. START distro-packages
@ -81,7 +81,7 @@ ${fedora_build}
.. code-block:: sh
$ sudo -H -u ${SERVICE_USER} -i
(${SERVICE_USER})$ git clone \"$GIT_URL\" \"$SEARX_SRC\"
(${SERVICE_USER})$ git clone \"$GIT_URL\" \"$SEARXNG_SRC\"
.. END clone searxng
@ -93,8 +93,8 @@ ${fedora_build}
.. code-block:: sh
(${SERVICE_USER})$ python3 -m venv \"${SEARX_PYENV}\"
(${SERVICE_USER})$ echo \". ${SEARX_PYENV}/bin/activate\" >> \"$SERVICE_HOME/.profile\"
(${SERVICE_USER})$ python3 -m venv \"${SEARXNG_PYENV}\"
(${SERVICE_USER})$ echo \". ${SEARXNG_PYENV}/bin/activate\" >> \"$SERVICE_HOME/.profile\"
.. END create virtualenv
@ -109,7 +109,7 @@ ${fedora_build}
$ sudo -H -u ${SERVICE_USER} -i
(${SERVICE_USER})$ command -v python && python --version
$SEARX_PYENV/bin/python
$SEARXNG_PYENV/bin/python
Python 3.8.1
# update pip's boilerplate ..
@ -119,7 +119,7 @@ ${fedora_build}
pip install -U pyyaml
# jump to SearXNG's working tree and install SearXNG into virtualenv
(${SERVICE_USER})$ cd \"$SEARX_SRC\"
(${SERVICE_USER})$ cd \"$SEARXNG_SRC\"
(${SERVICE_USER})$ pip install -e .
@ -134,7 +134,7 @@ ${fedora_build}
.. code-block:: sh
$ sudo -H mkdir -p \"$(dirname ${SEARXNG_SETTINGS_PATH})\"
$ sudo -H cp \"$SEARX_SRC/utils/templates/etc/searxng/settings.yml\" \\
$ sudo -H cp \"$SEARXNG_SRC/utils/templates/etc/searxng/settings.yml\" \\
\"${SEARXNG_SETTINGS_PATH}\"
.. group-tab:: searx/settings.yml
@ -142,7 +142,7 @@ ${fedora_build}
.. code-block:: sh
$ sudo -H mkdir -p \"$(dirname ${SEARXNG_SETTINGS_PATH})\"
$ sudo -H cp \"$SEARX_SRC/searx/settings.yml\" \\
$ sudo -H cp \"$SEARXNG_SRC/searx/settings.yml\" \\
\"${SEARXNG_SETTINGS_PATH}\"
.. tabs::
@ -168,14 +168,14 @@ ${fedora_build}
# start webapp
$ sudo -H -u ${SERVICE_USER} -i
(${SERVICE_USER})$ cd ${SEARX_SRC}
(${SERVICE_USER})$ cd ${SEARXNG_SRC}
(${SERVICE_USER})$ export SEARXNG_SETTINGS_PATH=\"${SEARXNG_SETTINGS_PATH}\"
(${SERVICE_USER})$ python searx/webapp.py
# disable debug
$ sudo -H sed -i -e \"s/debug : True/debug : False/g\" \"$SEARXNG_SETTINGS_PATH\"
Open WEB browser and visit http://$SEARX_INTERNAL_HTTP . If you are inside a
Open WEB browser and visit http://$SEARXNG_INTERNAL_HTTP . If you are inside a
container or in a script, test with curl:
.. tabs::
@ -184,13 +184,13 @@ container or in a script, test with curl:
.. code-block:: sh
$ xdg-open http://$SEARX_INTERNAL_HTTP
$ xdg-open http://$SEARXNG_INTERNAL_HTTP
.. group-tab:: curl
.. code-block:: none
$ curl --location --verbose --head --insecure $SEARX_INTERNAL_HTTP
$ curl --location --verbose --head --insecure $SEARXNG_INTERNAL_HTTP
* Trying 127.0.0.1:8888...
* TCP_NODELAY set

View file

@ -569,7 +569,7 @@ This installs a reverse proxy (ProxyPass) into nginx site (${NGINX_FILTRON_SITE}
"${REPO_ROOT}/utils/searx.sh" install uwsgi
# shellcheck disable=SC2034
SEARX_SRC=$("${REPO_ROOT}/utils/searx.sh" --getenv SEARX_SRC)
SEARXNG_SRC=$("${REPO_ROOT}/utils/searx.sh" --getenv SEARXNG_SRC)
# shellcheck disable=SC2034
SEARXNG_URL_PATH=$("${REPO_ROOT}/utils/searx.sh" --getenv SEARXNG_URL_PATH)
nginx_install_app --variant=filtron "${NGINX_FILTRON_SITE}"

View file

@ -8,7 +8,7 @@
# Initialize installation procedures:
#
# - Modified source_dot_config function that
# - loads .config.sh from an existing installation (at SEARX_SRC).
# - loads .config.sh from an existing installation (at SEARXNG_SRC).
# - initialize **SEARX_SRC_INIT_FILES**
# - functions like:
# - install_log_searx_instance()
@ -25,13 +25,13 @@
# - utils/morty.sh
# - utils/filtron.sh
#
# If '${SEARX_SRC}/.config.sh' exists, the modified source_dot_config() function
# If '${SEARXNG_SRC}/.config.sh' exists, the modified source_dot_config() function
# loads this configuration (instead of './.config.sh').
# **SEARX_SRC_INIT_FILES**
#
# Array of file names to sync into a installation at $SEARX_SRC. The file names
# are relative to the $REPO_ROOT. Set by function init_SEARX_SRC_INIT_FILES().
# Array of file names to sync into a installation at $SEARXNG_SRC. The file names
# are relative to the $REPO_ROOT. Set by function init_SEARXNG_SRC_INIT_FILES().
# Most often theses are files like:
# - .config.sh
# - searx/settings.yml
@ -46,25 +46,25 @@ eval orig_"$(declare -f source_dot_config)"
source_dot_config() {
# Modified source_dot_config function that
# - loads .config.sh from an existing installation (at SEARX_SRC).
# - loads .config.sh from an existing installation (at SEARXNG_SRC).
# - initialize SEARX_SRC_INIT_FILES
if [ -z "$eval_SEARX_SRC" ]; then
export eval_SEARX_SRC='true'
SEARX_SRC=$("${REPO_ROOT}/utils/searx.sh" --getenv SEARX_SRC)
SEARX_PYENV=$("${REPO_ROOT}/utils/searx.sh" --getenv SEARX_PYENV)
if [ -z "$eval_SEARXNG_SRC" ]; then
export eval_SEARXNG_SRC='true'
SEARXNG_SRC=$("${REPO_ROOT}/utils/searx.sh" --getenv SEARXNG_SRC)
SEARXNG_PYENV=$("${REPO_ROOT}/utils/searx.sh" --getenv SEARXNG_PYENV)
SEARXNG_SETTINGS_PATH=$("${REPO_ROOT}/utils/searx.sh" --getenv SEARXNG_SETTINGS_PATH)
if [ ! -r "${SEARX_SRC}" ]; then
info_msg "not yet cloned: ${SEARX_SRC}"
if [ ! -r "${SEARXNG_SRC}" ]; then
info_msg "not yet cloned: ${SEARXNG_SRC}"
orig_source_dot_config
return 0
fi
info_msg "using instance at: ${SEARX_SRC}"
info_msg "using instance at: ${SEARXNG_SRC}"
# set and log DOT_CONFIG
if [ -r "${SEARX_SRC}/.config.sh" ]; then
info_msg "switching to ${SEARX_SRC}/.config.sh"
DOT_CONFIG="${SEARX_SRC}/.config.sh"
if [ -r "${SEARXNG_SRC}/.config.sh" ]; then
info_msg "switching to ${SEARXNG_SRC}/.config.sh"
DOT_CONFIG="${SEARXNG_SRC}/.config.sh"
else
info_msg "using local config: ${DOT_CONFIG}"
fi
@ -86,7 +86,7 @@ init_SEARX_SRC_INIT_FILES(){
# keep list empty if there is no installation
SEARX_SRC_INIT_FILES=()
if [ ! -r "$SEARX_SRC" ]; then
if [ ! -r "$SEARXNG_SRC" ]; then
return 0
fi
@ -104,9 +104,9 @@ init_SEARX_SRC_INIT_FILES(){
if [ -z "$fname" ]; then
continue
fi
if [ -r "${SEARX_SRC}/${fname}" ]; then
# diff "${REPO_ROOT}/${fname}" "${SEARX_SRC}/${fname}"
if ! cmp --silent "${REPO_ROOT}/${fname}" "${SEARX_SRC}/${fname}"; then
if [ -r "${SEARXNG_SRC}/${fname}" ]; then
# diff "${REPO_ROOT}/${fname}" "${SEARXNG_SRC}/${fname}"
if ! cmp --silent "${REPO_ROOT}/${fname}" "${SEARXNG_SRC}/${fname}"; then
SEARX_SRC_INIT_FILES+=("${fname}")
info_msg "local clone (workingtree), modified file: ./$fname"
msg="to update use: sudo -H ./utils/searx.sh install init-src"
@ -120,8 +120,8 @@ 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 " SEARX_PYENV : ${_BBlue}${SEARX_PYENV}${_creset}"
echo -e " SEARX_SRC : ${_BBlue}${SEARX_SRC:-none}${_creset}"
echo -e " SEARXNG_PYENV : ${_BBlue}${SEARXNG_PYENV}${_creset}"
echo -e " SEARXNG_SRC : ${_BBlue}${SEARXNG_SRC:-none}${_creset}"
echo -e " SEARXNG_URL : ${_BBlue}${SEARXNG_URL:-none}${_creset}"
if in_container; then
@ -148,26 +148,26 @@ install_searx_get_state(){
# Prompts a string indicating the status of the installation procedure
#
# missing-searx-clone:
# There is no clone at ${SEARX_SRC}
# There is no clone at ${SEARXNG_SRC}
# missing-searx-pyenv:
# There is no pyenv in ${SEARX_PYENV}
# There is no pyenv in ${SEARXNG_PYENV}
# installer-modified:
# There are files modified locally in the installer (clone),
# see ${SEARX_SRC_INIT_FILES} description.
# python-installed:
# Scripts can be executed in instance's environment
# - user: ${SERVICE_USER}
# - pyenv: ${SEARX_PYENV}
# - pyenv: ${SEARXNG_PYENV}
if [ -f /etc/searx/settings.yml ]; then
err_msg "settings.yml in /etc/searx/ is deprecated, move file to folder /etc/searxng/"
fi
if ! [ -r "${SEARX_SRC}" ]; then
if ! [ -r "${SEARXNG_SRC}" ]; then
echo "missing-searx-clone"
return
fi
if ! [ -f "${SEARX_PYENV}/bin/activate" ]; then
if ! [ -f "${SEARXNG_PYENV}/bin/activate" ]; then
echo "missing-searx-pyenv"
return
fi

View file

@ -502,7 +502,7 @@ This installs a reverse proxy (ProxyPass) into nginx site (${NGINX_MORTY_SITE})"
"${REPO_ROOT}/utils/searx.sh" install uwsgi
# shellcheck disable=SC2034
SEARX_SRC=$("${REPO_ROOT}/utils/searx.sh" --getenv SEARX_SRC)
SEARXNG_SRC=$("${REPO_ROOT}/utils/searx.sh" --getenv SEARXNG_SRC)
# shellcheck disable=SC2034
SEARXNG_URL_PATH=$("${REPO_ROOT}/utils/searx.sh" --getenv SEARXNG_URL_PATH)
nginx_install_app "${NGINX_MORTY_SITE}"

View file

@ -12,7 +12,7 @@ source "${REPO_ROOT}/utils/lib_install.sh"
# config
# ----------------------------------------------------------------------------
SEARX_INTERNAL_HTTP="${SEARXNG_BIND_ADDRESS}:${SEARXNG_PORT}"
SEARXNG_INTERNAL_HTTP="${SEARXNG_BIND_ADDRESS}:${SEARXNG_PORT}"
SEARXNG_URL_PATH="${SEARXNG_URL_PATH:-$(echo "${PUBLIC_URL}" \
| sed -e 's,^.*://[^/]*\(/.*\),\1,g')}"
@ -26,12 +26,14 @@ SERVICE_HOME="${SERVICE_HOME_BASE}/${SERVICE_USER}"
SERVICE_GROUP="${SERVICE_USER}"
GIT_BRANCH="${GIT_BRANCH:-master}"
SEARX_PYENV="${SERVICE_HOME}/searx-pyenv"
SEARX_SRC="${SERVICE_HOME}/searx-src"
SEARXNG_PYENV="${SERVICE_HOME}/searx-pyenv"
SEARXNG_SRC="${SERVICE_HOME}/searx-src"
# shellcheck disable=SC2034
SEARXNG_STATIC="${SEARXNG_SRC}/searx/static"
SEARXNG_SETTINGS_PATH="/etc/searxng/settings.yml"
SEARXNG_UWSGI_APP="searxng.ini"
# shellcheck disable=SC2034
SEARX_UWSGI_SOCKET="/run/uwsgi/app/searxng/socket"
SEARXNG_UWSGI_SOCKET="/run/uwsgi/app/searxng/socket"
# apt packages
SEARX_PACKAGES_debian="\
@ -153,10 +155,10 @@ shell
install / remove
:all: complete (de-) installation of SearXNG service
:user: add/remove service user '$SERVICE_USER' ($SERVICE_HOME)
:dot-config: copy ./config.sh to ${SEARX_SRC}
:dot-config: copy ./config.sh to ${SEARXNG_SRC}
:searx-src: clone $GIT_URL
:init-src: copy files (SEARX_SRC_INIT_FILES) to ${SEARX_SRC}
:pyenv: create/remove virtualenv (python) in $SEARX_PYENV
:init-src: copy files (SEARXNG_SRC_INIT_FILES) to ${SEARXNG_SRC}
:pyenv: create/remove virtualenv (python) in $SEARXNG_PYENV
:uwsgi: install SearXNG uWSGI application
:settings: reinstall settings from ${SEARXNG_SETTINGS_PATH}
:packages: install needed packages from OS package manager
@ -173,7 +175,7 @@ deactivate service
stop and deactivate service daemon (systemd unit)
inspect
:service: run some small tests and inspect service's status and log
:settings: inspect YAML setting <key> from SearXNG instance (${SEARX_SRC})
:settings: inspect YAML setting <key> from SearXNG instance (${SEARXNG_SRC})
option
set one of the available options
apache
@ -267,8 +269,8 @@ main() {
rst_title "SearXNG (install uwsgi)"
verify_continue_install
install_searx_uwsgi
if ! service_is_available "http://${SEARX_INTERNAL_HTTP}"; then
err_msg "URL http://${SEARX_INTERNAL_HTTP} not available, check SearXNG & uwsgi setup!"
if ! service_is_available "http://${SEARXNG_INTERNAL_HTTP}"; then
err_msg "URL http://${SEARXNG_INTERNAL_HTTP} not available, check SearXNG & uwsgi setup!"
fi
;;
packages)
@ -355,8 +357,8 @@ install_all() {
test_local_searx
wait_key
install_searx_uwsgi
if ! service_is_available "http://${SEARX_INTERNAL_HTTP}"; then
err_msg "URL http://${SEARX_INTERNAL_HTTP} not available, check SearXNG & uwsgi setup!"
if ! service_is_available "http://${SEARXNG_INTERNAL_HTTP}"; then
err_msg "URL http://${SEARXNG_INTERNAL_HTTP} not available, check SearXNG & uwsgi setup!"
fi
if ask_yn "Do you want to inspect the installation?" Ny; then
inspect_service
@ -391,7 +393,7 @@ install_check() {
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"
sudo -H -u "${SERVICE_USER}" "${SEARXNG_PYENV}/bin/python" "utils/searxng_check.py"
if uWSGI_app_available 'searx.ini'; then
warn_msg "old searx.ini uWSGI app exists"
@ -404,7 +406,7 @@ update_searx() {
rst_para "fetch from $GIT_URL and reset to origin/$GIT_BRANCH"
tee_stderr 0.3 <<EOF | sudo -H -u "${SERVICE_USER}" -i 2>&1 | prefix_stdout "$_service_prefix"
cd ${SEARX_SRC}
cd ${SEARXNG_SRC}
git fetch origin "$GIT_BRANCH"
git reset --hard "origin/$GIT_BRANCH"
pip install -U pip
@ -458,7 +460,7 @@ EOF
}
clone_is_available() {
[[ -f "$SEARX_SRC/.git/config" ]]
[[ -f "$SEARXNG_SRC/.git/config" ]]
}
# shellcheck disable=SC2164
@ -482,12 +484,12 @@ clone_searx() {
warn_msg "take into account, installing branch $GIT_BRANCH while current branch is $(git rev-parse --abbrev-ref HEAD)"
fi
export SERVICE_HOME
git_clone "$REPO_ROOT" "$SEARX_SRC" \
git_clone "$REPO_ROOT" "$SEARXNG_SRC" \
"$GIT_BRANCH" "$SERVICE_USER"
pushd "${SEARX_SRC}" > /dev/null
pushd "${SEARXNG_SRC}" > /dev/null
tee_stderr 0.1 <<EOF | sudo -H -u "${SERVICE_USER}" -i 2>&1 | prefix_stdout "$_service_prefix"
cd "${SEARX_SRC}"
cd "${SEARXNG_SRC}"
git remote set-url origin ${GIT_URL}
git config user.email "$ADMIN_EMAIL"
git config user.name "$ADMIN_NAME"
@ -509,7 +511,7 @@ prompt_installation_status(){
return 0
;;
*)
info_msg "SearXNG instance already installed at: $SEARX_SRC"
info_msg "SearXNG instance already installed at: $SEARXNG_SRC"
info_msg "status: ${_BBlue}$(install_searx_get_state)${_creset} "
branch="$(git name-rev --name-only HEAD)"
remote="$(git config branch."${branch}".remote)"
@ -549,7 +551,7 @@ prompt_installation_setting(){
_state="$(install_searx_get_state)"
case $_state in
python-installed|installer-modified)
sudo -H -u "${SERVICE_USER}" "${SEARX_PYENV}/bin/python" <<EOF
sudo -H -u "${SERVICE_USER}" "${SEARXNG_PYENV}/bin/python" <<EOF
import sys
from searx import get_setting
name = "${1}"
@ -578,7 +580,7 @@ get_installed_version_variables() {
_state="$(install_searx_get_state)"
case $_state in
python-installed|installer-modified)
sudo -H -u "${SERVICE_USER}" "${SEARX_PYENV}/bin/python" -m searx.version;;
sudo -H -u "${SERVICE_USER}" "${SEARXNG_PYENV}/bin/python" -m searx.version;;
*)
return 42
;;
@ -586,7 +588,7 @@ get_installed_version_variables() {
}
init_SEARX_SRC(){
rst_title "Update instance: ${SEARX_SRC}/" section
rst_title "Update instance: ${SEARXNG_SRC}/" section
if ! clone_is_available; then
err_msg "you have to install SearXNG first"
@ -624,19 +626,19 @@ init_SEARX_SRC(){
break
;;
"replace file")
info_msg "copy: ${REPO_ROOT}/${fname} --> ${SEARX_SRC}/${fname}"
cp "${REPO_ROOT}/${fname}" "${SEARX_SRC}/${fname}"
info_msg "copy: ${REPO_ROOT}/${fname} --> ${SEARXNG_SRC}/${fname}"
cp "${REPO_ROOT}/${fname}" "${SEARXNG_SRC}/${fname}"
break
;;
"diff files")
$DIFF_CMD "${SEARX_SRC}/${fname}" "${REPO_ROOT}/${fname}"
$DIFF_CMD "${SEARXNG_SRC}/${fname}" "${REPO_ROOT}/${fname}"
;;
"interactive shell")
backup_file "${SEARX_SRC}/${fname}"
backup_file "${SEARXNG_SRC}/${fname}"
echo -e "// edit ${_Red}${dst}${_creset} to your needs"
echo -e "// exit with [${_BCyan}CTRL-D${_creset}]"
sudo -H -u "${SERVICE_USER}" -i
$DIFF_CMD "${SEARX_SRC}/${fname}" "${REPO_ROOT}/${fname}"
$DIFF_CMD "${SEARXNG_SRC}/${fname}" "${REPO_ROOT}/${fname}"
echo
echo -e "// ${_BBlack}did you edit file ...${_creset}"
echo -en "// ${_Red}${dst}${_creset}"
@ -650,19 +652,19 @@ init_SEARX_SRC(){
}
install_DOT_CONFIG(){
rst_title "Update instance: ${SEARX_SRC}/.config.sh" section
rst_title "Update instance: ${SEARXNG_SRC}/.config.sh" section
if cmp --silent "${REPO_ROOT}/.config.sh" "${SEARX_SRC}/.config.sh"; then
info_msg "${SEARX_SRC}/.config.sh is up to date"
if cmp --silent "${REPO_ROOT}/.config.sh" "${SEARXNG_SRC}/.config.sh"; then
info_msg "${SEARXNG_SRC}/.config.sh is up to date"
return 0
fi
diff "${REPO_ROOT}/.config.sh" "${SEARX_SRC}/.config.sh"
diff "${REPO_ROOT}/.config.sh" "${SEARXNG_SRC}/.config.sh"
if ! ask_yn "Do you want to copy file .config.sh into instance?" Yn; then
return 42
fi
backup_file "${SEARX_SRC}/.config.sh"
cp "${REPO_ROOT}/.config.sh" "${SEARX_SRC}/.config.sh"
backup_file "${SEARXNG_SRC}/.config.sh"
cp "${REPO_ROOT}/.config.sh" "${SEARXNG_SRC}/.config.sh"
}
install_settings() {
@ -689,30 +691,30 @@ remove_settings() {
remove_searx() {
rst_title "Drop SearXNG sources" section
if ask_yn "Do you really want to drop SearXNG sources ($SEARX_SRC)?"; then
rm -rf "$SEARX_SRC"
if ask_yn "Do you really want to drop SearXNG sources ($SEARXNG_SRC)?"; then
rm -rf "$SEARXNG_SRC"
else
rst_para "Leave SearXNG sources unchanged."
fi
}
pyenv_is_available() {
[[ -f "${SEARX_PYENV}/bin/activate" ]]
[[ -f "${SEARXNG_PYENV}/bin/activate" ]]
}
create_pyenv() {
rst_title "Create virtualenv (python)" section
echo
if [[ ! -f "${SEARX_SRC}/manage" ]]; then
if [[ ! -f "${SEARXNG_SRC}/manage" ]]; then
err_msg "to create pyenv for SearXNG, SearXNG has to be cloned first"
return 42
fi
info_msg "create pyenv in ${SEARX_PYENV}"
info_msg "create pyenv in ${SEARXNG_PYENV}"
tee_stderr 0.1 <<EOF | sudo -H -u "${SERVICE_USER}" -i 2>&1 | prefix_stdout "$_service_prefix"
rm -rf "${SEARX_PYENV}"
python3 -m venv "${SEARX_PYENV}"
grep -qFs -- 'source ${SEARX_PYENV}/bin/activate' ~/.profile \
|| echo 'source ${SEARX_PYENV}/bin/activate' >> ~/.profile
rm -rf "${SEARXNG_PYENV}"
python3 -m venv "${SEARXNG_PYENV}"
grep -qFs -- 'source ${SEARXNG_PYENV}/bin/activate' ~/.profile \
|| echo 'source ${SEARXNG_PYENV}/bin/activate' >> ~/.profile
EOF
info_msg "inspect python's virtual environment"
tee_stderr 0.1 <<EOF | sudo -H -u "${SERVICE_USER}" -i 2>&1 | prefix_stdout "$_service_prefix"
@ -725,22 +727,22 @@ pip install -U pip
pip install -U setuptools
pip install -U wheel
pip install -U pyyaml
cd ${SEARX_SRC}
cd ${SEARXNG_SRC}
pip install -e .
EOF
}
remove_pyenv() {
rst_title "Remove virtualenv (python)" section
if ! ask_yn "Do you really want to drop ${SEARX_PYENV} ?"; then
if ! ask_yn "Do you really want to drop ${SEARXNG_PYENV} ?"; then
return
fi
info_msg "remove pyenv activation from ~/.profile"
tee_stderr 0.1 <<EOF | sudo -H -u "${SERVICE_USER}" -i 2>&1 | prefix_stdout "$_service_prefix"
grep -v 'source ${SEARX_PYENV}/bin/activate' ~/.profile > ~/.profile.##
grep -v 'source ${SEARXNG_PYENV}/bin/activate' ~/.profile > ~/.profile.##
mv ~/.profile.## ~/.profile
EOF
rm -rf "${SEARX_PYENV}"
rm -rf "${SEARXNG_PYENV}"
}
configure_searx() {
@ -748,7 +750,7 @@ configure_searx() {
rst_para "Setup SearXNG config located at $SEARXNG_SETTINGS_PATH"
echo
tee_stderr 0.1 <<EOF | sudo -H -i 2>&1 | prefix_stdout "$_service_prefix"
cd ${SEARX_SRC}
cd ${SEARXNG_SRC}
sed -i -e "s/ultrasecretkey/$(openssl rand -hex 16)/g" "$SEARXNG_SETTINGS_PATH"
EOF
}
@ -757,8 +759,8 @@ test_local_searx() {
rst_title "Testing SearXNG instance localy" section
echo
if service_is_available "http://${SEARX_INTERNAL_HTTP}" &>/dev/null; then
err_msg "URL/port http://${SEARX_INTERNAL_HTTP} is already in use, you"
if service_is_available "http://${SEARXNG_INTERNAL_HTTP}" &>/dev/null; then
err_msg "URL/port http://${SEARXNG_INTERNAL_HTTP} is already in use, you"
err_msg "should stop that service before starting local tests!"
if ! ask_yn "Continue with local tests?"; then
return
@ -767,10 +769,10 @@ test_local_searx() {
sed -i -e "s/debug: false/debug: true/g" "$SEARXNG_SETTINGS_PATH"
tee_stderr 0.1 <<EOF | sudo -H -u "${SERVICE_USER}" -i 2>&1 | prefix_stdout "$_service_prefix"
export SEARXNG_SETTINGS_PATH="${SEARXNG_SETTINGS_PATH}"
cd ${SEARX_SRC}
cd ${SEARXNG_SRC}
timeout 10 python searx/webapp.py &
sleep 3
curl --location --verbose --head --insecure $SEARX_INTERNAL_HTTP
curl --location --verbose --head --insecure $SEARXNG_INTERNAL_HTTP
EOF
sed -i -e "s/debug: true/debug: false/g" "$SEARXNG_SETTINGS_PATH"
}
@ -805,7 +807,7 @@ deactivate_service() {
enable_image_proxy() {
info_msg "try to enable image_proxy ..."
tee_stderr 0.1 <<EOF | sudo -H -i 2>&1 | prefix_stdout "$_service_prefix"
cd ${SEARX_SRC}
cd ${SEARXNG_SRC}
sed -i -e "s/image_proxy: false/image_proxy: true/g" "$SEARXNG_SETTINGS_PATH"
EOF
uWSGI_restart "$SEARXNG_UWSGI_APP"
@ -814,7 +816,7 @@ EOF
disable_image_proxy() {
info_msg "try to enable image_proxy ..."
tee_stderr 0.1 <<EOF | sudo -H -i 2>&1 | prefix_stdout "$_service_prefix"
cd ${SEARX_SRC}
cd ${SEARXNG_SRC}
sed -i -e "s/image_proxy: true/image_proxy: false/g" "$SEARXNG_SETTINGS_PATH"
EOF
uWSGI_restart "$SEARXNG_UWSGI_APP"
@ -824,7 +826,7 @@ enable_debug() {
warn_msg "Do not enable debug in production environments!!"
info_msg "try to enable debug mode ..."
tee_stderr 0.1 <<EOF | sudo -H -i 2>&1 | prefix_stdout "$_service_prefix"
cd ${SEARX_SRC}
cd ${SEARXNG_SRC}
sed -i -e "s/debug: false/debug: true/g" "$SEARXNG_SETTINGS_PATH"
EOF
uWSGI_restart "$SEARXNG_UWSGI_APP"
@ -833,7 +835,7 @@ EOF
disable_debug() {
info_msg "try to disable debug mode ..."
tee_stderr 0.1 <<EOF | sudo -H -i 2>&1 | prefix_stdout "$_service_prefix"
cd ${SEARX_SRC}
cd ${SEARXNG_SRC}
sed -i -e "s/debug: true/debug: false/g" "$SEARXNG_SETTINGS_PATH"
EOF
uWSGI_restart "$SEARXNG_UWSGI_APP"
@ -903,11 +905,11 @@ EOF
lxc_suite_info
else
info_msg "public URL --> ${PUBLIC_URL}"
info_msg "internal URL --> http://${SEARX_INTERNAL_HTTP}"
info_msg "internal URL --> http://${SEARXNG_INTERNAL_HTTP}"
fi
if ! service_is_available "http://${SEARX_INTERNAL_HTTP}"; then
err_msg "uWSGI app (service) at http://${SEARX_INTERNAL_HTTP} is not available!"
if ! service_is_available "http://${SEARXNG_INTERNAL_HTTP}"; then
err_msg "uWSGI app (service) at http://${SEARXNG_INTERNAL_HTTP} is not available!"
MSG="${_Green}[${_BCyan}CTRL-C${_Green}] to stop or [${_BCyan}KEY${_Green}] to continue"\
wait_key
fi

View file

@ -4,7 +4,7 @@ LoadModule headers_module ${APACHE_MODULES}/mod_headers.so
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 "${SEARXNG_URL_PATH}" dontlog
# CustomLog /dev/null combined env=dontlog
@ -22,6 +22,13 @@ LoadModule proxy_uwsgi_module ${APACHE_MODULES}/mod_proxy_uwsgi.so
Allow from all
ProxyPreserveHost On
ProxyPass unix:${SEARX_UWSGI_SOCKET}|uwsgi://uwsgi-uds-searx/
ProxyPass unix:${SEARXNG_UWSGI_SOCKET}|uwsgi://uwsgi-uds-searx/
</Location>
# uWSGI serves the static files and in settings.yml we use::
#
# ui:
# static_use_hash: true
#
# Alias ${SEARXNG_URL_PATH}/static/ ${SEARXNG_STATIC}/

View file

@ -12,5 +12,5 @@ location ${SEARXNG_URL_PATH} {
}
location ${SEARXNG_URL_PATH}/static/ {
alias ${SEARX_SRC}/searx/static/;
alias ${SEARXNG_STATIC}/;
}

View file

@ -16,7 +16,7 @@ env = LANGUAGE=C.UTF-8
env = LC_ALL=C.UTF-8
# chdir to specified directory before apps loading
chdir = ${SEARX_SRC}/searx
chdir = ${SEARXNG_SRC}/searx
# SearXNG configuration (settings.yml)
env = SEARXNG_SETTINGS_PATH=${SEARXNG_SETTINGS_PATH}
@ -57,10 +57,10 @@ enable-threads = true
module = searx.webapp
# set PYTHONHOME/virtualenv
virtualenv = ${SEARX_PYENV}
virtualenv = ${SEARXNG_PYENV}
# add directory (or glob) to pythonpath
pythonpath = ${SEARX_SRC}
pythonpath = ${SEARXNG_SRC}
# speak to upstream
@ -74,20 +74,20 @@ pythonpath = ${SEARX_SRC}
# 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_HTTP}
http = ${SEARXNG_INTERNAL_HTTP}
# using unix-sockets:
#
# On some distributions you need to create the app folder for the sockets::
# Don't forget to create the folder where the sockets should take place::
#
# mkdir -p ${SEARX_UWSGI_SOCKET}
# chown -R ${SERVICE_USER}:${SERVICE_GROUP} ${SEARX_UWSGI_SOCKET}
# mkdir -p "$(dirname ${SEARXNG_UWSGI_SOCKET})"
# chown -R "${SERVICE_USER}:${SERVICE_GROUP}" "$(dirname ${SEARXNG_UWSGI_SOCKET})"
#
# socket = ${SEARX_UWSGI_SOCKET}
# socket = ${SEARXNG_UWSGI_SOCKET}
# uwsgi serves the static files
# expires set to one year since there are hashes
static-map = /static=${SEARX_SRC}/searx/static
static-map = /static=${SEARXNG_STATIC}
static-expires = /* 31557600
static-gzip-all = True
offload-threads = %k

View file

@ -16,7 +16,7 @@ env = LANGUAGE=C.UTF-8
env = LC_ALL=C.UTF-8
# chdir to specified directory before apps loading
chdir = ${SEARX_SRC}/searx
chdir = ${SEARXNG_SRC}/searx
# SearXNG configuration (settings.yml)
env = SEARXNG_SETTINGS_PATH=${SEARXNG_SETTINGS_PATH}
@ -57,10 +57,10 @@ enable-threads = true
module = searx.webapp
# set PYTHONHOME/virtualenv
virtualenv = ${SEARX_PYENV}
virtualenv = ${SEARXNG_PYENV}
# add directory (or glob) to pythonpath
pythonpath = ${SEARX_SRC}
pythonpath = ${SEARXNG_SRC}
# speak to upstream
@ -74,20 +74,24 @@ pythonpath = ${SEARX_SRC}
# 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_HTTP}
# http = ${SEARXNG_INTERNAL_HTTP}
# using unix-sockets:
#
# On some distributions you need to create the app folder for the sockets::
# Don't forget to create the folder where the sockets should take place::
#
# mkdir -p ${SEARX_UWSGI_SOCKET}
# chown -R ${SERVICE_USER}:${SERVICE_GROUP} ${SEARX_UWSGI_SOCKET}
# mkdir -p "$(dirname ${SEARXNG_UWSGI_SOCKET})"
# chown -R "${SERVICE_USER}:${SERVICE_GROUP}" "$(dirname ${SEARXNG_UWSGI_SOCKET})"
#
socket = ${SEARX_UWSGI_SOCKET}
socket = ${SEARXNG_UWSGI_SOCKET}
# uwsgi serves the static files
# uWSGI serves the static files and in settings.yml we use::
#
# ui:
# static_use_hash: true
#
static-map = /static=${SEARXNG_STATIC}
# expires set to one year since there are hashes
static-map = /static=${SEARX_SRC}/searx/static
static-expires = /* 31557600
static-gzip-all = True
offload-threads = %k

View file

@ -16,7 +16,7 @@ env = LANGUAGE=C.UTF-8
env = LC_ALL=C.UTF-8
# chdir to specified directory before apps loading
chdir = ${SEARX_SRC}/searx
chdir = ${SEARXNG_SRC}/searx
# SearXNG configuration (settings.yml)
env = SEARXNG_SETTINGS_PATH=${SEARXNG_SETTINGS_PATH}
@ -56,10 +56,10 @@ enable-threads = true
module = searx.webapp
# set PYTHONHOME/virtualenv
virtualenv = ${SEARX_PYENV}
virtualenv = ${SEARXNG_PYENV}
# add directory (or glob) to pythonpath
pythonpath = ${SEARX_SRC}
pythonpath = ${SEARXNG_SRC}
# speak to upstream
@ -73,20 +73,20 @@ pythonpath = ${SEARX_SRC}
# 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_HTTP}
http = ${SEARXNG_INTERNAL_HTTP}
# using unix-sockets:
#
# On some distributions you need to create the app folder for the sockets::
# Don't forget to create the folder where the sockets should take place::
#
# mkdir -p /run/uwsgi/app/searxng
# chown -R ${SERVICE_USER}:${SERVICE_GROUP} ${SEARX_UWSGI_SOCKET}
# mkdir -p "$(dirname ${SEARXNG_UWSGI_SOCKET})"
# chown -R "${SERVICE_USER}:${SERVICE_GROUP}" "$(dirname ${SEARXNG_UWSGI_SOCKET})"
#
# socket = ${SEARX_UWSGI_SOCKET}
# socket = ${SEARXNG_UWSGI_SOCKET}
# uwsgi serves the static files
# expires set to one year since there are hashes
static-map = /static=${SEARX_SRC}/searx/static
static-map = /static=${SEARXNG_STATIC}
static-expires = /* 31557600
static-gzip-all = True
offload-threads = %k

View file

@ -16,7 +16,7 @@ env = LANGUAGE=C.UTF-8
env = LC_ALL=C.UTF-8
# chdir to specified directory before apps loading
chdir = ${SEARX_SRC}/searx
chdir = ${SEARXNG_SRC}/searx
# SearXNG configuration (settings.yml)
env = SEARXNG_SETTINGS_PATH=${SEARXNG_SETTINGS_PATH}
@ -56,10 +56,10 @@ enable-threads = true
module = searx.webapp
# set PYTHONHOME/virtualenv
virtualenv = ${SEARX_PYENV}
virtualenv = ${SEARXNG_PYENV}
# add directory (or glob) to pythonpath
pythonpath = ${SEARX_SRC}
pythonpath = ${SEARXNG_SRC}
# speak to upstream
@ -73,20 +73,24 @@ pythonpath = ${SEARX_SRC}
# 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_HTTP}
# http = ${SEARXNG_INTERNAL_HTTP}
# using unix-sockets:
#
# On some distributions you need to create the app folder for the sockets::
# Don't forget to create the folder where the sockets should take place::
#
# mkdir -p ${SEARX_UWSGI_SOCKET}
# chown -R ${SERVICE_USER}:${SERVICE_GROUP} ${SEARX_UWSGI_SOCKET}
# mkdir -p "$(dirname ${SEARXNG_UWSGI_SOCKET})"
# chown -R "${SERVICE_USER}:${SERVICE_GROUP}" "$(dirname ${SEARXNG_UWSGI_SOCKET})"
#
socket = ${SEARX_UWSGI_SOCKET}
socket = ${SEARXNG_UWSGI_SOCKET}
# uwsgi serves the static files
# uWSGI serves the static files and in settings.yml we use::
#
# ui:
# static_use_hash: true
#
static-map = /static=${SEARXNG_STATIC}
# expires set to one year since there are hashes
static-map = /static=${SEARX_SRC}/searx/static
static-expires = /* 31557600
static-gzip-all = True
offload-threads = %k