Browse Source

client server ok

master
zeus 1 year ago
parent
commit
e4cff54b10
  1. 26
      .gitignore
  2. 70
      Dockerfile
  3. 2
      Dockerfile.build
  4. 1
      dist/css/app.e5c9f9a1.css
  5. 10
      dist/css/chunk-vendors.f194a2fd.css
  6. BIN
      dist/fonts/themify.2c454669.eot
  7. BIN
      dist/fonts/themify.a1ecc3b8.woff
  8. BIN
      dist/fonts/themify.e23a7dca.ttf
  9. BIN
      dist/img/docker.7b56657d.png
  10. BIN
      dist/img/loading.f4404720.gif
  11. 362
      dist/img/themify.9c8e96ec.svg
  12. 1
      dist/index.html
  13. 2
      dist/js/app.f56fe913.js
  14. 1
      dist/js/app.f56fe913.js.map
  15. 117
      dist/js/chunk-vendors.8243ef5d.js
  16. 1
      dist/js/chunk-vendors.8243ef5d.js.map
  17. 1
      down.sh
  18. 43
      ecosystem.config.js
  19. 38
      hybrid/connect/swarmlab-connect.sh
  20. 2
      hybrid/join.sh
  21. 1
      hybrid/privatekey
  22. 1
      hybrid/publickey
  23. 29
      hybrid/scripts/add-nic-veth-pair.sh
  24. 26
      hybrid/scripts/add-nic.sh
  25. 24
      hybrid/scripts/expose-netns.sh
  26. 3
      keys/create.sh
  27. 33
      keys/swarmlab.crt
  28. 52
      keys/swarmlab.key
  29. 39
      nginx/swarmlab-stats-proxy-server.conf
  30. 25308
      package-lock.json
  31. 68
      package.json
  32. 50
      run.yml
  33. 8
      run.yml.sh
  34. 48
      src-local/llo/bclient.js
  35. 32
      src-local/llo/client.js
  36. 40
      src-local/llo/iotclient.js
  37. 381
      src-local/llo/iotserver.js
  38. 27
      src-local/llo/new.js
  39. 29
      src-local/llo/pubsub.js
  40. 11
      src-local/llo/runconfig.js
  41. 33
      src-local/llo/swarmlab.crt
  42. 52
      src-local/llo/swarmlab.key
  43. 11
      src-local/myconfig/runconfig.js
  44. 2531
      src-local/package-lock.json
  45. 16
      src-local/package.json
  46. 132
      src/App.vue
  47. 250
      src/assets/css/_cards.scss
  48. 254
      src/assets/css/_variables.scss
  49. 1153
      src/assets/css/themify-icons.css
  50. BIN
      src/assets/fonts/glyphicons-halflings-regular.448c34a.woff2
  51. BIN
      src/assets/fonts/glyphicons-halflings-regular.e18bbf6.ttf
  52. BIN
      src/assets/fonts/glyphicons-halflings-regular.f4769f9.eot
  53. BIN
      src/assets/fonts/glyphicons-halflings-regular.fa27723.woff
  54. BIN
      src/assets/fonts/themify.eot
  55. 362
      src/assets/fonts/themify.svg
  56. BIN
      src/assets/fonts/themify.ttf
  57. BIN
      src/assets/fonts/themify.woff
  58. BIN
      src/assets/img/apple-icon.png
  59. BIN
      src/assets/img/background.jpg
  60. BIN
      src/assets/img/code-128.png
  61. BIN
      src/assets/img/docker.png
  62. 5
      src/assets/img/docker.svg
  63. BIN
      src/assets/img/faces/face-0.jpg
  64. BIN
      src/assets/img/faces/face-1.jpg
  65. BIN
      src/assets/img/faces/face-2.jpg
  66. BIN
      src/assets/img/faces/face-3.jpg
  67. BIN
      src/assets/img/favicon.png
  68. 288
      src/assets/img/glyphicons-halflings-regular.8988968.svg
  69. 5
      src/assets/img/images.svg
  70. BIN
      src/assets/img/new_logo.png
  71. 5
      src/assets/img/object-group.svg
  72. BIN
      src/assets/img/services/gitea.jpg
  73. BIN
      src/assets/img/services/gitea.png
  74. BIN
      src/assets/img/swarmlab-logo.png
  75. BIN
      src/assets/img/tim_80x80.png
  76. BIN
      src/assets/img/vue-logo.png
  77. BIN
      src/assets/loading.gif
  78. BIN
      src/assets/logo.png
  79. 32
      src/components/Card.vue
  80. 42
      src/components/mynetwork.vue
  81. 426
      src/components/mynetwork/mytable.vue
  82. 462
      src/components/mynetwork/mytable1.vue
  83. 124
      src/components/mynetwork/session
  84. 14
      src/config/index.js
  85. 99
      src/main.js
  86. 40
      src/store/index.js
  87. 135
      src/store/modules/create_pipelineLLO.js

26
.gitignore

@ -0,0 +1,26 @@
.DS_Store
node_modules
vimsession
swarmlabdoc.js
swarmlabdoc.asciidoc_config
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

70
Dockerfile

@ -0,0 +1,70 @@
#FROM alpine:3.11
FROM node:alpine
LABEL MAINTAINERS="Guillaume Scheibel <guillaume.scheibel@gmail.com>, Damien DUPORTAL <damien.duportal@gmail.com>"
# Installing package required for the runtime
RUN apk add --no-cache \
bash \
curl \
ca-certificates \
findutils \
font-bakoma-ttf \
git \
graphviz \
inotify-tools \
make \
python3 \
py3-pillow \
py3-setuptools \
tzdata \
unzip \
build-base \
libxml2-dev \
which \
nginx
# Installing Python dependencies for additional
# functionnalities
RUN apk add --no-cache --virtual .pythonmakedepends \
build-base \
python3-dev \
py3-pip \
&& pip3 install --no-cache-dir \
actdiag \
pip install supervisor supervisor-stdout \
'blockdiag[pdf]' \
nwdiag \
seqdiag \
&& apk del -r --no-cache .pythonmakedepends
COPY dist /home/node/swarmlab-app
COPY src-local/llo /home/node/server/llo
COPY src-local/package.json /home/node/server/package.json
RUN mkdir -p /home/node/run \
&& mkdir -p /home/node/logs \
&& chown -R node.node /home/node \
&& chmod -R 755 /home/node \
&& ln -s /usr/local/bin/node /usr/bin/node \
&& mkdir -p /run/nginx \
&& npm install pm2@latest -g
USER node
WORKDIR /home/node/server
RUN set -uex; \
# npm run build no need it!
npm install; \
npm i async url-exist-sync axios socketio-auth socket.io-client https socket.io bufferutil utf-8-validate --save \
npm audit fix; \
npm cache clean --force;
WORKDIR /home/node/swarmlab-app
VOLUME /home/node/swarmlab-app
EXPOSE 443 8080 3000
CMD ["pm2-runtime", "ecosystem.config.js"]

2
Dockerfile.build

@ -0,0 +1,2 @@
#!/bin/bash
docker build -f Dockerfile -t hub.swarmlab.io:5443/playground-hybrid-agent .

1
dist/css/app.e5c9f9a1.css

File diff suppressed because one or more lines are too long

10
dist/css/chunk-vendors.f194a2fd.css

File diff suppressed because one or more lines are too long

BIN
dist/fonts/themify.2c454669.eot

Binary file not shown.

BIN
dist/fonts/themify.a1ecc3b8.woff

Binary file not shown.

BIN
dist/fonts/themify.e23a7dca.ttf

Binary file not shown.

BIN
dist/img/docker.7b56657d.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
dist/img/loading.f4404720.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

362
dist/img/themify.9c8e96ec.svg

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 229 KiB

1
dist/index.html

@ -0,0 +1 @@
<!DOCTYPE html><html><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Vue App</title><link href="/css/app.e5c9f9a1.css" rel="preload" as="style"><link href="/css/chunk-vendors.f194a2fd.css" rel="preload" as="style"><link href="/js/app.f56fe913.js" rel="preload" as="script"><link href="/js/chunk-vendors.8243ef5d.js" rel="preload" as="script"><link href="/css/chunk-vendors.f194a2fd.css" rel="stylesheet"><link href="/css/app.e5c9f9a1.css" rel="stylesheet"></head><body><div id="app"></div><script src="/js/chunk-vendors.8243ef5d.js"></script><script src="/js/app.f56fe913.js"></script></body></html>

2
dist/js/app.f56fe913.js

File diff suppressed because one or more lines are too long

1
dist/js/app.f56fe913.js.map

File diff suppressed because one or more lines are too long

117
dist/js/chunk-vendors.8243ef5d.js

File diff suppressed because one or more lines are too long

1
dist/js/chunk-vendors.8243ef5d.js.map

File diff suppressed because one or more lines are too long

1
down.sh

@ -0,0 +1 @@
docker-compose -f run.yml down

43
ecosystem.config.js

@ -0,0 +1,43 @@
module.exports = {
"apps": [
{
"name" : "www",
"autorestart" : true,
"watch" : true,
"cwd" : "/home/node/swarmlab-app",
"script" : "nginx -g 'daemon off;'",
"exec_interpreter" : "none",
"log_type" : "json",
"log_file" : "/home/node/logs/logfilenginx",
"error_file" : "/home/node/logs/errorfilenginx",
"out_file" : "/home/node/logs/outfilenginx",
"log_date_format": "YYYY-MM-DD HH:mm Z",
"merge_logs" : true,
"exec_mode" : "fork_mode",
"max_restarts": 10,
"max_memory_restart": "500M",
"restart_delay" : 1000
},
{
"name" : "server",
"autorestart" : true,
"watch" : true,
"cwd" : "/home/node/server",
"script" : "llo/new.js",
"run_as_user" : "node",
"args" : "start",
"pid_file" : "/home/node/pid.pid",
"log_type" : "json",
"log_file" : "/home/node/logs/logfile",
"error_file" : "/home/node/logs/errorfile",
"out_file" : "/home/node/logs/outfile",
"log_date_format": "YYYY-MM-DD HH:mm Z",
"merge_logs" : true,
"exec_mode" : "fork",
"max_restarts": 10,
"max_memory_restart": "500M",
"restart_delay": 1000
},
]
}

38
hybrid/connect/swarmlab-connect.sh

@ -0,0 +1,38 @@
DEV_NAME=wg0
#INTERFACE_IP=10.13.13.2/24
INTERFACE_IP=10.13.13.2/16
INTERFACE_IProute=10.13.13.2
ENDPOINT_IP=`grep Endpoint /etc/wireguard/$DEV_NAME.conf | awk '{print $3}' | cut -d: -f1`
echo "ip $INTERFACE_IP"
ip link set $DEV_NAME down
ip link del $DEV_NAME
# add wireguard interface
ip link add $DEV_NAME type wireguard
# set wireguard conf
wg setconf $DEV_NAME /etc/wireguard/$DEV_NAME.conf
# assign ip to wireguard interface
ip addr add $INTERFACE_IP dev $DEV_NAME
# set sysctl
sysctl -w net.ipv4.conf.all.rp_filter=2
# set mtu for wireguard interface
ip link set mtu 1420 up dev $DEV_NAME
# bring wireguard interface up
ip link set up dev $DEV_NAME
# add route
ip route add default via $INTERFACE_IProute metric 2 table 200
ip route show table 200 | grep -w $INTERFACE_IProute
# add local lan route
ip rule add table main suppress_prefixlength 0
ip rule show | grep -w "suppress_prefixlength"

2
hybrid/join.sh

@ -0,0 +1,2 @@
docker swarm join --token SWMTKN-1-3099nls9my5ns1s0mnmwkx41mhpawl80hwjjbskbll7nghqhgn-asu68y4lhd1qlbpxr6oosk6wl 10.13.13.1:2377

1
hybrid/privatekey

@ -0,0 +1 @@
6CdrILpdZcm1OfOecSQSgaI90sLNOTVW9zO9Dac5b0w=

1
hybrid/publickey

@ -0,0 +1 @@
fEirlFuleXLeY2pgsCVb8G16DEVXJVGJuXdifX1+/wY=

29
hybrid/scripts/add-nic-veth-pair.sh

@ -0,0 +1,29 @@
#!/bin/sh
if [ $# -lt 3 ]; then
echo "This script will create a veth pair, attach one end to an OVS bridge,"
echo "and another end to the specified container as a virtual NIC."
echo ""
echo "Usage: $0 <CONTAINER> <VETH> <PEER> <OVS BRIDGE>"
echo "Example: $0 test-container-1 veth-1 peer-1 br-int"
exit 1
fi
CONTAINER=$1
VETH=$2
PEER=$3
OVS_BR=$4
NETNS=`sudo docker inspect -f '{{.State.Pid}}' $CONTAINER`
echo "add veth pair[$VETH <--> $PEER] to container[$CONTAINER] in netns[$NETNS]"
ip link delete $VETH || true
ip link add $VETH type veth peer name $PEER
echo "add port to ovs bridge $OVS_BR"
ovs-vsctl add-port $OVS_BR $VETH
echo "move $PEER to netns $NETNS"
ip link set $PEER netns $NETNS
ip netns exec $NETNS ip link set dev $PEER up
echo "done"

26
hybrid/scripts/add-nic.sh

@ -0,0 +1,26 @@
#!/bin/sh
if [ $# -lt 3 ]; then
echo "This script will add an OVS internal port to an OVS bridge,"
echo "then assign the port to the specified container as a virtual NIC."
echo ""
echo "Usage: $0 <CONTAINER> <NIC NAME> <OVS BRIDGE>"
echo "Example: $0 test-container-1 vnic-1 br-int"
exit 1
fi
CONTAINER=$1
PORT=$2
OVS_BR=$3
NETNS=`sudo docker inspect -f '{{.State.Pid}}' $CONTAINER`
echo "add port[$PORT] to container[$CONTAINER] in netns[$NETNS]"
echo "add port to ovs bridge $OVS_BR"
ovs-vsctl add-port $OVS_BR $PORT -- set Interface $PORT type=internal
#ovs-vsctl add-port br-int vnic-1 -- set Interface vnic-1 type=internal
echo "move $PORT to netns $NETNS"
ip link set $PORT netns $NETNS
ip netns exec $NETNS ip link set dev $PORT up
echo "done"

24
hybrid/scripts/expose-netns.sh

@ -0,0 +1,24 @@
#!/bin/bash
if [ $# -ne 1 ]; then
echo "Usage: $0 <container id or name>"
exit 1
fi
echo "expose container $1 netns"
NETNS=`sudo docker inspect -f '{{.State.Pid}}' $1`
if [ ! -d /var/run/netns ]; then
mkdir /var/run/netns
fi
if [ -f /var/run/netns/$NETNS ]; then
rm -rf /var/run/netns/$NETNS
fi
ln -s /proc/$NETNS/ns/net /var/run/netns/$NETNS
echo "done. netns: $NETNS"
echo "============================="
echo "current network namespaces: "
echo "============================="
ip netns

3
keys/create.sh

@ -0,0 +1,3 @@
openssl req -new -newkey rsa:4096 -days 365 -nodes -x509 \
-subj "/C=GR/ST=ATTICA/L=Athens/O=swarmlab/CN=hybrid-local.swarmlab.io" \
-keyout swarmlab.key -out swarmlab.crt

33
keys/swarmlab.crt

@ -0,0 +1,33 @@
-----BEGIN CERTIFICATE-----
MIIFqzCCA5OgAwIBAgIUL0lHp+0sOfYgkUXnsDkEwiUdPCIwDQYJKoZIhvcNAQEL
BQAwZTELMAkGA1UEBhMCR1IxDzANBgNVBAgMBkFUVElDQTEPMA0GA1UEBwwGQXRo
ZW5zMREwDwYDVQQKDAhzd2FybWxhYjEhMB8GA1UEAwwYaHlicmlkLWxvY2FsLnN3
YXJtbGFiLmlvMB4XDTIwMTIyNTE5MTU0NloXDTIxMTIyNTE5MTU0NlowZTELMAkG
A1UEBhMCR1IxDzANBgNVBAgMBkFUVElDQTEPMA0GA1UEBwwGQXRoZW5zMREwDwYD
VQQKDAhzd2FybWxhYjEhMB8GA1UEAwwYaHlicmlkLWxvY2FsLnN3YXJtbGFiLmlv
MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0raMBeIQWyvEzTRnV6vq
Nfuq74LyCGLAiywwsSSgQ+UasVDWDKIuzHY87F/eS5+D3u/GiCRwOgW2XovS8prR
FZATt8/Qe2pCIvf0QTb8K5Y6raqgeBGVpB7kcleC2+UsGX0cQMmeUoIZnBR9vXOY
mrIE9Lf3AeGx8omFmcuW07b7RICcRE508flmpcN0gkCARr99JI59O1Bwue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pZJ1RwxixmsqMmJxOf+9eZuS
QKnHtenGd8CRkdbAlb4OlcRfg1TQXVHC0U3lk9eFAy7iqcCpelAgLN2af5bssACo
cxiqtRicJlUtgbtIZuUE8CWxfGKBMLBlUFt2cyVwFZ+PlruPTR+hj0CLPyvSUe9f
+v8esdl4mvQoa/YBANtIMBmoab3Luwf1noWS6J8QVBUPezN7yCkMTb2XOu3ZrfmQ
Jmkimgl0UbbF65BEymu2iSVu6FlOhgtIi0vQ5hr8AJdGl1NUFqvAWf+zX/AWmdhg
lHniiVatSmynsipyyn6L7yXUElS7FaW5
-----END PRIVATE KEY-----

39
nginx/swarmlab-stats-proxy-server.conf

@ -0,0 +1,39 @@
proxy_cache_path /var/tmp levels=1:2 keys_zone=my_cache:10m max_size=10g inactive=60m use_temp_path=off;
resolver_timeout 5s;
server {
listen 80;
listen [::]:80 ipv6only=on;
#server_name hybrid-local.swarmlab.io;
server_name localhost;
return 301 https://hybrid-local.swarmlab.io$request_uri;
}
server {
listen [::]:443 ssl ipv6only=off;
#server_name hybrid-local.swarmlab.io;
server_name localhost;
root /home/node/swarmlab-app/dist;
# To allow special characters in headers
ignore_invalid_headers off;
# Allow any size file to be uploaded.
# Set to a value such as 1000m; to restrict file size to a specific value
client_max_body_size 0;
ssl_certificate /etc/nginx/swarmlab.crt;
ssl_certificate_key /etc/nginx/swarmlab.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!MD5;
location / {
index index.html;
}
}

25308
package-lock.json

File diff suppressed because it is too large

68
package.json

@ -0,0 +1,68 @@
{
"name": "bootstrap-vue-example",
"version": "0.1.0",
"private": true,
"scripts": {
"docs:build": "documentation build src/** -f html -o public/docs",
"docs:serve": "documentation build src/** -c jsdoc.conf.json -f html -o public/docs",
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"@fortawesome/fontawesome-svg-core": "^1.2.32",
"@fortawesome/free-brands-svg-icons": "^5.15.1",
"@fortawesome/free-solid-svg-icons": "^5.15.1",
"@fortawesome/vue-fontawesome": "^2.0.0",
"axios": "^0.21.0",
"bootstrap-vue": "^2.19.0",
"express": "^4.17.1",
"file-saver": "^2.0.5",
"import": "^0.0.6",
"jszip": "^3.5.0",
"luxon": "^1.25.0",
"mkdirp": "^0.5.5",
"multilang-extract-comments": "^0.3.3",
"sass": "^1.30.0",
"sass-loader": "^10.1.0",
"socket.io-client": "^3.0.3",
"vee-validate": "^3.4.5",
"vue": "^2.6.12",
"vue-codemirror": "^4.0.6",
"vue-socket.io-extended": "^4.0.5",
"vue-sweetalert2": "^4.1.1",
"vue-template-compiler": "^2.6.12",
"vue-wait": "^1.4.8",
"vue2-datepicker": "^3.8.2",
"vuetable-2": "^1.7.5",
"vuex": "^3.6.0"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^4.5.7",
"@vue/cli-service": "^4.5.7"
},
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/essential",
"eslint:recommended"
],
"rules": {},
"parserOptions": {
"parser": "babel-eslint"
}
},
"postcss": {
"plugins": {
"autoprefixer": {}
}
},
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 8"
]
}

50
run.yml

@ -0,0 +1,50 @@
version: "3.8"
services:
swarmlabclient:
image: hub.swarmlab.io:5443/playground-hybrid-agent:latest
user: root
environment:
- NODENAME={{.Node.Hostname}}
- NODEID={{.Node.ID}}
deploy:
replicas: 1
placement:
max_replicas_per_node: 1
#constraints:
#- node.id==${noderead}
#- node.labels.region==okeanos
resources:
limits:
cpus: '0.50'
memory: 250M
reservations:
cpus: '1'
memory: 750M
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 5
window: 120s
update_config:
parallelism: 2
delay: 10s
order: stop-first
ports:
- "55543:443"
- "3000:3000"
networks:
hybrid-net:
volumes:
- ${nodepath}/ecosystem.config.js:/home/node/swarmlab-app/ecosystem.config.js
- ${nodepath}/dist:/home/node/swarmlab-app/dist
- ${nodepath}/src-local/llo/new.js:/home/node/server/llo/new.js
# proxy
- ${nodepath}/nginx/swarmlab-stats-proxy-server.conf:/etc/nginx/conf.d/default.conf
- ${nodepath}/keys/swarmlab.crt:/etc/nginx/swarmlab.crt
- ${nodepath}/keys/swarmlab.key:/etc/nginx/swarmlab.key
networks:
hybrid-net:

8
run.yml.sh

@ -0,0 +1,8 @@
#docker service rm ondemand_playground_swarmlabclient
#env node7=636656brviohbzo5dhdggba0q \
#env node7=qpszok5px74lqpvidoeq2wyyc \
#docker stack deploy -c run.yml ondemand_playground
env nodepath=$PWD \
docker-compose -f run.yml up -d

48
src-local/llo/bclient.js

@ -0,0 +1,48 @@
var path = require('path');
var app = require('express')();
var http = require('http').Server(app);
var io = require('socket.io')(http);
const socketAuth = require('socketio-auth');
socketoptions = {
secure:true,
reconnect: true,
rejectUnauthorized : false
};
// Client
var io2 = require('socket.io-client');
var socket = io2.connect('https://83.212.78.17:3088', socketoptions);
socket.on('connection', s => {
console.error('socket2 connection');
var id = s.id
var roomiot = 'iot'
socket.emit('iot', roomiot);
socket.emit('subscribe', roomiot);
socket.emit('pingServerEmit', roomiot);
s.on('message', function (data) {
console.log('from room1 '+data);
});
s.on('iot', function (data) {
console.log('from room1 '+data);
});
});
var roomiot = 'iot'
socket.emit('action', roomiot);
socket.on('message', function (data) {
console.log('from room '+data);
});

32
src-local/llo/client.js

@ -0,0 +1,32 @@
options = {
secure:true,
reconnect: true,
rejectUnauthorized : false
};
// Client
var io2 = require('socket.io-client');
var socket = io2.connect('http://localhost:8084', options);
//var socket = io2.connect('https://service.swarmlab.io:55583');
var msg2 = "hello";
socket.emit('pingServer', msg2);
//var socket = require('socket.io-client')('httpis://localhost:8099');
socket.on('connect', function(){
console.error('connect ...');
//socket.emit("adhoc", 'Hallo World!')
});
socket.on('customEmit', function(data){
console.error('customEmit '+data);
//socket.emit("adhoc", 'Hallo World!')
});
socket.on('disconnect', function(){
console.error('disconnect');
});
//socket.emit("adhoc", 'Hallo World!')

40
src-local/llo/iotclient.js

@ -0,0 +1,40 @@
var fs = require( 'fs' );
var app = require('express')();
var https = require('https');
var server = https.createServer({
key: fs.readFileSync('./llo/swarmlab.key'),
cert: fs.readFileSync('./llo/swarmlab.crt'),
//ca: fs.readFileSync('./test_ca.crt'),
requestCert: false,
rejectUnauthorized: false
},app);
server.listen(3000, () => console.error('listening on https://localhost:3000/'));
var io = require('socket.io').listen(server);
console.error('socket.io example');
io.on('connection', s => {
if( typeof s !== "undefined" ){
console.error('socket connection');
}
s.on('actionstart', obj => {
console.error('fromclient '+obj);
socket.emit("log", obj)
});
/*
s.on('s1', function(room) {
console.log('leaving room', room);
})
*/
s.on('s1', () => {
console.log('hi from server');
}); // listen to the event
});

381
src-local/llo/iotserver.js

@ -0,0 +1,381 @@
"use strict"
var pathmodule = require('path');
var app = require('express')();
var http = require('http').Server(app);
var https = require('https');
var CONFIG = require( pathmodule.resolve( __dirname, "runconfig.js" ) );
const io = require("socket.io")(http, {
// pingTimeout: 30000,
// allowUpgrades: false,
// serveClient: false,
// pingInterval: 10000,
// //transports: [ 'websocket', 'polling' ],
// transports: [ 'polling', 'websocket' ],
cors: {
origin: "http://localhost:8080",
methods: ["GET", "POST"],
allowedHeaders: ["my-custom-header"],
credentials: true
},
cookie: {
name: "test",
httpOnly: false,
path: "/custom"
}
});
const { DateTime } = require("luxon");
var async = require("async");
const { check, validationResult } = require('express-validator');
const urlExistSync = require("url-exist-sync");
var express = require('express');
app.use(express.json());
const axios = require('axios');
axios.defaults.timeout = 30000
const helmet = require('helmet');
app.use(helmet());
const cors = require('cors')
const whitelist = [
'http://localhost:8080',
'http://localhost:3080',
'http://localhost:3081',
'http://localhost:3082'
]
const corsOptions = {
credentials: true,
methods: ['GET', 'PUT', 'POST', 'DELETE', 'OPTIONS'],
optionsSuccessStatus: 200, // some legacy browsers (IE11, various SmartTVs) choke on 204
allowedHeaders: [
'Content-Type',
'Authorization',
'X-Requested-With',
'device-remember-token',
'Access-Control-Allow-Origin',
'Access-Control-Allow-Headers',
'Origin',
'Accept'
],
origin: function(origin, callback) {
if (whitelist.indexOf(origin) !== -1) {
callback(null, true)
} else {
callback(null, true)
//callback(new Error('Not allowed by CORS'))
}
}
}
app.use(cors)
// ***************************************************
// checktoken
// ***************************************************
async function checkToken(token) {
const agent = new https.Agent({
rejectUnauthorized: false,
});
const instance = axios.create({
baseURL: 'https://api.swarmlab.io',
withCredentials: true,
rejectUnauthorized: false,
crossdomain: true,
httpsAgent: agent,
headers: {
'Accept': 'application/json',
'Content-Type': 'multipart/form-data',
'Authorization': 'Bearer '+token
}
})
try {
var pipelines = {
"source":'ssologin'
}
var params = {
pipeline: pipelines
}
var options = {
headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` },
};
instance.defaults.timeout = 30000;
const res = await instance.post('/istokenvalidsso',params,options);
if(res.status == 200){
//console.log("check " +JSON.stringify(res.data))
return res.data
}else{
console.log("noerror: " + res)
return res.status
}
}
catch (err) {
console.error("error: "+err);
var error = new Object();
error.action = '401'
return error
}
}
function convertDateToUTC(date) {
return new Date(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds(),date.getUTCMilliseconds());
}
// ***************************************************
// get pipelines
// ***************************************************
async function getpipelines(token,pipelinename) {
const agent = new https.Agent({
rejectUnauthorized: false,
});
const instance = axios.create({
baseURL: 'https://api.swarmlab.io',
withCredentials: true,
rejectUnauthorized: false,
crossdomain: true,
httpsAgent: agent,
headers: {
'Accept': 'application/json',
'Content-Type': 'multipart/form-data',
'Authorization': 'Bearer '+token
}
})
/*
var params = {
playbook: value
}
var options = {
params: params,
headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` },
};
const playbook = await api.GET('playbookCode',options);
return playbook
*/
try {
var pipelines = {
"querytokenFilter":CONFIG.api.token,
"filter":pipelinename
}
//var params = {
// pipeline: pipelines
// }
var params = {
querytokenFilter:CONFIG.api.token,
filter:pipelinename
}
var options = {
params: params,
headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` },
};
//https://api.swarmlab.io/gettutorlabrooms?sort=pipelinename%7Casc&page=1&per_page=5&filter=&type=scripts&tutor=yes
instance.defaults.timeout = 30000;
//const res = await instance.get('/getplaygrounds',params,options);
const res = await instance.get('/getplaygrounds',options);
if(res.status == 200){
return res.data
}else{
console.log("noerror: " + res)
return await res.status
}
}
catch (err) {
console.error("error: "+err);
var error = new Object();
error.action = '401'
return await error
}
}
// ***************************************************
// get user pipelines
// ***************************************************
async function getuserpipelines(token,user,swarmlabname) {
var pipelinename = user
const agent = new https.Agent({
rejectUnauthorized: false,
});
const instance = axios.create({
baseURL: 'https://api.swarmlab.io',
withCredentials: true,
rejectUnauthorized: false,
crossdomain: true,
httpsAgent: agent,
headers: {
'Accept': 'application/json',
'Content-Type': 'multipart/form-data',
'Authorization': 'Bearer '+token
}
})
try {
var pipelines = {
"querytokenFilter":CONFIG.api.token,
"filter":pipelinename,
swarmlabname:swarmlabname
}
//var params = {
// pipeline: pipelines
// }
var params = {
querytokenFilter:CONFIG.api.token,
filter:pipelinename,
swarmlabname:swarmlabname
}
var options = {
params: params,
headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` },
};
instance.defaults.timeout = 30000;
const res = await instance.get('/getuserplaygrounds',options);
if(res.status == 200){
return res.data
}else{
console.log("noerror: " + res)
return await res.status
}
}
catch (err) {
console.error("error: "+err);
var error = new Object();
error.action = '401'
error.error = err
return await error
}
}
global.online='ob';
global.pipelines=[];
// ***************************************************
// rest get
// ***************************************************
app.get('/run', (req, res, next) => {
(async() => {
var RES = new Object();
RES.code = req.query["action"]
RES.token = req.query["token"]
RES.error = false
RES.error_msg = "ok"
res.json(RES)
})()
});
// ***************************************************
// socket
// ***************************************************
//function getSHA256ofJSON(input){
// return require("crypto").createHash("sha256").update(JSON.stringify(input)).digest("hex");
//}
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
function getSHA256ofJSON(data, inputEncoding, encoding){
if (!data) {
return '';
}
inputEncoding = inputEncoding || 'utf-8';
encoding = encoding || 'hex';
const hash = require("crypto").createHash('md5');
return hash.update(JSON.stringify(data), inputEncoding).digest(encoding);
}
io.on('connection', s => {
console.error('socket connection');
// ------------------------------
// --- set
// ------------------------------
var usersession = new Object();
usersession.SOCKET = {};
usersession.SOCKET.error = {};
console.error('socket ...');
//s.auth = false;
s.auth = true;
// ------------------------------
// --- authenticate
// ------------------------------
s.on('authenticate', function(data){
const token = data
//console.log('invalid 1 ' + token);
console.log("check " +JSON.stringify(data))
(async() => {
//var isvalid = await checkToken(token);
//
/*
if(isvalid.action == 'ok'){
console.log("Authserver ok ", s.id + ' - ' + token);
usersession.SOCKET.user = isvalid.user
usersession.SOCKET.scope = isvalid.scope // space delimeter
usersession.SOCKET.token = isvalid.token
s.auth = true;
}else{
console.log("Authserver no ", s.id + ' - ' + token);
s.auth = false;
}
*/
s.auth = true;
})()
});
/*
setTimeout(function(){
if (!s.auth) {
console.log("Disconnecting timeout socket ", s.id);
//s.disconnect('unauthorized');
}else{
var room = usersession.SOCKET.user
//s.on("subscribe", function (room) {
s.join(room);
console.log("joining rooom", s.rooms);
console.log(room + ' created ')
// });
}
}, 30000);
*/
var id = s.id
s.on('action', obj => {
console.error('from client '+ s.id + ' obj ' + obj);
});
});
http.listen(3000, () => console.error('listening on http://localhost:3000/'));
console.error('socket.io example');

27
src-local/llo/new.js

@ -0,0 +1,27 @@
var fs = require('fs');
var https = require('https');
var express = require('express');
var app = express();
var options = {
key: fs.readFileSync('./llo/swarmlab.key'),
cert: fs.readFileSync('./llo/swarmlab.crt')
};
var serverPort = 3000;
var server = https.createServer(options, app);
var io = require('socket.io')(server);
io.on('connection', function(socket) {
console.log('new connection');
socket.on('s1', () => {
console.log('hi from server');
});
//socket.emit('message', 'This is a message from the dark side.');
});
server.listen(serverPort, function() {
console.log('server up and running at %s port', serverPort);
});

29
src-local/llo/pubsub.js

@ -0,0 +1,29 @@
var path = require('path');
var app = require('express')();
var http = require('http').Server(app);
var io = require('socket.io')(http);
/*
// server side code
io.sockets.on('connection', function(socket) {
socket.on('create', function(room) {
socket.join(room);
});
});
*/
io.on('connection', s => {
s.on("iot", function (room) {
s.join(room);
console.error('hi');
s.to(room).emit('message', 'hi from server');
io.emit('iotdata', 'hi from server');
});
});
http.listen(8084, () => console.error('listening on http://localhost:8084/'));

11
src-local/llo/runconfig.js

@ -0,0 +1,11 @@
var config = {};
config.mongo = {};
config.redis = {};
config.mongo.user = 'user1'
config.mongo.password= 'pass1'
config.redis.host = 'redisserver';
config.redis.port = 6379;
module.exports = config;

33
src-local/llo/swarmlab.crt

@ -0,0 +1,33 @@
-----BEGIN CERTIFICATE-----
MIIFqzCCA5OgAwIBAgIUL0lHp+0sOfYgkUXnsDkEwiUdPCIwDQYJKoZIhvcNAQEL
BQAwZTELMAkGA1UEBhMCR1IxDzANBgNVBAgMBkFUVElDQTEPMA0GA1UEBwwGQXRo
ZW5zMREwDwYDVQQKDAhzd2FybWxhYjEhMB8GA1UEAwwYaHlicmlkLWxvY2FsLnN3
YXJtbGFiLmlvMB4XDTIwMTIyNTE5MTU0NloXDTIxMTIyNTE5MTU0NlowZTELMAkG
A1UEBhMCR1IxDzANBgNVBAgMBkFUVElDQTEPMA0GA1UEBwwGQXRoZW5zMREwDwYD
VQQKDAhzd2FybWxhYjEhMB8GA1UEAwwYaHlicmlkLWxvY2FsLnN3YXJtbGFiLmlv
MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0raMBeIQWyvEzTRnV6vq
Nfuq74LyCGLAiywwsSSgQ+UasVDWDKIuzHY87F/eS5+D3u/GiCRwOgW2XovS8prR
FZATt8/Qe2pCIvf0QTb8K5Y6raqgeBGVpB7kcleC2+UsGX0cQMmeUoIZnBR9vXOY
mrIE9Lf3AeGx8omFmcuW07b7RICcRE508flmpcN0gkCARr99JI59O1BwueOlhpKe
fdg7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xixmsqMmJxOf+9eZuS
QKnHtenGd8CRkdbAlb4OlcRfg1TQXVHC0U3lk9eFAy7iqcCpelAgLN2af5bssACo
cxiqtRicJlUtgbtIZuUE8CWxfGKBMLBlUFt2cyVwFZ+PlruPTR+hj0CLPyvSUe9f
+v8esdl4mvQoa/YBANtIMBmoab3Luwf1noWS6J8QVBUPezN7yCkMTb2XOu3ZrfmQ
Jmkimgl0UbbF65BEymu2iSVu6FlOhgtIi0vQ5hr8AJdGl1NUFqvAWf+zX/AWmdhg
lHniiVatSmynsipyyn6L7yXUElS7FaW5
-----END PRIVATE KEY-----

11
src-local/myconfig/runconfig.js

@ -0,0 +1,11 @@
var config = {};
config.mongo = {};
config.redis = {};
config.mongo.user = 'user1'
config.mongo.password= 'pass1'
config.redis.host = 'redisserver';
config.redis.port = 6379;
module.exports = config;

2531
src-local/package-lock.json

File diff suppressed because it is too large

16
src-local/package.json

@ -0,0 +1,16 @@
{
"name": "swarmlab-agent",
"version": "1.0.0",
"description": "swarmlab on node",
"main": "server.js",
"scripts": {
"start": "node ./llo/server.js"
},
"dependencies": {
"async": "^3.2.0",
"chai": "^4.2.0",
"express": "^4.17.1",
"helmet": "^4.1.1",
"url-exist-sync": "^1.0.2"
}
}

132
src/App.vue

@ -0,0 +1,132 @@
<template>
<div id="app">
<nav class="navbar navbar-light navbar-expand-md bg-light justify-content-md-center justify-content-start">
<b-navbar-brand class="logo simple-text ti-swarmlab text-secondary">
Swarmlab.io
</b-navbar-brand>
<div class="navbar-collapse collapse justify-content-between align-items-center w-100" id="collapsingNavbar2">
<ul class="navbar-nav mx-auto text-md-center text-left">
<li class="nav-item">
<a class="nav-link" href="#">Link</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#"
@click="hybrid('bootstrap')"
>myNetwork</a>
</li>
<li class="nav-item my-auto">
<a class="nav-link navbar-brand mx-0 d-none d-md-inline" href="">Hybrid</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Link</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Link</a>
</li>
</ul>
<ul class="nav navbar-nav flex-row justify-content-md-center justify-content-start flex-nowrap">
<b-nav-item href="https://git.swarmlab.io:3000" target="_swarmlabgit"> Swarmlab_git </b-nav-item>
<b-nav-item > | </b-nav-item>
<b-nav-item :href="'https://api-client.swarmlab.io:8088/?token='+ token" target="_swarmlab"> Lab_onDemand </b-nav-item>
<b-nav-item > </b-nav-item>
</ul>
</div>
</nav>
<!-- ***************** container items ****************** -->
<b-row>
<b-col cols="12">
<network-table
style="background-color: #f8f9fa"
>
</network-table>
</b-col>
</b-row>
<b-row>
<b-col cols="12">
<!--
<doc-grep
style="background-color: #f8f9fa"
>
</doc-grep>
-->
</b-col>
</b-row>
</div>
</template>
<script>
import "@/assets/css/themify-icons.css";
//import NetworkTable from "./components/mynetwork/mytable.vue";
import NetworkTable from "./components/mynetwork.vue";
export default {
name: 'app',
components: {
NetworkTable
},
data() {
return {
show: true,
token: '',
SwarmabAsciiLabTemplate:''
}
},
mounted() {
},
created() {
},
methods: {
hybrid(action) {
console.log(action)
}
}
}
</script>
<style>
@import url('https://fonts.googleapis.com/css?family=Lato:400,700');
body {
background: #EEF1F4 !important;
}
.nav-background {
background: #353535;
}
.ti-swarmlab:before {
position: relative;
top:-5px;
right:-8px;
font-size: 1.5em;
font-weight: 300;
content: "\e606";
color: #222;
color: #74B3C8;
border-color: #c60000;
}
.ti-themify-logo:before {
content: "\e6d1";
}
.menoutext {
font-family: 'Lato', sans-serif !important;
}
</style>

250
src/assets/css/_cards.scss

@ -0,0 +1,250 @@
@import "@/assets/css/_variables.scss";
.card {
border-radius: $border-radius-extreme;
box-shadow: 0 2px 2px rgba(204, 197, 185, 0.5);
background-color: #FFFFFF;
color: $card-black-color;
margin-bottom: 20px;
position: relative;
z-index: 1;
border: none;
.card-image {
width: 100%;
overflow: hidden;
height: 260px;
border-radius: $border-radius-extreme $border-radius-extreme 0 0;
position: relative;
-webkit-transform-style: preserve-3d;
-moz-transform-style: preserve-3d;
transform-style: preserve-3d;
img {
width: 100%;
}
}
.card-body {
padding: 15px 15px 10px 15px;
}
.card-header {
padding: 20px 20px 0;
border-bottom: 0;
background-color: transparent;
}
.description {
font-size: $font-paragraph;
color: $font-color;
}
h6 {
font-size: $font-size-small;
margin: 0;
}
.card-category,
label {
font-size: $font-size-base;
font-weight: $font-weight-normal;
color: $dark-gray;
margin-bottom: 0px;
i {
font-size: $font-paragraph;
}
}
label {
font-size: 15px;
margin-bottom: 5px;
}
.card-title {
margin: $none;
color: $card-black-color;
font-weight: $font-weight-light;
}
.avatar {
width: 50px;
height: 50px;
overflow: hidden;
border-radius: 50%;
margin-right: 5px;
}
.footer {
padding: 0;
line-height: 30px;
.legend {
padding: 5px 0;
}
hr {
margin-top: 5px;
margin-bottom: 5px;
}
}
.stats {
color: #a9a9a9;
font-weight: 300;
i {
margin-right: 2px;
min-width: 15px;
display: inline-block;
}
}
.footer div {
display: inline-block;
}
.author {
font-size: $font-size-small;
font-weight: $font-weight-bold;
text-transform: uppercase;
}
.author i {
font-size: $font-size-base;
}
&.card-separator:after {
height: 100%;
right: -15px;
top: 0;
width: 1px;
background-color: $medium-gray;
content: "";
position: absolute;
}
.ct-chart {
margin: 30px 0 30px;
height: 245px;
}
.table {
tbody td:first-child,
thead th:first-child {
padding-left: 15px;
}
tbody td:last-child,
thead th:last-child {
padding-right: 15px;
}
}
.alert {
border-radius: $border-radius-base;
position: relative;
&.alert-with-icon {
padding-left: 65px;
}
}
.icon-big {
font-size: 3em;
min-height: 64px;
}
.numbers {
font-size: 2em;
text-align: right;
p {
margin: 0;
}
}
ul.team-members {
li {
padding: 10px 0px;
&:not(:last-child) {
border-bottom: 1px solid $medium-pale-bg;
}
}
}
}
.card-user {
.image {
border-radius: 8px 8px 0 0;
height: 150px;
position: relative;
overflow: hidden;
img {
width: 100%;
}
}
.image-plain {
height: 0;
margin-top: 110px;
}
.author {
text-align: center;
text-transform: none;
margin-top: -65px;
.title {
color: $default-states-color;
small {
color: $card-muted-color;
}
}
}
.avatar {
width: 100px;
height: 100px;
border-radius: 50%;
position: relative;
margin-bottom: 15px;