Browse Source

stop edit sidecar

master
zeus 3 years ago
parent
commit
5fa790a707
  1. 2
      dist/index.html
  2. 2
      dist/js/app.c94ad443.js
  3. 1
      dist/js/app.c94ad443.js.map
  4. 2
      dist/js/app.fe2236d7.js
  5. 1
      dist/js/app.fe2236d7.js.map
  6. 49
      src-local/llo/new.js
  7. 36
      src-local/stop-sidecar-edit-service.sh
  8. 10
      src-local/swarmlab_editor_service.sh
  9. 3
      src/components/mynetwork/availablemicroservices.vue
  10. 12
      src/components/mynetwork/mytable.vue
  11. 9
      src/config/index-web.js

2
dist/index.html

@ -1 +1 @@
<!DOCTYPE html><html lang=""><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.25658f84.css" rel="preload" as="style"><link href="/css/chunk-vendors.e469b508.css" rel="preload" as="style"><link href="/js/app.c94ad443.js" rel="preload" as="script"><link href="/js/chunk-vendors.d8d18fe6.js" rel="preload" as="script"><link href="/css/chunk-vendors.e469b508.css" rel="stylesheet"><link href="/css/app.25658f84.css" rel="stylesheet"></head><body><div id="app"></div><script src="/js/chunk-vendors.d8d18fe6.js"></script><script src="/js/app.c94ad443.js"></script></body></html>
<!DOCTYPE html><html lang=""><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.25658f84.css" rel="preload" as="style"><link href="/css/chunk-vendors.e469b508.css" rel="preload" as="style"><link href="/js/app.fe2236d7.js" rel="preload" as="script"><link href="/js/chunk-vendors.d8d18fe6.js" rel="preload" as="script"><link href="/css/chunk-vendors.e469b508.css" rel="stylesheet"><link href="/css/app.25658f84.css" rel="stylesheet"></head><body><div id="app"></div><script src="/js/chunk-vendors.d8d18fe6.js"></script><script src="/js/app.fe2236d7.js"></script></body></html>

2
dist/js/app.c94ad443.js

File diff suppressed because one or more lines are too long

1
dist/js/app.c94ad443.js.map

File diff suppressed because one or more lines are too long

2
dist/js/app.fe2236d7.js

File diff suppressed because one or more lines are too long

1
dist/js/app.fe2236d7.js.map

File diff suppressed because one or more lines are too long

49
src-local/llo/new.js

@ -101,6 +101,7 @@ socket.on('disconnect', reason => {
var server = http.createServer(app);
const io = require("socket.io")(server, {
//pingInterval: 25000,
reconnectionDelay: 5000,
reconnectionDelayMax: 5000,
pingTimeout: 90000, // default value is 10000ms, try changing it to 20k or more
@ -2780,28 +2781,44 @@ SWARMLAB_STORAGE_PASSWORD=${service_password}
});
socket.on('stop', (service) => {
var services_path = './instance/'+service+'/'+service
const stop = spawn('/bin/sh ./stop.sh', {
var services_pathexec = process.cwd()
var stopeditexec = `/bin/bash ./stop-sidecar-edit-service.sh ${service}`
const stopedit = spawn(stopeditexec, {
stdio: 'pipe',
shell: true,
cwd: services_path
});
stop.stdout.on('data', function (data) {
var n = {}
n.data = data.toString()
io.emit('message_out', n);
cwd: services_pathexec
});
stopedit.on('close', function (code) {
// var n = {}
// n.data = code
// io.emit('message_close', n);
const stop = spawn('/bin/sh ./stop.sh', {
stdio: 'pipe',
shell: true,
cwd: services_path
});
stop.stdout.on('data', function (data) {
var n = {}
n.data = data.toString()
io.emit('message_out', n);
});
stop.stderr.on('data', function (data) {
var n = {}
n.data = data.toString()
io.emit('message_err', n);
});
stop.stderr.on('data', function (data) {
var n = {}
n.data = data.toString()
io.emit('message_err', n);
});
stop.on('close', function (code) {
var n = {}
n.data = code
io.emit('message_close', n);
});
stop.on('close', function (code) {
var n = {}
n.data = code
io.emit('message_close', n);
});
});

36
src-local/stop-sidecar-edit-service.sh

@ -0,0 +1,36 @@
#!/bin/bash
if [[ $# -eq 0 ]] ; then
echo 'no service'
exit 1
fi
if [[ -z "$1" ]] ; then
echo 'no service'
exit 1
fi
service=$1
serviceeditororig=${service//_}
serviceeditororig=${service//-}
docker ps --format '{{.Names}}' | {
while read i; do
var=$i
# remove leading whitespace characters
var="${var#"${var%%[![:space:]]*}"}"
# remove trailing whitespace characters
var="${var%"${var##*[![:space:]]}"}"
serviceeditor=${var//_}
serviceeditor=${serviceeditor//-}
if [ "edit${serviceeditororig}masterservice1" == "$serviceeditor" ]; then
echo "stop sidecar instance ${serviceeditor} ";
docker stop edit_${serviceeditororig}masterservice1
docker container rm edit_${serviceeditororig}masterservice1
fi
done
}

10
src-local/swarmlab_editor_service.sh

@ -41,11 +41,13 @@ fi
R_PORT1=$2
service=$1
#string=$(tr -dc A-Za-z0-9 </dev/urandom | head -c 13 ; echo '')
serviceeditor=${service//_}
serviceeditor=${serviceeditor//-}
xhost +local:docker
docker stop edit_$service
docker container rm edit_$service
docker run --rm --volumes-from $service -p $R_PORT1:8080 -e TZ=Europe/Athens -e DISPLAY=$DISPLAY -v $(pwd)/swarmlab_editor_service:/tmp/start -v /tmp/.X11-unix:/tmp/.X11-unix --name edit_$service hub.swarmlab.io:5480/swarmlab-codeserver /bin/bash -c "echo \"start:${service}\"; /tmp/start"
docker stop edit_${serviceeditor}
docker container rm edit_${serviceeditor}
docker run --rm --volumes-from $service -p $R_PORT1:8080 -e TZ=Europe/Athens -e DISPLAY=$DISPLAY -v $(pwd)/swarmlab_editor_service:/tmp/start -v /tmp/.X11-unix:/tmp/.X11-unix --name edit_${serviceeditor} hub.swarmlab.io:5480/swarmlab-codeserver /bin/bash -c "echo \"start:${service}\"; /tmp/start"

3
src/components/mynetwork/availablemicroservices.vue

@ -431,7 +431,7 @@ export default {
//console.log('resiiiiiiii yes '+JSON.stringify(this.testactionrowindex[index]))
}else{
//Vue.delete(this.testactionrowindex, index)
console.log('resi NO2 '+JSON.stringify(res))
//console.log('resi NO2 '+JSON.stringify(res))
}
}
//console.log('string YES '+JSON.stringify(this.testactionrowindex))
@ -641,6 +641,7 @@ export default {
var value = this.hybridoptions.swarmlabname
await this.$root.$emit('hybrid_stop_instance', value)
Vue.delete(this.testactionrowindex, this.hybridoptions.index)
//console.log('down service '+ JSON.stringify(this.hybridoptions.index))
//Vue.nextTick( () => this.$refs.vuetable.refresh())
this.refreshVuetable()
}else {

12
src/components/mynetwork/mytable.vue

@ -395,7 +395,7 @@ export default {
if(grepju.test(data.Networks) && grepju.test(data.Names)){
this.webinterface = true
this.webinterface_port = data.Ports
console.log(JSON.stringify(this.webinterface_port))
//console.log(JSON.stringify(this.webinterface_port))
}else{
this.webinterface = false
this.webinterface_port = ''
@ -432,7 +432,7 @@ export default {
this.selectedNetworks = []
this.localNetworkoptions = []
this.localNetworkdefault = ''
console.log(JSON.stringify(this.hybridshowdata))
//console.log(JSON.stringify(this.hybridshowdata))
})
})
// from available services socket run here
@ -644,7 +644,7 @@ export default {
})
//console.log('start editor-------- ' + JSON.stringify(this.hybridshowdata.Names))
//console.log('start token-------- ' + JSON.stringify(log.data.port))
console.log('start editor-------- ' + JSON.stringify(log))
// console.log('start editor-------- ' + JSON.stringify(log))
this.$root.$emit('SERVER_hybrid_table_stop')
@ -1071,6 +1071,7 @@ info +='This permits the docker user on the local machine to connect to X window
// refresh adhocview.vue on console await
this.$root.$emit('SERVER_hybrid_table_start')
this.$socket.client.emit('container-stop', this.swarmlabname, this.hybridshowdata.ID);
//console.log('socket instance container-stop '+ this.swarmlabname +' '+ this.hybridshowdata.ID )
}else if(action == 'create-wirequard'){
//this.CONFIGprivatekey = value.privatekey
//this.CONFIGpublickey = value.publickey
@ -1079,6 +1080,7 @@ info +='This permits the docker user on the local machine to connect to X window
this.$socket.client.emit('create-wirequard', this.token);
}else if(action == 'stop'){
this.$socket.client.emit('stop', this.swarmlabname);
//console.log('socket instance container-stop passed from services '+ this.swarmlabname )
}
},
async socketopen () {
@ -1385,7 +1387,7 @@ info +='This permits the docker user on the local machine to connect to X window
this.$root.$emit('hybrid_log_in',val)
},
async message_close(val) {
console.log(" socket close "+JSON.stringify(val))
//console.log(" socket close "+JSON.stringify(val))
// Error in event handler for "hybrid_log_in": "TypeError: child is undefined"
// data: 0 gia na doume ean ine afto
// to lathos exafanistike
@ -1433,7 +1435,7 @@ info +='This permits the docker user on the local machine to connect to X window
},
async message_exec_editor(val) {
// refresh table hybrid storage
console.log(" socket out editor "+JSON.stringify(val))
//console.log(" socket out editor "+JSON.stringify(val))
if(val.start){
this.$root.$emit('SERVER_hybrid_table_stop')
this.editor_instance.start=val.start

9
src/config/index-web.js

@ -73,4 +73,13 @@ export const ApiConfigWEB = [
"ttydport": "3787/tcp",
"ttydurl": 'http'
},
{
"name": "microservice-numpylite",
"app": false,
"url": 'http',
"port": "80/tcp",
"ttyd": true,
"ttydport": "3787/tcp",
"ttydurl": 'http'
}
];

Loading…
Cancel
Save