Browse Source

install

master
zeus 4 years ago
parent
commit
35e02d85cb
  1. 1
      .gitignore
  2. 80
      install.sh
  3. 1
      src-local/hybrid/keys.json
  4. 6
      start.sh
  5. 16
      test/run.yml
  6. 10
      test/testdocker.sh
  7. 4
      test/testnode.js

1
.gitignore

@ -2,6 +2,7 @@
node_modules
src-local/instance/
src-local/hybrid/connect/
src-local/hybrid/keys.json
vimsession
swarmlabdoc.js

80
install.sh

@ -0,0 +1,80 @@
wdir=$PWD
wdir_connect="$wdir/src-local/hybrid/connect"
toolsok='ok'
# create wdir connect dir
if [ -d $wdir_connect ];then
mkdir -p $wdir_connect
fi
# check for node
nodeversion=$(node $wdir/test/testnode.js)
if [ $nodeversion != 'Node_is_working' ];then
echo "Cannot find node"
echo "Install it and try again!"
toolsok='no'
fi
#check for docker
dockerversion=$(/bin/bash $wdir/test/testdocker.sh)
if [ $dockerversion != 'linux' ];then
echo "Cannot find docker"
echo "Install it and try again!"
echo "http://docs.swarmlab.io/SwarmLab-HowTos/labs/Howtos/docker/install.adoc.html"
toolsok='no'
fi
#check for docker-compose
dockercomposeversion=$(docker-compose -f $wdir/test/run.yml config --services)
if [ $dockercomposeversion != 'swarmlabclient' ];then
echo "Cannot find docker-compose"
echo "Install it and try again!"
echo "http://docs.swarmlab.io/SwarmLab-HowTos/labs/Howtos/docker/install.adoc.html"
toolsok='no'
fi
#check for wireguard
wgversion=$(wg --version | cut -d' ' -f1)
if [ $wgversion != 'wireguard-tools' ];then
echo "Cannot find wg"
echo "Install it and try again!"
echo "https://www.wireguard.com/install/"
toolsok='no'
fi
#check for jq
if ! command -v jq &> /dev/null
then
toolsok='no'
echo "jq could not be found"
exit
fi
if [ $toolsok == 'ok' ];then
npm install
fi
if [ $toolsok == 'ok' ];then
cd src-local
npm install
cd $wdir
fi
echo $nodeversion
echo $dockerversion
echo $dockercomposeversion
echo $wdir
echo $wdir_connect

1
src-local/hybrid/keys.json

@ -1 +0,0 @@
"{\"status\":\"off\",\"privatekey\":\"kJd3ga9/1b5NalONMP+CuezTZB+ZmaQVdzM7jLYUe30=\",\"publickey\":\"jf4fC0tmGe4Ioz+dY5c/AksqicZGGqJIH1OncOUIuj8=\",\"server_ip\":\"83.212.77.133:51820\",\"workerkey\":\"SWMTKN-1-3099nls9my5ns1s0mnmwkx41mhpawl80hwjjbskbll7nghqhgn-asu68y4lhd1qlbpxr6oosk6wl\",\"allowed_ips\":\"10.13.13.0/16, 0.0.0.0/0, ::/0\",\"swarmlab_public_wgkey\":\"WAuzcpIf1obckeLP94owls31j58LP2k+yIAasx9VFU8=\",\"wg_ip\":\"10.13.13.2\",\"swarm_ip\":\"10.13.13.1:2377\",\"wg_port\":\"51820\"}"

6
start.sh

@ -0,0 +1,6 @@
wdir=$PWD
cd src-local
./start-server.sh
cd $wdir
npm run serve

16
test/run.yml

@ -0,0 +1,16 @@
version: "3.8"
services:
swarmlabclient:
image: hub.swarmlab.io:5443/playground-hybrid-agent:latest
environment:
- NODENAME={{.Node.Hostname}}
ports:
- "55543:443"
networks:
hybrid-net:
networks:
hybrid-net:

10
test/testdocker.sh

@ -0,0 +1,10 @@
dockerswarm=$(docker info --format "{{json .}}" | jq .OSType)
tempswarm="${dockerswarm%\"}"
tempswarm="${tempswarm#\"}"
dockerswarm=$tempswarm
echo $dockerswarm

4
test/testnode.js

@ -0,0 +1,4 @@
function testNode() {
return "Node_is_working"
};
console.log(testNode());
Loading…
Cancel
Save