mirror of
https://github.com/searxng/searxng.git
synced 2024-12-29 20:50:28 +00:00
Merge pull request #446 from return42/searxng-brand
[brand] SearXNG environment variables & /utils scripts
This commit is contained in:
commit
8f18c69f7a
21 changed files with 173 additions and 111 deletions
|
@ -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>`)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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::
|
||||
|
|
|
@ -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', '')
|
||||
|
|
|
@ -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``::
|
||||
|
||||
|
|
|
@ -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>`
|
||||
|
|
8
manage
8
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
|
||||
)
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -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'),
|
||||
|
||||
|
|
|
@ -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 .."
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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 .."
|
||||
|
|
166
utils/searx.sh
166
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 ;;
|
||||
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
|
||||
check)
|
||||
rst_title "SearXNG (check installation)" part
|
||||
verify_continue_install
|
||||
sudo -H -u "${SERVICE_USER}" "${SEARX_PYENV}/bin/python" "utils/searxng_check.py"
|
||||
;;
|
||||
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"
|
||||
|
||||
)
|
||||
|
|
|
@ -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
|
|
@ -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/;
|
||||
}
|
Loading…
Reference in a new issue