on master help sign in
tooling box: added nginx + polished bash scripts and environment
99ff16cMarkus Heiser
.config.sh+2−1
@@ -18,7 +18,8 @@
18PUBLIC_URL="${SEARX_URL}"
18PUBLIC_URL="${SEARX_URL}"
19
19
20if [[ ${PUBLIC_URL} == "https://searx.me" ]]; then
20if [[ ${PUBLIC_URL} == "https://searx.me" ]]; then
21+ # hint: Linux containers do not have DNS entries, lets use IPs
21− PUBLIC_URL=
22+ PUBLIC_URL="http://$(primary_ip)/searx"
22fi
23fi
23
24
24# searx.sh
25# searx.sh
utils/filtron.sh+9−4
@@ -225,6 +225,11 @@ install_all() {
225 if ask_yn "Do you want to install a reverse proxy (ProxyPass)" Yn; then
225 if ask_yn "Do you want to install a reverse proxy (ProxyPass)" Yn; then
226 install_apache_site
226 install_apache_site
227 fi
227 fi
228+ elif nginx_is_installed; then
229+ info_msg "nginx is installed on this host."
230+ if ask_yn "Do you want to install a reverse proxy (ProxyPass)" Yn; then
231+ install_nginx_site
232+ fi
228 fi
233 fi
229 if ask_yn "Do you want to inspect the installation?" Ny; then
234 if ask_yn "Do you want to inspect the installation?" Ny; then
230 inspect_service
235 inspect_service
@@ -315,8 +320,6 @@ sourced ${DOT_CONFIG#"$REPO_ROOT/"} :
315
320
316EOF
321EOF
317
322
318− apache_is_installed && info_msg "Apache is installed."
319−
320 if service_account_is_available "$SERVICE_USER"; then
323 if service_account_is_available "$SERVICE_USER"; then
321 info_msg "service account $SERVICE_USER available."
324 info_msg "service account $SERVICE_USER available."
322 else
325 else
@@ -445,7 +448,7 @@ install_apache_site() {
445 rst_para "\
448 rst_para "\
446This installs a reverse proxy (ProxyPass) into apache site (${APACHE_FILTRON_SITE})"
449This installs a reverse proxy (ProxyPass) into apache site (${APACHE_FILTRON_SITE})"
447
450
448− ! apache_is_installed && err_msg "Apache is not installed."
451+ ! apache_is_installed && info_msg "Apache is not installed."
449
452
450 if ! ask_yn "Do you really want to continue?" Yn; then
453 if ! ask_yn "Do you really want to continue?" Yn; then
451 return
454 return
@@ -487,7 +490,7 @@ install_nginx_site() {
487 rst_para "\
490 rst_para "\
488This installs a reverse proxy (ProxyPass) into nginx site (${NGINX_FILTRON_SITE})"
491This installs a reverse proxy (ProxyPass) into nginx site (${NGINX_FILTRON_SITE})"
489
492
490− ! nginx_is_installed && err_msg "nginx is not installed."
493+ ! nginx_is_installed && info_msg "nginx is not installed."
491
494
492 if ! ask_yn "Do you really want to continue?" Yn; then
495 if ! ask_yn "Do you really want to continue?" Yn; then
493 return
496 return
@@ -497,7 +500,9 @@ This installs a reverse proxy (ProxyPass) into nginx site (${NGINX_FILTRON_SITE}
497
500
498 "${REPO_ROOT}/utils/searx.sh" install uwsgi
501 "${REPO_ROOT}/utils/searx.sh" install uwsgi
499
502
503+ # shellcheck disable=SC2034
500 SEARX_SRC=$("${REPO_ROOT}/utils/searx.sh" --getenv SEARX_SRC)
504 SEARX_SRC=$("${REPO_ROOT}/utils/searx.sh" --getenv SEARX_SRC)
505+ # shellcheck disable=SC2034
501 SEARX_URL_PATH=$("${REPO_ROOT}/utils/searx.sh" --getenv SEARX_URL_PATH)
506 SEARX_URL_PATH=$("${REPO_ROOT}/utils/searx.sh" --getenv SEARX_URL_PATH)
502 nginx_install_app --variant=filtron "${NGINX_FILTRON_SITE}"
507 nginx_install_app --variant=filtron "${NGINX_FILTRON_SITE}"
503
508
utils/lib.sh+31−28
@@ -482,7 +482,7 @@ service_is_available() {
482 # usage: service_is_available <URL>
482 # usage: service_is_available <URL>
483
483
484 [[ -z $1 ]] && die_caller 42 "missing argument <URL>"
484 [[ -z $1 ]] && die_caller 42 "missing argument <URL>"
485−
485+ local URL="$1"
486 http_code=$(curl -H 'Cache-Control: no-cache' \
486 http_code=$(curl -H 'Cache-Control: no-cache' \
487 --silent -o /dev/null --head --write-out '%{http_code}' --insecure \
487 --silent -o /dev/null --head --write-out '%{http_code}' --insecure \
488 "${URL}")
488 "${URL}")
@@ -969,6 +969,7 @@ uWSGI_distro_setup() {
969 # one day, see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=833067
969 # one day, see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=833067
970 uWSGI_APPS_AVAILABLE="${uWSGI_SETUP}/apps-available"
970 uWSGI_APPS_AVAILABLE="${uWSGI_SETUP}/apps-available"
971 uWSGI_APPS_ENABLED="${uWSGI_SETUP}/apps-enabled"
971 uWSGI_APPS_ENABLED="${uWSGI_SETUP}/apps-enabled"
972+ uWSGI_PACKAGES="uwsgi"
972 ;;
973 ;;
973 arch-*)
974 arch-*)
974 # systemd --> /usr/lib/systemd/system/uwsgi@.service
975 # systemd --> /usr/lib/systemd/system/uwsgi@.service
@@ -977,6 +978,7 @@ uWSGI_distro_setup() {
977 # - https://uwsgi-docs.readthedocs.io/en/latest/Systemd.html#one-service-per-app-in-systemd
978 # - https://uwsgi-docs.readthedocs.io/en/latest/Systemd.html#one-service-per-app-in-systemd
978 uWSGI_APPS_AVAILABLE="${uWSGI_SETUP}/apps-archlinux"
979 uWSGI_APPS_AVAILABLE="${uWSGI_SETUP}/apps-archlinux"
979 uWSGI_APPS_ENABLED="${uWSGI_SETUP}"
980 uWSGI_APPS_ENABLED="${uWSGI_SETUP}"
981+ uWSGI_PACKAGES="uwsgi"
980 ;;
982 ;;
981 fedora-*)
983 fedora-*)
982 # systemd --> /usr/lib/systemd/system/uwsgi.service
984 # systemd --> /usr/lib/systemd/system/uwsgi.service
@@ -984,6 +986,7 @@ uWSGI_distro_setup() {
984 # - https://uwsgi-docs.readthedocs.io/en/latest/Emperor.html
986 # - https://uwsgi-docs.readthedocs.io/en/latest/Emperor.html
985 uWSGI_APPS_AVAILABLE="${uWSGI_SETUP}/apps-available"
987 uWSGI_APPS_AVAILABLE="${uWSGI_SETUP}/apps-available"
986 uWSGI_APPS_ENABLED="${uWSGI_SETUP}.d"
988 uWSGI_APPS_ENABLED="${uWSGI_SETUP}.d"
989+ uWSGI_PACKAGES="uwsgi"
987 uWSGI_USER="uwsgi"
990 uWSGI_USER="uwsgi"
988 uWSGI_GROUP="uwsgi"
991 uWSGI_GROUP="uwsgi"
989 ;;
992 ;;
@@ -995,18 +998,26 @@ esac
995
998
996uWSGI_distro_setup
999uWSGI_distro_setup
997
1000
1001+install_uwsgi(){
1002+ info_msg "installing uwsgi ..."
1003+ pkg_install "$uWSGI_PACKAGES"
1004+ case $DIST_ID-$DIST_VERS in
1005+ fedora-*)
1006+ # enable & start should be called once at uWSGI installation time
1007+ systemctl enable uwsgi
1008+ systemctl restart uwsgi
1009+ ;;
1010+ esac
1011+}
1012+
998uWSGI_restart() {
1013uWSGI_restart() {
999
1014
1000 # usage: uWSGI_restart() <myapp.ini>
1015 # usage: uWSGI_restart() <myapp.ini>
1001
1016
1002 local CONF="$1"
1017 local CONF="$1"
1003− if [[ -z $CONF ]]; then
1004− err_msg "uWSGI_restart: missing arguments"
1005− return 42
1006− fi
1007
1018
1019+ [[ -z $CONF ]] && die_caller 42 "missing argument <myapp.ini>"
1008 info_msg "restart uWSGI service"
1020 info_msg "restart uWSGI service"
1009−
1010 case $DIST_ID-$DIST_VERS in
1021 case $DIST_ID-$DIST_VERS in
1011 ubuntu-*|debian-*)
1022 ubuntu-*|debian-*)
1012 # the 'service' method seems broken in that way, that it (re-)starts
1023 # the 'service' method seems broken in that way, that it (re-)starts
@@ -1025,6 +1036,9 @@ uWSGI_restart() {
1025 # in emperor mode, just touch the file to restart
1036 # in emperor mode, just touch the file to restart
1026 if uWSGI_app_enabled "${CONF}"; then
1037 if uWSGI_app_enabled "${CONF}"; then
1027 touch "${uWSGI_APPS_ENABLED}/${CONF}"
1038 touch "${uWSGI_APPS_ENABLED}/${CONF}"
1039+ # it seems, there is a polling time in between touch and restart
1040+ # of the service.
1041+ sleep 3
1028 else
1042 else
1029 info_msg "[uWSGI:emperor] ${CONF} not installed (no need to restart)"
1043 info_msg "[uWSGI:emperor] ${CONF} not installed (no need to restart)"
1030 fi
1044 fi
@@ -1040,11 +1054,9 @@ uWSGI_prepare_app() {
1040
1054
1041 # usage: uWSGI_prepare_app <myapp.ini>
1055 # usage: uWSGI_prepare_app <myapp.ini>
1042
1056
1057+ [[ -z $1 ]] && die_caller 42 "missing argument <myapp.ini>"
1058+
1043 local APP="${1%.*}"
1059 local APP="${1%.*}"
1044− if [[ -z $APP ]]; then
1045− err_msg "uWSGI_prepare_app: missing arguments"
1046− return 42
1047− fi
1048
1060
1049 case $DIST_ID-$DIST_VERS in
1061 case $DIST_ID-$DIST_VERS in
1050 fedora-*)
1062 fedora-*)
@@ -1065,10 +1077,8 @@ uWSGI_prepare_app() {
1065uWSGI_app_available() {
1077uWSGI_app_available() {
1066 # usage: uWSGI_app_available <myapp.ini>
1078 # usage: uWSGI_app_available <myapp.ini>
1067 local CONF="$1"
1079 local CONF="$1"
1068− if [[ -z $CONF ]]; then
1080+
1069− err_msg "uWSGI_app_available: missing arguments"
1081+ [[ -z $CONF ]] && die_caller 42 "missing argument <myapp.ini>"
1070− return 42
1071− fi
1072 [[ -f "${uWSGI_APPS_AVAILABLE}/${CONF}" ]]
1082 [[ -f "${uWSGI_APPS_AVAILABLE}/${CONF}" ]]
1073}
1083}
1074
1084
@@ -1101,6 +1111,8 @@ uWSGI_remove_app() {
1101 # usage: uWSGI_remove_app <myapp.ini>
1111 # usage: uWSGI_remove_app <myapp.ini>
1102
1112
1103 local CONF="$1"
1113 local CONF="$1"
1114+
1115+ [[ -z $CONF ]] && die_caller 42 "missing argument <myapp.ini>"
1104 info_msg "remove uWSGI app: ${CONF}"
1116 info_msg "remove uWSGI app: ${CONF}"
1105 uWSGI_disable_app "${CONF}"
1117 uWSGI_disable_app "${CONF}"
1106 uWSGI_restart "${CONF}"
1118 uWSGI_restart "${CONF}"
@@ -1110,12 +1122,10 @@ uWSGI_remove_app() {
1110uWSGI_app_enabled() {
1122uWSGI_app_enabled() {
1111 # usage: uWSGI_app_enabled <myapp.ini>
1123 # usage: uWSGI_app_enabled <myapp.ini>
1112
1124
1113− local CONF="$1"
1114 local exit_val=0
1125 local exit_val=0
1115− if [[ -z $CONF ]]; then
1126+ local CONF="$1"
1116− err_msg "uWSGI_app_enabled: missing arguments"
1127+
1117− return 42
1128+ [[ -z $CONF ]] && die_caller 42 "missing argument <myapp.ini>"
1118− fi
1119 case $DIST_ID-$DIST_VERS in
1129 case $DIST_ID-$DIST_VERS in
1120 ubuntu-*|debian-*)
1130 ubuntu-*|debian-*)
1121 [[ -f "${uWSGI_APPS_ENABLED}/${CONF}" ]]
1131 [[ -f "${uWSGI_APPS_ENABLED}/${CONF}" ]]
@@ -1145,11 +1155,7 @@ uWSGI_enable_app() {
1145
1155
1146 local CONF="$1"
1156 local CONF="$1"
1147
1157
1148− if [[ -z $CONF ]]; then
1158+ [[ -z $CONF ]] && die_caller 42 "missing argument <myapp.ini>"
1149− err_msg "uWSGI_enable_app: missing arguments"
1150− return 42
1151− fi
1152−
1153 case $DIST_ID-$DIST_VERS in
1159 case $DIST_ID-$DIST_VERS in
1154 ubuntu-*|debian-*)
1160 ubuntu-*|debian-*)
1155 mkdir -p "${uWSGI_APPS_ENABLED}"
1161 mkdir -p "${uWSGI_APPS_ENABLED}"
@@ -1183,11 +1189,8 @@ uWSGI_disable_app() {
1183 # usage: uWSGI_disable_app <myapp.ini>
1189 # usage: uWSGI_disable_app <myapp.ini>
1184
1190
1185 local CONF="$1"
1191 local CONF="$1"
1186− if [[ -z $CONF ]]; then
1187− err_msg "uWSGI_disable_app: missing arguments"
1188− return 42
1189− fi
1190
1192
1193+ [[ -z $CONF ]] && die_caller 42 "missing argument <myapp.ini>"
1191 case $DIST_ID-$DIST_VERS in
1194 case $DIST_ID-$DIST_VERS in
1192 ubuntu-*|debian-*)
1195 ubuntu-*|debian-*)
1193 service uwsgi stop "${CONF%.*}"
1196 service uwsgi stop "${CONF%.*}"
utils/lxc-searx.env+31−7
@@ -32,13 +32,36 @@ lxc_set_suite_env() {
32 # rolling releases see https://www.archlinux.org/releng/releases/
32 # rolling releases see https://www.archlinux.org/releng/releases/
33 "$LINUXCONTAINERS_ORG_NAME:archlinux" "archlinux"
33 "$LINUXCONTAINERS_ORG_NAME:archlinux" "archlinux"
34 )
34 )
35+
36+ PUBLIC_URL="${PUBLIC_URL:-http://$(uname -n)/searx}"
37+ if in_container; then
38+ # container hostnames do not have a DNS entry: use primary IP!
39+ PUBLIC_URL="http://$(primary_ip)/searx"
40+
41+ # make GUEST's services public to the HOST
35− export FILTRON_API="0.0.0.0:4005"
42+ FILTRON_API="0.0.0.0:4005"
36− export FILTRON_LISTEN="0.0.0.0:4004"
43+ FILTRON_LISTEN="0.0.0.0:4004"
37− export MORTY_LISTEN="0.0.0.0:3000"
44+ MORTY_LISTEN="0.0.0.0:3000"
45+
46+ # export LXC specific environment
47+ export PUBLIC_URL FILTRON_API FILTRON_LISTEN MORTY_LISTEN
48+ fi
38}
49}
39
50
40−# shellcheck disable=SC2034
51+lxc_suite_install_info() {
52+ (
53+ lxc_set_suite_env
54+ cat <<EOF
55+LXC suite: ${LXC_SUITE_NAME} --> ${PUBLIC_URL}
41−LXC_SUITE_INSTALL_INFO="suite includes searx, morty & filtron"
56+ suite includes searx, morty & filtron
57+suite images:
58+$(echo " ${LOCAL_IMAGES[*]}" | $FMT)
59+suite containers:
60+$(echo " ${CONTAINERS[*]}" | $FMT)
61+EOF
62+ )
63+ }
64+
42lxc_suite_install() {
65lxc_suite_install() {
43 (
66 (
44 lxc_set_suite_env
67 lxc_set_suite_env
@@ -62,8 +85,9 @@ lxc_suite_info() {
62 info_msg "(${ip%|*}) IPv6: http://[${ip#*|}]"
85 info_msg "(${ip%|*}) IPv6: http://[${ip#*|}]"
63 else
86 else
64 # IPv4:
87 # IPv4:
88+ # shellcheck disable=SC2034,SC2031
65− info_msg "(${ip%|*}) filtron: http://${ip#*|}:4004/"
89+ info_msg "(${ip%|*}) filtron: http://${ip#*|}:4004/ $PUBLIC_URL"
66− info_msg "(${ip%|*}) morty: http://${ip#*|}:3000/"
90+ info_msg "(${ip%|*}) morty: http://${ip#*|}:3000/ $PUBLIC_URL_MORTY"
67 info_msg "(${ip%|*}) docs-live: http://${ip#*|}:8080/"
91 info_msg "(${ip%|*}) docs-live: http://${ip#*|}:8080/"
68 fi
92 fi
69 done
93 done
utils/lxc.sh+8−13
@@ -112,14 +112,7 @@ EOF
112}
112}
113
113
114usage_containers() {
114usage_containers() {
115− cat <<EOF
115+ lxc_suite_install_info
116−LXC suite: ${LXC_SUITE_NAME}
117−$(echo " ${LXC_SUITE_INSTALL_INFO}" | $FMT)
118−suite images:
119−$(echo " ${LOCAL_IMAGES[*]}" | $FMT)
120−suite containers:
121−$(echo " ${CONTAINERS[*]}" | $FMT)
122−EOF
123 [ -n "${1+x}" ] && err_msg "$1"
116 [ -n "${1+x}" ] && err_msg "$1"
124}
117}
125
118
@@ -172,7 +165,7 @@ main() {
172 ''|--|containers) remove_containers ;;
165 ''|--|containers) remove_containers ;;
173 images) lxc_delete_images_localy ;;
166 images) lxc_delete_images_localy ;;
174 ${LXC_HOST_PREFIX}-*)
167 ${LXC_HOST_PREFIX}-*)
175− ! lxc_exists "$2" && usage_containers "unknown container: $2" && exit 42
168+ ! lxc_exists "$2" && warn_msg "container not yet exists: $2" && exit 0
176 if ask_yn "Do you really want to delete container $2"; then
169 if ask_yn "Do you really want to delete container $2"; then
177 lxc_delete_container "$2"
170 lxc_delete_container "$2"
178 fi
171 fi
@@ -201,7 +194,7 @@ main() {
201 lxc exec -t "$3" -- "${LXC_REPO_ROOT}/utils/lxc.sh" __show suite \
194 lxc exec -t "$3" -- "${LXC_REPO_ROOT}/utils/lxc.sh" __show suite \
202 | prefix_stdout "[${_BBlue}$3${_creset}] "
195 | prefix_stdout "[${_BBlue}$3${_creset}] "
203 ;;
196 ;;
204− *|--) show_suite;;
197+ *) show_suite;;
205 esac
198 esac
206 ;;
199 ;;
207 images) show_images ;;
200 images) show_images ;;
@@ -211,7 +204,7 @@ main() {
211 ! lxc_exists "$3" && usage_containers "unknown container: $3" && exit 42
204 ! lxc_exists "$3" && usage_containers "unknown container: $3" && exit 42
212 lxc config show "$3" | prefix_stdout "[${_BBlue}${3}${_creset}] "
205 lxc config show "$3" | prefix_stdout "[${_BBlue}${3}${_creset}] "
213 ;;
206 ;;
214− *|--)
207+ *)
215 rst_title "container configurations"
208 rst_title "container configurations"
216 echo
209 echo
217 lxc list "$LXC_HOST_PREFIX-"
210 lxc list "$LXC_HOST_PREFIX-"
@@ -226,7 +219,7 @@ main() {
226 ! lxc_exists "$3" && usage_containers "unknown container: $3" && exit 42
219 ! lxc_exists "$3" && usage_containers "unknown container: $3" && exit 42
227 lxc info "$3" | prefix_stdout "[${_BBlue}${3}${_creset}] "
220 lxc info "$3" | prefix_stdout "[${_BBlue}${3}${_creset}] "
228 ;;
221 ;;
229− *|--)
222+ *)
230 rst_title "container info"
223 rst_title "container info"
231 echo
224 echo
232 lxc_cmd info
225 lxc_cmd info
@@ -350,7 +343,9 @@ remove_containers() {
350 echo
343 echo
351 lxc list "$LXC_HOST_PREFIX-"
344 lxc list "$LXC_HOST_PREFIX-"
352 echo -en "\\n${_BRed}LXC containers to delete::${_creset}\\n\\n ${CONTAINERS[*]}\\n" | $FMT
345 echo -en "\\n${_BRed}LXC containers to delete::${_creset}\\n\\n ${CONTAINERS[*]}\\n" | $FMT
346+ local default=Ny
347+ [[ $FORCE_TIMEOUT = 0 ]] && default=Yn
353− if ask_yn "Do you really want to delete these containers"; then
348+ if ask_yn "Do you really want to delete these containers" $default; then
354 for i in "${CONTAINERS[@]}"; do
349 for i in "${CONTAINERS[@]}"; do
355 lxc_delete_container "$i"
350 lxc_delete_container "$i"
356 done
351 done
utils/morty.sh+9−6
@@ -7,6 +7,7 @@ source "$(dirname "${BASH_SOURCE[0]}")/lib.sh"
7# shellcheck source=utils/brand.env
7# shellcheck source=utils/brand.env
8source "${REPO_ROOT}/utils/brand.env"
8source "${REPO_ROOT}/utils/brand.env"
9source_dot_config
9source_dot_config
10+SEARX_URL="${PUBLIC_URL:-http://$(uname -n)/searx}"
10source "${REPO_ROOT}/utils/lxc-searx.env"
11source "${REPO_ROOT}/utils/lxc-searx.env"
11in_container && lxc_set_suite_env
12in_container && lxc_set_suite_env
12
13
@@ -17,12 +18,7 @@ in_container && lxc_set_suite_env
17MORTY_LISTEN="${MORTY_LISTEN:-127.0.0.1:3000}"
18MORTY_LISTEN="${MORTY_LISTEN:-127.0.0.1:3000}"
18PUBLIC_URL_PATH_MORTY="${PUBLIC_URL_PATH_MORTY:-/morty/}"
19PUBLIC_URL_PATH_MORTY="${PUBLIC_URL_PATH_MORTY:-/morty/}"
19
20
20−SEARX_URL="${PUBLIC_URL:-http://$(uname -n)/searx}"
21−PUBLIC_URL_MORTY="$(echo "$SEARX_URL" | sed -e's,^\(.*://[^/]*\).*,\1,g')${PUBLIC_URL_PATH_MORTY}"
21+PUBLIC_URL_MORTY="${PUBLIC_URL_MORTY:-$(echo "$SEARX_URL" | sed -e's,^\(.*://[^/]*\).*,\1,g')${PUBLIC_URL_PATH_MORTY}}"
22−if in_container; then
23− # container hostnames do not have a DNS entry, use primary IP
24− PUBLIC_URL_MORTY="$(url_replace_hostname "$PUBLIC_URL_MORTY" "$(primary_ip)")"
25−fi
26
22
27# shellcheck disable=SC2034
23# shellcheck disable=SC2034
28MORTY_TIMEOUT=5
24MORTY_TIMEOUT=5
@@ -229,6 +225,11 @@ install_all() {
229 if ask_yn "Do you want to install a reverse proxy (ProxyPass)" Yn; then
225 if ask_yn "Do you want to install a reverse proxy (ProxyPass)" Yn; then
230 install_apache_site
226 install_apache_site
231 fi
227 fi
228+ elif nginx_is_installed; then
229+ info_msg "nginx is installed on this host."
230+ if ask_yn "Do you want to install a reverse proxy (ProxyPass)" Yn; then
231+ install_nginx_site
232+ fi
232 fi
233 fi
233 info_searx
234 info_searx
234 if ask_yn "Add image and result proxy to searx settings.yml?" Yn; then
235 if ask_yn "Add image and result proxy to searx settings.yml?" Yn; then
@@ -462,7 +463,9 @@ This installs a reverse proxy (ProxyPass) into nginx site (${NGINX_MORTY_SITE})"
462
463
463 "${REPO_ROOT}/utils/searx.sh" install uwsgi
464 "${REPO_ROOT}/utils/searx.sh" install uwsgi
464
465
466+ # shellcheck disable=SC2034
465 SEARX_SRC=$("${REPO_ROOT}/utils/searx.sh" --getenv SEARX_SRC)
467 SEARX_SRC=$("${REPO_ROOT}/utils/searx.sh" --getenv SEARX_SRC)
468+ # shellcheck disable=SC2034
466 SEARX_URL_PATH=$("${REPO_ROOT}/utils/searx.sh" --getenv SEARX_URL_PATH)
469 SEARX_URL_PATH=$("${REPO_ROOT}/utils/searx.sh" --getenv SEARX_URL_PATH)
467 nginx_install_app "${NGINX_MORTY_SITE}"
470 nginx_install_app "${NGINX_MORTY_SITE}"
468
471
utils/searx.sh+16−7
@@ -81,6 +81,11 @@ case $DIST_ID-$DIST_VERS in
81 BUILD_PACKAGES="${BUILD_PACKAGES_debian}"
81 BUILD_PACKAGES="${BUILD_PACKAGES_debian}"
82 APACHE_PACKAGES="$APACHE_PACKAGES libapache2-mod-proxy-uwsgi"
82 APACHE_PACKAGES="$APACHE_PACKAGES libapache2-mod-proxy-uwsgi"
83 ;;
83 ;;
84+ ubuntu-20.04)
85+ # https://askubuntu.com/a/1224710
86+ SEARX_PACKAGES="${SEARX_PACKAGES_debian} python-is-python3"
87+ BUILD_PACKAGES="${BUILD_PACKAGES_debian}"
88+ ;;
84 ubuntu-*|debian-*)
89 ubuntu-*|debian-*)
85 SEARX_PACKAGES="${SEARX_PACKAGES_debian}"
90 SEARX_PACKAGES="${SEARX_PACKAGES_debian}"
86 BUILD_PACKAGES="${BUILD_PACKAGES_debian}"
91 BUILD_PACKAGES="${BUILD_PACKAGES_debian}"
@@ -206,7 +211,12 @@ main() {
206 pyenv) create_pyenv ;;
211 pyenv) create_pyenv ;;
207 searx-src) clone_searx ;;
212 searx-src) clone_searx ;;
208 settings) install_settings ;;
213 settings) install_settings ;;
214+ uwsgi)
209− uwsgi) install_searx_uwsgi;;
215+ install_searx_uwsgi
216+ if ! service_is_available "http://${SEARX_INTERNAL_HTTP}"; then
217+ err_msg "URL http://${SEARX_INTERNAL_HTTP} not available, check searx & uwsgi setup!"
218+ fi
219+ ;;
210 packages)
220 packages)
211 pkg_install "$SEARX_PACKAGES"
221 pkg_install "$SEARX_PACKAGES"
212 ;;
222 ;;
@@ -272,11 +282,6 @@ install_all() {
272 rst_title "Install $SEARX_INSTANCE_NAME (service)"
282 rst_title "Install $SEARX_INSTANCE_NAME (service)"
273 pkg_install "$SEARX_PACKAGES"
283 pkg_install "$SEARX_PACKAGES"
274 wait_key
284 wait_key
275− case $DIST_ID-$DIST_VERS in
276− fedora-*)
277− systemctl enable uwsgi
278− ;;
279− esac
280 assert_user
285 assert_user
281 wait_key
286 wait_key
282 clone_searx
287 clone_searx
@@ -514,6 +519,7 @@ EOF
514install_searx_uwsgi() {
519install_searx_uwsgi() {
515 rst_title "Install searx's uWSGI app (searx.ini)" section
520 rst_title "Install searx's uWSGI app (searx.ini)" section
516 echo
521 echo
522+ install_uwsgi
517 uWSGI_install_app "$SEARX_UWSGI_APP"
523 uWSGI_install_app "$SEARX_UWSGI_APP"
518}
524}
519
525
@@ -575,7 +581,10 @@ EOF
575}
581}
576
582
577set_result_proxy() {
583set_result_proxy() {
584+
585+ # usage: set_result_proxy <URL> [<key>]
586+
578− info_msg "try to set result proxy ..."
587+ info_msg "try to set result proxy: $1"
579 cp "${SEARX_SETTINGS_PATH}" "${SEARX_SETTINGS_PATH}.bak"
588 cp "${SEARX_SETTINGS_PATH}" "${SEARX_SETTINGS_PATH}.bak"
580 _set_result_proxy "$1" "$2" > "${SEARX_SETTINGS_PATH}"
589 _set_result_proxy "$1" "$2" > "${SEARX_SETTINGS_PATH}"
581}
590}