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_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"'

53
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

Loading…
Cancel
Save