@@ -213,10 +213,9 @@ def get_host_setup_script(
213213 configure_redis_for_standalone(){{
214214 # Workers connect to the master private IP; Redis must not listen on loopback only.
215215 if [ ! -f /etc/redis/redis.conf ]; then
216- echo "--> Redis: /etc/redis/redis.conf not found, skipping Redis configuration"
217216 return 0
218217 fi
219- echo "--> Redis: configuring for standalone workers (bind 0.0.0.0)"
218+ echo "--> Configuring Redis for standalone workers (bind 0.0.0.0)"
220219 sed -i -E 's/^bind .*/bind 0.0.0.0 -::1/' /etc/redis/redis.conf
221220 if grep -q '^protected-mode yes' /etc/redis/redis.conf; then
222221 sed -i 's/^protected-mode yes/protected-mode no/' /etc/redis/redis.conf
@@ -227,55 +226,26 @@ def get_host_setup_script(
227226
228227 install_packages(){{
229228 set -e
230- if [ -f { SA_SETUP_DONE_FILE } ]; then
231- echo "--> Lithops host setup: already completed ({ SA_SETUP_DONE_FILE } ), skipping install_packages"
232- return 0
233- fi
234- echo "--> Lithops host setup: running install_packages"
235229 export DEBIAN_FRONTEND=noninteractive
236230 export DOCKER_REQUIRED={ str (docker ).lower ()} ;
237- INSTALL_DOCKER=false
238- INSTALL_LITHOPS_DEPS=false
239- if command -v docker >/dev/null 2>&1; then
240- echo "--> docker: already installed ($(docker --version 2>/dev/null | head -1))"
241- else
242- INSTALL_DOCKER=true
243- INSTALL_LITHOPS_DEPS=true
244- echo "--> docker: not found, will install"
245- fi
246- if command -v unzip >/dev/null 2>&1; then
247- echo "--> unzip: already installed"
248- else
249- INSTALL_LITHOPS_DEPS=true
250- echo "--> unzip: not found, will install Lithops system dependencies"
251- fi
252- if command -v pip3 >/dev/null 2>&1; then
253- echo "--> pip3: already installed ($(pip3 --version 2>/dev/null | head -1))"
254- else
255- INSTALL_LITHOPS_DEPS=true
256- echo "--> pip3: not found, will install Lithops system dependencies"
257- fi
231+ command -v docker >/dev/null 2>&1 || {{ export INSTALL_DOCKER=true; export INSTALL_LITHOPS_DEPS=true;}};
232+ command -v unzip >/dev/null 2>&1 || {{ export INSTALL_LITHOPS_DEPS=true; }};
233+ command -v pip3 >/dev/null 2>&1 || {{ export INSTALL_LITHOPS_DEPS=true; }};
258234
259235 if [ "$INSTALL_DOCKER" = true ] && [ "$DOCKER_REQUIRED" = true ]; then
260236 wait_internet_connection;
261- echo "--> Installing Docker apt repository"
237+ echo "--> Installing Docker repository"
262238 apt_install update
263239 apt_install install -y apt-transport-https ca-certificates curl gnupg software-properties-common
264240 curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
265241 DOCKER_APT="deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg]"
266242 DOCKER_APT="$DOCKER_APT https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
267243 echo "$DOCKER_APT" > /etc/apt/sources.list.d/docker.list
268- else
269- if [ "$DOCKER_REQUIRED" != true ]; then
270- echo "--> Docker: not required for this runtime, skipping Docker repository setup"
271- else
272- echo "--> Docker: repository setup skipped (Docker already installed)"
273- fi
274244 fi;
275245
276246 if [ "$INSTALL_LITHOPS_DEPS" = true ]; then
277247 wait_internet_connection;
278- echo "--> Installing Lithops system dependencies (apt) "
248+ echo "--> Installing Lithops system dependencies"
279249 apt_install update
280250
281251 if [ "$INSTALL_DOCKER" = true ] && [ "$DOCKER_REQUIRED" = true ]; then
@@ -284,9 +254,7 @@ def get_host_setup_script(
284254 apt_install install -y unzip redis-server python3-pip
285255 fi;
286256 configure_redis_for_standalone
287- else
288- echo "--> Lithops system dependencies (apt): already present, skipping apt install"
289- configure_redis_for_standalone
257+
290258 fi;
291259
292260 EXTRA_APT="{ extra_apt_packages } "
@@ -295,15 +263,11 @@ def get_host_setup_script(
295263 apt_install update
296264 echo "--> Installing extra apt packages: $EXTRA_APT"
297265 apt_install install -y $EXTRA_APT
298- else
299- echo "--> Extra apt packages: none configured, skipping"
300266 fi;
301267
302- if pip3 list 2>/dev/null | grep -q lithops; then
303- echo "--> Lithops python package: already installed ($(pip3 show lithops 2>/dev/null | awk '/^Version:/ {{print $2}}' | head -1)), skipping pip install"
304- else
268+ if ! pip3 list 2>/dev/null | grep -q lithops; then
305269 wait_internet_connection;
306- echo "--> Lithops python package: not found, installing ({ lithops_pip_spec } )"
270+ echo "--> Installing Lithops python dependencies ({ lithops_pip_spec } )"
307271 export PIP_BREAK_SYSTEM_PACKAGES=1
308272 # --ignore-installed: do not uninstall Debian python packages (avoids RECORD errors)
309273 pip3 install --ignore-installed -U pip
@@ -315,18 +279,11 @@ def get_host_setup_script(
315279 echo "--> Installing extra python packages: $EXTRA_PY"
316280 export PIP_BREAK_SYSTEM_PACKAGES=1
317281 pip3 install --ignore-installed $EXTRA_PY
318- else
319- echo "--> Extra python packages: none configured, skipping"
320282 fi;
321- echo "--> Lithops host setup: install_packages finished"
322283 }}
323284 """
324285 if run_install :
325- script += f"""echo "--> Lithops host setup: starting ({ SA_SETUP_LOG_FILE } )"
326- install_packages 2>&1 | tee -a { SA_SETUP_LOG_FILE }
327- touch { SA_SETUP_DONE_FILE }
328- echo "--> Lithops host setup: marked complete ({ SA_SETUP_DONE_FILE } )"
329- """
286+ script += f"install_packages >> { SA_SETUP_LOG_FILE } 2>&1 && touch { SA_SETUP_DONE_FILE } ;\n "
330287 return script
331288
332289
@@ -374,7 +331,7 @@ def get_master_setup_script(config, vm_data):
374331 echo '127.0.0.1 lithops-master' >> /etc/hosts;
375332 cat $USER_HOME/.ssh/id_rsa.pub >> $USER_HOME/.ssh/authorized_keys;
376333 }}
377- install_packages 2>&1 | tee -a { SA_SETUP_LOG_FILE } ; test ${{PIPESTATUS[0]}} -eq 0 && touch { SA_SETUP_DONE_FILE } && \\
334+ install_packages >> { SA_SETUP_LOG_FILE } 2>&1 && touch { SA_SETUP_DONE_FILE } && \\
378335 setup_host >> { SA_SETUP_LOG_FILE } 2>&1 && \\
379336 setup_service >> { SA_SETUP_LOG_FILE } 2>&1 && \\
380337 (test -f $USER_HOME/.ssh/lithops_id_rsa || generate_ssh_key >> { SA_SETUP_LOG_FILE } 2>&1)
@@ -419,7 +376,7 @@ def get_worker_setup_script(config, vm_data):
419376 systemctl enable { WORKER_SERVICE_NAME } ;
420377 systemctl start { WORKER_SERVICE_NAME } ;
421378 }}
422- install_packages 2>&1 | tee -a { SA_SETUP_LOG_FILE } ; test ${{PIPESTATUS[0]}} -eq 0 && touch { SA_SETUP_DONE_FILE } && \\
379+ install_packages >> { SA_SETUP_LOG_FILE } 2>&1 && touch { SA_SETUP_DONE_FILE } && \\
423380 setup_host >> { SA_SETUP_LOG_FILE } 2>&1 && \\
424381 setup_service >> { SA_SETUP_LOG_FILE } 2>&1
425382 echo '{ vm_data ['master_ip' ]} lithops-master' >> /etc/hosts
0 commit comments