zeus
4 years ago
87 changed files with 33358 additions and 0 deletions
@ -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? |
@ -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"] |
@ -0,0 +1,2 @@ |
|||
#!/bin/bash |
|||
docker build -f Dockerfile -t hub.swarmlab.io:5443/playground-hybrid-agent . |
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 229 KiB |
@ -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> |
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1 @@ |
|||
docker-compose -f run.yml down |
@ -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 |
|||
}, |
|||
] |
|||
} |
|||
|
@ -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" |
|||
|
@ -0,0 +1,2 @@ |
|||
docker swarm join --token SWMTKN-1-3099nls9my5ns1s0mnmwkx41mhpawl80hwjjbskbll7nghqhgn-asu68y4lhd1qlbpxr6oosk6wl 10.13.13.1:2377 |
|||
|
@ -0,0 +1 @@ |
|||
6CdrILpdZcm1OfOecSQSgaI90sLNOTVW9zO9Dac5b0w= |
@ -0,0 +1 @@ |
|||
fEirlFuleXLeY2pgsCVb8G16DEVXJVGJuXdifX1+/wY= |
@ -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" |
@ -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" |
@ -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 |
@ -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 |
@ -0,0 +1,33 @@ |
|||
-----BEGIN CERTIFICATE----- |
|||
MIIFqzCCA5OgAwIBAgIUL0lHp+0sOfYgkUXnsDkEwiUdPCIwDQYJKoZIhvcNAQEL |
|||
BQAwZTELMAkGA1UEBhMCR1IxDzANBgNVBAgMBkFUVElDQTEPMA0GA1UEBwwGQXRo |
|||
ZW5zMREwDwYDVQQKDAhzd2FybWxhYjEhMB8GA1UEAwwYaHlicmlkLWxvY2FsLnN3 |
|||
YXJtbGFiLmlvMB4XDTIwMTIyNTE5MTU0NloXDTIxMTIyNTE5MTU0NlowZTELMAkG |
|||
A1UEBhMCR1IxDzANBgNVBAgMBkFUVElDQTEPMA0GA1UEBwwGQXRoZW5zMREwDwYD |
|||
VQQKDAhzd2FybWxhYjEhMB8GA1UEAwwYaHlicmlkLWxvY2FsLnN3YXJtbGFiLmlv |
|||
MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0raMBeIQWyvEzTRnV6vq |
|||
Nfuq74LyCGLAiywwsSSgQ+UasVDWDKIuzHY87F/eS5+D3u/GiCRwOgW2XovS8prR |
|||
FZATt8/Qe2pCIvf0QTb8K5Y6raqgeBGVpB7kcleC2+UsGX0cQMmeUoIZnBR9vXOY |
|||
mrIE9Lf3AeGx8omFmcuW07b7RICcRE508flmpcN0gkCARr99JI59O1BwueOlhpKe |
|||
fdg7kHgL3XTpoIUimdaEp+wqIjqNytiD3mlCKazVjHdHlQ0aiBpUahiLKmMPLpJS |
|||
dejmdxHAidDsVCkOdTZbC+JHWFCnL8hiJ3JwQjRd2dzhMIGAqqjuFQ7ZnUx20r8b |
|||
IBKXBOvzfHrNx+Sm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rRX2ffln2C7vAmHe7 |
|||
Zd/wfKEGe2gkiVrs9M8Merp6k3eG+MwKAEtWxEwWishIxXGJHmhA9YiGtrxddwZE |
|||
dEgm+jKE93+mVE4ko86TjEN10Cfy/3jVLr1t8SA5lyMQ7FDbEFVW6wmuga4u/jgL |
|||
Bb/FRHnahLPywvkzeita |
|||
-----END CERTIFICATE----- |
@ -0,0 +1,52 @@ |
|||
-----BEGIN PRIVATE KEY----- |
|||
MIIJRAIBADANBgkqhkiG9w0BAQEFAASCCS4wggkqAgEAAoICAQDStowF4hBbK8TN |
|||
NGdXq+o1+6rvgvIIYsCLLDCxJKBD5RqxUNYMoi7MdjzsX95Ln4Pe78aIJHA6BbZe |
|||
i9LymtEVkBO3z9B7akIi9/RBNvwrljqtqqB4EZWkHuRyV4Lb5SwZfRxAyZ5Sghmc |
|||
FH29c5iasgT0t/cB4bHyiYWZy5bTtvtEgJxETnTx+Walw3SCQIBGv30kjn07UHC5 |
|||
46WGkp592DuQeAvddOmghSKZ1oSn7CoiOo3K2IPeaUIprNWMd0eVDRqIGlRqGIsq |
|||
Yw8uklJ16OZ3EcCJ0OxUKQ51NlsL4kdYUKcvyGIncnBCNF3Z3OEwgYCqqO4VDtmd |
|||
THbSvxsgEpcE6/N8es3H5KZIkT/GV3EHJysO7eFxpkg1pH5paT1NRCdQLWlD4l8P |
|||
DzP8FKhg5YFLL/iqethxin3NFAD/3Y5p/2UqasApuraM6dpEXwq1dnt6i2Jqh4Bm |
|||
5ICDqmx6zja0XBrkx6djm2FXNnOGwLT6Sj/KjfiG/e1Q1ttxlZbmnk8dDEhAE5kY |
|||
oAPnXxVoJs8hoXNIKcb7Js71j1ejs7DWClqrc4a+4ShSH8FMJtOe40Xwbh2v9Nfm |
|||
/ikz6XwyahY41oLvnEcmptagkzWAln8TwH5nCVuoaul9VkrtoIOV1sNJcukHyNOR |
|||
WGlbZP/phan3mCA5O0dr8s3bFdCJgwIDAQABAoICABhoCon36FsXE8GNC1dNU2CT |
|||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
|||
uDGTBHXjd4tzrWz20zcbR6N0tAJQ0VnZTXf4+sldhKqMaXYWC7DZa7MXHpIowI+N |
|||
1SEdAoIBAQCT5pxV8PKYT+nOt8lshQGz2AkHa3rzpZJ1RwxixmsqMmJxOf+9eZuS |
|||
QKnHtenGd8CRkdbAlb4OlcRfg1TQXVHC0U3lk9eFAy7iqcCpelAgLN2af5bssACo |
|||
cxiqtRicJlUtgbtIZuUE8CWxfGKBMLBlUFt2cyVwFZ+PlruPTR+hj0CLPyvSUe9f |
|||
+v8esdl4mvQoa/YBANtIMBmoab3Luwf1noWS6J8QVBUPezN7yCkMTb2XOu3ZrfmQ |
|||
Jmkimgl0UbbF65BEymu2iSVu6FlOhgtIi0vQ5hr8AJdGl1NUFqvAWf+zX/AWmdhg |
|||
lHniiVatSmynsipyyn6L7yXUElS7FaW5 |
|||
-----END PRIVATE KEY----- |
@ -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; |
|||
} |
|||
|
|||
|
|||
} |
File diff suppressed because it is too large
@ -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" |
|||
] |
|||
} |
@ -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: |
|||
|
@ -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 |
|||
|
|||
|
@ -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); |
|||
}); |
|||
|
|||
|
|||
|
@ -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!')
|
|||
|
@ -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
|
|||
|
|||
|
|||
}); |
|||
|
@ -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'); |
@ -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); |
|||
}); |
@ -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/')); |
@ -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; |
@ -0,0 +1,33 @@ |
|||
-----BEGIN CERTIFICATE----- |
|||
MIIFqzCCA5OgAwIBAgIUL0lHp+0sOfYgkUXnsDkEwiUdPCIwDQYJKoZIhvcNAQEL |
|||
BQAwZTELMAkGA1UEBhMCR1IxDzANBgNVBAgMBkFUVElDQTEPMA0GA1UEBwwGQXRo |
|||
ZW5zMREwDwYDVQQKDAhzd2FybWxhYjEhMB8GA1UEAwwYaHlicmlkLWxvY2FsLnN3 |
|||
YXJtbGFiLmlvMB4XDTIwMTIyNTE5MTU0NloXDTIxMTIyNTE5MTU0NlowZTELMAkG |
|||
A1UEBhMCR1IxDzANBgNVBAgMBkFUVElDQTEPMA0GA1UEBwwGQXRoZW5zMREwDwYD |
|||
VQQKDAhzd2FybWxhYjEhMB8GA1UEAwwYaHlicmlkLWxvY2FsLnN3YXJtbGFiLmlv |
|||
MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAg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oSTyGL4t55OZBRdvbDdx0EgjFekx3m6rPDzYg/NsGFub2BQFJtRCzxmSlXcNA3L2 |
|||
tuYOqouZz550DEB1zJvkrjKjT42vjJ/sCox9PrXyFb5UVxJDjfmJ/NwYTrlWi+TI |
|||
4nwm982DFTR0Q2Jc0R43HZSavKglypOOda3tAzOwzXR1P8xoUUnG1cA8ZCRt0kZ6 |
|||
MQkLHgnx4CoHclu0cGxFyYQNs+P37rGupJNaARgJNhsBl+Sc+nzEKHijoBaBjwly |
|||
nYiendESj+fyUlYYGq2lCZ39D++xyn1diOxcIM0gchPZFlhUTUgInpUZaszzTp2a |
|||
+C114D8NK9vl07xKe2VAO8KWm4k/I+52dCDQ0oFO5T0Yvg2rRX2ffln2C7vAmHe7 |
|||
Zd/wfKEGe2gkiVrs9M8Merp6k3eG+MwKAEtWxEwWishIxXGJHmhA9YiGtrxddwZE |
|||
dEgm+jKE93+mVE4ko86TjEN10Cfy/3jVLr1t8SA5lyMQ7FDbEFVW6wmuga4u/jgL |
|||
Bb/FRHnahLPywvkzeita |
|||
-----END CERTIFICATE----- |
@ -0,0 +1,52 @@ |
|||
-----BEGIN PRIVATE KEY----- |
|||
MIIJRAIBADANBgkqhkiG9w0BAQEFAASCCS4wggkqAgEAAoICAQDStowF4hBbK8TN |
|||
NGdXq+o1+6rvgvIIYsCLLDCxJKBD5RqxUNYMoi7MdjzsX95Ln4Pe78aIJHA6BbZe |
|||
i9LymtEVkBO3z9B7akIi9/RBNvwrljqtqqB4EZWkHuRyV4Lb5SwZfRxAyZ5Sghmc |
|||
FH29c5iasgT0t/cB4bHyiYWZy5bTtvtEgJxETnTx+Walw3SCQIBGv30kjn07UHC5 |
|||
46WGkp592DuQeAvddOmghSKZ1oSn7CoiOo3K2IPeaUIprNWMd0eVDRqIGlRqGIsq |
|||
Yw8uklJ16OZ3EcCJ0OxUKQ51NlsL4kdYUKcvyGIncnBCNF3Z3OEwgYCqqO4VDtmd |
|||
THbSvxsgEpcE6/N8es3H5KZ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zkdD+1CKFqtMUes3+DWotioSccikSrDGUGEnmdAKC0v |
|||
DiKtxUI+LDfWfSSVuyJhG6H3vlsRNT6HA2n1lAJlAoIBAQCT/ov6ksOHkpcVYKgU |
|||
3mji6QfafcqPxK6yygf6UCngF1aWX3pkpsxelK1Poq6eNluHludZj2YUc6tVFI/S |
|||
QmlgfiEZvcQDrhKA+3be+Gbx+F8F8AHY+fsn/4MiMwSsX8AwRXuutIX+OE6OCf0A |
|||
xsJB7RAnkosx6EBAP9sRhGRklmjNtRKVOVzoqj41RtDrmTVmK6T2//SZaMh6HwYR |
|||
nhC13u2MG7HGyTYKe02/YfnFxl8GUoKMz3H7BPHuw44ej7Ceh/TZ1OuUAJW+oXOv |
|||
uDGTBHXjd4tzrWz20zcbR6N0tAJQ0VnZTXf4+sldhKqMaXYWC7DZa7MXHpIowI+N |
|||
1SEdAoIBAQCT5pxV8PKYT+nOt8lshQGz2AkHa3rzpZJ1RwxixmsqMmJxOf+9eZuS |
|||
QKnHtenGd8CRkdbAlb4OlcRfg1TQXVHC0U3lk9eFAy7iqcCpelAgLN2af5bssACo |
|||
cxiqtRicJlUtgbtIZuUE8CWxfGKBMLBlUFt2cyVwFZ+PlruPTR+hj0CLPyvSUe9f |
|||
+v8esdl4mvQoa/YBANtIMBmoab3Luwf1noWS6J8QVBUPezN7yCkMTb2XOu3ZrfmQ |
|||
Jmkimgl0UbbF65BEymu2iSVu6FlOhgtIi0vQ5hr8AJdGl1NUFqvAWf+zX/AWmdhg |
|||
lHniiVatSmynsipyyn6L7yXUElS7FaW5 |
|||
-----END PRIVATE KEY----- |
@ -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; |
File diff suppressed because it is too large
@ -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" |
|||
} |
|||
} |
@ -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> |
@ -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; |
|||