diff --git a/utils/filtron.sh b/utils/filtron.sh index d2be60737..6c58b07a2 100755 --- a/utils/filtron.sh +++ b/utils/filtron.sh @@ -97,15 +97,24 @@ apache (${PUBLIC_URL}) filtron rules: ${FILTRON_RULES} If needed, set PUBLIC_URL of your WEB service in the '${DOT_CONFIG#"$REPO_ROOT/"}' file:: - PUBLIC_URL : ${PUBLIC_URL} PUBLIC_HOST : ${PUBLIC_HOST} SERVICE_USER : ${SERVICE_USER} + FILTRON_TARGET : ${FILTRON_TARGET} FILTRON_API : ${FILTRON_API} FILTRON_LISTEN : ${FILTRON_LISTEN} - FILTRON_TARGET : ${FILTRON_TARGET} - EOF + if in_container; then + # in containers the service is listening on 0.0.0.0 (see lxc-searx.env) + for ip in $(global_IPs) ; do + if [[ $ip =~ .*:.* ]]; then + echo " container URL (IPv6): http://[${ip#*|}]:4005/" + else + # IPv4: + echo " container URL (IPv4): http://${ip#*|}:4005/" + fi + done + fi [[ -n ${1} ]] && err_msg "$1" } diff --git a/utils/morty.sh b/utils/morty.sh index d79faa037..17039a05e 100755 --- a/utils/morty.sh +++ b/utils/morty.sh @@ -83,39 +83,37 @@ apache : ${PUBLIC_URL_MORTY} :install: apache site with a reverse proxy (ProxyPass) :remove: apache site ${APACHE_MORTY_SITE} -If needed, set the environment variable MORTY_LISTEN in the -${DOT_CONFIG#"$REPO_ROOT/"} file:: - - MORTY_LISTEN : ${MORTY_LISTEN} - SERVICE_USER : ${SERVICE_USER} - +If needed, set the environment variables in the '${DOT_CONFIG#"$REPO_ROOT/"}' file:: + PUBLIC_URL_MORTY: ${PUBLIC_URL_MORTY} + MORTY_LISTEN: ${MORTY_LISTEN} + SERVICE_USER: ${SERVICE_USER} EOF if in_container; then - lxc_suite_info - else - info_msg "public URL --> ${PUBLIC_URL}" - info_msg "internal URL --> http://${SEARX_INTERNAL_URL}" + # in containers the service is listening on 0.0.0.0 (see lxc-searx.env) + for ip in $(global_IPs) ; do + if [[ $ip =~ .*:.* ]]; then + echo " container URL (IPv6): http://[${ip#*|}]:3000/" + else + # IPv4: + echo " container URL (IPv4): http://${ip#*|}:3000/" + fi + done fi + echo info_searx + [[ -n ${1} ]] && err_msg "$1" } info_searx() { # shellcheck disable=SC1117 cat < ] $(basename "$0") apache [install|remove] shell @@ -153,12 +153,25 @@ apache searx settings: ${SEARX_SETTINGS_PATH} If needed, set PUBLIC_URL of your WEB service in the '${DOT_CONFIG#"$REPO_ROOT/"}' file:: - PUBLIC_URL : ${PUBLIC_URL} SEARX_INSTANCE_NAME : ${SEARX_INSTANCE_NAME} SERVICE_USER : ${SERVICE_USER} - + SEARX_INTERNAL_HTTP : http://${SEARX_INTERNAL_HTTP} EOF + if in_container; then + # searx is listening on 127.0.0.1 and not available from outside container + # in containers the service is listening on 0.0.0.0 (see lxc-searx.env) + echo -e "${_BBlack}HINT:${_creset} searx only listen on loopback device" \ + "${_BBlack}inside${_creset} the container." + for ip in $(global_IPs) ; do + if [[ $ip =~ .*:.* ]]; then + echo " container (IPv6): [${ip#*|}]" + else + # IPv4: + echo " container (IPv4): ${ip#*|}" + fi + done + fi [[ -n ${1} ]] && err_msg "$1" } @@ -277,8 +290,8 @@ install_all() { test_local_searx wait_key install_searx_uwsgi - if ! service_is_available "http://$SEARX_INTERNAL_URL"; then - err_msg "URL http://$SEARX_INTERNAL_URL not available, check searx & uwsgi setup!" + if ! service_is_available "http://${SEARX_INTERNAL_HTTP}"; then + err_msg "URL http://${SEARX_INTERNAL_HTTP} not available, check searx & uwsgi setup!" fi if ask_yn "Do you want to inspect the installation?" Ny; then inspect_service @@ -481,8 +494,8 @@ test_local_searx() { rst_title "Testing searx instance localy" section echo - if service_is_available "http://$SEARX_INTERNAL_URL" &>/dev/null; then - err_msg "URL/port http://$SEARX_INTERNAL_URL is already in use, you" + if service_is_available "http://${SEARX_INTERNAL_HTTP}" &>/dev/null; then + err_msg "URL/port http://${SEARX_INTERNAL_HTTP} is already in use, you" err_msg "should stop that service before starting local tests!" if ! ask_yn "Continue with local tests?"; then return @@ -494,7 +507,7 @@ export SEARX_SETTINGS_PATH="${SEARX_SETTINGS_PATH}" cd ${SEARX_SRC} timeout 10 python searx/webapp.py & sleep 3 -curl --location --verbose --head --insecure $SEARX_INTERNAL_URL +curl --location --verbose --head --insecure $SEARX_INTERNAL_HTTP EOF sed -i -e "s/debug : True/debug : False/g" "$SEARX_SETTINGS_PATH" } @@ -624,12 +637,10 @@ sourced ${DOT_CONFIG#"$REPO_ROOT/"} : PUBLIC_URL : ${PUBLIC_URL} SEARX_URL_PATH : ${SEARX_URL_PATH} SEARX_INSTANCE_NAME : ${SEARX_INSTANCE_NAME} - SEARX_INTERNAL_URL : ${SEARX_INTERNAL_URL} + SEARX_INTERNAL_HTTP : ${SEARX_INTERNAL_HTTP} EOF - apache_is_installed && info_msg "Apache is installed." - if service_account_is_available "$SERVICE_USER"; then info_msg "Service account $SERVICE_USER exists." else @@ -661,11 +672,11 @@ EOF lxc_suite_info else info_msg "public URL --> ${PUBLIC_URL}" - info_msg "internal URL --> http://${SEARX_INTERNAL_URL}" + info_msg "internal URL --> http://${SEARX_INTERNAL_HTTP}" fi - if ! service_is_available "http://${SEARX_INTERNAL_URL}"; then - err_msg "uWSGI app (service) at http://${SEARX_INTERNAL_URL} is not available!" + if ! service_is_available "http://${SEARX_INTERNAL_HTTP}"; then + err_msg "uWSGI app (service) at http://${SEARX_INTERNAL_HTTP} is not available!" MSG="${_Green}[${_BCyan}CTRL-C${_Green}] to stop or [${_BCyan}KEY${_Green}] to continue"\ wait_key fi @@ -720,8 +731,8 @@ install_apache_site() { rst_title "Install Apache site $APACHE_SEARX_SITE" rst_para "\ -This installs the searx uwsgi app as apache site. If your server ist public to -the internet you should instead use a reverse proxy (filtron) to block +This installs the searx uwsgi app as apache site. If your server is public to +the internet, you should instead use a reverse proxy (filtron) to block excessively bot queries." ! apache_is_installed && err_msg "Apache is not installed." @@ -730,7 +741,7 @@ excessively bot queries." return fi - pkg_install "$APACHE_APT_PACKAGES" + pkg_install "$APACHE_PACKAGES" a2enmod uwsgi echo diff --git a/utils/templates/etc/uwsgi/apps-archlinux/searx.ini b/utils/templates/etc/uwsgi/apps-archlinux/searx.ini index 66653fc0e..8d3349c58 100644 --- a/utils/templates/etc/uwsgi/apps-archlinux/searx.ini +++ b/utils/templates/etc/uwsgi/apps-archlinux/searx.ini @@ -68,7 +68,7 @@ pythonpath = ${SEARX_SRC} # https://uwsgi-docs.readthedocs.io/en/latest/Options.html#plugin-http # Native HTTP support: https://uwsgi-docs.readthedocs.io/en/latest/HTTP.html -http = ${SEARX_INTERNAL_URL} +http = ${SEARX_INTERNAL_HTTP} # using unix-sockets: # diff --git a/utils/templates/etc/uwsgi/apps-available/searx.ini b/utils/templates/etc/uwsgi/apps-available/searx.ini index 4f8674012..806f74439 100644 --- a/utils/templates/etc/uwsgi/apps-available/searx.ini +++ b/utils/templates/etc/uwsgi/apps-available/searx.ini @@ -67,7 +67,7 @@ pythonpath = ${SEARX_SRC} # https://uwsgi-docs.readthedocs.io/en/latest/Options.html#plugin-http # Native HTTP support: https://uwsgi-docs.readthedocs.io/en/latest/HTTP.html -http = ${SEARX_INTERNAL_URL} +http = ${SEARX_INTERNAL_HTTP} # using unix-sockets: #