on master help sign in
tooling box: simplify build enviroments
7b4cf2eMarkus Heiser
.config.mkdeleted−13
@@ -1,13 +0,0 @@
1−# -*- coding: utf-8; mode: makefile-gmake -*-
2−# SPDX-License-Identifier: AGPL-3.0-or-later
3−#
4−# This environment is used by Makefile targets. If you not maintain your own
5−# searx brand, you normally not need to change the defaults (except SEARX_URL).
6−# Compare your settings here with file .config.sh used by the toolboxing in
7−# utils.
8−
9−export SEARX_URL:=$(or ${SEARX_URL},https://searx.me)
10−
11−export DOCS_URL:=$(or ${DOCS_URL},https://asciimoo.github.io/searx)
12−export GIT_URL:=$(or ${GIT_URL},https://github.com/asciimoo/searx)
13−
.config.sh+15−20
@@ -11,46 +11,41 @@
11# adding them to you local brand (git branch)::
11# adding them to you local brand (git branch)::
12#
12#
13# git add .config
13# git add .config
14−#
15−# Compare your settings here with file .config.mk used by the Makefile targets.
16
14
17# The public URL of the searx instance: PUBLIC_URL="https://mydomain.xy/searx"
15# The public URL of the searx instance: PUBLIC_URL="https://mydomain.xy/searx"
18−# The default is taken from the Makefile environment (SEARX_URL).
16+# The default is taken from ./utils/brand.env.
17+
19−PUBLIC_URL="${SEARX_URL:-http://$(uname -n)/searx}"
18+PUBLIC_URL="${SEARX_URL}"
20−PUBLIC_HOST="${PUBLIC_HOST:-$(echo "$PUBLIC_URL" | sed -e 's/[^/]*\/\/\([^@]*@\)\?\([^:/]*\).*/\2/')}"
19+#PUBLIC_URL="http://$(uname -n)/searx"
21
20
22# searx.sh
21# searx.sh
23# ---------
22# ---------
24
23
25−SEARX_INTERNAL_URL="${SEARX_INTERNAL_URL:-127.0.0.1:8888}"
24+# SEARX_INTERNAL_URL="127.0.0.1:8888"
26
25
27−# Only change, if you maintain a searx brand in your searx fork. The default is
26+# Only change, if you maintain a searx brand in your searx fork.
28−# taken from the Makefile environment (DOCS_URL, GIT_URL).
27+# GIT_BRANCH="${GIT_BRANCH:-master}"
29−SEARX_DOCS_URL="${DOCS_URL:-https://asciimoo.github.io/searx}"
30−SEARX_GIT_URL="${GIT_URL:-https://github.com/asciimoo/searx.git}"
31−SEARX_GIT_BRANCH="${SEARX_GIT_BRANCH:-master}"
32
28
33# filtron.sh
29# filtron.sh
34# ----------
30# ----------
35
31
36−FILTRON_API="${FILTRON_API:-127.0.0.1:4005}"
32+# FILTRON_API="127.0.0.1:4005"
37−FILTRON_LISTEN="${FILTRON_LISTEN:-127.0.0.1:4004}"
33+# FILTRON_LISTEN="127.0.0.1:4004"
38−FILTRON_TARGET="${FILTRON_TARGET:-127.0.0.1:8888}"
34+# FILTRON_TARGET="127.0.0.1:8888"
39
35
40# morty.sh
36# morty.sh
41# --------
37# --------
42
38
43# morty listen address
39# morty listen address
44−MORTY_LISTEN="${MORTY_LISTEN:-127.0.0.1:3000}"
40+# MORTY_LISTEN="127.0.0.1:3000"
41+# PUBLIC_URL_PATH_MORTY="/morty"
45
42
46# system services
43# system services
47# ---------------
44# ---------------
48
45
46+# Common $HOME folder of the service accounts
47+# SERVICE_HOME_BASE="/usr/local"
48+
49# **experimental**: Set SERVICE_USER to run all services by one account, but be
49# **experimental**: Set SERVICE_USER to run all services by one account, but be
50# aware that removing discrete components might conflict!
50# aware that removing discrete components might conflict!
51−#
52# SERVICE_USER=searx
51# SERVICE_USER=searx
53−
54−# Common $HOME folder of the service accounts
55−SERVICE_HOME_BASE="${SERVICE_HOME_BASE:-/usr/local}"
56−
Makefile+5−1
@@ -1,6 +1,10 @@
1# -*- coding: utf-8; mode: makefile-gmake -*-
1# -*- coding: utf-8; mode: makefile-gmake -*-
2.DEFAULT_GOAL=help
2.DEFAULT_GOAL=help
3−include ./.config.mk
3+
4+export GIT_URL=https://github.com/asciimoo/searx
5+export SEARX_URL=https://searx.me
6+export DOCS_URL=https://asciimoo.github.io/searx
7+
4include utils/makefile.include
8include utils/makefile.include
5
9
6PYOBJECTS = searx
10PYOBJECTS = searx
docs/conf.py+3−3
@@ -5,10 +5,10 @@ from sphinx_build_tools import load_sphinx_config
5from searx.version import VERSION_STRING
5from searx.version import VERSION_STRING
6from pallets_sphinx_themes import ProjectLink
6from pallets_sphinx_themes import ProjectLink
7
7
8−GIT_URL = os.environ.get("GIT_URL", "https://github.com/asciimoo/searx")
8+from searx.brand import GIT_URL
9GIT_BRANCH =os.environ.get("GIT_BRANCH", "master")
9GIT_BRANCH =os.environ.get("GIT_BRANCH", "master")
10−SEARX_URL = os.environ.get("SEARX_URL", "https://searx.me")
10+from searx.brand import SEARX_URL
11−DOCS_URL = os.environ.get("DOCS_URL", "https://asciimoo.github.io/searx/")
11+from searx.brand import DOCS_URL
12
12
13# Project --------------------------------------------------------------
13# Project --------------------------------------------------------------
14
14
docs/dev/makefile.rst+1−2
@@ -44,8 +44,7 @@ Makefile setup
44
44
45.. _git stash: https://git-scm.com/docs/git-stash
45.. _git stash: https://git-scm.com/docs/git-stash
46
46
47−The main setup is done in the :origin:`.config.sh` (read :ref:`toolboxing
47+The main setup is done in the :origin:`Makefile`::
48−setup`)::
49
48
50 export SEARX_URL=https://searx.me
49 export SEARX_URL=https://searx.me
51
50
utils/filtron.sh+5
@@ -5,6 +5,8 @@
5
5
6# shellcheck source=utils/lib.sh
6# shellcheck source=utils/lib.sh
7source "$(dirname "${BASH_SOURCE[0]}")/lib.sh"
7source "$(dirname "${BASH_SOURCE[0]}")/lib.sh"
8+# shellcheck source=utils/brand.env
9+source "${REPO_ROOT}/utils/brand.env"
8source_dot_config
10source_dot_config
9source "${REPO_ROOT}/utils/lxc-searx.env"
11source "${REPO_ROOT}/utils/lxc-searx.env"
10in_container && lxc_set_suite_env
12in_container && lxc_set_suite_env
@@ -13,6 +15,9 @@ in_container && lxc_set_suite_env
13# config
15# config
14# ----------------------------------------------------------------------------
16# ----------------------------------------------------------------------------
15
17
18+PUBLIC_URL="${PUBLIC_URL:-http://$(uname -n)/searx}"
19+PUBLIC_HOST="${PUBLIC_HOST:-$(echo "$PUBLIC_URL" | sed -e 's/[^/]*\/\/\([^@]*@\)\?\([^:/]*\).*/\2/')}"
20+
16FILTRON_URL_PATH="${FILTRON_URL_PATH:-$(echo "${PUBLIC_URL}" \
21FILTRON_URL_PATH="${FILTRON_URL_PATH:-$(echo "${PUBLIC_URL}" \
17| sed -e 's,^.*://[^/]*\(/.*\),\1,g')}"
22| sed -e 's,^.*://[^/]*\(/.*\),\1,g')}"
18[[ "${FILTRON_URL_PATH}" == "${PUBLIC_URL}" ]] && FILTRON_URL_PATH=/
23[[ "${FILTRON_URL_PATH}" == "${PUBLIC_URL}" ]] && FILTRON_URL_PATH=/
utils/morty.sh+5−2
@@ -4,6 +4,8 @@
4
4
5# shellcheck source=utils/lib.sh
5# shellcheck source=utils/lib.sh
6source "$(dirname "${BASH_SOURCE[0]}")/lib.sh"
6source "$(dirname "${BASH_SOURCE[0]}")/lib.sh"
7+# shellcheck source=utils/brand.env
8+source "${REPO_ROOT}/utils/brand.env"
7source_dot_config
9source_dot_config
8source "${REPO_ROOT}/utils/lxc-searx.env"
10source "${REPO_ROOT}/utils/lxc-searx.env"
9in_container && lxc_set_suite_env
11in_container && lxc_set_suite_env
@@ -12,8 +14,9 @@ in_container && lxc_set_suite_env
12# config
14# config
13# ----------------------------------------------------------------------------
15# ----------------------------------------------------------------------------
14
16
15−PUBLIC_URL_PATH_MORTY="/morty"
17+PUBLIC_URL="${PUBLIC_URL:-http://$(uname -n)/searx}"
18+PUBLIC_URL_PATH_MORTY="${PUBLIC_URL_PATH_MORTY:-/morty}"
16−PUBLIC_URL_MORTY="$(dirname "${PUBLIC_URL}")${PUBLIC_URL_PATH_MORTY}"
19+PUBLIC_URL_MORTY="$(echo $PUBLIC_URL | sed -e's,^\(.*://[^/]*\).*,\1,g')${PUBLIC_URL_PATH_MORTY}"
17
20
18MORTY_LISTEN="${MORTY_LISTEN:-127.0.0.1:3000}"
21MORTY_LISTEN="${MORTY_LISTEN:-127.0.0.1:3000}"
19# shellcheck disable=SC2034
22# shellcheck disable=SC2034
utils/searx.sh+9−8
@@ -5,6 +5,8 @@
5
5
6# shellcheck source=utils/lib.sh
6# shellcheck source=utils/lib.sh
7source "$(dirname "${BASH_SOURCE[0]}")/lib.sh"
7source "$(dirname "${BASH_SOURCE[0]}")/lib.sh"
8+# shellcheck source=utils/brand.env
9+source "${REPO_ROOT}/utils/brand.env"
8source_dot_config
10source_dot_config
9source "${REPO_ROOT}/utils/lxc-searx.env"
11source "${REPO_ROOT}/utils/lxc-searx.env"
10in_container && lxc_set_suite_env
12in_container && lxc_set_suite_env
@@ -13,6 +15,8 @@ in_container && lxc_set_suite_env
13# config
15# config
14# ----------------------------------------------------------------------------
16# ----------------------------------------------------------------------------
15
17
18+PUBLIC_URL="${PUBLIC_URL:-http://$(uname -n)/searx}"
19+
16SEARX_INTERNAL_URL="${SEARX_INTERNAL_URL:-127.0.0.1:8888}"
20SEARX_INTERNAL_URL="${SEARX_INTERNAL_URL:-127.0.0.1:8888}"
17
21
18SEARX_URL_PATH="${SEARX_URL_PATH:-$(echo "${PUBLIC_URL}" \
22SEARX_URL_PATH="${SEARX_URL_PATH:-$(echo "${PUBLIC_URL}" \
@@ -28,8 +32,7 @@ SERVICE_HOME="${SERVICE_HOME_BASE}/${SERVICE_USER}"
28# shellcheck disable=SC2034
32# shellcheck disable=SC2034
29SERVICE_GROUP="${SERVICE_USER}"
33SERVICE_GROUP="${SERVICE_USER}"
30
34
31−SEARX_GIT_URL="${SEARX_GIT_URL:-https://github.com/asciimoo/searx.git}"
35+GIT_BRANCH="${GIT_BRANCH:-master}"
32−SEARX_GIT_BRANCH="${SEARX_GIT_BRANCH:-master}"
33SEARX_PYENV="${SERVICE_HOME}/searx-pyenv"
36SEARX_PYENV="${SERVICE_HOME}/searx-pyenv"
34SEARX_SRC="${SERVICE_HOME}/searx-src"
37SEARX_SRC="${SERVICE_HOME}/searx-src"
35SEARX_SETTINGS_PATH="/etc/searx/settings.yml"
38SEARX_SETTINGS_PATH="/etc/searx/settings.yml"
@@ -126,7 +129,7 @@ shell
126install / remove
129install / remove
127 :all: complete (de-) installation of searx service
130 :all: complete (de-) installation of searx service
128 :user: add/remove service user '$SERVICE_USER' ($SERVICE_HOME)
131 :user: add/remove service user '$SERVICE_USER' ($SERVICE_HOME)
129− :searx-src: clone $SEARX_GIT_URL
132+ :searx-src: clone $GIT_URL
130 :pyenv: create/remove virtualenv (python) in $SEARX_PYENV
133 :pyenv: create/remove virtualenv (python) in $SEARX_PYENV
131 :uwsgi: install searx uWSGI application
134 :uwsgi: install searx uWSGI application
132 :settings: reinstall settings from ${REPO_ROOT}/searx/settings.yml
135 :settings: reinstall settings from ${REPO_ROOT}/searx/settings.yml
@@ -151,7 +154,6 @@ searx settings: ${SEARX_SETTINGS_PATH}
151If needed, set PUBLIC_URL of your WEB service in the '${DOT_CONFIG#"$REPO_ROOT/"}' file::
154If needed, set PUBLIC_URL of your WEB service in the '${DOT_CONFIG#"$REPO_ROOT/"}' file::
152
155
153 PUBLIC_URL : ${PUBLIC_URL}
156 PUBLIC_URL : ${PUBLIC_URL}
154− PUBLIC_HOST : ${PUBLIC_HOST}
155 SEARX_INSTANCE_NAME : ${SEARX_INSTANCE_NAME}
157 SEARX_INSTANCE_NAME : ${SEARX_INSTANCE_NAME}
156 SERVICE_USER : ${SERVICE_USER}
158 SERVICE_USER : ${SERVICE_USER}
157
159
@@ -286,7 +288,7 @@ update_searx() {
286 echo
288 echo
287 tee_stderr 0.3 <<EOF | sudo -H -u "${SERVICE_USER}" -i 2>&1 | prefix_stdout "$_service_prefix"
289 tee_stderr 0.3 <<EOF | sudo -H -u "${SERVICE_USER}" -i 2>&1 | prefix_stdout "$_service_prefix"
288cd ${SEARX_SRC}
290cd ${SEARX_SRC}
289−git checkout -B "$SEARX_GIT_BRANCH"
291+git checkout -B "$GIT_BRANCH"
290git pull
292git pull
291${SEARX_SRC}/manage.sh update_packages
293${SEARX_SRC}/manage.sh update_packages
292EOF
294EOF
@@ -344,12 +346,12 @@ clone_searx() {
344 fi
346 fi
345 export SERVICE_HOME
347 export SERVICE_HOME
346 git_clone "$REPO_ROOT" "$SEARX_SRC" \
348 git_clone "$REPO_ROOT" "$SEARX_SRC" \
347− "$SEARX_GIT_BRANCH" "$SERVICE_USER"
349+ "$GIT_BRANCH" "$SERVICE_USER"
348
350
349 pushd "${SEARX_SRC}" > /dev/null
351 pushd "${SEARX_SRC}" > /dev/null
350 tee_stderr 0.1 <<EOF | sudo -H -u "${SERVICE_USER}" -i 2>&1 | prefix_stdout "$_service_prefix"
352 tee_stderr 0.1 <<EOF | sudo -H -u "${SERVICE_USER}" -i 2>&1 | prefix_stdout "$_service_prefix"
351cd "${SEARX_SRC}"
353cd "${SEARX_SRC}"
352−git remote set-url origin ${SEARX_GIT_URL}
354+git remote set-url origin ${GIT_URL}
353git config user.email "$ADMIN_EMAIL"
355git config user.email "$ADMIN_EMAIL"
354git config user.name "$ADMIN_NAME"
356git config user.name "$ADMIN_NAME"
355git config --list
357git config --list
@@ -546,7 +548,6 @@ inspect_service() {
546sourced ${DOT_CONFIG#"$REPO_ROOT/"} :
548sourced ${DOT_CONFIG#"$REPO_ROOT/"} :
547
549
548 PUBLIC_URL : ${PUBLIC_URL}
550 PUBLIC_URL : ${PUBLIC_URL}
549− PUBLIC_HOST : ${PUBLIC_HOST}
550 SEARX_URL_PATH : ${SEARX_URL_PATH}
551 SEARX_URL_PATH : ${SEARX_URL_PATH}
551 SEARX_INSTANCE_NAME : ${SEARX_INSTANCE_NAME}
552 SEARX_INSTANCE_NAME : ${SEARX_INSTANCE_NAME}
552 SEARX_INTERNAL_URL : ${SEARX_INTERNAL_URL}
553 SEARX_INTERNAL_URL : ${SEARX_INTERNAL_URL}
utils/templates/etc/apache2/sites-available/morty.conf+1−1
@@ -23,6 +23,6 @@ ProxyPreserveHost On
23 # needed by searx to render correct *Search URL* in the *Link* box and
23 # needed by searx to render correct *Search URL* in the *Link* box and
24 # *saved preference*.
24 # *saved preference*.
25
25
26− # RequestHeader set Host ${PUBLIC_URL_PATH_MORTY}
26+ # RequestHeader set Host ${PUBLIC_HOST}
27
27
28</Location>
28</Location>