From b1e90cff23eae2181d2b430e77471f488947d1a9 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Sat, 7 Mar 2020 20:24:08 +0100 Subject: LXC: separate lxc-suite from lxc & improved command line. Signed-off-by: Markus Heiser --- utils/lxc-searx.env | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 utils/lxc-searx.env (limited to 'utils/lxc-searx.env') diff --git a/utils/lxc-searx.env b/utils/lxc-searx.env new file mode 100644 index 000000000..b088ca792 --- /dev/null +++ b/utils/lxc-searx.env @@ -0,0 +1,62 @@ +# -*- coding: utf-8; mode: sh indent-tabs-mode: nil -*- +# SPDX-License-Identifier: AGPL-3.0-or-later +# shellcheck shell=bash + +# This file is a setup of a LXC suite. It is sourced from different context, do +# not manipulate the environment directly, implement functions and manipulate +# environment only is subshells! + +# ---------------------------------------------------------------------------- +# config +# ---------------------------------------------------------------------------- + +lxc_set_suite_env() { + # name of https://images.linuxcontainers.org + export LINUXCONTAINERS_ORG_NAME="${LINUXCONTAINERS_ORG_NAME:-images}" + export LXC_HOST_PREFIX="${LXC_HOST_PREFIX:-searx}" + export LXC_SUITE=( + # end of standard support see https://wiki.ubuntu.com/Releases + "$LINUXCONTAINERS_ORG_NAME:ubuntu/16.04" "ubu1604" # April 2021 + "$LINUXCONTAINERS_ORG_NAME:ubuntu/18.04" "ubu1804" # April 2023 + "$LINUXCONTAINERS_ORG_NAME:ubuntu/19.10" "ubu1910" # July 2020 + "$LINUXCONTAINERS_ORG_NAME:ubuntu/20.04" "ubu2004" # future (EOL 2030) + + # EOL see https://fedoraproject.org/wiki/Releases + "$LINUXCONTAINERS_ORG_NAME:fedora/31" "fedora31" + + # rolling releases see https://www.archlinux.org/releng/releases/ + "$LINUXCONTAINERS_ORG_NAME:archlinux" "archlinux" + ) + export FILTRON_API="0.0.0.0:4005" + export FILTRON_LISTEN="0.0.0.0:4004" + export MORTY_LISTEN="0.0.0.0:3000" +} + +lxc_suite_install() { + ( + lxc_set_suite_env + export FORCE_TIMEOUT=0 + "${LXC_REPO_ROOT}/utils/searx.sh" install all + "${LXC_REPO_ROOT}/utils/morty.sh" install all + "${LXC_REPO_ROOT}/utils/filtron.sh" install all + + rst_title "suite installation finished ($(hostname))" part + lxc_suite_info + echo + ) +} + +lxc_suite_info() { + ( + lxc_set_suite_env + for ip in $(global_IPs) ; do + if [[ $ip =~ .*:.* ]]; then + info_msg "(${ip%|*}) IPv6: http://[${ip#*|}]" + else + # IPv4: + info_msg "(${ip%|*}) filtron: http://${ip#*|}:4004/" + info_msg "(${ip%|*}) morty: http://${ip#*|}:3000/" + fi + done + ) +} -- cgit v1.2.3 From 86e79488aab3ff434c6682a9464ba2eee49158e9 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Sun, 15 Mar 2020 17:01:36 +0100 Subject: LXC: utils/makefile.lxc (inital) add /.lxcenv.mk to contaiiners Get LXC environment when building make targets. Signed-off-by: Markus Heiser --- utils/lxc-searx.env | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'utils/lxc-searx.env') diff --git a/utils/lxc-searx.env b/utils/lxc-searx.env index b088ca792..a5ef5712c 100644 --- a/utils/lxc-searx.env +++ b/utils/lxc-searx.env @@ -32,6 +32,7 @@ lxc_set_suite_env() { export MORTY_LISTEN="0.0.0.0:3000" } +lxc_suite_install_info="suite includes searx, morty & filtron" lxc_suite_install() { ( lxc_set_suite_env @@ -46,6 +47,16 @@ lxc_suite_install() { ) } +lxc_suite_prepare_buildhost() { + ( + lxc_set_suite_env + export FORCE_TIMEOUT=0 + "${LXC_REPO_ROOT}/utils/searx.sh" install buildhost + rst_title "buildhost installation finished ($(hostname))" part + echo + ) +} + lxc_suite_info() { ( lxc_set_suite_env -- cgit v1.2.3 From d2cfe9ce5bb409472f10590aa1ae069b2a971a49 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Wed, 18 Mar 2020 15:34:46 +0100 Subject: LXC: add /.lxcenv Signed-off-by: Markus Heiser --- utils/lxc-searx.env | 1 + 1 file changed, 1 insertion(+) (limited to 'utils/lxc-searx.env') diff --git a/utils/lxc-searx.env b/utils/lxc-searx.env index a5ef5712c..f81ee1c08 100644 --- a/utils/lxc-searx.env +++ b/utils/lxc-searx.env @@ -51,6 +51,7 @@ lxc_suite_prepare_buildhost() { ( lxc_set_suite_env export FORCE_TIMEOUT=0 + # "${LXC_REPO_ROOT}/utils/searx.sh* install packages "${LXC_REPO_ROOT}/utils/searx.sh" install buildhost rst_title "buildhost installation finished ($(hostname))" part echo -- cgit v1.2.3 From 5e2b161379420acd39e0474bb7f59545df7e1f3a Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Sun, 29 Mar 2020 16:46:07 +0200 Subject: Makefile: marginal fix Signed-off-by: Markus Heiser --- utils/lxc-searx.env | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'utils/lxc-searx.env') diff --git a/utils/lxc-searx.env b/utils/lxc-searx.env index f81ee1c08..123108bf7 100644 --- a/utils/lxc-searx.env +++ b/utils/lxc-searx.env @@ -63,11 +63,12 @@ lxc_suite_info() { lxc_set_suite_env for ip in $(global_IPs) ; do if [[ $ip =~ .*:.* ]]; then - info_msg "(${ip%|*}) IPv6: http://[${ip#*|}]" + info_msg "(${ip%|*}) IPv6: http://[${ip#*|}]" else # IPv4: - info_msg "(${ip%|*}) filtron: http://${ip#*|}:4004/" - info_msg "(${ip%|*}) morty: http://${ip#*|}:3000/" + info_msg "(${ip%|*}) filtron: http://${ip#*|}:4004/" + info_msg "(${ip%|*}) morty: http://${ip#*|}:3000/" + info_msg "(${ip%|*}) docs-live: http://${ip#*|}:8080/" fi done ) -- cgit v1.2.3 From 3e4d022d0425e4f7647573c97f105aa5208e5537 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Mon, 30 Mar 2020 11:03:46 +0200 Subject: [fix] make test.sh: fix various shellcheck error messages Signed-off-by: Markus Heiser --- utils/lxc-searx.env | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'utils/lxc-searx.env') diff --git a/utils/lxc-searx.env b/utils/lxc-searx.env index 123108bf7..a5de6c3de 100644 --- a/utils/lxc-searx.env +++ b/utils/lxc-searx.env @@ -32,11 +32,13 @@ lxc_set_suite_env() { export MORTY_LISTEN="0.0.0.0:3000" } -lxc_suite_install_info="suite includes searx, morty & filtron" +# shellcheck disable=SC2034 +LXC_SUITE_INSTALL_INFO="suite includes searx, morty & filtron" lxc_suite_install() { ( lxc_set_suite_env - export FORCE_TIMEOUT=0 + FORCE_TIMEOUT=0 + export FORCE_TIMEOUT "${LXC_REPO_ROOT}/utils/searx.sh" install all "${LXC_REPO_ROOT}/utils/morty.sh" install all "${LXC_REPO_ROOT}/utils/filtron.sh" install all @@ -50,7 +52,8 @@ lxc_suite_install() { lxc_suite_prepare_buildhost() { ( lxc_set_suite_env - export FORCE_TIMEOUT=0 + FORCE_TIMEOUT=0 + export FORCE_TIMEOUT # "${LXC_REPO_ROOT}/utils/searx.sh* install packages "${LXC_REPO_ROOT}/utils/searx.sh" install buildhost rst_title "buildhost installation finished ($(hostname))" part -- cgit v1.2.3 From f27f6c6c5d372b257dfe671ec26eb73f6e12ed28 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Tue, 31 Mar 2020 18:25:40 +0200 Subject: docs: use make and uitls/searx.sh in containers Signed-off-by: Markus Heiser --- utils/lxc-searx.env | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'utils/lxc-searx.env') diff --git a/utils/lxc-searx.env b/utils/lxc-searx.env index a5de6c3de..41bbae468 100644 --- a/utils/lxc-searx.env +++ b/utils/lxc-searx.env @@ -49,18 +49,6 @@ lxc_suite_install() { ) } -lxc_suite_prepare_buildhost() { - ( - lxc_set_suite_env - FORCE_TIMEOUT=0 - export FORCE_TIMEOUT - # "${LXC_REPO_ROOT}/utils/searx.sh* install packages - "${LXC_REPO_ROOT}/utils/searx.sh" install buildhost - rst_title "buildhost installation finished ($(hostname))" part - echo - ) -} - lxc_suite_info() { ( lxc_set_suite_env -- cgit v1.2.3 From af988dbf71ce4b14d2056676d7d9691335266d83 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Fri, 3 Apr 2020 17:08:42 +0200 Subject: utils/lxc.sh: support build of selected containers $ sudo -H ./utils/lxc.sh build $ sudo -H ./utils/lxc.sh show [images|suite|info|config []] Signed-off-by: Markus Heiser --- utils/lxc-searx.env | 3 +++ 1 file changed, 3 insertions(+) (limited to 'utils/lxc-searx.env') diff --git a/utils/lxc-searx.env b/utils/lxc-searx.env index 41bbae468..2a3fdf37b 100644 --- a/utils/lxc-searx.env +++ b/utils/lxc-searx.env @@ -15,6 +15,9 @@ lxc_set_suite_env() { export LINUXCONTAINERS_ORG_NAME="${LINUXCONTAINERS_ORG_NAME:-images}" export LXC_HOST_PREFIX="${LXC_HOST_PREFIX:-searx}" export LXC_SUITE=( + + # to disable containers, comment out lines .. + # end of standard support see https://wiki.ubuntu.com/Releases "$LINUXCONTAINERS_ORG_NAME:ubuntu/16.04" "ubu1604" # April 2021 "$LINUXCONTAINERS_ORG_NAME:ubuntu/18.04" "ubu1804" # April 2023 -- cgit v1.2.3 From 3c19f2f1cef31fd512975c70a25442d078992a42 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Sat, 4 Apr 2020 12:40:14 +0200 Subject: utils/lxc.sh install: support installation on selected containers Signed-off-by: Markus Heiser --- utils/lxc-searx.env | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'utils/lxc-searx.env') diff --git a/utils/lxc-searx.env b/utils/lxc-searx.env index 2a3fdf37b..fc5b33f06 100644 --- a/utils/lxc-searx.env +++ b/utils/lxc-searx.env @@ -10,10 +10,12 @@ # config # ---------------------------------------------------------------------------- +# shellcheck disable=SC2034 +LXC_SUITE_NAME="searx" lxc_set_suite_env() { # name of https://images.linuxcontainers.org export LINUXCONTAINERS_ORG_NAME="${LINUXCONTAINERS_ORG_NAME:-images}" - export LXC_HOST_PREFIX="${LXC_HOST_PREFIX:-searx}" + export LXC_HOST_PREFIX="${LXC_SUITE_NAME:-searx}" export LXC_SUITE=( # to disable containers, comment out lines .. -- cgit v1.2.3 From 99ff16c465ed4d3b98041bf308dfeb0918b535ab Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Mon, 13 Apr 2020 11:34:28 +0200 Subject: tooling box: added nginx + polished bash scripts and environment - add installation method for nginx sites, morty and filtron - clean up PUBLIC_URL environment in and outside of containers - clean up comand lines - handle uWSGI quirks on fedora (emperor mode) - handle Python quirks on debian (there is no 'python' command anymore) - lib.sh: add die and die_caller functions - lxc_suite_install_info is now a function - lint: shellcheck Signed-off-by: Markus Heiser --- utils/lxc-searx.env | 38 +++++++++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 7 deletions(-) (limited to 'utils/lxc-searx.env') diff --git a/utils/lxc-searx.env b/utils/lxc-searx.env index fc5b33f06..a51312fb8 100644 --- a/utils/lxc-searx.env +++ b/utils/lxc-searx.env @@ -32,13 +32,36 @@ lxc_set_suite_env() { # rolling releases see https://www.archlinux.org/releng/releases/ "$LINUXCONTAINERS_ORG_NAME:archlinux" "archlinux" ) - export FILTRON_API="0.0.0.0:4005" - export FILTRON_LISTEN="0.0.0.0:4004" - export MORTY_LISTEN="0.0.0.0:3000" + + PUBLIC_URL="${PUBLIC_URL:-http://$(uname -n)/searx}" + if in_container; then + # container hostnames do not have a DNS entry: use primary IP! + PUBLIC_URL="http://$(primary_ip)/searx" + + # make GUEST's services public to the HOST + FILTRON_API="0.0.0.0:4005" + FILTRON_LISTEN="0.0.0.0:4004" + MORTY_LISTEN="0.0.0.0:3000" + + # export LXC specific environment + export PUBLIC_URL FILTRON_API FILTRON_LISTEN MORTY_LISTEN + fi } -# shellcheck disable=SC2034 -LXC_SUITE_INSTALL_INFO="suite includes searx, morty & filtron" +lxc_suite_install_info() { + ( + lxc_set_suite_env + cat < ${PUBLIC_URL} + suite includes searx, morty & filtron +suite images: +$(echo " ${LOCAL_IMAGES[*]}" | $FMT) +suite containers: +$(echo " ${CONTAINERS[*]}" | $FMT) +EOF + ) + } + lxc_suite_install() { ( lxc_set_suite_env @@ -62,8 +85,9 @@ lxc_suite_info() { info_msg "(${ip%|*}) IPv6: http://[${ip#*|}]" else # IPv4: - info_msg "(${ip%|*}) filtron: http://${ip#*|}:4004/" - info_msg "(${ip%|*}) morty: http://${ip#*|}:3000/" + # shellcheck disable=SC2034,SC2031 + info_msg "(${ip%|*}) filtron: http://${ip#*|}:4004/ $PUBLIC_URL" + info_msg "(${ip%|*}) morty: http://${ip#*|}:3000/ $PUBLIC_URL_MORTY" info_msg "(${ip%|*}) docs-live: http://${ip#*|}:8080/" fi done -- cgit v1.2.3