Browse Source

add console

master
zeus 3 years ago
parent
commit
c3c1132a58
  1. 2
      install/usr/share/swarmlab.io/sec/bin/start-nginx.sh
  2. 6
      install/usr/share/swarmlab.io/sec/bin/swarmlab-nmap
  3. 25
      install/usr/share/swarmlab.io/sec/swarmlab-sec

2
install/usr/share/swarmlab.io/sec/bin/start-nginx.sh

@ -0,0 +1,2 @@
#!/bin/sh
/usr/bin/supervisord -n -c /etc/supervisor/supervisord.conf

6
install/usr/share/swarmlab.io/sec/bin/swarmlab-nmap

@ -0,0 +1,6 @@
#/bin/sh
#ip=`nslookup hybrid-mpi_master_1.hybrid-mpi_hybrid-mpi | grep Addr | cut -d':' -f2 | grep -v 127.0.`
ip=`nslookup $NODENAME | grep Addr | cut -d':' -f2 | grep -v 127.0.`
nmap -sn -oG - $ip/24 | grep Up | grep $NODENETWORK | cut -d ' ' -f 2

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

@ -80,6 +80,19 @@ DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"
# ---------------------------------------------- # ----------------------------------------------
function EPHEMERAL_PORT() {
LOW_BOUND=49152
RANGE=16384
while true; do
CANDIDATE=$[$LOW_BOUND + ($RANDOM % $RANGE)]
(echo "" >/dev/tcp/127.0.0.1/${CANDIDATE}) >/dev/null 2>&1
if [ $? -ne 0 ]; then
echo $CANDIDATE
break
fi
done
}
Wdir=$(pwd) Wdir=$(pwd)
if [ ! -f $Wdir/.env ]; then if [ ! -f $Wdir/.env ]; then
@ -88,6 +101,14 @@ REGISTRY_ADDR=localhost
REGISTRY_PORT=5000 REGISTRY_PORT=5000
IMAGE_NAME=$HYBRID_NETWORK IMAGE_NAME=$HYBRID_NETWORK
SSH_PORT= SSH_PORT=
WEB_PORT=$(EPHEMERAL_PORT)
WEB_PORT1=$(EPHEMERAL_PORT)
WEB_PORT2=$(EPHEMERAL_PORT)
R_PORT1=$(EPHEMERAL_PORT)
R_PORT2=$(EPHEMERAL_PORT)
R_PORT3=$(EPHEMERAL_PORT)
R_PORT4=$(EPHEMERAL_PORT)
R_PORT5=$(EPHEMERAL_PORT)
EOF EOF
fi fi
@ -312,6 +333,7 @@ fi
/bin/mkdir -p $Wdir/project /bin/mkdir -p $Wdir/project
/bin/mkdir -p $Wdir/logs
/bin/cp -f $DIR/project/mpich-3.2.tar.gz $Wdir /bin/cp -f $DIR/project/mpich-3.2.tar.gz $Wdir
/bin/cp -rf $DIR/project/bin $Wdir/project /bin/cp -rf $DIR/project/bin $Wdir/project
/bin/cp -rf $DIR/project/examples $Wdir/project /bin/cp -rf $DIR/project/examples $Wdir/project
@ -321,6 +343,7 @@ fi
/bin/cp -f $DIR/$hostnames_get $Wdir/$hostnames_get /bin/cp -f $DIR/$hostnames_get $Wdir/$hostnames_get
/bin/cp -f $DIR/ROOT_PASSWORD $Wdir/ROOT_PASSWORD /bin/cp -f $DIR/ROOT_PASSWORD $Wdir/ROOT_PASSWORD
/bin/cp -rf $DIR/.vimrc $Wdir/.vimrc /bin/cp -rf $DIR/.vimrc $Wdir/.vimrc
/bin/cp -rf $DIR/bin $Wdir
/bin/cp -rf $DIR/install-vim-plugin.sh $Wdir/install-vim-plugin.sh /bin/cp -rf $DIR/install-vim-plugin.sh $Wdir/install-vim-plugin.sh
@ -344,11 +367,13 @@ services:
user: root user: root
entrypoint: ["sec_bootstrap", "role=master", "sec_master_service_name=master", "sec_worker_service_name=worker"] entrypoint: ["sec_bootstrap", "role=master", "sec_master_service_name=master", "sec_worker_service_name=worker"]
ports: ports:
- "\${R_PORT1}:3787"
- "\${SSH_PORT}:22" - "\${SSH_PORT}:22"
networks: networks:
- ${HYBRID_NETWORK} - ${HYBRID_NETWORK}
volumes: volumes:
- $Wdir/project:/project - $Wdir/project:/project
- $Wdir/bin/ttyd.x86_64:/usr/bin/ttyd
worker: worker:

Loading…
Cancel
Save