From 782f73540e2d383ea122716507ccd9582918ab51 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Fri, 27 May 2022 18:43:14 +0200 Subject: [utils/searxng.sh] implement new script to install SearXNG Signed-off-by: Markus Heiser --- utils/lib.sh | 47 +- utils/lib_install.sh | 7 +- utils/lib_redis.sh | 27 +- utils/lxc-searx.env | 97 --- utils/lxc-searxng.env | 68 ++ utils/lxc.sh | 2 +- utils/morty.sh | 2 +- utils/searxng.sh | 894 +++++++++++++++++++++ utils/searxng_check.py | 7 + .../etc/httpd/sites-available/searxng.conf | 41 + .../etc/httpd/sites-available/searxng.conf:socket | 41 + .../etc/nginx/default.apps-available/searxng.conf | 29 + .../default.apps-available/searxng.conf:socket | 26 + utils/templates/etc/searxng/settings.yml | 78 +- .../templates/etc/uwsgi/apps-archlinux/searxng.ini | 18 +- .../etc/uwsgi/apps-archlinux/searxng.ini:socket | 17 - .../templates/etc/uwsgi/apps-available/searxng.ini | 24 +- .../etc/uwsgi/apps-available/searxng.ini:socket | 23 +- 18 files changed, 1204 insertions(+), 244 deletions(-) delete mode 100644 utils/lxc-searx.env create mode 100644 utils/lxc-searxng.env create mode 100755 utils/searxng.sh create mode 100644 utils/templates/etc/httpd/sites-available/searxng.conf create mode 100644 utils/templates/etc/httpd/sites-available/searxng.conf:socket create mode 100644 utils/templates/etc/nginx/default.apps-available/searxng.conf create mode 100644 utils/templates/etc/nginx/default.apps-available/searxng.conf:socket (limited to 'utils') diff --git a/utils/lib.sh b/utils/lib.sh index 257c15024..32db47524 100755 --- a/utils/lib.sh +++ b/utils/lib.sh @@ -195,7 +195,7 @@ wait_key(){ [[ -n $_t ]] && _t="-t $_t" printf "$msg" # shellcheck disable=SC2086 - read -r -s -n1 $_t + read -r -s -n1 $_t || true echo clean_stdin } @@ -1027,7 +1027,7 @@ nginx_include_apps_enabled() { local include_directive="include ${NGINX_APPS_ENABLED}/*.conf;" local include_directive_re="^\s*include ${NGINX_APPS_ENABLED}/\*\.conf;" - info_msg "checking existence: '${include_directive}' in file ${server_conf}" + info_msg "checking existence: '${include_directive}' in file ${server_conf}" if grep "${include_directive_re}" "${server_conf}"; then info_msg "OK, already exists." return @@ -1117,7 +1117,7 @@ apache_distro_setup() { APACHE_SITES_AVAILABLE="/etc/httpd/sites-available" APACHE_SITES_ENABLED="/etc/httpd/sites-enabled" APACHE_MODULES="modules" - APACHE_PACKAGES="httpd" + APACHE_PACKAGES="httpd mod_ssl" ;; *) err_msg "$DIST_ID-$DIST_VERS: apache not yet implemented" @@ -1249,8 +1249,6 @@ apache_dissable_site() { # ----- uWSGI_SETUP="${uWSGI_SETUP:=/etc/uwsgi}" -uWSGI_USER= -uWSGI_GROUP= # How distros manage uWSGI apps is very different. From uWSGI POV read: # - https://uwsgi-docs.readthedocs.io/en/latest/Management.html @@ -1276,13 +1274,14 @@ uWSGI_distro_setup() { ;; fedora-*|centos-7) # systemd --> /usr/lib/systemd/system/uwsgi.service - # The unit file starts uWSGI in emperor mode (/etc/uwsgi.ini), see - # - https://uwsgi-docs.readthedocs.io/en/latest/Emperor.html + # Fedora runs uWSGI in emperor-tyrant mode: in Tyrant mode the + # Emperor will run the vassal using the UID/GID of the vassal + # configuration file [1] (user and group of the app .ini file). + # There are some quirks abbout additional POSIX groups in uWSGI + # 2.0.x, read at least: https://github.com/unbit/uwsgi/issues/2099 uWSGI_APPS_AVAILABLE="${uWSGI_SETUP}/apps-available" uWSGI_APPS_ENABLED="${uWSGI_SETUP}.d" uWSGI_PACKAGES="uwsgi" - uWSGI_USER="uwsgi" - uWSGI_GROUP="uwsgi" ;; *) err_msg "$DIST_ID-$DIST_VERS: uWSGI not yet implemented" @@ -1344,30 +1343,6 @@ uWSGI_restart() { esac } -uWSGI_prepare_app() { - - # usage: uWSGI_prepare_app - - [[ -z $1 ]] && die_caller 42 "missing argument " - - local APP="${1%.*}" - - case $DIST_ID-$DIST_VERS in - fedora-*|centos-7) - # in emperor mode, the uwsgi user is the owner of the sockets - info_msg "prepare (uwsgi:uwsgi) /run/uwsgi/app/${APP}" - mkdir -p "/run/uwsgi/app/${APP}" - chown -R "uwsgi:uwsgi" "/run/uwsgi/app/${APP}" - ;; - *) - info_msg "prepare (${SERVICE_USER}:${SERVICE_GROUP}) /run/uwsgi/app/${APP}" - mkdir -p "/run/uwsgi/app/${APP}" - chown -R "${SERVICE_USER}:${SERVICE_GROUP}" "/run/uwsgi/app/${APP}" - ;; - esac -} - - uWSGI_app_available() { # usage: uWSGI_app_available local CONF="$1" @@ -1378,7 +1353,7 @@ uWSGI_app_available() { uWSGI_install_app() { - # usage: uWSGI_install_app [