Browse Source

community menou 1

master
zeus 3 years ago
parent
commit
7f3aabddd4
  1. 10
      .gitignore
  2. 22
      run.yml
  3. 17
      src-local/community/config/cse242017102-test.js
  4. 17
      src-local/community/config/rootapostolos-ansibletest.js
  5. 17
      src-local/community/config/rootapostolos-mytest1.js
  6. 133
      src-local/llo/new.js
  7. 44
      src-local/myconfig/default.conf
  8. 29
      src-local/myconfig/nginx.conf
  9. 77
      src-local/myconfig/sec_bootstrap
  10. 1
      src/components/mynetwork/AdhocView.vue
  11. 7
      src/components/mynetwork/availablemicroservices.vue
  12. 4
      src/components/mynetwork/availablemicroservicescustom.vue
  13. 1
      src/components/mynetwork/dockerservices.vue
  14. 291
      src/components/mynetwork/mytable.vue
  15. 38
      src/config/index-gui.js
  16. 64
      src/store/modules/create_pipelineLLO.js

10
.gitignore

@ -18,14 +18,12 @@ viwsession/
testfilemanager/
README-update
!./src-local/community/config/
!./src-local/community/config/README
!./src-local/community/custom/
!./src-local/community/README
./src-local/community/
src-local/community/rootapostolos@swarmlab.io_mytest1_microservice-ipterm/
src-local/community/rootapostolos@swarmlab.io_ansibletest_microservice-alpine313/
src-local/community/cse242017102@uniwa.gr_test_microservice-nodejs/
src-local/builders/bento-swarmlab/
src-local/community/*
src-local/community/config/*
src-local/builders/bento-swarmlab/*
swarmlabdoc.js
swarmlabdoc.asciidoc_config

22
run.yml

@ -121,6 +121,28 @@ services:
- ${nodepath}/src-local/instance:/instance
- ${nodepath}/src-local/community:/community
swarmlabsidecarserver:
image: hub.swarmlab.io:5480/hybrid-nginx:latest
user: docker
#privileged: true
container_name: swarmlab-sidecar-agent
entrypoint: ["/usr/bin/sec_bootstrap", "role=masterservice", "sec_master_service_name=masterservice", "sec_worker_service_name=workerservice"]
environment:
- NODENAME={{.Node.Hostname}}
- NODEID={{.Node.ID}}
ports:
- "3384:80"
volumes:
- ${nodepath}/src-local/instance:/data/www/instance
- ${nodepath}/src-local/community:/data/www/community
- ${nodepath}/src-local/myconfig/sec_bootstrap:/usr/bin/sec_bootstrap
- ${nodepath}/src-local/myconfig/nginx.conf:/etc/nginx/nginx.conf
- ${nodepath}/src-local/myconfig/default.conf:/etc/nginx/conf.d/default.conf
# - ${nodepath}/src-local/myconfig/supervisord.conf:/etc/supervisor/supervisord.conf
- /etc/localtime:/etc/localtime:ro
networks:
hybrid-net:
networks:
hybrid-net:

17
src-local/community/config/cse242017102-test.js

@ -1,17 +0,0 @@
{
"servicedata": {
"service": "test",
"baseservice": "microservice-nodejs",
"user": "cse242017102@uniwa.gr",
"port1": "",
"url1": "",
"name1": "",
"port2": "",
"url2": "",
"name2": "",
"port3": "",
"url3": "",
"name3": ""
},
"baseservicedata": {"name":"microservice-nodejs","custom":"true","customostext":"Base OS: alpine:3.13","customos":"apk add --no-cache net-tools ","customshtext":"It is executed after all the normal builds","customsh":" #!/bin/sh","app":false,"url":"http","port":"80/tcp","ttyd":true,"ttydport":"3787/tcp","ttydurl":"http"}
}

17
src-local/community/config/rootapostolos-ansibletest.js

@ -1,17 +0,0 @@
{
"servicedata": {
"service": "ansibletest",
"baseservice": "microservice-alpine313",
"user": "rootapostolos@swarmlab.io",
"port1": "",
"url1": "",
"name1": "",
"port2": "",
"url2": "",
"name2": "",
"port3": "",
"url3": "",
"name3": ""
},
"baseservicedata": {"name":"microservice-alpine313","large":"no","custom":"true","customostext":"Base OS: alpine3.13","customos":"apk add --no-cache net-tools ","customshtext":"It is executed after all the normal builds","customsh":" #!/bin/sh","app":false,"url":"http","port":"80/tcp","ttyd":true,"ttydport":"3787/tcp","ttydurl":"http"}
}

17
src-local/community/config/rootapostolos-mytest1.js

@ -1,17 +0,0 @@
{
"servicedata": {
"service": "mytest1",
"baseservice": "microservice-ipterm",
"user": "rootapostolos@swarmlab.io",
"port1": "8081",
"url1": "http",
"name1": "n1",
"port2": "8082",
"url2": "http",
"name2": "n2",
"port3": "8083",
"url3": "https",
"name3": "n3"
},
"baseservicedata": {"name":"microservice-ipterm","custom":"true","customostext":"Base OS: debian:jessie ","customos":"apt-get update && apt-get install -y --no-install-recommends net-tools","customshtext":"It is executed after all the normal builds","customsh":" #!/bin/sh","app":false,"url":"http","port":"80/tcp","ttyd":true,"ttydport":"3787/tcp","ttydurl":"http"}
}

133
src-local/llo/new.js

@ -1653,8 +1653,89 @@ app.get('/rungui', (req, res, next) => {
var runpath = `./instance/${RES.instance}/${RES.instance}`
var runpathfile = `./instance/${RES.instance}/${RES.instance}/run-gui.sh`
//console.log(runpath)
//console.log(showexec)
var buildoutdir = `${runpath}/logs/build-out.log`
var builderrdir = `${runpath}/logs/build-out.log`
//const buildout = fs.openSync(buildoutdir, 'a');
//const builderr = fs.openSync(builderrdir, 'a');
try {
const buildout = fs.openSync(buildoutdir, 'a');
const builderr = fs.openSync(builderrdir, 'a');
var buildimage = `echo "EXEC PID: $$"; ${showexec}`
//var buildimage = `echo "EXEC PID: $$"; docker run -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix microservice-firefox /bin/sh -c "firefox"`
const run_buildimage = spawn(buildimage, {
detached: true,
shell: true,
stdio: [ 'ignore', buildout, builderr ],
cwd: runpath
});
var n = {}
n.pid = run_buildimage.pid
io.emit('build_set_buildpid', n);
n.data = 'start ...'
io.emit('message_out', n);
n.data = 'i am trying to automatically start the application'
io.emit('message_out', n);
n.data = 'If this fails, try:'
io.emit('message_out', n);
var buildtmpexec = ""
buildtmpexec = fs.readFileSync(runpathfile, {encoding:'utf8', flag:'r'});
//var buildtmpexec = `docker run -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix microservice-firefox /bin/sh -c "firefox"`
n.data = buildtmpexec
io.emit('message_out', n);
run_buildimage.on('exit', (data) => {
//console.log('exit '+data);
var n = {}
n.data = 'exit!'
io.emit('message_close', n);
});
run_buildimage.on('close', (data) => {
//console.log('close '+data);
var n = {}
n.data = 'close!'
io.emit('message_close', n);
n.name = `${RES.instance}`
n.dir = `${runpath}`
io.emit('message_close_build', n);
RES.error = false
RES.error_msg = 'no'
RES.data = 'no'
res.json(RES)
});
console.log(run_buildimage.pid);
run_buildimage.unref();
} catch (error) {
console.log('Error:', error);
RES.error = true
RES.error_msg = error
RES.data = 'no'
res.json(RES)
}
});
app.get('/runguicustom', (req, res, next) => {
var RES = new Object();
RES.instance = req.query["instance"]
RES.exec = req.query["exec"]
RES.imageid = req.query["id"]
RES.error = false
RES.error_msg = "ok"
RES.error_msg0 = ""
RES.data = "All_services_are_running";
var showexec = `./run-gui.sh`
//var runpath = `./instance/${RES.instance}/${RES.instance}`
var runpath = `./${RES.instance}`
var runpathfile = `${runpath}/run-gui.sh`
var buildoutdir = `${runpath}/logs/build-out.log`
var builderrdir = `${runpath}/logs/build-out.log`
@ -1663,7 +1744,11 @@ app.get('/rungui', (req, res, next) => {
try {
const buildout = fs.openSync(buildoutdir, 'a');
const builderr = fs.openSync(builderrdir, 'a');
var runexec = `xhost +local:docker
docker exec -e DISPLAY=\$DISPLAY ${RES.imageid} ${RES.exec}
`
const extrapackagestext = fs.writeFileSync(runpathfile, runexec, {encoding:'utf8'});
var buildimage = `echo "EXEC PID: $$"; ${showexec}`
//var buildimage = `echo "EXEC PID: $$"; docker run -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix microservice-firefox /bin/sh -c "firefox"`
const run_buildimage = spawn(buildimage, {
@ -2136,6 +2221,38 @@ app.get('/getcustom', (req, res, next) => {
}
});
app.get('/getlog4gui', (req, res, next) => {
var RES = new Object();
var mypath1 = process.cwd()
var runuser = process.env.USER || ""
RES.instance = req.query["instance"]
RES.error = false
RES.error_msg = "ok"
var instancedir = `${mypath1}/${RES.instance}`
console.log(instancedir)
if (fs.existsSync(instancedir)) {
try {
const log = fs.readFileSync(instancedir, {encoding:'utf8', flag:'r'});
RES.error = false
RES.error_msg = 'ok'
RES.log = log
res.json(RES)
} catch (error) {
RES.error = true
RES.error_msg = error
RES.data = 'no'
RES.log = 'no'
res.json(RES)
}
}else{
RES.error = false
RES.error_msg = 'nodir'
RES.data = 'no'
RES.log = 'no'
res.json(RES)
}
});
app.get('/getcustomuser', (req, res, next) => {
var RES = new Object();
var mypath1 = process.cwd()
@ -3832,6 +3949,18 @@ TEST=${value.baseservice}
//console.log('value2 '+JSON.stringify(ENV_service_file_os))
var service_up = '/bin/bash ../install/usr/share/swarmlab.io/sec/swarmlab-sec up size='+service_size
const comment_clearall = /\s\bclear_all\b(?!.*\()/g;
// /\bclear_all\b(?!.*\()/g;
var myservicecustom_buildfile = `./community/${value.user}_${value.service}_${value.baseservice}/install/usr/share/swarmlab.io/sec/swarmlab-sec`
var changeclearall = fs.readFileSync(myservicecustom_buildfile, 'utf8')
if (changeclearall.match(comment_clearall)) {
var changeclearall_tmp = changeclearall.replace(comment_clearall, ' #clear_all\necho ""')
fs.writeFileSync(myservicecustom_buildfile, changeclearall_tmp ,{encoding:'utf8',flag:'w'});
}
child[0] = spawn(service_up, {
shell: true,
cwd: services_path,

44
src-local/myconfig/default.conf

@ -0,0 +1,44 @@
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log /var/log/nginx/log/host.access.log main;
location / {
root /data/www;
index index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /data/www;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}

29
src-local/myconfig/nginx.conf

@ -0,0 +1,29 @@
user www-data;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '[$time_local] $remote_user:$remote_addr "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
include /etc/nginx/conf.d/*.conf;
}

77
src-local/myconfig/sec_bootstrap

@ -0,0 +1,77 @@
#!/bin/sh
ROLE="undefined"
MPI_MASTER_SERVICE_NAME="sec_masterservice"
MPI_WORKER_SERVICE_NAME="sec_workerservice"
HOSTNAMES="/etc/nethosts"
#######################
# ARGUMENTS PARSER
while [ "$1" != "" ];
do
PARAM=$(echo "$1" | awk -F= '{print $1}')
VALUE=$(echo "$1" | awk -F= '{print $2}')
case $PARAM in
role)
[ "$VALUE" ] && ROLE=$VALUE
;;
sec_master_service_name)
[ "$VALUE" ] && MPI_MASTER_SERVICE_NAME=$VALUE
;;
sec_worker_service_name)
[ "$VALUE" ] && MPI_WORKER_SERVICE_NAME=$VALUE
;;
*)
echo "ERROR: unknown parameter \"$PARAM\""
exit 1
;;
esac
shift
done
cat > /etc/opt/service_names <<- EOF
MPI_MASTER_SERVICE_NAME=${MPI_MASTER_SERVICE_NAME}
MPI_WORKER_SERVICE_NAME=${MPI_WORKER_SERVICE_NAME}
EOF
case $ROLE in
"masterservice")
# Auto update default host file in background and dumb all output
auto_update_hosts "${HOSTNAMES}" > /dev/null 2>&1 &
#/usr/bin/supervisord -n -c /etc/supervisor/supervisord.conf
#ttyd -p 3787 bash &
/usr/sbin/nginx
sleep 1
/usr/sbin/nginx
tail -f /dev/null
# Start ssh server
#/usr/sbin/sshd -D
;;
"workerservice")
# Start ssh server in background
#/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
# shellcheck disable=SC2086
# 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"'
esac

1
src/components/mynetwork/AdhocView.vue

@ -458,6 +458,7 @@ export default {
})
// from runLLO
this.$root.$on('hybrid_log_in', (log) => {
console.log(log)
//this.code += log.data
//this.code += "\n"
//console.log(" form socket log "+JSON.stringify(this.code))

7
src/components/mynetwork/availablemicroservices.vue

@ -34,6 +34,13 @@
<div class="input-group input-group-sm sm-3">
<button
class="btn btn-outline-success btn-sm"
round
type="button"
@click="setFilter">
Refresh Table</button>
<input type="text"
class="form-control"
aria-label="Small" aria-describedby="inputGroup-sizing-sm"

4
src/components/mynetwork/availablemicroservicescustom.vue

@ -286,7 +286,7 @@
:key="vuetablekeygslotcustom">
<div class="d-flex justify-content-center">
<button
v-if="testtest[props.rowData.service] != props.rowData.service && testtestdir[props.rowData.service] == props.rowData.service"
v-if=" testtestdir[props.rowData.service] == props.rowData.service"
class="ti-check btn btn-sm text-success"
title="Remove Lab_Instance"
round
@ -860,9 +860,11 @@ export default {
value.index = this.hybridoptions.index
value.size = this.hybridoptions.size
value.port = this.hybridoptions.port
/* check it
var res = await store.dispatch('pipelineLLO/getswarmlabmicroserviceinfo', value.baseservice)
var swarmlab1info=res.data.swarmlabinfo
value.git = swarmlab1info
*/
//console.log('inf git 0 '+ JSON.stringify(value.swarmlabname))
//console.log('inf git 1 '+ JSON.stringify(res))
//console.log('inf '+ JSON.stringify(value))

1
src/components/mynetwork/dockerservices.vue

@ -404,6 +404,7 @@ export default {
rowClicked(row, event) {
//console.log('click')
// console.log(row)
// console.log('row')
//console.log(event)
//this.actionrowindex = index
this.$root.$emit('hybrid_show_info',row)

291
src/components/mynetwork/mytable.vue

@ -55,13 +55,17 @@
Web</button>
<button
v-if="webinterfacegeneric && hybridshowdata.Names"
class="btn btn-outline-info"
class="btn btn-info"
round
type="button"
@click="onAction('startwebgeneric')"
>
openGui</button>
{{ webinterfacegeneric_text }}</button>
</div>
<div class="input-group-prepend">
<button
v-if="hybridshowdata.Names"
@ -204,13 +208,111 @@
</div> <!-- row -->
<div class="row"
v-if="webinterfacegeneric && webinterfacegeneric_menou1 && hybridshowdata.Names"
>
<div class="col-12">
<hr>
</div>
</div>
<div class="row"
v-if="webinterfacegeneric && webinterfacegeneric_menou1 && hybridshowdata.Names"
>
<div class="col-5">
<div class="input-group input-group-sm sm-3">
<!-- menou 1 --------------------------- -->
<div class="input-group-prepend">
<a :href="webinterfacegeneric_menou1_url" :target="webinterfacegeneric_menou1_url_target1"
v-if="webinterfacegeneric && webinterfacegeneric_menou1 && hybridshowdata.Names && !webinterfacegeneric_menou1typelog"
class="btn btn-outline-secondary"
role="button"> {{ webinterfacegeneric_menou1_text }}
</a>
<button
v-if="webinterfacegeneric && webinterfacegeneric_menou1 && hybridshowdata.Names && webinterfacegeneric_menou1typelog && !webinterfacegeneric_menou1typelog_active"
class="btn btn-outline-secondary"
round
type="button"
@click="guilogs(1)"
>
{{ webinterfacegeneric_menou1_text }}
</button>
<button
v-if="webinterfacegeneric && webinterfacegeneric_menou1 && hybridshowdata.Names && webinterfacegeneric_menou1typelog && webinterfacegeneric_menou1typelog_active"
class="btn btn-outline-warning"
round
type="button"
@click="guilogsclose(1)"
>
{{ webinterfacegeneric_menou1_text }}
</button>
</div>
<!-- menou 2 --------------------------- -->
<div class="input-group-prepend">
<a :href="webinterfacegeneric_menou2_url" :target="webinterfacegeneric_menou1_url_target2"
v-if="webinterfacegeneric && webinterfacegeneric_menou2 && hybridshowdata.Names && !webinterfacegeneric_menou2typelog"
class="btn btn-outline-secondary"
role="button"> {{ webinterfacegeneric_menou2_text }}
</a>
<button
v-if="webinterfacegeneric && webinterfacegeneric_menou2 && hybridshowdata.Names && webinterfacegeneric_menou2typelog && !webinterfacegeneric_menou2typelog_active"
class="btn btn-outline-secondary"
round
type="button"
@click="guilogs(2)"
>
{{ webinterfacegeneric_menou2_text }}
</button>
<button
v-if="webinterfacegeneric && webinterfacegeneric_menou2 && hybridshowdata.Names && webinterfacegeneric_menou2typelog && webinterfacegeneric_menou2typelog_active"
class="btn btn-outline-warning"
round
type="button"
@click="guilogsclose(2)"
>
{{ webinterfacegeneric_menou2_text }}
</button>
</div>
<!-- menou 3 --------------------------- -->
<div class="input-group-prepend">
<a :href="webinterfacegeneric_menou3_url" :target="webinterfacegeneric_menou1_url_target3"
v-if="webinterfacegeneric && webinterfacegeneric_menou3 && hybridshowdata.Names && !webinterfacegeneric_menou3typelog"
class="btn btn-outline-secondary"
role="button"> {{ webinterfacegeneric_menou3_text }}
</a>
<button
v-if="webinterfacegeneric && webinterfacegeneric_menou3 && hybridshowdata.Names && webinterfacegeneric_menou3typelog && !webinterfacegeneric_menou3typelog_active"
class="btn btn-outline-secondary"
round
type="button"
@click="guilogs(3)"
>
{{ webinterfacegeneric_menou3_text }}
</button>
<button
v-if="webinterfacegeneric && webinterfacegeneric_menou3 && hybridshowdata.Names && webinterfacegeneric_menou3typelog && webinterfacegeneric_menou3typelog_active"
class="btn btn-outline-warning"
round
type="button"
@click="guilogsclose(3)"
>
{{ webinterfacegeneric_menou3_text }}
</button>
</div>
</div>
</div>
</div>
</b-container>
<b-container fluid>
<div class="row" >
<div class="col-2 text-info" >
@ -387,6 +489,39 @@ export default {
localNetworkdefault:'',
webinterface: false,
webinterfacegeneric: false,
webinterfacegeneric_text: 'openGui',
webinterfacegeneric_menou1_url_target1: '_blank',
webinterfacegeneric_menou1_url_target2: '_blank',
webinterfacegeneric_menou1_url_target3: '_blank',
webinterfacegeneric_menou_exec: '',
webinterfacegeneric_menou_basedir: '',
swarmlab_services_type: 'swarmlab',
webinterfacegeneric_menou1: false,
webinterfacegeneric_menou1_text: '',
webinterfacegeneric_menou1_url: '',
webinterfacegeneric_menou1typelog: false,
webinterfacegeneric_menou1typelog_active: false,
webinterfacegeneric_menou1typedir: '',
webinterfacegeneric_menou1typedir_log: '',
webinterfacegeneric_menou2: false,
webinterfacegeneric_menou2_text: '',
webinterfacegeneric_menou2_url: '',
webinterfacegeneric_menou2typelog: false,
webinterfacegeneric_menou2typelog_active: false,
webinterfacegeneric_menou2typedir: '',
webinterfacegeneric_menou2typedir_log: '',
webinterfacegeneric_menou3: false,
webinterfacegeneric_menou3_text: '',
webinterfacegeneric_menou3_url: '',
webinterfacegeneric_menou3typelog: false,
webinterfacegeneric_menou3typelog_active: false,
webinterfacegeneric_menou3typedir: '',
webinterfacegeneric_menou3typedir_log: '',
webinterfacegenericedit: false,
webinterface_port: '',
STATUS:{},
@ -422,6 +557,7 @@ export default {
swarmlabname_git:'',
// run on
hybridshowdata:{},
hybridshowdata_user:{},
hybridshowdatashare:{},
issocket:'close',
setFilter: {},
@ -437,7 +573,7 @@ export default {
},
mounted() {
this.$root.$on('hybrid_show_info', (data) => {
(async () => {
// -------------- new menou
this.actionrowindex = false
this.actionrowindexselect = true
@ -446,20 +582,16 @@ export default {
this.$root.$emit('hybrid_show_instance_images','images')
// -------------- new menou
this.webinterface = false
this.webinterfacegeneric = false
this.webinterfacegenericedit = false
this.$nextTick(function () {
// this.$nextTick(function () {
this.hybridshowdata = data
var filterju = `microservice-jupyter`
var grepju = new RegExp(filterju);
if(grepju.test(data.Networks) && grepju.test(data.Names)){
this.webinterface = true
this.webinterface_port = data.Ports
//console.log(JSON.stringify(this.webinterface_port))
}else{
this.webinterface = false
this.webinterface_port = ''
@ -474,7 +606,6 @@ export default {
}
//EDITORcustom
(async () => {
var strbase = '_masterservice_1'
var sRegExInput1 = new RegExp(strbase, 'g');
var getcustomnames = this.hybridshowdata.Names.replace(sRegExInput1 ,'');
@ -484,38 +615,80 @@ export default {
})
//console.log(logdatacustom.data);
if(logdatacustom.data && logdatacustom.data.data){
//console.log(logdatacustom.data.data);
this.hybridshowdata_user = JSON.parse(logdatacustom.data.data)
console.log(this.hybridshowdata_user);
var urlgeniGUIEDITOR = this.hybridshowdata.Names.split('_');
this.webinterfacegenericedit = true
var urlgeniGUI = this.hybridshowdata_user.servicedata.baseservice
this.swarmlab_services_type = 'custom'
}else{
var urlgeniGUItmp = this.hybridshowdata.Names.split('_');
var urlgeniGUI = urlgeniGUItmp[0]
this.swarmlab_services_type = 'swarmlab'
}
})();
var urlgeniGUI = this.hybridshowdata.Names.split('_');
// GUI firefox
for(var i = 0; i < ApiConfigGUI.length; i++) {
var obGUI = ApiConfigGUI[i];
if(obGUI.name == urlgeniGUI[0]){
if(obGUI.name == urlgeniGUI){
this.webinterfacegeneric = true
this.webinterfacegeneric_text = obGUI.menou
this.webinterfacegeneric_menou_exec = obGUI.exec
//console.log(obGUI.name);
if(this.hybridshowdata_user.servicedata && this.swarmlab_services_type == 'custom'){
var baseservicetmp1 = this.hybridshowdata_user.servicedata.user.split('@')
var baseservicecustom = `${baseservicetmp1[0]}-${this.hybridshowdata_user.servicedata.service}`
this.webinterfacegeneric_menou_basedir = `community/${this.hybridshowdata_user.servicedata.user}_${this.hybridshowdata_user.servicedata.service}_${this.hybridshowdata_user.servicedata.baseservice}/${baseservicecustom}`
}else{
var baseservicetmp1 = this.hybridshowdata.Names.split('_')
this.webinterfacegeneric_menou_basedir = `instance/${baseservicetmp1[0]}/${baseservicetmp1[0]}`
}
if(obGUI.menou1){
this.webinterfacegeneric_menou1 = true
this.webinterfacegeneric_menou1_text = obGUI.menou1
this.webinterfacegeneric_menou1_url = `${obGUI.menou1server}/${this.webinterfacegeneric_menou_basedir}/${obGUI.menou1url}`
this.webinterfacegeneric_menou1_url_target1 = urlgeniGUI+'_1'
if(obGUI.menou1type == 'log'){
this.webinterfacegeneric_menou1typelog = true
this.webinterfacegeneric_menou1typedir = `${this.webinterfacegeneric_menou_basedir}/${obGUI.menou2url}`
}
}
if(obGUI.menou2){
this.webinterfacegeneric_menou2 = true
this.webinterfacegeneric_menou2_text = obGUI.menou2
this.webinterfacegeneric_menou2_url = `${obGUI.menou2server}/${this.webinterfacegeneric_menou_basedir}/${obGUI.menou2url}`
this.webinterfacegeneric_menou1_url_target2 = urlgeniGUI+'_2'
if(obGUI.menou2type){
if(obGUI.menou2type == 'log'){
this.webinterfacegeneric_menou2typelog = true
this.webinterfacegeneric_menou2typedir = `${this.webinterfacegeneric_menou_basedir}/${obGUI.menou2url}`
}
}
}
if(obGUI.menou3){
this.webinterfacegeneric_menou3 = true
this.webinterfacegeneric_menou3_text = obGUI.menou3
this.webinterfacegeneric_menou3_url = `${obGUI.menou3server}/${this.webinterfacegeneric_menou_basedir}/${obGUI.menou3url}`
this.webinterfacegeneric_menou1_url_target2 = urlgeniGUI+'_3'
if(obGUI.menou3type == 'log'){
this.webinterfacegeneric_menou3typelog = true
this.webinterfacegeneric_menou3typedir = `${this.webinterfacegeneric_menou_basedir}/${obGUI.menou2url}`
}
}
}
/*
var filterjugeneric = `microservice-firefox`
var grepju1 = new RegExp(filterjugeneric);
if(grepju1.test(data.Networks) && grepju1.test(data.Names)){
this.webinterfacegeneric = true
}else{
this.webinterfacegeneric = false
}
*/
this.addNetworkMenou = false
this.localNetworks = []
this.selectedNetworks = []
this.localNetworkoptions = []
this.localNetworkdefault = ''
//console.log(JSON.stringify(this.hybridshowdata))
// })
})();
})
})
// from available services socket run here
this.$root.$on('hybrid_start_instance', (data) => {
this.swarmlabname = data.swarmlabname
@ -671,6 +844,57 @@ export default {
},
methods: {
async guilogsclose(action){
this.webinterfacegeneric_menou1typelog_active = false
this.webinterfacegeneric_menou2typelog_active = false
this.webinterfacegeneric_menou3typelog_active = false
this.actionrowindexconsole = false
this.$root.$emit('hybrid_show_instance_images','images')
},
async guilogs(action){
var logdatacustom = await store.dispatch("pipelineLLO/getlog4gui",{
token:this.token,
instance:this.webinterfacegeneric_menou2typedir
})
if(!logdatacustom.data.error){
if(logdatacustom.data.log != 'no'){
if(action == 1){
this.webinterfacegeneric_menou1typedir_log = logdatacustom.data.log
this.webinterfacegeneric_menou1typelog_active = true
this.actionrowindexconsole = true
this.$root.$emit('hybrid_show_instance_images','console')
var val = {}
val.data = this.webinterfacegeneric_menou1typedir_log
var log = await store.dispatch("pipelineLLO/getlogs",{
container:this.hybridshowdata.ID
})
this.$root.$emit('hybrid_log_in',val)
}else if(action == 2){
this.webinterfacegeneric_menou2typedir_log = logdatacustom.data.log
this.webinterfacegeneric_menou2typelog_active = true
this.actionrowindexconsole = true
this.$root.$emit('hybrid_show_instance_images','console')
var val = {}
val.data = this.webinterfacegeneric_menou2typedir_log
var log = await store.dispatch("pipelineLLO/getlogs",{
container:this.hybridshowdata.ID
})
this.$root.$emit('hybrid_log_in',val)
}else if(action == 3){
this.webinterfacegeneric_menou3typedir_log = logdatacustom.data.log
this.webinterfacegeneric_menou3typelog_active = true
this.actionrowindexconsole = true
this.$root.$emit('hybrid_show_instance_images','console')
var val = {}
val.data = this.webinterfacegeneric_menou3typedir_log
var log = await store.dispatch("pipelineLLO/getlogs",{
container:this.hybridshowdata.ID
})
this.$root.$emit('hybrid_log_in',val)
}
}
}
},
async updateNetwork(container,action){
// console.log(JSON.stringify(container));
// console.log(JSON.stringify('selected :' + this.selectedNetworks));
@ -929,13 +1153,29 @@ info += '</p>'
}else if(action == 'container-logsclose'){
this.actionrowindexconsole = false
this.$root.$emit('hybrid_show_instance_images','images')
this.webinterfacegeneric_menou1typelog_active = false
this.webinterfacegeneric_menou2typelog_active = false
this.webinterfacegeneric_menou3typelog_active = false
}else if(action == 'startwebgeneric'){
this.$wait.start('myRunInstanceeditor');
var urlgen = this.hybridshowdata.Names.split('_');
//console.log('logs---------- ' + JSON.stringify(this.hybridshowdata))
//console.log('logs---------- ' + JSON.stringify(urlgen[0]))
if(this.swarmlab_services_type == 'swarmlab'){
var log = await store.dispatch("pipelineLLO/rungui",{
instance:urlgen[0]
})
} else if(this.swarmlab_services_type == 'custom'){
var baseservicetmp1as = this.hybridshowdata_user.servicedata.user.split('@')
var baseservicecustomas = `${baseservicetmp1as[0]}-${this.hybridshowdata_user.servicedata.service}`
var guicustom = `community/${this.hybridshowdata_user.servicedata.user}_${this.hybridshowdata_user.servicedata.service}_${this.hybridshowdata_user.servicedata.baseservice}/${baseservicecustomas}`
var log = await store.dispatch("pipelineLLO/runguicustom",{
instance:guicustom,
exec:this.webinterfacegeneric_menou_exec,
id:baseservicecustomas
})
}
this.$wait.end('myRunInstanceeditor');
}else if(action == 'startweb'){
var log = await store.dispatch("pipelineLLO/getjupyterinfo",{
instance:this.hybridshowdata.Names
@ -1175,13 +1415,16 @@ if(pocurlcodeserver != 'no'){
token:this.token,
instance:getcustomnames
})
console.log('---------------------')
console.log(logdatacustom.data)
//console.log('---------------------')
//console.log(logdatacustom.data)
if(logdatacustom.data && logdatacustom.data.data){
// EDITORcustom
var logdatacustomres = JSON.parse(logdatacustom.data.data)
// console.log(JSON.parse(logdatacustom.data.data))
//console.log('------111111111111111---------------')
var swarmlabinstance1cda1 = new RegExp("(->)");
if(swarmlabinstance1cda1.test(this.hybridshowdata.Ports)){
var splitcda1split = this.hybridshowdata.Ports.split(',')

38
src/config/index-gui.js

@ -1,26 +1,64 @@
export const ApiConfigGUI = [
{
"name": "justtemplate",
"automated": true,
"version": 0,
"menou": "xeLatex",
"menou1": "ViewPDF",
"menou1url": "docs/main.pdf",
"menou1server": "http://localhost:3384",
"menou2": "View2",
"menou2url": "docs2/main.pdf",
"menou2type": "log",
"menou2server": "http://localhost:3384",
"menou3": "Compile",
"menou3url": "docs/main111111111111.pdf",
"menou3server": "http://localhost:3384",
"port": 0
},
{
"name": "microservice-firefox",
"automated": true,
"menou": "openGui",
"version": 0,
"port": 0
},
{
"name": "microservice-xelatexthesis",
"automated": true,
"exec": '/bin/sh -c "latex-all"',
"version": 0,
"menou": "Compile",
"menou1": "View-PDF",
"menou1url": "docs/main.pdf",
"menou1server": "http://localhost:3384",
"menou2": "xeLatex-LOG",
"menou2type": "log",
"menou2url": "docs/main.log",
"menou2server": "http://localhost:3394",
"port": 0
},
{
"name": "microservice-wireshark",
"automated": true,
"menou": "openGui",
"version": 0,
"port": 0
},
{
"name": "microservice-oletools",
"automated": true,
"menou": "openGui",
"version": 0,
"port": 0
}

64
src/store/modules/create_pipelineLLO.js

@ -494,6 +494,39 @@ export default {
return R;
}
}
},
async runguicustom({commit,rootGetters}, value) {
//console.log('value '+JSON.stringify(value))
try {
var token = value.token
var params = {
instance: value.instance,
exec: value.exec,
id: value.id
}
var options = {
params: params,
headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` },
};
var sock_server_l = ApiConfig.url_80+'/runguicustom'
var p = await axios.get(sock_server_l,options);
//var p = await axios.get('https://localhost:3000/getservicesinfo',options);
return p
//console.log(JSON.stringify(p))
//console.log(value.token)
//console.log(value.swarmlabname)
} catch (e) {
if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){
//console.log('error '+JSON.stringify(e))
window.location.href = 'https://api-login.swarmlab.io:8089';
}else{
var R = {
ERROR_str: e,
ERROR: 'yes'
}
return R;
}
}
},
async getcustom({commit,rootGetters}, value) {
//console.log('value '+JSON.stringify(value))
@ -777,6 +810,37 @@ export default {
return R;
}
}
},
async getlog4gui({commit,rootGetters}, value) {
//console.log('value '+JSON.stringify(value))
try {
var token = value.token
var params = {
instance: value.instance
}
var options = {
params: params,
headers: { 'content-type': 'application/x-www-form-urlencoded',Authorization: `Bearer ${token}` },
};
var sock_server_l = ApiConfig.url_80+'/getlog4gui'
var p = await axios.get(sock_server_l,options);
//var p = await axios.get('https://localhost:3000/getservicesinfo',options);
return p
//console.log(JSON.stringify(p))
//console.log(value.token)
//console.log(value.swarmlabname)
} catch (e) {
if(e.message == "Request failed with status code 401" || /401/i.test(e.message)){
//console.log('error '+JSON.stringify(e))
window.location.href = 'https://api-login.swarmlab.io:8089';
}else{
var R = {
ERROR_str: e,
ERROR: 'yes'
}
return R;
}
}
},
async chowncustom({commit,rootGetters}, value) {
//console.log('value '+JSON.stringify(value))

Loading…
Cancel
Save