From b79af95e9da6ce370c3d9a9f5be46ae2ec5c20af Mon Sep 17 00:00:00 2001 From: zeus Date: Mon, 29 Nov 2021 20:09:04 +0200 Subject: [PATCH] ssh --- .../usr/share/swarmlab.io/sec/sec_bootstrap | 20 +++---- .../usr/share/swarmlab.io/sec/swarmlab-sec | 53 +++++++++++-------- 2 files changed, 42 insertions(+), 31 deletions(-) diff --git a/install/usr/share/swarmlab.io/sec/sec_bootstrap b/install/usr/share/swarmlab.io/sec/sec_bootstrap index 1dd7c5a..f270e5a 100755 --- a/install/usr/share/swarmlab.io/sec/sec_bootstrap +++ b/install/usr/share/swarmlab.io/sec/sec_bootstrap @@ -46,26 +46,28 @@ case $ROLE in # Auto update default host file in background and dumb all output auto_update_hosts "${HOSTNAMES}" > /dev/null 2>&1 & + tail -f /dev/null + # Start ssh server - /usr/sbin/sshd -D + #/usr/sbin/sshd -D ;; "workerservice") # Start ssh server in background - /usr/sbin/sshd -D & + #/usr/sbin/sshd -D & # Keep trying to connect to master node and stay there indefinitely so that master node can see # the connected hosts that are ready for MPI work - while sleep 1 - do + #while sleep 1 + #do # shellcheck disable=SC2086 - ssh -T -o "StrictHostKeyChecking no" \ - -i "${USER_HOME}/.ssh/id_rsa" \ - ${USER}@${MPI_MASTER_SERVICE_NAME} \ - "tail -f /dev/null" - done + # ssh -T -o "StrictHostKeyChecking no" \ + # -i "${USER_HOME}/.ssh/id_rsa" \ + # ${USER}@${MPI_MASTER_SERVICE_NAME} \ + tail -f /dev/null + #done ;; *) echo 'role argument only accepts "masterservice" or "workerservice"' diff --git a/install/usr/share/swarmlab.io/sec/swarmlab-sec b/install/usr/share/swarmlab.io/sec/swarmlab-sec index 3282e9e..d1dd5fd 100755 --- a/install/usr/share/swarmlab.io/sec/swarmlab-sec +++ b/install/usr/share/swarmlab.io/sec/swarmlab-sec @@ -277,23 +277,23 @@ services: - $Wdir/project:/home/docker/project - workerservice: - image: $IMAGE_NAME - privileged: true - environment: - - NODENAME=${NODENAME} - - NODENETWORK=${NODENETWORK} - - DISPLAY=\${DISPLAY} - cap_add: - - NET_ADMIN - user: root - entrypoint: ["sec_bootstrap", "role=workerservice", "sec_master_service_name=masterservice", "sec_worker_service_name=workerservice"] - #ports: - # - "\${SSH_PORT}:22" - networks: - - ${HYBRID_NETWORK} - volumes: - - $Wdir/project:/home/docker/project +# workerservice: +# image: $IMAGE_NAME +# privileged: true +# environment: +# - NODENAME=${NODENAME} +# - NODENETWORK=${NODENETWORK} +# - DISPLAY=\${DISPLAY} +# cap_add: +# - NET_ADMIN +# user: root +# entrypoint: ["sec_bootstrap", "role=workerservice", "sec_master_service_name=masterservice", "sec_worker_service_name=workerservice"] +# #ports: +# # - "\${SSH_PORT}:22" +# networks: +# - ${HYBRID_NETWORK} +# volumes: +# - $Wdir/project:/home/docker/project networks: ${HYBRID_NETWORK}: @@ -465,9 +465,18 @@ up_master () printf "\\n%s\\n" "$HEADER" echo "$ docker-compose up -d masterservice" printf "\\n" - docker-compose rm -f - docker-compose up --build -d masterservice + #docker-compose rm -f + #docker-compose up --build -d masterservice #docker-compose up --force-recreate -d masterservice + + docker-compose rm -f -s -v + docker pull $IMAGE_NAME + docker-compose up --build --remove-orphans -d masterservice << ANSWERS +yes +yes +yes +ANSWERS + } @@ -646,7 +655,7 @@ if [ $COMMAND_UP -eq 1 ]; then generate_ssh_keys build_and_push_image # remove for microservices up_master - up_workers + #up_workers prompt_ready show_instruction @@ -667,7 +676,7 @@ elif [ $COMMAND_SCALE -eq 1 ]; then down_master down_workers up_master - up_workers + #up_workers prompt_ready show_instruction @@ -678,7 +687,7 @@ elif [ $COMMAND_RELOAD -eq 1 ]; then down_workers build_and_push_image up_master - up_workers + #up_workers prompt_ready show_instruction