Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion server/app/lib/utils/masterUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -2617,7 +2617,8 @@ var MasterUtil = function () {
});
};
this.getSensuCookbooks = function(){
var cookbooks = ['recipe[sensu-client]','recipe[sensu_check_load]','recipe[sensu_check_disk]','recipe[sensu_check_cpu]','recipe[sensu_check_memory]','recipe[consul-client-demo]'];
//var cookbooks = ['recipe[sensu-client]','recipe[sensu_check_load]','recipe[sensu_check_disk]','recipe[sensu_check_cpu]','recipe[sensu_check_memory]','recipe[consul-client-demo]'];
var cookbooks = ['recipe[sensu-client]','recipe[consul-client-demo]','recipe[cft-rlc-demo]'];
return cookbooks;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -785,12 +785,29 @@ CloudFormationBlueprintSchema.methods.launch = function (launchParams, callback)
}
if(launchParams.orgName)
{
launchParams.monitor.parameters.orgName = launchParams.orgName;
var orgNameString = launchParams.orgName;
if(Array.isArray(orgNameString))
orgNameString = orgNameString[0];
launchParams.monitor.parameters.orgName = orgNameString;
//Adding to sensu-client cookbook attribute.
jsonAttributes['sensu-client'] = {
"check-tenant-id": orgNameString
}
}
//jsonAttributes['sensu-client'] = masterUtil.getSensuCookbookAttributes(launchParams.monitor, instance.id);
//Changed based on new sensu and consul server configurations.
jsonAttributes['consul-client-demo'] = masterUtil.getSensuCookbookAttributes(launchParams.monitor, instance.id);
}
//Adding ipAddress to Attributes of all instances. Required only for the demo cookbook
var ipAddresses = [];
for (var x = 0; x < instances.length; x++) {
ipAddresses.push(instances[x].PrivateIpAddress);
}
ipAddresses = ipAddresses.join(',');
jsonAttributes['cft-rlc-demo'] = {
"ipAddresses":ipAddresses
}
logger.debug('Attributes: ', JSON.stringify(jsonAttributes));

logger.debug("runlist: ", JSON.stringify(runlist));
launchParams.infraManager.bootstrapInstance({
Expand Down
89 changes: 46 additions & 43 deletions server/app/services/blueprintService.js
Original file line number Diff line number Diff line change
Expand Up @@ -407,49 +407,52 @@ blueprintService.launch = function launch(blueprintId,reqBody, callback) {
Array.isArray(instId) ? instanceXId = instId[0] : instanceXId=results.id
var instancePollObject = setInterval(()=> {
instancesDao.getInstanceById(instanceXId, (err, resultx)=> {
if(err) cbx(err)
else{
var result = resultx[0]
if(result.instanceState === 'running' && !jobDone)
{
logger.info('Blueprint succesfully launched and bootstrapped')
jobDone = true
clearInterval(instancePollObject)
async.each(result.appUrls, (urlObj, cb)=> {
var hcUrl = urlObj.url
var hcMod = hcUrl.replace('$host',result.instanceIP)
logger.info('HEALTH CHECK URL '+ hcMod)
var intervalBusService = setInterval(()=> {
commandCentre.createBusinessService(hcMod, result.chefNodeName, result.chefNodeName, result.chefNodeName, (error, res) => {

if(!error){
clearInterval(intervalBusService)
logger.info('Business service event in DBoard triggered successfully for '+ result.instanceIP)
cb()
}
else{
logger.info(JSON.stringify(error))
}
})
}, 3000, 5)
}, (err)=> {
if(!err){
logger.info('Business Services set created successfully')
}
else{
logger.info('No response from Command Center. Giving Up')
}
})
}
else if (result.instanceState === 'failed'){
jobDone = true
logger.info('Blueprint launch failed')
logger.info(result.body)
clearInterval(instancePollObject)
}
}
})
}, 10000)
if(err) cbx(err)
else {
var result = resultx[0];
if(result){
if (result.instanceState) {

if (result.instanceState === 'running' && !jobDone) {
logger.info('Blueprint succesfully launched and bootstrapped')
jobDone = true
clearInterval(instancePollObject)
async.each(result.appUrls, (urlObj, cb) => {
var hcUrl = urlObj.url
var hcMod = hcUrl.replace('$host', result.instanceIP)
logger.info('HEALTH CHECK URL ' + hcMod)
var intervalBusService = setInterval(() => {
commandCentre.createBusinessService(hcMod, result.chefNodeName, result.chefNodeName, result.chefNodeName, (error, res) => {
if (!error) {
clearInterval(intervalBusService)
logger.info('Business service event in DBoard triggered successfully for ' + result.instanceIP)
cb()
}
else {
logger.info(JSON.stringify(error))
}
})
}, 3000, 5)
}, (err) => {
if (!err) {
logger.info('Business Services set created successfully')
}
else {
logger.info('No response from Command Center. Giving Up')
}
})
}
else if (result.instanceState === 'failed') {
jobDone = true
logger.info('Blueprint launch failed')
logger.info(result.body)
clearInterval(instancePollObject)
}
}
}
}
})
}, 10000)
callback(null, results);
return;
}
Expand Down
12 changes: 11 additions & 1 deletion server/app/services/schedulerService.js
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,17 @@ function startStopManagedInstance(instance,catUser,action,callback){
callback(err);
return;
}
callback(null, keyPair[0].region);
//Fix for additional regions added for provider - Vinod
var foundRegion = false;
for(var p = 0; p < keyPair.length; p++){
if(keyPair[p].region == instance.region){
foundRegion = true;
callback(null, keyPair[p].region);

}
}
if(!foundRegion) //to support old flow.
callback(null, keyPair[0].region);
});
}
}
Expand Down
8 changes: 7 additions & 1 deletion server/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,9 @@ function getDefaultsConfig() {
regions: [{
region_name: "US East (N. Virginia)",
region: "us-east-1"
},{
region_name: "US East (Ohio)",
region: "us-east-2"
}, {
region_name: "US West (Oregon)",
region: "us-west-2"
Expand Down Expand Up @@ -249,7 +252,7 @@ function getDefaultsConfig() {
NetworkOut: 'MB'
},
costData:{
regions:['us-east-1','us-west-2','us-west-1','eu-west-1','eu-central-1','ap-southeast-1','ap-northeast-1','ap-southeast-2','sa-east-1'],
regions:['us-east-1','us-east-2','us-west-2','us-west-1','eu-west-1','eu-central-1','ap-southeast-1','ap-northeast-1','ap-southeast-2','sa-east-1'],
productName1:['Amazon Elastic Compute Cloud','Amazon RDS Service','Amazon Redshift','Amazon ElastiCache'],
productName2:['Amazon CloudFront','Amazon Route 53','Amazon Simple Storage Service','Amazon Virtual Private Cloud']
},
Expand All @@ -258,6 +261,9 @@ function getDefaultsConfig() {
'us-east-1': {
name: 'US East (N. Virginia)'
},
'us-east-2': {
name: 'US East (Ohio)'
},
'us-west-1': {
name: 'US West (N. California)'
},
Expand Down