diff --git a/.config.mk b/.config.mk deleted file mode 100644 index e03d2905..00000000 --- a/.config.mk +++ /dev/null @@ -1,13 +0,0 @@ -# -*- coding: utf-8; mode: makefile-gmake -*- -# SPDX-License-Identifier: AGPL-3.0-or-later -# -# This environment is used by Makefile targets. If you not maintain your own -# searx brand, you normally not need to change the defaults (except SEARX_URL). -# Compare your settings here with file .config.sh used by the toolboxing in -# utils. - -export SEARX_URL:=$(or ${SEARX_URL},https://searx.me) - -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/.config.sh b/.config.sh index 0fdc0ca1..57411ce6 100644 --- a/.config.sh +++ b/.config.sh @@ -11,46 +11,41 @@ # adding them to you local brand (git branch):: # # git add .config -# -# Compare your settings here with file .config.mk used by the Makefile targets. # The public URL of the searx instance: PUBLIC_URL="https://mydomain.xy/searx" -# The default is taken from the Makefile environment (SEARX_URL). -PUBLIC_URL="${SEARX_URL:-http://$(uname -n)/searx}" -PUBLIC_HOST="${PUBLIC_HOST:-$(echo "$PUBLIC_URL" | sed -e 's/[^/]*\/\/\([^@]*@\)\?\([^:/]*\).*/\2/')}" +# The default is taken from ./utils/brand.env. + +PUBLIC_URL="${SEARX_URL}" +#PUBLIC_URL="http://$(uname -n)/searx" # searx.sh # --------- -SEARX_INTERNAL_URL="${SEARX_INTERNAL_URL:-127.0.0.1:8888}" +# SEARX_INTERNAL_URL="127.0.0.1:8888" -# Only change, if you maintain a searx brand in your searx fork. The default is -# taken from the Makefile environment (DOCS_URL, GIT_URL). -SEARX_DOCS_URL="${DOCS_URL:-https://asciimoo.github.io/searx}" -SEARX_GIT_URL="${GIT_URL:-https://github.com/asciimoo/searx.git}" -SEARX_GIT_BRANCH="${SEARX_GIT_BRANCH:-master}" +# Only change, if you maintain a searx brand in your searx fork. +# GIT_BRANCH="${GIT_BRANCH:-master}" # filtron.sh # ---------- -FILTRON_API="${FILTRON_API:-127.0.0.1:4005}" -FILTRON_LISTEN="${FILTRON_LISTEN:-127.0.0.1:4004}" -FILTRON_TARGET="${FILTRON_TARGET:-127.0.0.1:8888}" +# FILTRON_API="127.0.0.1:4005" +# FILTRON_LISTEN="127.0.0.1:4004" +# FILTRON_TARGET="127.0.0.1:8888" # morty.sh # -------- # morty listen address -MORTY_LISTEN="${MORTY_LISTEN:-127.0.0.1:3000}" +# MORTY_LISTEN="127.0.0.1:3000" +# PUBLIC_URL_PATH_MORTY="/morty" # system services # --------------- +# Common $HOME folder of the service accounts +# SERVICE_HOME_BASE="/usr/local" + # **experimental**: Set SERVICE_USER to run all services by one account, but be # aware that removing discrete components might conflict! -# # SERVICE_USER=searx - -# Common $HOME folder of the service accounts -SERVICE_HOME_BASE="${SERVICE_HOME_BASE:-/usr/local}" - diff --git a/Makefile b/Makefile index acff120f..335fa8ef 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,10 @@ # -*- coding: utf-8; mode: makefile-gmake -*- .DEFAULT_GOAL=help -include ./.config.mk + +export GIT_URL=https://github.com/asciimoo/searx +export SEARX_URL=https://searx.me +export DOCS_URL=https://asciimoo.github.io/searx + include utils/makefile.include PYOBJECTS = searx diff --git a/docs/conf.py b/docs/conf.py index c2b2bbd8..761465c4 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -5,10 +5,10 @@ from sphinx_build_tools import load_sphinx_config from searx.version import VERSION_STRING from pallets_sphinx_themes import ProjectLink -GIT_URL = os.environ.get("GIT_URL", "https://github.com/asciimoo/searx") +from searx.brand import GIT_URL GIT_BRANCH =os.environ.get("GIT_BRANCH", "master") -SEARX_URL = os.environ.get("SEARX_URL", "https://searx.me") -DOCS_URL = os.environ.get("DOCS_URL", "https://asciimoo.github.io/searx/") +from searx.brand import SEARX_URL +from searx.brand import DOCS_URL # Project -------------------------------------------------------------- diff --git a/docs/dev/makefile.rst b/docs/dev/makefile.rst index ed9942f4..85aea8ae 100644 --- a/docs/dev/makefile.rst +++ b/docs/dev/makefile.rst @@ -44,8 +44,7 @@ Makefile setup .. _git stash: https://git-scm.com/docs/git-stash -The main setup is done in the :origin:`.config.sh` (read :ref:`toolboxing -setup`):: +The main setup is done in the :origin:`Makefile`:: export SEARX_URL=https://searx.me diff --git a/utils/filtron.sh b/utils/filtron.sh index 85000c59..c81a252a 100755 --- a/utils/filtron.sh +++ b/utils/filtron.sh @@ -5,6 +5,8 @@ # shellcheck source=utils/lib.sh source "$(dirname "${BASH_SOURCE[0]}")/lib.sh" +# shellcheck source=utils/brand.env +source "${REPO_ROOT}/utils/brand.env" source_dot_config source "${REPO_ROOT}/utils/lxc-searx.env" in_container && lxc_set_suite_env @@ -13,6 +15,9 @@ in_container && lxc_set_suite_env # config # ---------------------------------------------------------------------------- +PUBLIC_URL="${PUBLIC_URL:-http://$(uname -n)/searx}" +PUBLIC_HOST="${PUBLIC_HOST:-$(echo "$PUBLIC_URL" | sed -e 's/[^/]*\/\/\([^@]*@\)\?\([^:/]*\).*/\2/')}" + FILTRON_URL_PATH="${FILTRON_URL_PATH:-$(echo "${PUBLIC_URL}" \ | sed -e 's,^.*://[^/]*\(/.*\),\1,g')}" [[ "${FILTRON_URL_PATH}" == "${PUBLIC_URL}" ]] && FILTRON_URL_PATH=/ diff --git a/utils/morty.sh b/utils/morty.sh index 58de0cc9..a20cde36 100755 --- a/utils/morty.sh +++ b/utils/morty.sh @@ -4,6 +4,8 @@ # shellcheck source=utils/lib.sh source "$(dirname "${BASH_SOURCE[0]}")/lib.sh" +# shellcheck source=utils/brand.env +source "${REPO_ROOT}/utils/brand.env" source_dot_config source "${REPO_ROOT}/utils/lxc-searx.env" in_container && lxc_set_suite_env @@ -12,8 +14,9 @@ in_container && lxc_set_suite_env # config # ---------------------------------------------------------------------------- -PUBLIC_URL_PATH_MORTY="/morty" -PUBLIC_URL_MORTY="$(dirname "${PUBLIC_URL}")${PUBLIC_URL_PATH_MORTY}" +PUBLIC_URL="${PUBLIC_URL:-http://$(uname -n)/searx}" +PUBLIC_URL_PATH_MORTY="${PUBLIC_URL_PATH_MORTY:-/morty}" +PUBLIC_URL_MORTY="$(echo $PUBLIC_URL | sed -e's,^\(.*://[^/]*\).*,\1,g')${PUBLIC_URL_PATH_MORTY}" MORTY_LISTEN="${MORTY_LISTEN:-127.0.0.1:3000}" # shellcheck disable=SC2034 diff --git a/utils/searx.sh b/utils/searx.sh index 19cb4198..a6f2d5ee 100755 --- a/utils/searx.sh +++ b/utils/searx.sh @@ -5,6 +5,8 @@ # shellcheck source=utils/lib.sh source "$(dirname "${BASH_SOURCE[0]}")/lib.sh" +# shellcheck source=utils/brand.env +source "${REPO_ROOT}/utils/brand.env" source_dot_config source "${REPO_ROOT}/utils/lxc-searx.env" in_container && lxc_set_suite_env @@ -13,6 +15,8 @@ in_container && lxc_set_suite_env # config # ---------------------------------------------------------------------------- +PUBLIC_URL="${PUBLIC_URL:-http://$(uname -n)/searx}" + SEARX_INTERNAL_URL="${SEARX_INTERNAL_URL:-127.0.0.1:8888}" SEARX_URL_PATH="${SEARX_URL_PATH:-$(echo "${PUBLIC_URL}" \ @@ -28,8 +32,7 @@ SERVICE_HOME="${SERVICE_HOME_BASE}/${SERVICE_USER}" # shellcheck disable=SC2034 SERVICE_GROUP="${SERVICE_USER}" -SEARX_GIT_URL="${SEARX_GIT_URL:-https://github.com/asciimoo/searx.git}" -SEARX_GIT_BRANCH="${SEARX_GIT_BRANCH:-master}" +GIT_BRANCH="${GIT_BRANCH:-master}" SEARX_PYENV="${SERVICE_HOME}/searx-pyenv" SEARX_SRC="${SERVICE_HOME}/searx-src" SEARX_SETTINGS_PATH="/etc/searx/settings.yml" @@ -126,7 +129,7 @@ shell install / remove :all: complete (de-) installation of searx service :user: add/remove service user '$SERVICE_USER' ($SERVICE_HOME) - :searx-src: clone $SEARX_GIT_URL + :searx-src: clone $GIT_URL :pyenv: create/remove virtualenv (python) in $SEARX_PYENV :uwsgi: install searx uWSGI application :settings: reinstall settings from ${REPO_ROOT}/searx/settings.yml @@ -151,7 +154,6 @@ 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} - PUBLIC_HOST : ${PUBLIC_HOST} SEARX_INSTANCE_NAME : ${SEARX_INSTANCE_NAME} SERVICE_USER : ${SERVICE_USER} @@ -286,7 +288,7 @@ update_searx() { echo tee_stderr 0.3 <&1 | prefix_stdout "$_service_prefix" cd ${SEARX_SRC} -git checkout -B "$SEARX_GIT_BRANCH" +git checkout -B "$GIT_BRANCH" git pull ${SEARX_SRC}/manage.sh update_packages EOF @@ -344,12 +346,12 @@ clone_searx() { fi export SERVICE_HOME git_clone "$REPO_ROOT" "$SEARX_SRC" \ - "$SEARX_GIT_BRANCH" "$SERVICE_USER" + "$GIT_BRANCH" "$SERVICE_USER" pushd "${SEARX_SRC}" > /dev/null tee_stderr 0.1 <&1 | prefix_stdout "$_service_prefix" cd "${SEARX_SRC}" -git remote set-url origin ${SEARX_GIT_URL} +git remote set-url origin ${GIT_URL} git config user.email "$ADMIN_EMAIL" git config user.name "$ADMIN_NAME" git config --list @@ -546,7 +548,6 @@ inspect_service() { sourced ${DOT_CONFIG#"$REPO_ROOT/"} : PUBLIC_URL : ${PUBLIC_URL} - PUBLIC_HOST : ${PUBLIC_HOST} SEARX_URL_PATH : ${SEARX_URL_PATH} SEARX_INSTANCE_NAME : ${SEARX_INSTANCE_NAME} SEARX_INTERNAL_URL : ${SEARX_INTERNAL_URL} diff --git a/utils/templates/etc/apache2/sites-available/morty.conf b/utils/templates/etc/apache2/sites-available/morty.conf index 6bcc77b7..2c5727b1 100644 --- a/utils/templates/etc/apache2/sites-available/morty.conf +++ b/utils/templates/etc/apache2/sites-available/morty.conf @@ -23,6 +23,6 @@ ProxyPreserveHost On # needed by searx to render correct *Search URL* in the *Link* box and # *saved preference*. - # RequestHeader set Host ${PUBLIC_URL_PATH_MORTY} + # RequestHeader set Host ${PUBLIC_HOST}