zeus 3 years ago
parent
commit
b79af95e9d
  1. 20
      install/usr/share/swarmlab.io/sec/sec_bootstrap
  2. 53
      install/usr/share/swarmlab.io/sec/swarmlab-sec

20
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 default host file in background and dumb all output
auto_update_hosts "${HOSTNAMES}" > /dev/null 2>&1 & auto_update_hosts "${HOSTNAMES}" > /dev/null 2>&1 &
tail -f /dev/null
# Start ssh server # Start ssh server
/usr/sbin/sshd -D #/usr/sbin/sshd -D
;; ;;
"workerservice") "workerservice")
# Start ssh server in background # 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 # 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 # the connected hosts that are ready for MPI work
while sleep 1 #while sleep 1
do #do
# shellcheck disable=SC2086 # shellcheck disable=SC2086
ssh -T -o "StrictHostKeyChecking no" \ # ssh -T -o "StrictHostKeyChecking no" \
-i "${USER_HOME}/.ssh/id_rsa" \ # -i "${USER_HOME}/.ssh/id_rsa" \
${USER}@${MPI_MASTER_SERVICE_NAME} \ # ${USER}@${MPI_MASTER_SERVICE_NAME} \
"tail -f /dev/null" tail -f /dev/null
done #done
;; ;;
*) *)
echo 'role argument only accepts "masterservice" or "workerservice"' echo 'role argument only accepts "masterservice" or "workerservice"'

53
install/usr/share/swarmlab.io/sec/swarmlab-sec

@ -277,23 +277,23 @@ services:
- $Wdir/project:/home/docker/project - $Wdir/project:/home/docker/project
workerservice: # workerservice:
image: $IMAGE_NAME # image: $IMAGE_NAME
privileged: true # privileged: true
environment: # environment:
- NODENAME=${NODENAME} # - NODENAME=${NODENAME}
- NODENETWORK=${NODENETWORK} # - NODENETWORK=${NODENETWORK}
- DISPLAY=\${DISPLAY} # - DISPLAY=\${DISPLAY}
cap_add: # cap_add:
- NET_ADMIN # - NET_ADMIN
user: root # user: root
entrypoint: ["sec_bootstrap", "role=workerservice", "sec_master_service_name=masterservice", "sec_worker_service_name=workerservice"] # entrypoint: ["sec_bootstrap", "role=workerservice", "sec_master_service_name=masterservice", "sec_worker_service_name=workerservice"]
#ports: # #ports:
# - "\${SSH_PORT}:22" # # - "\${SSH_PORT}:22"
networks: # networks:
- ${HYBRID_NETWORK} # - ${HYBRID_NETWORK}
volumes: # volumes:
- $Wdir/project:/home/docker/project # - $Wdir/project:/home/docker/project
networks: networks:
${HYBRID_NETWORK}: ${HYBRID_NETWORK}:
@ -465,9 +465,18 @@ up_master ()
printf "\\n%s\\n" "$HEADER" printf "\\n%s\\n" "$HEADER"
echo "$ docker-compose up -d masterservice" echo "$ docker-compose up -d masterservice"
printf "\\n" printf "\\n"
docker-compose rm -f #docker-compose rm -f
docker-compose up --build -d masterservice #docker-compose up --build -d masterservice
#docker-compose up --force-recreate -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 generate_ssh_keys
build_and_push_image # remove for microservices build_and_push_image # remove for microservices
up_master up_master
up_workers #up_workers
prompt_ready prompt_ready
show_instruction show_instruction
@ -667,7 +676,7 @@ elif [ $COMMAND_SCALE -eq 1 ]; then
down_master down_master
down_workers down_workers
up_master up_master
up_workers #up_workers
prompt_ready prompt_ready
show_instruction show_instruction
@ -678,7 +687,7 @@ elif [ $COMMAND_RELOAD -eq 1 ]; then
down_workers down_workers
build_and_push_image build_and_push_image
up_master up_master
up_workers #up_workers
prompt_ready prompt_ready
show_instruction show_instruction

Loading…
Cancel
Save