lxc-searx.env 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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/18.04" "ubu1804" # April 2023
  20. "$LINUXCONTAINERS_ORG_NAME:ubuntu/20.04" "ubu2004" # April 2025
  21. "$LINUXCONTAINERS_ORG_NAME:ubuntu/20.10" "ubu2010" # July 2021
  22. # EOL see https://fedoraproject.org/wiki/Releases
  23. "$LINUXCONTAINERS_ORG_NAME:fedora/33" "fedora33"
  24. # rolling releases see https://www.archlinux.org/releng/releases/
  25. "$LINUXCONTAINERS_ORG_NAME:archlinux" "archlinux"
  26. # EOL 30 June 2024
  27. "$LINUXCONTAINERS_ORG_NAME:centos/7" "centos7"
  28. )
  29. PUBLIC_URL="${PUBLIC_URL:-http://$(uname -n)/searx}"
  30. if in_container; then
  31. # container hostnames do not have a DNS entry: use primary IP!
  32. PUBLIC_URL="http://$(primary_ip)/searx"
  33. # make GUEST's services public to the HOST
  34. FILTRON_API="0.0.0.0:4005"
  35. FILTRON_LISTEN="0.0.0.0:4004"
  36. MORTY_LISTEN="0.0.0.0:3000"
  37. # export LXC specific environment
  38. export PUBLIC_URL FILTRON_API FILTRON_LISTEN MORTY_LISTEN
  39. fi
  40. }
  41. lxc_suite_install_info() {
  42. (
  43. lxc_set_suite_env
  44. cat <<EOF
  45. LXC suite: ${LXC_SUITE_NAME} --> ${PUBLIC_URL}
  46. suite includes searx, morty & filtron
  47. suite images:
  48. $(echo " ${LOCAL_IMAGES[*]}" | $FMT)
  49. suite containers:
  50. $(echo " ${CONTAINERS[*]}" | $FMT)
  51. EOF
  52. )
  53. }
  54. lxc_suite_install() {
  55. (
  56. lxc_set_suite_env
  57. FORCE_TIMEOUT=0
  58. export FORCE_TIMEOUT
  59. "${LXC_REPO_ROOT}/utils/searx.sh" install all
  60. "${LXC_REPO_ROOT}/utils/morty.sh" install all
  61. "${LXC_REPO_ROOT}/utils/filtron.sh" install all
  62. rst_title "suite installation finished ($(hostname))" part
  63. lxc_suite_info
  64. echo
  65. )
  66. }
  67. lxc_suite_info() {
  68. (
  69. lxc_set_suite_env
  70. for ip in $(global_IPs) ; do
  71. if [[ $ip =~ .*:.* ]]; then
  72. info_msg "(${ip%|*}) IPv6: http://[${ip#*|}]"
  73. else
  74. # IPv4:
  75. # shellcheck disable=SC2034,SC2031
  76. info_msg "(${ip%|*}) filtron: http://${ip#*|}:4004/ $PUBLIC_URL"
  77. info_msg "(${ip%|*}) morty: http://${ip#*|}:3000/ $PUBLIC_URL_MORTY"
  78. info_msg "(${ip%|*}) docs-live: http://${ip#*|}:8080/"
  79. fi
  80. done
  81. )
  82. }