SearXNG is a free internet metasearch engine which aggregates results from various search services and databases. Users are neither tracked nor profiled.
Python bingbravedegoogleduckduckgogooglemetasearchprivacypythonqwantsearchsearch-enginesearxsearxngstartpageyahoo
LXC: separate lxc-suite from lxc & improved command line.
Markus Heiserb1e90cff23ea
diff --git a/Makefile b/Makefileindex 63e7e97f0..822adb1ae 100644--- a/Makefile+++ b/Makefile@@ -110,7 +110,7 @@ test.sh:shellcheck -x utils/searx.shshellcheck -x utils/morty.shshellcheck -x utils/lxc.sh- shellcheck -x utils/lxc.env+ shellcheck -x utils/lxc-searx.envshellcheck -x .config.shtest.pep8: pyenvinstalldiff --git a/utils/filtron.sh b/utils/filtron.shindex 89971d61d..537cea145 100755--- a/utils/filtron.sh+++ b/utils/filtron.sh@@ -6,7 +6,7 @@# shellcheck source=utils/lib.shsource "$(dirname "${BASH_SOURCE[0]}")/lib.sh"source_dot_config-source "${REPO_ROOT}/utils/lxc.env"+source "${REPO_ROOT}/utils/lxc-searx.env"# ----------------------------------------------------------------------------# configdiff --git a/utils/lib.sh b/utils/lib.shindex 09883df3b..26a26d750 100755--- a/utils/lib.sh+++ b/utils/lib.sh@@ -1062,14 +1062,69 @@ EOF# containers# -----------is_container() {- sudo_or_exit-- # usage: is_container && echo "process running inside a LXC container"- # is_container || echo "process is not running inside a LXC container"+in_container() {+ # Test if shell runs in a container.## hint: Reads init process environment, therefore root access is required!+ #+ # usage: in_container && echo "process running inside a LXC container"+ # in_container || echo "process is not running inside a LXC container"+ #+ sudo_or_exit# to be safe, take a look at the environment of process 1 (/sbin/init)grep -qa 'container=lxc' /proc/1/environ}+++lxc_exists(){++ # usage: lxc_exists <name> || echo "container <name> does not exists"++ lxc info "$1" &>/dev/null+}++lxc_image_exists(){+ # usage: lxc_image_exists <alias> || echo "image <alias> does locally not exists"++ lxc image info "local:$1" &>/dev/null++}++lxc_delete_container() {++ # usage: lxc_delete_container <container-name>++ if lxc info "$1" &>/dev/null; then+ info_msg "stop & delete instance ${_BBlue}${1}${_creset}"+ lxc stop "$1" &>/dev/null+ lxc delete "$1" | prefix_stdout+ else+ warn_msg "instance '$1' does not exist / can't delete :o"+ fi+}++lxc_delete_local_image() {++ # usage: lxc_delete_local_image <container-name>++ info_msg "delete image 'local:$i'"+ lxc image delete "local:$i"+}+++# IP+# --++global_IPs(){+ # usage: global_IPS+ #+ # print list of host's SCOPE global addresses and adapters e.g::+ #+ # $ global_IPs+ # enp4s0|192.168.1.127+ # lxdbr0|10.246.86.1+ # lxdbr0|fd42:8c58:2cd:b73f::1++ ip -o addr show | sed -nr 's/[0-9]*:\s*([a-z0-9]*).*inet[6]?\s*([a-z0-9.:]*).*scope global.*/\1|\2/p'+}diff --git a/utils/lxc-searx.env b/utils/lxc-searx.envnew file mode 100644index 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+ )+}diff --git a/utils/lxc.env b/utils/lxc.envdeleted file mode 100644index d470f256c..000000000--- a/utils/lxc.env+++ /dev/null@@ -1,14 +0,0 @@-# -*- coding: utf-8; mode: sh indent-tabs-mode: nil -*--# SPDX-License-Identifier: AGPL-3.0-or-later--# Herein we place all, what is needed to know when inside containers. Its-# sourced from different context --> do not manipulate the environment directly,-# implement functions!--# shellcheck shell=sh--searx_suite_set_env() {- export FILTRON_API="0.0.0.0:4005"- export FILTRON_LISTEN="0.0.0.0:4004"- export MORTY_LISTEN="0.0.0.0:3000"-}diff --git a/utils/lxc.sh b/utils/lxc.shindex f9e6e6b7a..b5ae59a7b 100755--- a/utils/lxc.sh+++ b/utils/lxc.sh@@ -5,7 +5,11 @@# shellcheck source=utils/lib.shsource "$(dirname "${BASH_SOURCE[0]}")/lib.sh"source_dot_config-source "${REPO_ROOT}/utils/lxc.env"++# load environment of the LXC suite+LXC_ENV="${LXC_ENV:-${REPO_ROOT}/utils/lxc-searx.env}"+source "$LXC_ENV"+lxc_set_suite_env# ----------------------------------------------------------------------------# config@@ -14,33 +18,27 @@ source "${REPO_ROOT}/utils/lxc.env"# read also:# - https://lxd.readthedocs.io/en/latest/-# name of https://images.linuxcontainers.org-LINUXCONTAINERS_ORG_NAME="${LINUXCONTAINERS_ORG_NAME:-images}"-HOST_PREFIX="${HOST_PREFIX:-searx}"+LXC_HOST_PREFIX="${LXC_HOST_PREFIX:-test}"# where all folders from HOST are mountedLXC_SHARE_FOLDER="/share"LXC_REPO_ROOT="${LXC_SHARE_FOLDER}/$(basename "${REPO_ROOT}")"-TEST_IMAGES=(- "$LINUXCONTAINERS_ORG_NAME:ubuntu/18.04" "ubu1804"- "$LINUXCONTAINERS_ORG_NAME:ubuntu/19.04" "ubu1904"- "$LINUXCONTAINERS_ORG_NAME:ubuntu/19.10" "ubu1910"- "$LINUXCONTAINERS_ORG_NAME:ubuntu/20.04" "ubu2004"- "$LINUXCONTAINERS_ORG_NAME:archlinux" "archlinux"- "$LINUXCONTAINERS_ORG_NAME:fedora/31" "fedora31"-)--ubu1804_boilerplate="+ubu1604_boilerplate="export DEBIAN_FRONTEND=noninteractiveapt-get update -yapt-get upgrade -yapt-get install -y git curl wget"+ubu1804_boilerplate="$ubu1604_boilerplate"ubu1904_boilerplate="$ubu1804_boilerplate"ubu1910_boilerplate="$ubu1904_boilerplate"+# shellcheck disable=SC2034-ubu2004_boilerplate="$ubu1910_boilerplate"+ubu2004_boilerplate="+$ubu1910_boilerplate+echo 'Set disable_coredump false' >> /etc/sudo.conf+"# shellcheck disable=SC2034archlinux_boilerplate="@@ -57,11 +55,13 @@ echo 'Set disable_coredump false' >> /etc/sudo.conf"REMOTE_IMAGES=()+CONTAINERS=()LOCAL_IMAGES=()-for ((i=0; i<${#TEST_IMAGES[@]}; i+=2)); do- REMOTE_IMAGES=("${REMOTE_IMAGES[@]}" "${TEST_IMAGES[i]}")- LOCAL_IMAGES=("${LOCAL_IMAGES[@]}" "${HOST_PREFIX}-${TEST_IMAGES[i+1]}")+for ((i=0; i<${#LXC_SUITE[@]}; i+=2)); do+ REMOTE_IMAGES=("${REMOTE_IMAGES[@]}" "${LXC_SUITE[i]}")+ CONTAINERS=("${CONTAINERS[@]}" "${LXC_HOST_PREFIX}-${LXC_SUITE[i+1]}")+ LOCAL_IMAGES=("${LOCAL_IMAGES[@]}" "${LXC_SUITE[i+1]}")doneHOST_USER="${SUDO_USER:-$USER}"@@ -71,36 +71,48 @@ HOST_GROUP_ID=$(id -g "${HOST_USER}")# ----------------------------------------------------------------------------usage() {# -----------------------------------------------------------------------------+ _cmd="$(basename "$0")"cat <<EOFusage::- $(basename "$0") build [containers]- $(basename "$0") install [searx-suite]- $(basename "$0") remove [containers|subordinate]- $(basename "$0") [start|stop] [containers|<container-name>]- $(basename "$0") show [info|config|searx-suite]- $(basename "$0") cmd ...--build / remove- :containers: build & launch (or remove) all LXC containers+ $_cmd build [containers]+ $_cmd copy [images]+ $_cmd remove [containers|<name>|images|subordinate]+ $_cmd add [subordinate]+ $_cmd [start|stop] [containers|<name>]+ $_cmd show [info|config|suite|images]+ $_cmd cmd [--|<name>] ...+ $_cmd install [suite]++build+ :containers: build & launch all LXC containers of the suite+copy:+ :images: copy remote images of the suite into local storage+remove+ :containers: delete all 'containers' or only <container-name>+ :images: delete local images of the suiteadd / remove- :subordinate: lxd permission to map ${HOST_USER}'s user/group id through+ :subordinate: LXD permission to map ${HOST_USER}'s user/group id throughstart/stop- :containers: start/stop of all 'containers' or only <container-name>+ :containers: start/stop all 'containers' from the suite+ :<name>: start/stop conatiner <name> from suiteshow- :info: show info of all containers- :config: show config of all containers- :searx-suite: show searx-suite services of all containers-cmd ...- run commandline ... in all containers+ :info: show info of all the containers from LXC suite+ :config: show config of all the containers from the LXC suite+ :suite: show services of all the containers from the LXC suite+ :images: show information of local images+cmd+ -- run command ... in all containers of the LXC suite+ :<name>: run command ... in container <name>install- :searx-suite: install searx suite, includes morty & filtron+ :suite: install LXC suite, includes morty & filtron-all LXC containers:- ${LOCAL_IMAGES[@]}+Images of the LXC suite:+$(echo " ${LOCAL_IMAGES[*]}" | $FMT)+Containers of the LXC suite:+$(echo " ${CONTAINERS[*]}" | $FMT)EOF[ -n "${1+x}" ] && err_msg "$1"}@@ -122,10 +134,12 @@ main() {local exit_vallocal _usage="unknown or missing $1 command $2"- if [[ ! $1 == __* ]] && ! required_commands lxc; then- lxd_info- exit 42+ # don't check prerequisite when in recursion+ if [[ ! $1 == __* ]]; then+ ! required_commands lxc && lxd_info && exit 42+ [[ -z $LXC_SUITE ]] && err_msg "missing LXC_SUITE" && exit 42fi+case $1 in--source-only) ;;-h|--help) usage; exit 0;;@@ -133,16 +147,28 @@ main() {build)sudo_or_exitcase $2 in- containers) build_instances ;;+ ''|containers) build_instances ;;+ *) usage "$_usage"; exit 42;;+ esac+ ;;+ copy)+ case $2 in+ ''|images) lxc_copy_images_localy;;*) usage "$_usage"; exit 42;;esac;;remove)sudo_or_exitcase $2 in- containers) remove_instances ;;+ ''|containers) remove_instances ;;+ images) lxc_delete_images_localy ;;subordinate) echo; del_subordinate_ids ;;- *) usage "$_usage"; exit 42;;+ ${LXC_HOST_PREFIX}-*)+ if ask_yn "Do you really want to delete conatiner $2"; then+ lxc_delete_container "$2"+ fi+ ;;+ *) usage "unknown (or mising) container <name> $2"; exit 42;;esac;;add)@@ -155,116 +181,86 @@ main() {start|stop)sudo_or_exitcase $2 in- containers) lxc_cmd "$1" ;;- *)+ ''|containers) lxc_cmd "$1" ;;+ ${LXC_HOST_PREFIX}-*)info_msg "lxc $1 $2"lxc "$1" "$2" | prefix_stdout "[${_BBlue}${i}${_creset}] ";;+ *) usage "ukknown or missing container <name> $2"; exit 42;;esac;;show)sudo_or_exitcase $2 in- config) lxc_cmd config show;;- info) lxc_cmd info;;- searx-suite)- for i in "${LOCAL_IMAGES[@]}"; do- info_msg "[${_BBlue}${i}${_creset}] ${_BGreen}${LXC_REPO_ROOT}/utils/lxc.sh install $2${_creset}"- lxc exec -t "${i}" -- "${LXC_REPO_ROOT}/utils/lxc.sh" __show "$2" | prefix_stdout "[${i}] "- done+ suite) show_suite ;;+ images) show_images ;;+ config)+ rst_title "container configurations"+ echo+ lxc list "$LXC_HOST_PREFIX-"+ echo+ lxc_cmd config show+ ;;+ info)+ rst_title "container info"+ echo+ lxc_cmd info;;*) usage "$_usage"; exit 42;;esac;;__show)case $2 in- searx-suite) searx_suite_info ;;+ suite) lxc_suite_info ;;esac;;cmd)sudo_or_exitshift- for i in "${LOCAL_IMAGES[@]}"; do- exit_val=- info_msg "[${_BBlue}${i}${_creset}] ${_BGreen}${*}${_creset}"- lxc exec "${i}" -- "$@"- exit_val=$?- if [[ $exit_val -ne 0 ]]; then- warn_msg "[${_BBlue}${i}${_creset}] exit code (${_BRed}${exit_val}${_creset}) from ${_BGreen}${*}${_creset}"- else- info_msg "[${_BBlue}${i}${_creset}] exit code (${exit_val}) from ${_BGreen}${*}${_creset}"- fi- echo- done+ case $1 in+ --)+ shift+ for name in "${CONTAINERS[@]}"; do+ lxc_exec_cmd "${name}" "$@"+ done+ ;;+ ${LXC_HOST_PREFIX}-*)+ local name=$1+ shift+ lxc_exec_cmd "${name}" "$@"+ ;;++ *) usage "unknown <name>: $1"; exit 42+ ;;+ esac;;install)sudo_or_exitcase $2 in- searx-suite)- for i in "${LOCAL_IMAGES[@]}"; do- info_msg "[${_BBlue}${i}${_creset}] ${_BGreen}${LXC_REPO_ROOT}/utils/lxc.sh install $2${_creset}"- lxc exec -t "${i}" -- "${LXC_REPO_ROOT}/utils/lxc.sh" __install "$2" | prefix_stdout "[${i}] "- done- ;;- *) usage "$_usage"; exit 42;;+ suite) install_suite ;;+ *) usage "$_usage"; exit 42 ;;esac;;__install)case $2 in- searx-suite) searx_suite_install ;;+ suite) lxc_suite_install ;;esac;;doc)echoecho ".. generic utils/lxc.sh documentation";;-- *)- usage "unknown or missing command $1"; exit 42;;+ -*) usage "unknown option $1"; exit 42;;+ *) usage "unknown or missing command $1"; exit 42;;esac}-searx_suite_install() {- (- searx_suite_set_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 "searx-suite installation finished ($(hostname))" part- searx_suite_info- echo- )-}--searx_suite_info() {- (- searx_suite_set_env- rst_para "Services of the container $(hostname)"- for ip in $(hostname -I); do- echo- if [[ $ip =~ .*:.* ]]; then- :- # IPv6: not yet implemented / tested- # echo " searx (filtron) --> http://[$ip]:4004/"- # echo " morty --> http://[$ip]:3000/"- else- # IPv4:- echo " searx (filtron) --> http://$ip:4004/"- echo " morty --> http://$ip:3000/"- fi- done- )-}build_instances() {rst_title "Build LXC instances"-- rst_title "copy images" sectionecho+ add_subordinate_idslxc_copy_images_localy- # lxc image list local: && wait_keyechorst_title "build containers" sectionecho@@ -272,64 +268,141 @@ build_instances() {lxc_config_containerslxc_boilerplate_containersecho- lxc list "$HOST_PREFIX"+ lxc list "$LXC_HOST_PREFIX"}remove_instances() {rst_title "Remove LXC instances"- lxc list "$HOST_PREFIX"- echo -en "\\nLXC containers(s)::\\n\\n ${LOCAL_IMAGES[*]}\\n" | $FMT- if ask_yn "Do you really want to delete all images"; then- lxc_delete_containers+ rst_para "existing containers matching ${_BGreen}$LXC_HOST_PREFIX-*${_creset}"+ echo+ lxc list "$LXC_HOST_PREFIX-"+ echo -en "\\n${_BRed}LXC containers to delete::${_creset}\\n\\n ${CONTAINERS[*]}\\n" | $FMT+ if ask_yn "Do you really want to delete these conatiners"; then+ for i in "${CONTAINERS[@]}"; do+ lxc_delete_container "$i"+ donefiecho- lxc list "$HOST_PREFIX"- # lxc image list local: && wait_key+ lxc list "$LXC_HOST_PREFIX-"}# images# ------lxc_copy_images_localy() {- for ((i=0; i<${#TEST_IMAGES[@]}; i+=2)); do- if lxc image info "local:${TEST_IMAGES[i+1]}" &>/dev/null; then- info_msg "image ${TEST_IMAGES[i]} already copied --> ${TEST_IMAGES[i+1]}"+ rst_title "copy images" section+ echo+ for ((i=0; i<${#LXC_SUITE[@]}; i+=2)); do+ if lxc_image_exists "local:${LXC_SUITE[i+1]}"; then+ info_msg "image ${LXC_SUITE[i]} already copied --> ${LXC_SUITE[i+1]}"else- info_msg "copy image locally ${TEST_IMAGES[i]} --> ${TEST_IMAGES[i+1]}"- lxc image copy "${TEST_IMAGES[i]}" local: \- --alias "${TEST_IMAGES[i+1]}" | prefix_stdout+ info_msg "copy image locally ${LXC_SUITE[i]} --> ${LXC_SUITE[i+1]}"+ lxc image copy "${LXC_SUITE[i]}" local: \+ --alias "${LXC_SUITE[i+1]}" | prefix_stdoutfidone+ # lxc image list local: && wait_key}lxc_delete_images_localy() {+ rst_title "Delete LXC images"+ rst_para "local existing images"echo+ lxc image list local:+ echo -en "\\n${_BRed}LXC images to delete::${_creset}\\n\\n ${LOCAL_IMAGES[*]}\\n"+ if ask_yn "Do you really want to delete these images"; then+ for i in "${LOCAL_IMAGES[@]}"; do+ lxc_delete_local_image "$i"+ done+ fi+ echo+ lxc image list local:+}++show_images(){+ rst_title "local images"+ echo+ lxc image list local:+ echo -en "\\n${_Green}LXC suite images::${_creset}\\n\\n ${LOCAL_IMAGES[*]}\\n"+ wait_keyfor i in "${LOCAL_IMAGES[@]}"; do- info_msg "delete image 'local:$i'"- lxc image delete "local:$i"+ if lxc_image_exists "$i"; then+ info_msg "lxc image info ${_BBlue}${i}${_creset}"+ lxc image info "$i" | prefix_stdout "[${_BBlue}${i}${_creset}] "+ else+ warn_msg "image ${_BBlue}$i${_creset} does not yet exists"+ fidone- #lxc image list local:+}+# container# ---------+show_suite(){+ rst_title "LXC suite ($LXC_HOST_PREFIX-*)"+ echo+ lxc list "$LXC_HOST_PREFIX-"+ echo+ for i in "${CONTAINERS[@]}"; do+ if ! lxc_exists "$i"; then+ warn_msg "container ${_BBlue}$i${_creset} does not yet exists"+ else+ lxc exec -t "${i}" -- "${LXC_REPO_ROOT}/utils/lxc.sh" __show suite \+ | prefix_stdout "[${_BBlue}${i}${_creset}] "+ fi+ done+}++install_suite() {+ for i in "${CONTAINERS[@]}"; do+ if ! lxc_exists "$i"; then+ warn_msg "container ${_BBlue}$i${_creset} does not yet exists"+ else+ info_msg "[${_BBlue}${i}${_creset}] ${_BGreen}${LXC_REPO_ROOT}/utils/lxc.sh install suite${_creset}"+ lxc exec -t "${i}" -- "${LXC_REPO_ROOT}/utils/lxc.sh" __install suite \+ | prefix_stdout "[${_BBlue}${i}${_creset}] "+ fi+ done+}+lxc_cmd() {- for i in "${LOCAL_IMAGES[@]}"; do- info_msg "lxc $* $i"- lxc "$@" "$i" | prefix_stdout "[${_BBlue}${i}${_creset}] "+ for i in "${CONTAINERS[@]}"; do+ if ! lxc_exists "$i"; then+ warn_msg "container ${_BBlue}$i${_creset} does not yet exists"+ else+ info_msg "lxc $* $i"+ lxc "$@" "$i" | prefix_stdout "[${_BBlue}${i}${_creset}] "+ echo+ fidone}+lxc_exec_cmd() {+ local name="$1"+ shift+ exit_val=+ info_msg "[${_BBlue}${name}${_creset}] ${_BGreen}${*}${_creset}"+ lxc exec "${name}" -- "$@"+ exit_val=$?+ if [[ $exit_val -ne 0 ]]; then+ warn_msg "[${_BBlue}${i}${_creset}] exit code (${_BRed}${exit_val}${_creset}) from ${_BGreen}${*}${_creset}"+ else+ info_msg "[${_BBlue}${i}${_creset}] exit code (${exit_val}) from ${_BGreen}${*}${_creset}"+ fi+ echo+}+lxc_init_containers() {local image_namelocal container_name- for ((i=0; i<${#TEST_IMAGES[@]}; i+=2)); do+ for ((i=0; i<${#LXC_SUITE[@]}; i+=2)); do- image_name="${TEST_IMAGES[i+1]}"- container_name="${HOST_PREFIX}-${image_name}"+ image_name="${LXC_SUITE[i+1]}"+ container_name="${LXC_HOST_PREFIX}-${image_name}"if lxc info "${container_name}" &>/dev/null; theninfo_msg "container '${container_name}' already exists"@@ -341,7 +414,7 @@ lxc_init_containers() {}lxc_config_containers() {- for i in "${LOCAL_IMAGES[@]}"; do+ for i in "${CONTAINERS[@]}"; doinfo_msg "[${_BBlue}${i}${_creset}] configure container ..."info_msg "[${_BBlue}${i}${_creset}] map uid/gid from host to container"@@ -364,10 +437,10 @@ lxc_boilerplate_containers() {local container_namelocal boilerplate_script- for ((i=0; i<${#TEST_IMAGES[@]}; i+=2)); do+ for ((i=0; i<${#LXC_SUITE[@]}; i+=2)); do- image_name="${TEST_IMAGES[i+1]}"- container_name="${HOST_PREFIX}-${image_name}"+ image_name="${LXC_SUITE[i+1]}"+ container_name="${LXC_HOST_PREFIX}-${image_name}"boilerplate_script="${image_name}_boilerplate"boilerplate_script="${!boilerplate_script}"@@ -386,18 +459,6 @@ lxc_boilerplate_containers() {done}-lxc_delete_containers() {- for i in "${LOCAL_IMAGES[@]}"; do- if lxc info "$i" &>/dev/null; then- info_msg "stop & delete instance ${_BBlue}${i}${_creset}"- lxc stop "$i" &>/dev/null- lxc delete "$i" | prefix_stdout- else- warn_msg "instance '$i' does not exist / can't delete :o"- fi- done-}-# subordinates# ------------#diff --git a/utils/morty.sh b/utils/morty.shindex 143e7e0c8..175bdf019 100755--- a/utils/morty.sh+++ b/utils/morty.sh@@ -5,7 +5,7 @@# shellcheck source=utils/lib.shsource "$(dirname "${BASH_SOURCE[0]}")/lib.sh"source_dot_config-source "${REPO_ROOT}/utils/lxc.env"+source "${REPO_ROOT}/utils/lxc-searx.env"# ----------------------------------------------------------------------------# configdiff --git a/utils/searx.sh b/utils/searx.shindex 9d73f46e2..205c7068d 100755--- a/utils/searx.sh+++ b/utils/searx.sh@@ -6,7 +6,7 @@# shellcheck source=utils/lib.shsource "$(dirname "${BASH_SOURCE[0]}")/lib.sh"source_dot_config-source "${REPO_ROOT}/utils/lxc.env"+source "${REPO_ROOT}/utils/lxc-searx.env"# ----------------------------------------------------------------------------# config@@ -544,13 +544,13 @@ EOFuWSGI_app_available "$SEARX_UWSGI_APP" \|| err_msg "uWSGI app $SEARX_UWSGI_APP not available!"- if is_container; then+ if in_container; thenwarn_msg "runnning inside container ..."- for ip in $(hostname -I); do+ for ip in $(global_IPs); doif [[ $ip =~ .*:.* ]]; then- info_msg " public HTTP service (IPv6) --> http://[$ip]"+ info_msg " public HTTP service (IPv6) --> http://${ip#*|}"else- info_msg " public HTTP service (IPv4) --> http://$ip"+ info_msg " public HTTP service (IPv4) --> http://${ip#*|}"fidonewarn_msg "SEARX_INTERNAL_URL not available from outside"@@ -564,7 +564,7 @@ EOFif ! service_is_available "${PUBLIC_URL}"; thenwarn_msg "Public service at ${PUBLIC_URL} is not available!"- if is_container; then+ if in_container; thenwarn_msg "Check if public name is correct and routed or use the public IP from above."fifi