@@ -63,6 +63,12 @@ HOST_USER="${SUDO_USER:-$USER}"
63HOST_USER_ID=$(id -u "${HOST_USER}")
63HOST_USER_ID=$(id -u "${HOST_USER}")
64HOST_GROUP_ID=$(id -g "${HOST_USER}")
64HOST_GROUP_ID=$(id -g "${HOST_USER}")
66+searx_suite_set_env() {
67+ export FILTRON_API="0.0.0.0:4005"
68+ export FILTRON_LISTEN="0.0.0.0:4004"
69+ export MORTY_LISTEN="0.0.0.0:3000"
66# ----------------------------------------------------------------------------
72# ----------------------------------------------------------------------------
68# ----------------------------------------------------------------------------
74# ----------------------------------------------------------------------------
@@ -74,8 +80,8 @@ usage::
74 $(basename "$0") build [containers]
80 $(basename "$0") build [containers]
75 $(basename "$0") install [searx-suite]
81 $(basename "$0") install [searx-suite]
76 $(basename "$0") remove [containers|subordinate]
82 $(basename "$0") remove [containers|subordinate]
77− $(basename "$0") [start|stop] [containers]
83+ $(basename "$0") [start|stop] [containers|<container-name>]
78− $(basename "$0") inspect [info|config]
84+ $(basename "$0") show [info|config|searx-suite]
79 $(basename "$0") cmd ...
85 $(basename "$0") cmd ...
81build / remove
87build / remove
@@ -83,10 +89,11 @@ build / remove
83add / remove
89add / remove
84 :subordinate: lxd permission to map ${HOST_USER}'s user/group id through
90 :subordinate: lxd permission to map ${HOST_USER}'s user/group id through
86− :containers: start/stop of all containers
92+ :containers: start/stop of all 'containers' or only <container-name>
88− :info: show info of all containers
94+ :info: show info of all containers
89− :config: show config of all containers
95+ :config: show config of all containers
96+ :searx-suite: show searx-suite services of all containers
91 run commandline ... in all containers
98 run commandline ... in all containers
@@ -116,22 +123,10 @@ main() {
116 local exit_val
123 local exit_val
117 local _usage="unknown or missing $1 command $2"
124 local _usage="unknown or missing $1 command $2"
123− searx-suite) install_searx_suite ;;
128− if ! required_commands lxc; then
126+ if [[ ! $1 == __* ]] && ! required_commands lxc; then
129− lxd_info
127+ lxd_info
135 case $1 in
130 case $1 in
136 --source-only) ;;
131 --source-only) ;;
137 -h|--help) usage; exit 0;;
132 -h|--help) usage; exit 0;;
@@ -141,20 +136,23 @@ main() {
141 case $2 in
136 case $2 in
142 containers) build_instances ;;
137 containers) build_instances ;;
143 *) usage "$_usage"; exit 42;;
138 *) usage "$_usage"; exit 42;;
146 sudo_or_exit
142 sudo_or_exit
147 case $2 in
143 case $2 in
148 containers) remove_instances ;;
144 containers) remove_instances ;;
149 subordinate) echo; del_subordinate_ids ;;
145 subordinate) echo; del_subordinate_ids ;;
150 *) usage "$_usage"; exit 42;;
146 *) usage "$_usage"; exit 42;;
153 sudo_or_exit
150 sudo_or_exit
154 case $2 in
151 case $2 in
155 subordinate) echo; add_subordinate_ids ;;
152 subordinate) echo; add_subordinate_ids ;;
156 *) usage "$_usage"; exit 42;;
153 *) usage "$_usage"; exit 42;;
158 start|stop)
156 start|stop)
159 sudo_or_exit
157 sudo_or_exit
160 case $2 in
158 case $2 in
@@ -163,14 +161,27 @@ main() {
163 info_msg "lxc $1 $2"
161 info_msg "lxc $1 $2"
164 lxc "$1" "$2" | prefix_stdout "[${_BBlue}${i}${_creset}] "
162 lxc "$1" "$2" | prefix_stdout "[${_BBlue}${i}${_creset}] "
168 sudo_or_exit
167 sudo_or_exit
169 case $2 in
168 case $2 in
170 config) lxc_cmd config show;;
169 config) lxc_cmd config show;;
171 info) lxc_cmd info;;
170 info) lxc_cmd info;;
172+ for i in "${LOCAL_IMAGES[@]}"; do
173+ info_msg "[${_BBlue}${i}${_creset}] ${_BGreen}${LXC_REPO_ROOT}/utils/lxc.sh install $2${_creset}"
174+ lxc exec -t "${i}" -- "${LXC_REPO_ROOT}/utils/lxc.sh" __show "$2" | prefix_stdout "[${i}] "
172 *) usage "$_usage"; exit 42;;
177 *) usage "$_usage"; exit 42;;
182+ searx-suite) searx_suite_info ;;
175 sudo_or_exit
186 sudo_or_exit
@@ -192,30 +203,55 @@ main() {
192 searx-suite)
203 searx-suite)
193 for i in "${LOCAL_IMAGES[@]}"; do
204 for i in "${LOCAL_IMAGES[@]}"; do
194 info_msg "[${_BBlue}${i}${_creset}] ${_BGreen}${LXC_REPO_ROOT}/utils/lxc.sh install $2${_creset}"
205 info_msg "[${_BBlue}${i}${_creset}] ${_BGreen}${LXC_REPO_ROOT}/utils/lxc.sh install $2${_creset}"
195− lxc exec "${i}" -- "${LXC_REPO_ROOT}/utils/lxc.sh" __install "$2"
206+ lxc exec -t "${i}" -- "${LXC_REPO_ROOT}/utils/lxc.sh" __install "$2" | prefix_stdout "[${i}] "
198 *) usage "$_usage"; exit 42;;
209 *) usage "$_usage"; exit 42;;
214+ searx-suite) searx_suite_install ;;
201 usage "unknown or missing command $1"; exit 42;;
218 usage "unknown or missing command $1"; exit 42;;
205−install_searx_suite() {
222+searx_suite_install() {
206− export FILTRON_API="0.0.0.0:4005"
223+ (
207− export FILTRON_LISTEN="0.0.0.0:4004"
224+ searx_suite_set_env
208− export MORTY_LISTEN="0.0.0.0:3000"
225+ export FORCE_TIMEOUT=0
209− FORCE_TIMEOUT=0 "${LXC_REPO_ROOT}/utils/searx.sh" install all
226+ "${LXC_REPO_ROOT}/utils/searx.sh" install all
210− FORCE_TIMEOUT=0 "${LXC_REPO_ROOT}/utils/morty.sh" install all
227+ "${LXC_REPO_ROOT}/utils/morty.sh" install all
211− FORCE_TIMEOUT=0 "${LXC_REPO_ROOT}/utils/filtron.sh" install all
228+ "${LXC_REPO_ROOT}/utils/filtron.sh" install all
212− rst_title "[$(hostname)] searx-suite installation finished" part
230+ rst_title "searx-suite installation finished ($(hostname))" part
213− rst_para "IPs of the container ..."
231+ searx_suite_info
215− ip addr show | grep "inet\s*[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*"
233+ )
239+ rst_para "Services of the container $(hostname)"
240+ for ip in $(hostname -I); do
242+ if [[ $ip =~ .*:.* ]]; then
244+ # IPv6: not yet implemented / tested
245+ # echo " searx (filtron) --> http://[$ip]:4004/"
246+ # echo " morty --> http://[$ip]:3000/"
249+ echo " searx (filtron) --> http://$ip:4004/"
250+ echo " morty --> http://$ip:3000/"
220build_instances() {
256build_instances() {
221 rst_title "Build LXC instances"
257 rst_title "Build LXC instances"