Browse Source

admin

master
zeus 3 years ago
parent
commit
27076014f8
  1. 2
      dist/index.html
  2. 2
      dist/js/app.183d7804.js
  3. 1
      dist/js/app.183d7804.js.map
  4. 2
      dist/js/app.52e9c83b.js
  5. 1
      dist/js/app.52e9c83b.js.map
  6. 9
      files/Dockerfile
  7. 10
      run.yml
  8. 58
      src-local/llo/new.js
  9. 4
      src/components/mynetwork/availablemicroservices.vue
  10. 4
      src/components/mynetwork/mytable.vue
  11. 31
      src/store/modules/create_pipelineLLO.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.52e9c83b.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.52e9c83b.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.183d7804.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.183d7804.js"></script></body></html>

2
dist/js/app.183d7804.js

File diff suppressed because one or more lines are too long

1
dist/js/app.183d7804.js.map

File diff suppressed because one or more lines are too long

2
dist/js/app.52e9c83b.js

File diff suppressed because one or more lines are too long

1
dist/js/app.52e9c83b.js.map

File diff suppressed because one or more lines are too long

9
files/Dockerfile

@ -0,0 +1,9 @@
FROM hub.swarmlab.io:5480/venus-admin:latest
ARG USER_NAME
ARG USER_ID
ARG GROUP_ID
ARG GROUP_NAME
RUN addgroup -g ${GROUP_ID} ${GROUP_NAME} && adduser -S ${USER_NAME} -u ${USER_ID} -G ${GROUP_NAME} ${USER_NAME}

10
run.yml

@ -102,7 +102,14 @@ services:
swarmlabadmin: swarmlabadmin:
container_name: 'swarmlabadmin' container_name: 'swarmlabadmin'
image: 'hub.swarmlab.io:5480/venus-admin:latest' build:
context: .
dockerfile: files/Dockerfile
args:
USER_ID: ${USER_ID}
USER_NAME: ${USER_NAME}
GROUP_ID: ${GROUP_ID}
GROUP_NAME: ${GROUP_NAME}
entrypoint: /bin/bash -c "tail -f /dev/null" entrypoint: /bin/bash -c "tail -f /dev/null"
user: root user: root
network_mode: host network_mode: host
@ -113,7 +120,6 @@ services:
- /lib/modules:/lib/modules - /lib/modules:/lib/modules
- ${nodepath}/src-local/instance:/instance - ${nodepath}/src-local/instance:/instance
networks: networks:
hybrid-net: hybrid-net:

58
src-local/llo/new.js

@ -1689,8 +1689,8 @@ app.get('/chown', (req, res, next) => {
RES.instance = req.query["instance"] RES.instance = req.query["instance"]
RES.error = false RES.error = false
RES.error_msg = "ok" RES.error_msg = "ok"
//var showexec = `docker exec swarmlabadmin /bin/bash -c "chown -R ${runuser}:${runuser} /instance/${RES.instance}/${RES.instance}"` var showexec = `docker exec swarmlabadmin /bin/bash -c "chown -R ${runuser}:${runuser} /instance/${RES.instance}/${RES.instance}"`
var showexec = `docker exec swarmlabadmin /bin/bash -c "chown -R root:root /instance/${RES.instance}/${RES.instance}"` //var showexec = `docker exec swarmlabadmin /bin/bash -c "chown -R root:root /instance/${RES.instance}/${RES.instance}"`
//console.log(showexec) //console.log(showexec)
try { try {
log = spawn(showexec, { log = spawn(showexec, {
@ -1731,6 +1731,60 @@ app.get('/chown', (req, res, next) => {
} }
}); });
app.get('/checkowner', (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 = `./instance/${RES.instance}/${RES.instance}`
if (fs.existsSync(instancedir)) {
var showexec = `docker exec swarmlabadmin /bin/bash -c "chown -R ${runuser}:${runuser} /instance/${RES.instance}/${RES.instance}"`
try {
log = spawn(showexec, {
shell: true,
//cwd: services_path,
detached: false,
stdio: 'pipe'
});
log.stdout.on('data', function (data) {
var n = {}
n.data = data.toString()
io.emit('message_out', n);
});
log.stderr.on('data', function (data) {
var n = {}
n.data = data.toString()
io.emit('message_err', n);
});
log.on('close', function (code) {
var n = {}
n.data = code
io.emit('message_close', n);
n.start = `${RES.instance}`
RES.error = false
RES.error_msg = 'ok'
RES.data = n.data
res.json(RES)
});
} catch (error) {
console.log('Error:', error);
RES.error = true
RES.error_msg = error
RES.data = 'no'
res.json(RES)
}
}else{
RES.error = false
RES.error_msg = 'nodir'
RES.data = 'no'
res.json(RES)
}
});
app.get('/runbackup', (req, res, next) => { app.get('/runbackup', (req, res, next) => {

4
src/components/mynetwork/availablemicroservices.vue

@ -567,6 +567,10 @@ export default {
value.git = swarmlab1info value.git = swarmlab1info
//console.log('inf git 1 '+ JSON.stringify(swarmlab1info)) //console.log('inf git 1 '+ JSON.stringify(swarmlab1info))
//console.log('inf '+ JSON.stringify(value)) //console.log('inf '+ JSON.stringify(value))
var log = await store.dispatch("pipelineLLO/checkowner",{
token:this.token,
instance:this.hybridoptions.swarmlabname
})
this.$root.$emit('hybrid_install_instance', value) this.$root.$emit('hybrid_install_instance', value)
this.$wait.end('myRunInstancetutor'); this.$wait.end('myRunInstancetutor');
//Vue.nextTick( () => this.$refs.vuetable.refresh()) //Vue.nextTick( () => this.$refs.vuetable.refresh())

4
src/components/mynetwork/mytable.vue

@ -1357,7 +1357,7 @@ info +='This permits the docker user on the local machine to connect to X window
var cwdservice = val.service var cwdservice = val.service
//console.log(" path "+JSON.stringify(cwdpath)) //console.log(" path "+JSON.stringify(cwdpath))
//console.log(" path-------- "+JSON.stringify(val)) //console.log(" path-------- "+JSON.stringify(val))
var errorrun = "<b>error checking context:</b> 'no permission to read from '... ./src-local/instance/microservice-mongoserver/microservice-mongoserver/data/WiredTiger'" var errorrun = "<b>error checking context:</b> 'no permission to read from ..."
var info=`<h5><b>You might see an error message:</b></h5><br> var info=`<h5><b>You might see an error message:</b></h5><br>
<samp> ${errorrun} </samp> <samp> ${errorrun} </samp>
<br> <br>
@ -1366,7 +1366,7 @@ info +='This permits the docker user on the local machine to connect to X window
<br> <br>
<br> ` <br> `
info +='<p class="text-success">' info +='<p class="text-success">'
info += 'sudo chown -R $USER.$USER '+cwdpath + '/instance/'+cwdservice+'/'+cwdservice+'/data' info += 'sudo chown -R $USER.$USER '+cwdpath + '/instance/'+cwdservice+'/'+cwdservice
info +='</p>' info +='</p>'
info +='<br> <br> <b>and try again</b> <br>' info +='<br> <br> <b>and try again</b> <br>'

31
src/store/modules/create_pipelineLLO.js

@ -429,6 +429,37 @@ export default {
return R; return R;
} }
} }
},
async checkowner({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+'/checkowner'
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 runbackup({commit,rootGetters}, value) { async runbackup({commit,rootGetters}, value) {
//console.log('value '+JSON.stringify(value)) //console.log('value '+JSON.stringify(value))

Loading…
Cancel
Save