diff options
| author | Markus Heiser <markus.heiser@darmarIT.de> | 2020-06-19 04:50:36 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-06-19 04:50:36 +0000 |
| commit | 6337d515dd11d2014a775b67103eda51c7fc38e2 (patch) | |
| tree | fdd3f1e67a8e08d28b137348834aa6c72e4513ab /utils/lxc-searx.env | |
| parent | 5dd235463a11bec2e3546e89f2b31d2a5aa40326 (diff) | |
| parent | c83007a6bcd2a7f765e7655b91cc6714fbc4ab01 (diff) | |
Merge branch 'master' into new-readme
Diffstat (limited to 'utils/lxc-searx.env')
| -rw-r--r-- | utils/lxc-searx.env | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/utils/lxc-searx.env b/utils/lxc-searx.env new file mode 100644 index 000000000..a51312fb8 --- /dev/null +++ b/utils/lxc-searx.env @@ -0,0 +1,95 @@ +# -*- 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 +# ---------------------------------------------------------------------------- + +# 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_SUITE_NAME:-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 + "$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" + ) + + 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 +} + +lxc_suite_install_info() { + ( + lxc_set_suite_env + cat <<EOF +LXC suite: ${LXC_SUITE_NAME} --> ${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 + 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 + + 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: + # 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 + ) +} |