fix deploy stuff

This commit is contained in:
tknew2 2014-06-23 15:10:18 +02:00
parent 7fd1cb1af6
commit f47f7d20b8
4 changed files with 54 additions and 38 deletions

View File

@ -628,8 +628,10 @@ It contains this:
"name" : "API",
"script" : "app.js",
"env": {
"NODE_ENV": "production",
"AWESOME_SERVICE_API_TOKEN": "xxx"
"COMMON_VARIABLE": "true"
},
"env_production" : {
"NODE_ENV": "production"
}
},{
"name" : "WEB",
@ -639,12 +641,14 @@ It contains this:
"production" : {
"user" : "node",
"host" : "212.83.163.1",
"ref" : "origin/master",
"repo" : "git@github.com:repo.git",
"path" : "/var/www/production"
},
"dev" : {
"user" : "node",
"host" : "212.83.163.1",
"ref" : "origin/master",
"repo" : "git@github.com:repo.git",
"path" : "/var/www/development"
}

View File

@ -717,13 +717,19 @@ CLI._reloadProcessName = function (process_name, reload_method, cb) {
/**
* Start or restart|reload|gracefulReload a JSON configuration file
* @param {string} action restart|reload
* @param {string} action restart|reload
* @param {string} json_conf json file path
* @param {string} opts option like environment type and co
* @param {string} opts option like environment type and co
* @callback cb optionnal
*/
CLI._jsonStartOrAction = function(action, json_conf, opts, cb) {
var data = fs.readFileSync(json_conf);
try {
var data = fs.readFileSync(json_conf);
} catch(e) {
printError('Configuration file %s is missing. Action canceled.', json_conf);
return cb ? cb(e) : exitCli(cst.ERROR_EXIT);
}
var appConf = JSON.parse(data);
// v2 JSON declaration
if (appConf.apps) appConf = appConf.apps;
@ -1004,15 +1010,16 @@ CLI._stopAll = function(cb) {
* @param {} name
* @return
*/
CLI._stopProcessName = function(name, cb) { Satan.executeRemote('stopProcessName', name, function(err, list) {
if (err) {
printError(err);
return cb ? cb({msg:err}) : exitCli(cst.ERROR_EXIT);
}
printOut(cst.PREFIX_MSG + 'Stopping process by name ' + name);
return cb ? cb(null, list) : speedList();
});
};
CLI._stopProcessName = function(name, cb) {
Satan.executeRemote('stopProcessName', name, function(err, list) {
if (err) {
printError(err);
return cb ? cb({msg:err}) : exitCli(cst.ERROR_EXIT);
}
printOut(cst.PREFIX_MSG + 'Stopping process by name ' + name);
return cb ? cb(null, list) : speedList();
});
};
/**
* Description
@ -1020,15 +1027,16 @@ CLI._stopProcessName = function(name, cb) { Satan.executeRemote('stopProcessName
* @param {} pm2_id
* @return
*/
CLI._stopId = function(pm2_id, cb) { Satan.executeRemote('stopProcessId', pm2_id, function(err, list) {
if (err) {
printError(err);
return cb ? cb({msg:err}) : exitCli(cst.ERROR_EXIT);
}
printOut(cst.PREFIX_MSG + ' Process stopped');
return cb ? cb(null, list) : speedList();
});
};
CLI._stopId = function(pm2_id, cb) {
Satan.executeRemote('stopProcessId', pm2_id, function(err, list) {
if (err) {
printError(err);
return cb ? cb({msg:err}) : exitCli(cst.ERROR_EXIT);
}
printOut(cst.PREFIX_MSG + ' Process stopped');
return cb ? cb(null, list) : speedList();
});
};
/**
* Description
@ -1038,12 +1046,11 @@ CLI._stopId = function(pm2_id, cb) { Satan.executeRemote('stopProcessId', pm2_id
*/
CLI.generateSample = function() {
var sample = fs.readFileSync(path.join(__dirname, cst.SAMPLE_FILE_PATH));
var dt = sample.toString();
var dt = sample.toString();
var f_name = 'ecosystem.json';
fs.writeFileSync(path.join(process.env.PWD, f_name), dt);
printOut('Sample generated on current folder\n%s :\n', f_name);
printOut(dt);
printOut('File %s generated', path.join(process.env.PWD, f_name));
exitCli(cst.SUCCESS_EXIT);
};
@ -1052,14 +1059,15 @@ CLI.generateSample = function() {
* @method list
* @return
*/
CLI.list = function(cb) { Satan.executeRemote('getMonitorData', {}, function(err, list) {
if (err) {
printError(err);
return cb ? cb({msg:err}) : exitCli(cst.ERROR_EXIT);
}
return cb ? cb(null, list) : speedList();
});
};
CLI.list = function(cb) {
Satan.executeRemote('getMonitorData', {}, function(err, list) {
if (err) {
printError(err);
return cb ? cb({msg:err}) : exitCli(cst.ERROR_EXIT);
}
return cb ? cb(null, list) : speedList();
});
};
/**
* Description

View File

@ -3,10 +3,12 @@
"name" : "API",
"script" : "app.js",
"env": {
"NODE_ENV": "production",
"AWESOME_SERVICE_API_TOKEN": "xxx"
"COMMON_VARIABLE": "true"
},
"env_production" : {
"NODE_ENV": "production"
}
}, {
},{
"name" : "WEB",
"script" : "web.js"
}],
@ -14,12 +16,14 @@
"production" : {
"user" : "node",
"host" : "212.83.163.1",
"ref" : "origin/master",
"repo" : "git@github.com:repo.git",
"path" : "/var/www/production"
},
"dev" : {
"user" : "node",
"host" : "212.83.163.1",
"ref" : "origin/master",
"repo" : "git@github.com:repo.git",
"path" : "/var/www/development"
}

View File

@ -107,7 +107,7 @@
"pm2-multimeter": "~0.1.2",
"pm2-interface": "~0.1.3",
"pm2-axon-rpc": "~0.0.2",
"pm2-deploy" : "~0.0.3",
"pm2-deploy" : "~0.0.4",
"axon": "~1.0.0",
"cron": "~1.0.4",
"colors": "~0.6.2",