forked from zaclys/searxng
LXC: install searx-suite installs searx, filtron & morty on all containers
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
parent
d5917cc029
commit
af6acd3417
|
@ -204,7 +204,7 @@ install_all() {
|
||||||
install_apache_site
|
install_apache_site
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if ask_yn "Do you want to inspect the installation?" Yn; then
|
if ask_yn "Do you want to inspect the installation?" Ny; then
|
||||||
inspect_service
|
inspect_service
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -253,7 +253,6 @@ grep -qFs -- 'source $GO_ENV' ~/.profile || echo 'source $GO_ENV' >> ~/.profile
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
filtron_is_installed() {
|
filtron_is_installed() {
|
||||||
[[ -f $SERVICE_HOME/go-apps/bin/filtron ]]
|
[[ -f $SERVICE_HOME/go-apps/bin/filtron ]]
|
||||||
}
|
}
|
||||||
|
|
|
@ -290,6 +290,15 @@ cache_download() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
backup_file() {
|
||||||
|
|
||||||
|
# usage: backup_file /path/to/file.foo
|
||||||
|
|
||||||
|
local stamp=$(date +"_%Y%m%d_%H%M%S")
|
||||||
|
info_msg "create backup: ${1}${stamp}"
|
||||||
|
cp -a "${1}" "${1}${stamp}"
|
||||||
|
}
|
||||||
|
|
||||||
choose_one() {
|
choose_one() {
|
||||||
|
|
||||||
# usage:
|
# usage:
|
||||||
|
|
55
utils/lxc.sh
55
utils/lxc.sh
|
@ -19,6 +19,7 @@ HOST_PREFIX="${HOST_PREFIX:-searx}"
|
||||||
|
|
||||||
# where all folders from HOST are mounted
|
# where all folders from HOST are mounted
|
||||||
LXC_SHARE_FOLDER="/share"
|
LXC_SHARE_FOLDER="/share"
|
||||||
|
LXC_REPO_ROOT="${LXC_SHARE_FOLDER}/$(basename "${REPO_ROOT}")"
|
||||||
|
|
||||||
TEST_IMAGES=(
|
TEST_IMAGES=(
|
||||||
"$LINUXCONTAINERS_ORG_NAME:ubuntu/18.04" "ubu1804"
|
"$LINUXCONTAINERS_ORG_NAME:ubuntu/18.04" "ubu1804"
|
||||||
|
@ -71,6 +72,7 @@ usage() {
|
||||||
usage::
|
usage::
|
||||||
|
|
||||||
$(basename "$0") build [containers]
|
$(basename "$0") build [containers]
|
||||||
|
$(basename "$0") install [searx-suite]
|
||||||
$(basename "$0") remove [containers|subordinate]
|
$(basename "$0") remove [containers|subordinate]
|
||||||
$(basename "$0") [start|stop] [containers]
|
$(basename "$0") [start|stop] [containers]
|
||||||
$(basename "$0") inspect [info|config]
|
$(basename "$0") inspect [info|config]
|
||||||
|
@ -87,6 +89,8 @@ inspect
|
||||||
:config: show config of all containers
|
:config: show config of all containers
|
||||||
cmd ...
|
cmd ...
|
||||||
run commandline ... in all containers
|
run commandline ... in all containers
|
||||||
|
install
|
||||||
|
:searx-suite: install searx suite, includes morty & filtron
|
||||||
|
|
||||||
all LXC containers:
|
all LXC containers:
|
||||||
${LOCAL_IMAGES[@]}
|
${LOCAL_IMAGES[@]}
|
||||||
|
@ -110,14 +114,24 @@ EOF
|
||||||
main() {
|
main() {
|
||||||
|
|
||||||
local exit_val
|
local exit_val
|
||||||
|
|
||||||
if ! required_commands lxc; then
|
|
||||||
lxd_info
|
|
||||||
exit 42
|
|
||||||
fi
|
|
||||||
|
|
||||||
local _usage="unknown or missing $1 command $2"
|
local _usage="unknown or missing $1 command $2"
|
||||||
|
|
||||||
|
case $1 in
|
||||||
|
__install)
|
||||||
|
sudo_or_exit
|
||||||
|
case $2 in
|
||||||
|
searx-suite) install_searx_suite ;;
|
||||||
|
esac
|
||||||
|
exit
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
if ! required_commands lxc; then
|
||||||
|
lxd_info
|
||||||
|
exit 42
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
case $1 in
|
case $1 in
|
||||||
--source-only) ;;
|
--source-only) ;;
|
||||||
-h|--help) usage; exit 0;;
|
-h|--help) usage; exit 0;;
|
||||||
|
@ -161,6 +175,7 @@ main() {
|
||||||
sudo_or_exit
|
sudo_or_exit
|
||||||
shift
|
shift
|
||||||
for i in "${LOCAL_IMAGES[@]}"; do
|
for i in "${LOCAL_IMAGES[@]}"; do
|
||||||
|
exit_val=
|
||||||
info_msg "[${_BBlue}${i}${_creset}] ${_BGreen}${*}${_creset}"
|
info_msg "[${_BBlue}${i}${_creset}] ${_BGreen}${*}${_creset}"
|
||||||
lxc exec "${i}" -- "$@"
|
lxc exec "${i}" -- "$@"
|
||||||
exit_val=$?
|
exit_val=$?
|
||||||
|
@ -171,11 +186,37 @@ main() {
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
|
install)
|
||||||
|
sudo_or_exit
|
||||||
|
case $2 in
|
||||||
|
searx-suite)
|
||||||
|
for i in "${LOCAL_IMAGES[@]}"; do
|
||||||
|
info_msg "[${_BBlue}${i}${_creset}] ${_BGreen}${LXC_REPO_ROOT}/utils/lxc.sh install $2${_creset}"
|
||||||
|
lxc exec "${i}" -- "${LXC_REPO_ROOT}/utils/lxc.sh" __install "$2"
|
||||||
|
done
|
||||||
|
;;
|
||||||
|
*) usage "$_usage"; exit 42;;
|
||||||
|
esac ;;
|
||||||
*)
|
*)
|
||||||
usage "unknown or missing command $1"; exit 42;;
|
usage "unknown or missing command $1"; exit 42;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
install_searx_suite() {
|
||||||
|
export FILTRON_API="0.0.0.0:4005"
|
||||||
|
export FILTRON_LISTEN="0.0.0.0:4004"
|
||||||
|
export MORTY_LISTEN="0.0.0.0:3000"
|
||||||
|
FORCE_TIMEOUT=0 "${LXC_REPO_ROOT}/utils/searx.sh" install all
|
||||||
|
FORCE_TIMEOUT=0 "${LXC_REPO_ROOT}/utils/morty.sh" install all
|
||||||
|
FORCE_TIMEOUT=0 "${LXC_REPO_ROOT}/utils/filtron.sh" install all
|
||||||
|
rst_title "[$(hostname)] searx-suite installation finished" part
|
||||||
|
rst_para "IPs of the container ..."
|
||||||
|
echo
|
||||||
|
ip addr show | grep "inet\s*[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*"
|
||||||
|
echo
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
build_instances() {
|
build_instances() {
|
||||||
rst_title "Build LXC instances"
|
rst_title "Build LXC instances"
|
||||||
|
|
||||||
|
@ -271,7 +312,7 @@ lxc_config_containers() {
|
||||||
# https://lxd.readthedocs.io/en/latest/instances/#type-disk
|
# https://lxd.readthedocs.io/en/latest/instances/#type-disk
|
||||||
lxc config device add "$i" repo_share disk \
|
lxc config device add "$i" repo_share disk \
|
||||||
source="${REPO_ROOT}" \
|
source="${REPO_ROOT}" \
|
||||||
path="${LXC_SHARE_FOLDER}/$(basename "${REPO_ROOT}")" &>/dev/null
|
path="${LXC_REPO_ROOT}" &>/dev/null
|
||||||
# lxc config show "$i" && wait_key
|
# lxc config show "$i" && wait_key
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
|
@ -207,7 +207,7 @@ install_all() {
|
||||||
install_apache_site
|
install_apache_site
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if ask_yn "Do you want to inspect the installation?" Yn; then
|
if ask_yn "Do you want to inspect the installation?" Ny; then
|
||||||
inspect_service
|
inspect_service
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -408,6 +408,7 @@ This removes apache site ${APACHE_MORTY_SITE}."
|
||||||
|
|
||||||
apache_remove_site "$APACHE_MORTY_SITE"
|
apache_remove_site "$APACHE_MORTY_SITE"
|
||||||
}
|
}
|
||||||
|
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
main "$@"
|
main "$@"
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
|
|
|
@ -43,9 +43,6 @@ case $DIST_ID in
|
||||||
git build-essential libxslt-dev zlib1g-dev libffi-dev libssl-dev "
|
git build-essential libxslt-dev zlib1g-dev libffi-dev libssl-dev "
|
||||||
;;
|
;;
|
||||||
arch) # pacman packages
|
arch) # pacman packages
|
||||||
# FIXME:
|
|
||||||
# - /usr/lib/uwsgi/http_plugin.so: cannot open shared object file: No such file or directory !!!
|
|
||||||
# - /usr/lib/uwsgi/systemd_logger_plugin.so: cannot open shared object file: No such file or directory !!!
|
|
||||||
SEARX_PACKAGES="\
|
SEARX_PACKAGES="\
|
||||||
python python-pip python-lxml python-babel \
|
python python-pip python-lxml python-babel \
|
||||||
uwsgi uwsgi-plugin-python \
|
uwsgi uwsgi-plugin-python \
|
||||||
|
@ -233,7 +230,7 @@ install_all() {
|
||||||
if ! service_is_available "http://$SEARX_INTERNAL_URL"; then
|
if ! service_is_available "http://$SEARX_INTERNAL_URL"; then
|
||||||
err_msg "URL http://$SEARX_INTERNAL_URL not available, check searx & uwsgi setup!"
|
err_msg "URL http://$SEARX_INTERNAL_URL not available, check searx & uwsgi setup!"
|
||||||
fi
|
fi
|
||||||
if ask_yn "Do you want to inspect the installation?" Yn; then
|
if ask_yn "Do you want to inspect the installation?" Ny; then
|
||||||
inspect_service
|
inspect_service
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -331,19 +328,26 @@ install_settings() {
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rst_para "Diff between origin's setting file (-) and current (+):"
|
rst_para "Diff between origin's setting file (+) and current (-):"
|
||||||
echo
|
echo
|
||||||
$DIFF_CMD "${SEARX_SRC}/searx/settings.yml" "${SEARX_SETTINGS_PATH}"
|
$DIFF_CMD "${SEARX_SETTINGS_PATH}" "${SEARX_SRC}/searx/settings.yml"
|
||||||
|
|
||||||
local action
|
local action
|
||||||
choose_one action "What should happen to the settings file? " \
|
choose_one action "What should happen to the settings file? " \
|
||||||
"keep new configuration" \
|
"keep configuration unchanged" \
|
||||||
|
"use origin settings" \
|
||||||
"start interactiv shell"
|
"start interactiv shell"
|
||||||
case $action in
|
case $action in
|
||||||
"keep new configuration")
|
"keep configuration unchanged")
|
||||||
info_msg "continue using new settings file"
|
info_msg "leave settings file unchanged"
|
||||||
|
;;
|
||||||
|
"use origin settings")
|
||||||
|
backup_file "${SEARX_SETTINGS_PATH}"
|
||||||
|
info_msg "install origin settings"
|
||||||
|
cp "${SEARX_SRC}/searx/settings.yml" "${SEARX_SETTINGS_PATH}"
|
||||||
;;
|
;;
|
||||||
"start interactiv shell")
|
"start interactiv shell")
|
||||||
|
backup_file "${SEARX_SETTINGS_PATH}"
|
||||||
echo -e "// exit with [${_BCyan}CTRL-D${_creset}]"
|
echo -e "// exit with [${_BCyan}CTRL-D${_creset}]"
|
||||||
sudo -H -i
|
sudo -H -i
|
||||||
rst_para 'Diff between new setting file (-) and current (+):'
|
rst_para 'Diff between new setting file (-) and current (+):'
|
||||||
|
|
|
@ -32,7 +32,7 @@ master = true
|
||||||
lazy-apps = true
|
lazy-apps = true
|
||||||
|
|
||||||
# load uWSGI plugins
|
# load uWSGI plugins
|
||||||
plugin = python,http,systemd_logger
|
plugin = python
|
||||||
|
|
||||||
# By default the Python plugin does not initialize the GIL. This means your
|
# By default the Python plugin does not initialize the GIL. This means your
|
||||||
# app-generated threads will not run. If you need threads, remember to enable
|
# app-generated threads will not run. If you need threads, remember to enable
|
||||||
|
|
Loading…
Reference in New Issue