[mod] utils/searx.sh - check a SearXNG installation

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
Markus Heiser 2021-10-29 18:09:44 +02:00
parent 2b1252148d
commit 38482739de
1 changed files with 40 additions and 34 deletions

View File

@ -141,7 +141,7 @@ usage() {
cat <<EOF cat <<EOF
usage:: usage::
$(basename "$0") shell $(basename "$0") shell
$(basename "$0") install [all|init-src|dot-config|user|searx-src|pyenv|uwsgi|packages|settings|buildhost] $(basename "$0") install [all|check|init-src|dot-config|user|searx-src|pyenv|uwsgi|packages|settings|buildhost]
$(basename "$0") update [searx] $(basename "$0") update [searx]
$(basename "$0") remove [all|user|pyenv|searx-src] $(basename "$0") remove [all|user|pyenv|searx-src]
$(basename "$0") activate [service] $(basename "$0") activate [service]
@ -154,7 +154,6 @@ shell
start interactive shell from user ${SERVICE_USER} start interactive shell from user ${SERVICE_USER}
install / remove install / remove
:all: complete (de-) installation of searx service :all: complete (de-) installation of searx service
:check: check the SearXNG installation
:user: add/remove service user '$SERVICE_USER' ($SERVICE_HOME) :user: add/remove service user '$SERVICE_USER' ($SERVICE_HOME)
:dot-config: copy ./config.sh to ${SEARX_SRC} :dot-config: copy ./config.sh to ${SEARX_SRC}
:searx-src: clone $GIT_URL :searx-src: clone $GIT_URL
@ -164,6 +163,8 @@ install / remove
:settings: reinstall settings from ${SEARXNG_SETTINGS_PATH} :settings: reinstall settings from ${SEARXNG_SETTINGS_PATH}
:packages: install needed packages from OS package manager :packages: install needed packages from OS package manager
:buildhost: install packages from OS package manager needed by buildhosts :buildhost: install packages from OS package manager needed by buildhosts
install
:check: check the SearXNG installation
update searx update searx
Update SearXNG installation ($SERVICE_HOME) Update SearXNG installation ($SERVICE_HOME)
activate service activate service
@ -216,15 +217,15 @@ main() {
install) install)
sudo_or_exit sudo_or_exit
case $2 in case $2 in
check)
rst_title "SearXNG (check installation)" part
verify_continue_install
sudo -H -u "${SERVICE_USER}" "${SEARX_PYENV}/bin/python" "utils/searxng_check.py"
;;
all) all)
rst_title "SearXNG (install)" part rst_title "SearXNG (install)" part
install_all install_all
;; ;;
check)
rst_title "SearXNG (check installation)" part
verify_continue_install
install_check
;;
user) user)
rst_title "SearXNG (install user)" rst_title "SearXNG (install user)"
verify_continue_install verify_continue_install
@ -352,6 +353,37 @@ install_all() {
fi fi
} }
install_check() {
if service_account_is_available "$SERVICE_USER"; then
info_msg "Service account $SERVICE_USER exists."
else
err_msg "Service account $SERVICE_USER does not exists!"
fi
if pyenv_is_available; then
info_msg "~$SERVICE_USER: python environment is available."
else
err_msg "~$SERVICE_USER: python environment is not available!"
fi
if clone_is_available; then
info_msg "~$SERVICE_USER: SearXNG software is installed."
else
err_msg "~$SERVICE_USER: Missing SearXNG software!"
fi
if uWSGI_app_enabled "$SEARXNG_UWSGI_APP"; then
info_msg "uWSGI app $SEARXNG_UWSGI_APP is enabled."
else
err_msg "uWSGI app $SEARXNG_UWSGI_APP not enabled!"
fi
uWSGI_app_available "$SEARXNG_UWSGI_APP" \
|| err_msg "uWSGI app $SEARXNG_UWSGI_APP not available!"
sudo -H -u "${SERVICE_USER}" "${SEARX_PYENV}/bin/python" "utils/searxng_check.py"
}
update_searx() { update_searx() {
rst_title "Update SearXNG instance" rst_title "Update SearXNG instance"
@ -851,33 +883,7 @@ sourced ${DOT_CONFIG} :
EOF EOF
install_log_searx_instance install_log_searx_instance
if service_account_is_available "$SERVICE_USER"; then install_check
info_msg "Service account $SERVICE_USER exists."
else
err_msg "Service account $SERVICE_USER does not exists!"
fi
if pyenv_is_available; then
info_msg "~$SERVICE_USER: python environment is available."
else
err_msg "~$SERVICE_USER: python environment is not available!"
fi
if clone_is_available; then
info_msg "~$SERVICE_USER: SearXNG software is installed."
else
err_msg "~$SERVICE_USER: Missing SearXNG software!"
fi
if uWSGI_app_enabled "$SEARXNG_UWSGI_APP"; then
info_msg "uWSGI app $SEARXNG_UWSGI_APP is enabled."
else
err_msg "uWSGI app $SEARXNG_UWSGI_APP not enabled!"
fi
uWSGI_app_available "$SEARXNG_UWSGI_APP" \
|| err_msg "uWSGI app $SEARXNG_UWSGI_APP not available!"
if in_container; then if in_container; then
lxc_suite_info lxc_suite_info
else else