diff --git a/files/mongo/docker-compose.yml b/files/mongo/docker-compose.yml index f3b410e..e4a30b8 100644 --- a/files/mongo/docker-compose.yml +++ b/files/mongo/docker-compose.yml @@ -26,6 +26,7 @@ services: swlabadminvenus: hostname: 'swlabadminvenus' + container_name: 'swlabadminvenus' image: 'hub.swarmlab.io:5480/venus-admin:latest' entrypoint: /bin/bash -c "tail -f /dev/null" user: root diff --git a/llo/connect-new.js b/llo/connect-new.js index a0e4a03..f4b422b 100644 --- a/llo/connect-new.js +++ b/llo/connect-new.js @@ -522,7 +522,7 @@ function myserverStatus(){ var mongoserver = JSON.parse(fs.readFileSync('./hybrid/venus-stats/config.json', 'utf8')) var mypath = process.cwd() - var showexec = `./hybrid/scripts/check-wg-connection.sh` + var showexec = `docker exec swlabadminvenus /bin/bash -c "/usr/local/bin/check-wg-connection.sh"` log = spawn(showexec, { shell: true, cwd: mypath, @@ -544,14 +544,28 @@ function myserverStatus(){ var resprivatekey = interfaces[i].ip; var respublickey = interfaces[i].publickey; var bootstrapstackid = interfaces[i].stackid; - if(intconnection == 'no'){ - var nn = {} - nn.connection = interfaces[i].connection; - nn.AllowedIPs = interfaces[i].ip; - nn.publickey = interfaces[i].publickey; - nn.bootstrapstackid = interfaces[i].stackid; - console.log('no connection '+JSON.stringify(nn)); - } + if(intconnection == 'no'){ + var nn = {} + nn.connection = interfaces[i].connection; + nn.AllowedIPs = interfaces[i].ip; + nn.publickey = interfaces[i].publickey; + nn.bootstrapstackid = interfaces[i].stackid; + console.log('no connection '+JSON.stringify(nn)); + var wgdown = `/bin/bash /config/${nn.bootstrapstackid}/ifdown_linux` + var showexec1 = `docker exec swlabadminvenus /bin/bash -c "${wgdown}"` + log1 = spawn(showexec1, { + shell: true, + cwd: mypath, + detached: false, + stdio: 'pipe' + }); + log1.on('close', function (code) { + console.log('close1 '+JSON.stringify(code)); + var n = {} + n.data = code + io.emit('message_close', n); + }); + } } });