lxc-searx.env 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. # -*- coding: utf-8; mode: sh indent-tabs-mode: nil -*-
  2. # SPDX-License-Identifier: AGPL-3.0-or-later
  3. # shellcheck shell=bash
  4. # This file is a setup of a LXC suite. It is sourced from different context, do
  5. # not manipulate the environment directly, implement functions and manipulate
  6. # environment only is subshells!
  7. # ----------------------------------------------------------------------------
  8. # config
  9. # ----------------------------------------------------------------------------
  10. # shellcheck disable=SC2034
  11. LXC_SUITE_NAME="searx"
  12. lxc_set_suite_env() {
  13. # name of https://images.linuxcontainers.org
  14. export LINUXCONTAINERS_ORG_NAME="${LINUXCONTAINERS_ORG_NAME:-images}"
  15. export LXC_HOST_PREFIX="${LXC_SUITE_NAME:-searx}"
  16. export LXC_SUITE=(
  17. # to disable containers, comment out lines ..
  18. # end of standard support see https://wiki.ubuntu.com/Releases
  19. "$LINUXCONTAINERS_ORG_NAME:ubuntu/16.04" "ubu1604" # April 2021
  20. "$LINUXCONTAINERS_ORG_NAME:ubuntu/18.04" "ubu1804" # April 2023
  21. "$LINUXCONTAINERS_ORG_NAME:ubuntu/20.04" "ubu2004" # April 2025
  22. "$LINUXCONTAINERS_ORG_NAME:ubuntu/20.10" "ubu2010" # July 2021
  23. # EOL see https://fedoraproject.org/wiki/Releases
  24. "$LINUXCONTAINERS_ORG_NAME:fedora/31" "fedora31"
  25. # rolling releases see https://www.archlinux.org/releng/releases/
  26. "$LINUXCONTAINERS_ORG_NAME:archlinux" "archlinux"
  27. # EOL 30 June 2024
  28. "$LINUXCONTAINERS_ORG_NAME:centos/7" "centos7"
  29. )
  30. PUBLIC_URL="${PUBLIC_URL:-http://$(uname -n)/searx}"
  31. if in_container; then
  32. # container hostnames do not have a DNS entry: use primary IP!
  33. PUBLIC_URL="http://$(primary_ip)/searx"
  34. # make GUEST's services public to the HOST
  35. FILTRON_API="0.0.0.0:4005"
  36. FILTRON_LISTEN="0.0.0.0:4004"
  37. MORTY_LISTEN="0.0.0.0:3000"
  38. # export LXC specific environment
  39. export PUBLIC_URL FILTRON_API FILTRON_LISTEN MORTY_LISTEN
  40. fi
  41. }
  42. lxc_suite_install_info() {
  43. (
  44. lxc_set_suite_env
  45. cat <<EOF
  46. LXC suite: ${LXC_SUITE_NAME} --> ${PUBLIC_URL}
  47. suite includes searx, morty & filtron
  48. suite images:
  49. $(echo " ${LOCAL_IMAGES[*]}" | $FMT)
  50. suite containers:
  51. $(echo " ${CONTAINERS[*]}" | $FMT)
  52. EOF
  53. )
  54. }
  55. lxc_suite_install() {
  56. (
  57. lxc_set_suite_env
  58. FORCE_TIMEOUT=0
  59. export FORCE_TIMEOUT
  60. "${LXC_REPO_ROOT}/utils/searx.sh" install all
  61. "${LXC_REPO_ROOT}/utils/morty.sh" install all
  62. "${LXC_REPO_ROOT}/utils/filtron.sh" install all
  63. rst_title "suite installation finished ($(hostname))" part
  64. lxc_suite_info
  65. echo
  66. )
  67. }
  68. lxc_suite_info() {
  69. (
  70. lxc_set_suite_env
  71. for ip in $(global_IPs) ; do
  72. if [[ $ip =~ .*:.* ]]; then
  73. info_msg "(${ip%|*}) IPv6: http://[${ip#*|}]"
  74. else
  75. # IPv4:
  76. # shellcheck disable=SC2034,SC2031
  77. info_msg "(${ip%|*}) filtron: http://${ip#*|}:4004/ $PUBLIC_URL"
  78. info_msg "(${ip%|*}) morty: http://${ip#*|}:3000/ $PUBLIC_URL_MORTY"
  79. info_msg "(${ip%|*}) docs-live: http://${ip#*|}:8080/"
  80. fi
  81. done
  82. )
  83. }