mirror of https://github.com/searxng/searxng.git
tooling box: simplify build enviroments
- no more need for a .config.mk - docs: use searx.brands environment - searx.sh, filtron.sh & morty.sh are sourcing utils/brand.env Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
parent
65b22be1f4
commit
7b4cf2eb48
13
.config.mk
13
.config.mk
|
@ -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)
|
|
||||||
|
|
35
.config.sh
35
.config.sh
|
@ -11,46 +11,41 @@
|
||||||
# adding them to you local brand (git branch)::
|
# adding them to you local brand (git branch)::
|
||||||
#
|
#
|
||||||
# git add .config
|
# 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 public URL of the searx instance: PUBLIC_URL="https://mydomain.xy/searx"
|
||||||
# The default is taken from the Makefile environment (SEARX_URL).
|
# The default is taken from ./utils/brand.env.
|
||||||
PUBLIC_URL="${SEARX_URL:-http://$(uname -n)/searx}"
|
|
||||||
PUBLIC_HOST="${PUBLIC_HOST:-$(echo "$PUBLIC_URL" | sed -e 's/[^/]*\/\/\([^@]*@\)\?\([^:/]*\).*/\2/')}"
|
PUBLIC_URL="${SEARX_URL}"
|
||||||
|
#PUBLIC_URL="http://$(uname -n)/searx"
|
||||||
|
|
||||||
# searx.sh
|
# 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
|
# Only change, if you maintain a searx brand in your searx fork.
|
||||||
# taken from the Makefile environment (DOCS_URL, GIT_URL).
|
# GIT_BRANCH="${GIT_BRANCH:-master}"
|
||||||
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}"
|
|
||||||
|
|
||||||
# filtron.sh
|
# filtron.sh
|
||||||
# ----------
|
# ----------
|
||||||
|
|
||||||
FILTRON_API="${FILTRON_API:-127.0.0.1:4005}"
|
# FILTRON_API="127.0.0.1:4005"
|
||||||
FILTRON_LISTEN="${FILTRON_LISTEN:-127.0.0.1:4004}"
|
# FILTRON_LISTEN="127.0.0.1:4004"
|
||||||
FILTRON_TARGET="${FILTRON_TARGET:-127.0.0.1:8888}"
|
# FILTRON_TARGET="127.0.0.1:8888"
|
||||||
|
|
||||||
# morty.sh
|
# morty.sh
|
||||||
# --------
|
# --------
|
||||||
|
|
||||||
# morty listen address
|
# 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
|
# 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
|
# **experimental**: Set SERVICE_USER to run all services by one account, but be
|
||||||
# aware that removing discrete components might conflict!
|
# aware that removing discrete components might conflict!
|
||||||
#
|
|
||||||
# SERVICE_USER=searx
|
# SERVICE_USER=searx
|
||||||
|
|
||||||
# Common $HOME folder of the service accounts
|
|
||||||
SERVICE_HOME_BASE="${SERVICE_HOME_BASE:-/usr/local}"
|
|
||||||
|
|
||||||
|
|
6
Makefile
6
Makefile
|
@ -1,6 +1,10 @@
|
||||||
# -*- coding: utf-8; mode: makefile-gmake -*-
|
# -*- coding: utf-8; mode: makefile-gmake -*-
|
||||||
.DEFAULT_GOAL=help
|
.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
|
include utils/makefile.include
|
||||||
|
|
||||||
PYOBJECTS = searx
|
PYOBJECTS = searx
|
||||||
|
|
|
@ -5,10 +5,10 @@ from sphinx_build_tools import load_sphinx_config
|
||||||
from searx.version import VERSION_STRING
|
from searx.version import VERSION_STRING
|
||||||
from pallets_sphinx_themes import ProjectLink
|
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")
|
GIT_BRANCH =os.environ.get("GIT_BRANCH", "master")
|
||||||
SEARX_URL = os.environ.get("SEARX_URL", "https://searx.me")
|
from searx.brand import SEARX_URL
|
||||||
DOCS_URL = os.environ.get("DOCS_URL", "https://asciimoo.github.io/searx/")
|
from searx.brand import DOCS_URL
|
||||||
|
|
||||||
# Project --------------------------------------------------------------
|
# Project --------------------------------------------------------------
|
||||||
|
|
||||||
|
|
|
@ -44,8 +44,7 @@ Makefile setup
|
||||||
|
|
||||||
.. _git stash: https://git-scm.com/docs/git-stash
|
.. _git stash: https://git-scm.com/docs/git-stash
|
||||||
|
|
||||||
The main setup is done in the :origin:`.config.sh` (read :ref:`toolboxing
|
The main setup is done in the :origin:`Makefile`::
|
||||||
setup`)::
|
|
||||||
|
|
||||||
export SEARX_URL=https://searx.me
|
export SEARX_URL=https://searx.me
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
|
|
||||||
# shellcheck source=utils/lib.sh
|
# shellcheck source=utils/lib.sh
|
||||||
source "$(dirname "${BASH_SOURCE[0]}")/lib.sh"
|
source "$(dirname "${BASH_SOURCE[0]}")/lib.sh"
|
||||||
|
# shellcheck source=utils/brand.env
|
||||||
|
source "${REPO_ROOT}/utils/brand.env"
|
||||||
source_dot_config
|
source_dot_config
|
||||||
source "${REPO_ROOT}/utils/lxc-searx.env"
|
source "${REPO_ROOT}/utils/lxc-searx.env"
|
||||||
in_container && lxc_set_suite_env
|
in_container && lxc_set_suite_env
|
||||||
|
@ -13,6 +15,9 @@ in_container && lxc_set_suite_env
|
||||||
# config
|
# 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}" \
|
FILTRON_URL_PATH="${FILTRON_URL_PATH:-$(echo "${PUBLIC_URL}" \
|
||||||
| sed -e 's,^.*://[^/]*\(/.*\),\1,g')}"
|
| sed -e 's,^.*://[^/]*\(/.*\),\1,g')}"
|
||||||
[[ "${FILTRON_URL_PATH}" == "${PUBLIC_URL}" ]] && FILTRON_URL_PATH=/
|
[[ "${FILTRON_URL_PATH}" == "${PUBLIC_URL}" ]] && FILTRON_URL_PATH=/
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
|
|
||||||
# shellcheck source=utils/lib.sh
|
# shellcheck source=utils/lib.sh
|
||||||
source "$(dirname "${BASH_SOURCE[0]}")/lib.sh"
|
source "$(dirname "${BASH_SOURCE[0]}")/lib.sh"
|
||||||
|
# shellcheck source=utils/brand.env
|
||||||
|
source "${REPO_ROOT}/utils/brand.env"
|
||||||
source_dot_config
|
source_dot_config
|
||||||
source "${REPO_ROOT}/utils/lxc-searx.env"
|
source "${REPO_ROOT}/utils/lxc-searx.env"
|
||||||
in_container && lxc_set_suite_env
|
in_container && lxc_set_suite_env
|
||||||
|
@ -12,8 +14,9 @@ in_container && lxc_set_suite_env
|
||||||
# config
|
# config
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
|
|
||||||
PUBLIC_URL_PATH_MORTY="/morty"
|
PUBLIC_URL="${PUBLIC_URL:-http://$(uname -n)/searx}"
|
||||||
PUBLIC_URL_MORTY="$(dirname "${PUBLIC_URL}")${PUBLIC_URL_PATH_MORTY}"
|
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}"
|
MORTY_LISTEN="${MORTY_LISTEN:-127.0.0.1:3000}"
|
||||||
# shellcheck disable=SC2034
|
# shellcheck disable=SC2034
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
|
|
||||||
# shellcheck source=utils/lib.sh
|
# shellcheck source=utils/lib.sh
|
||||||
source "$(dirname "${BASH_SOURCE[0]}")/lib.sh"
|
source "$(dirname "${BASH_SOURCE[0]}")/lib.sh"
|
||||||
|
# shellcheck source=utils/brand.env
|
||||||
|
source "${REPO_ROOT}/utils/brand.env"
|
||||||
source_dot_config
|
source_dot_config
|
||||||
source "${REPO_ROOT}/utils/lxc-searx.env"
|
source "${REPO_ROOT}/utils/lxc-searx.env"
|
||||||
in_container && lxc_set_suite_env
|
in_container && lxc_set_suite_env
|
||||||
|
@ -13,6 +15,8 @@ in_container && lxc_set_suite_env
|
||||||
# config
|
# config
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
PUBLIC_URL="${PUBLIC_URL:-http://$(uname -n)/searx}"
|
||||||
|
|
||||||
SEARX_INTERNAL_URL="${SEARX_INTERNAL_URL:-127.0.0.1:8888}"
|
SEARX_INTERNAL_URL="${SEARX_INTERNAL_URL:-127.0.0.1:8888}"
|
||||||
|
|
||||||
SEARX_URL_PATH="${SEARX_URL_PATH:-$(echo "${PUBLIC_URL}" \
|
SEARX_URL_PATH="${SEARX_URL_PATH:-$(echo "${PUBLIC_URL}" \
|
||||||
|
@ -28,8 +32,7 @@ SERVICE_HOME="${SERVICE_HOME_BASE}/${SERVICE_USER}"
|
||||||
# shellcheck disable=SC2034
|
# shellcheck disable=SC2034
|
||||||
SERVICE_GROUP="${SERVICE_USER}"
|
SERVICE_GROUP="${SERVICE_USER}"
|
||||||
|
|
||||||
SEARX_GIT_URL="${SEARX_GIT_URL:-https://github.com/asciimoo/searx.git}"
|
GIT_BRANCH="${GIT_BRANCH:-master}"
|
||||||
SEARX_GIT_BRANCH="${SEARX_GIT_BRANCH:-master}"
|
|
||||||
SEARX_PYENV="${SERVICE_HOME}/searx-pyenv"
|
SEARX_PYENV="${SERVICE_HOME}/searx-pyenv"
|
||||||
SEARX_SRC="${SERVICE_HOME}/searx-src"
|
SEARX_SRC="${SERVICE_HOME}/searx-src"
|
||||||
SEARX_SETTINGS_PATH="/etc/searx/settings.yml"
|
SEARX_SETTINGS_PATH="/etc/searx/settings.yml"
|
||||||
|
@ -126,7 +129,7 @@ shell
|
||||||
install / remove
|
install / remove
|
||||||
:all: complete (de-) installation of searx service
|
:all: complete (de-) installation of searx service
|
||||||
:user: add/remove service user '$SERVICE_USER' ($SERVICE_HOME)
|
: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
|
:pyenv: create/remove virtualenv (python) in $SEARX_PYENV
|
||||||
:uwsgi: install searx uWSGI application
|
:uwsgi: install searx uWSGI application
|
||||||
:settings: reinstall settings from ${REPO_ROOT}/searx/settings.yml
|
: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::
|
If needed, set PUBLIC_URL of your WEB service in the '${DOT_CONFIG#"$REPO_ROOT/"}' file::
|
||||||
|
|
||||||
PUBLIC_URL : ${PUBLIC_URL}
|
PUBLIC_URL : ${PUBLIC_URL}
|
||||||
PUBLIC_HOST : ${PUBLIC_HOST}
|
|
||||||
SEARX_INSTANCE_NAME : ${SEARX_INSTANCE_NAME}
|
SEARX_INSTANCE_NAME : ${SEARX_INSTANCE_NAME}
|
||||||
SERVICE_USER : ${SERVICE_USER}
|
SERVICE_USER : ${SERVICE_USER}
|
||||||
|
|
||||||
|
@ -286,7 +288,7 @@ update_searx() {
|
||||||
echo
|
echo
|
||||||
tee_stderr 0.3 <<EOF | sudo -H -u "${SERVICE_USER}" -i 2>&1 | prefix_stdout "$_service_prefix"
|
tee_stderr 0.3 <<EOF | sudo -H -u "${SERVICE_USER}" -i 2>&1 | prefix_stdout "$_service_prefix"
|
||||||
cd ${SEARX_SRC}
|
cd ${SEARX_SRC}
|
||||||
git checkout -B "$SEARX_GIT_BRANCH"
|
git checkout -B "$GIT_BRANCH"
|
||||||
git pull
|
git pull
|
||||||
${SEARX_SRC}/manage.sh update_packages
|
${SEARX_SRC}/manage.sh update_packages
|
||||||
EOF
|
EOF
|
||||||
|
@ -344,12 +346,12 @@ clone_searx() {
|
||||||
fi
|
fi
|
||||||
export SERVICE_HOME
|
export SERVICE_HOME
|
||||||
git_clone "$REPO_ROOT" "$SEARX_SRC" \
|
git_clone "$REPO_ROOT" "$SEARX_SRC" \
|
||||||
"$SEARX_GIT_BRANCH" "$SERVICE_USER"
|
"$GIT_BRANCH" "$SERVICE_USER"
|
||||||
|
|
||||||
pushd "${SEARX_SRC}" > /dev/null
|
pushd "${SEARX_SRC}" > /dev/null
|
||||||
tee_stderr 0.1 <<EOF | sudo -H -u "${SERVICE_USER}" -i 2>&1 | prefix_stdout "$_service_prefix"
|
tee_stderr 0.1 <<EOF | sudo -H -u "${SERVICE_USER}" -i 2>&1 | prefix_stdout "$_service_prefix"
|
||||||
cd "${SEARX_SRC}"
|
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.email "$ADMIN_EMAIL"
|
||||||
git config user.name "$ADMIN_NAME"
|
git config user.name "$ADMIN_NAME"
|
||||||
git config --list
|
git config --list
|
||||||
|
@ -546,7 +548,6 @@ inspect_service() {
|
||||||
sourced ${DOT_CONFIG#"$REPO_ROOT/"} :
|
sourced ${DOT_CONFIG#"$REPO_ROOT/"} :
|
||||||
|
|
||||||
PUBLIC_URL : ${PUBLIC_URL}
|
PUBLIC_URL : ${PUBLIC_URL}
|
||||||
PUBLIC_HOST : ${PUBLIC_HOST}
|
|
||||||
SEARX_URL_PATH : ${SEARX_URL_PATH}
|
SEARX_URL_PATH : ${SEARX_URL_PATH}
|
||||||
SEARX_INSTANCE_NAME : ${SEARX_INSTANCE_NAME}
|
SEARX_INSTANCE_NAME : ${SEARX_INSTANCE_NAME}
|
||||||
SEARX_INTERNAL_URL : ${SEARX_INTERNAL_URL}
|
SEARX_INTERNAL_URL : ${SEARX_INTERNAL_URL}
|
||||||
|
|
|
@ -23,6 +23,6 @@ ProxyPreserveHost On
|
||||||
# needed by searx to render correct *Search URL* in the *Link* box and
|
# needed by searx to render correct *Search URL* in the *Link* box and
|
||||||
# *saved preference*.
|
# *saved preference*.
|
||||||
|
|
||||||
# RequestHeader set Host ${PUBLIC_URL_PATH_MORTY}
|
# RequestHeader set Host ${PUBLIC_HOST}
|
||||||
|
|
||||||
</Location>
|
</Location>
|
||||||
|
|
Loading…
Reference in New Issue