summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorMarkus Heiser <markus.heiser@darmarit.de>2020-03-29 15:09:34 +0200
committerMarkus Heiser <markus.heiser@darmarit.de>2020-03-29 15:09:34 +0200
commit7b4cf2eb489d8f6c95ccac5af180254b78e7c460 (patch)
treed3b8f4fbd5f5bcc7b78be06aecacf739ffa9b1e4 /utils
parent65b22be1f4e6bb4f293f3d8cef0c4c7635528090 (diff)
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>
Diffstat (limited to 'utils')
-rwxr-xr-xutils/filtron.sh5
-rwxr-xr-xutils/morty.sh7
-rwxr-xr-xutils/searx.sh17
-rw-r--r--utils/templates/etc/apache2/sites-available/morty.conf2
4 files changed, 20 insertions, 11 deletions
diff --git a/utils/filtron.sh b/utils/filtron.sh
index 85000c592..c81a252a5 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 58de0cc99..a20cde36c 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 19cb41986..a6f2d5ee6 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 <<EOF | sudo -H -u "${SERVICE_USER}" -i 2>&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 <<EOF | sudo -H -u "${SERVICE_USER}" -i 2>&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 6bcc77b78..2c5727b19 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}
</Location>