Selaa lähdekoodia

Elxr start and stop for server and client

master
guest 2 vuotta sitten
vanhempi
commit
3c9786d8f6
1 muutettua tiedostoa jossa 23 lisäystä ja 49 poistoa
  1. 23
    49
      index.js

+ 23
- 49
index.js Näytä tiedosto



} }
, 'start': (args) => { , 'start': (args) => {
// Usage : elxr start {{instanceName=elixir}} {{all||server||client||{{microserviceName=elixir||express}}}}


var label = clioverrides.cmd var label = clioverrides.cmd
var env = Object.assign({}, process.env); // Shallow clone it. var env = Object.assign({}, process.env); // Shallow clone it.
if(clioverrides.node_env === 'development') { if(clioverrides.node_env === 'development') {
env.DEBUG = 'loopback:connector:' + dbForLabel(label) env.DEBUG = 'loopback:connector:' + dbForLabel(label)
startFn( { debugport : 9228, script : 'elixir/server.js', name : 'Elixir Loopback Server', path : '/' + 'elixir-server'
, pidstore : '.express.server.pid'
} )
startFn( { debugport : 9227, script : 'bin/www', name : 'Express Server', path : '/' + 'chess-server-lib/server'
, pidstore : '.elixir-server.elixir.server.pid'
} )
if(!processedArgs._[2]) processedArgs._[2] = 'all'
if(processedArgs._[2] === 'server' || processedArgs._[2] === 'all'
|| processedArgs._[2] === 'elixir' // specific microservice name.
) {
startFn( { debugport : 9228, script : 'elixir/server.js', name : 'Elixir Loopback Server', path : '/' + 'elixir-server'
, pidstore : '.elixir-server.elixir.server.pid'
} )
}
if(processedArgs._[2] === 'server' || processedArgs._[2] === 'all'
|| processedArgs._[2] === 'express' // specific microservice name.
) {
startFn( { debugport : 9227, script : 'bin/www', name : 'Express Server', path : '/' + 'chess-server-lib/server'
, pidstore : '.express.server.pid'
} )
}
// cmd = 'node'()

// nodeShellExec('node', ['--inspect=9226', ' bin/www'], {
// inherit : true,
// shell: true, detached: true,
// cwd : 'qms/server',
// env: env,
// shell : true
// })

// nodeShellExec('ember', ['s'], {
// // inherit : true,
// shell: true, detached: true,
// cwd : 'client/',
// env: env
// })
startFn( {
name : 'Elixir Ember Client', path : '/' + 'client'
, cmd : ['node_modules/ember-cli/bin/ember', ['s']]
, pidstore : '.client.server.pid'
} )

// console.log('Starting Elixir Ember Client');
// var cmd = ['ember', ['s']]
// var childPromise = nodeShellExec(...cmd, {
// // var childPromise = nodeShellExec('node', ['--inspect=9227', './node_modules/.bin/ember', 's'], {
// // PB : TODO -- ember debugging.
// // inherit : true,
// shell: true,
// detached: true,
// stdio: 'ignore',
// cwd: instanceroot + '/' + 'client'
// , env: env
// })
// // .catch(e=>console.error(e))

// child = childPromise.process;
// if (typeof child.pid !== 'undefined') {
// console.log(`started Elixir Client Host PID(${child.pid}) : NODE_ENV=${process.NODE_ENV} ${cmd}`);
// fs.writeFileSync('.client.server.pid', '' + child.pid, {
// encoding: 'utf8'
// })
// }
if(processedArgs._[2] === 'client' || processedArgs._[2] === 'all') {
startFn( {
name : 'Elixir Ember Client', path : '/' + 'client'
, cmd : ['node_modules/ember-cli/bin/ember', ['s']]
, pidstore : '.client.server.pid'
} )
}
} }


} }

Loading…
Peruuta
Tallenna