...
|
...
|
@@ -483,60 +483,14 @@ function deploy(ips){ |
|
|
}
|
|
|
|
|
|
writeToText(">>>正在部署系统,请稍后..."+scalingGroupName);
|
|
|
if(scalingGroupName.indexOf("nginx")>=0){
|
|
|
writeToText(">>>nginx项目,请稍后...");
|
|
|
var nginxPushParam={};
|
|
|
if(scalingGroupName.toUpperCase().indexOf("PCH5")>=0){
|
|
|
nginxPushParam.type=2;
|
|
|
}else{
|
|
|
nginxPushParam.type=1;
|
|
|
}
|
|
|
|
|
|
if($("#cloudType").val()==2){
|
|
|
nginxPushParam.select=2;//qcloud伸缩
|
|
|
}else{
|
|
|
nginxPushParam.select=3;//aws上的nginx伸缩
|
|
|
}
|
|
|
|
|
|
$.ajax({
|
|
|
url: contextPath + "nginxSync/pushTask",
|
|
|
type: "post",
|
|
|
dataType: "json",
|
|
|
data: nginxPushParam,
|
|
|
success: function (response) {
|
|
|
var intervalNginx = setInterval(function () {
|
|
|
$.ajax({
|
|
|
url: contextPath + "nginxSync/getTaskLog",
|
|
|
type: 'POST',
|
|
|
dataType: 'json',
|
|
|
data: {
|
|
|
taskId: response.data.taskId
|
|
|
},
|
|
|
success: function (data3) {
|
|
|
//console.log(data3);
|
|
|
var messagedata = data3.data;
|
|
|
var logList = messagedata.log;
|
|
|
if (logList != "") {
|
|
|
writeToText(logList);
|
|
|
}
|
|
|
//code为2 ,则结束
|
|
|
var code = messagedata.isFinished;
|
|
|
if (code == 1) {
|
|
|
clearInterval(intervalNginx);
|
|
|
writeToText("完毕..........");
|
|
|
|
|
|
}
|
|
|
},
|
|
|
error: function (e) {
|
|
|
requestError(url);
|
|
|
}
|
|
|
});
|
|
|
}, 3000);
|
|
|
},
|
|
|
error: function (e) {
|
|
|
requestError(url);
|
|
|
}
|
|
|
});
|
|
|
if(scalingGroupName=="PCH5-memcache"){
|
|
|
//pch5的memcache:获得镜像机器之后,把ips保存到mobject_info(监控对象)和internal_domain
|
|
|
updateMemcacheInfo("PC/H5");
|
|
|
}else if(scalingGroupName=="java-gateway-memcache"){
|
|
|
//java-gateway的memcache:获得镜像机器之后,把ips保存到mobject_info(监控对象)和internal_domain
|
|
|
updateMemcacheInfo("java");
|
|
|
}else if(scalingGroupName.indexOf("nginx")>=0){
|
|
|
updateNginxInfo();
|
|
|
}else if(scalingGroupName.indexOf("ELASTICSEARCH")>=0){
|
|
|
//伸缩ELASTICSEARCH机器
|
|
|
updateEsConfig();
|
...
|
...
|
@@ -558,6 +512,121 @@ function deploy(ips){ |
|
|
}
|
|
|
}
|
|
|
|
|
|
function updateMemcacheInfo(memcacheType){
|
|
|
var paramFront={};
|
|
|
paramFront.newInstanceIps = newInstanceIps;
|
|
|
paramFront.cloudType=$("#cloudType").val();
|
|
|
paramFront.memcacheType=memcacheType;
|
|
|
|
|
|
//1.更新internal_domain
|
|
|
writeToText("开始更新内部dns:internal_domain.......");
|
|
|
var url=contextPath+'autoScalingTool/updateMemcacheInfoForInternalDomain';
|
|
|
$.ajax({
|
|
|
url: url,
|
|
|
type: 'POST',
|
|
|
data: paramFront,
|
|
|
dataType: 'json',
|
|
|
async: false,
|
|
|
success: function (data) {
|
|
|
if (!data || data.code != 200) {
|
|
|
responseError(data);
|
|
|
}else{
|
|
|
writeToText(" ");
|
|
|
}
|
|
|
},
|
|
|
error: function (e) {
|
|
|
requestError(url);
|
|
|
}
|
|
|
});
|
|
|
writeToText("开始更新内部dns结束.......");
|
|
|
|
|
|
//2.更新监控对象
|
|
|
writeToText("开始更新监控对象:mobject_info.......");
|
|
|
url=contextPath+'autoScalingTool/updateMemcacheInfoForMobject';
|
|
|
$.ajax({
|
|
|
url: url,
|
|
|
type: 'POST',
|
|
|
data: paramFront,
|
|
|
dataType: 'json',
|
|
|
async: false,
|
|
|
success: function (data) {
|
|
|
if (!data || data.code != 200) {
|
|
|
responseError(data);
|
|
|
}else{
|
|
|
writeToText(" ");
|
|
|
}
|
|
|
},
|
|
|
error: function (e) {
|
|
|
requestError(url);
|
|
|
}
|
|
|
});
|
|
|
writeToText("开始更新监控对象结束.......");
|
|
|
|
|
|
//更新主机标签
|
|
|
upHostCmdbInfo();
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
//nginx类型机器伸之后
|
|
|
function updateNginxInfo(){
|
|
|
writeToText(">>>nginx项目,请稍后...");
|
|
|
var nginxPushParam={};
|
|
|
if(scalingGroupName.toUpperCase().indexOf("PCH5")>=0){
|
|
|
nginxPushParam.type=2;
|
|
|
}else{
|
|
|
nginxPushParam.type=1;
|
|
|
}
|
|
|
|
|
|
if($("#cloudType").val()==2){
|
|
|
nginxPushParam.select=2;//qcloud伸缩
|
|
|
}else{
|
|
|
nginxPushParam.select=3;//aws上的nginx伸缩
|
|
|
}
|
|
|
|
|
|
var url=contextPath + "nginxSync/pushTask";
|
|
|
$.ajax({
|
|
|
url: url,
|
|
|
type: "post",
|
|
|
dataType: "json",
|
|
|
data: nginxPushParam,
|
|
|
success: function (response) {
|
|
|
var intervalNginx = setInterval(function () {
|
|
|
var urlNext=contextPath + "nginxSync/getTaskLog";
|
|
|
$.ajax({
|
|
|
url: urlNext,
|
|
|
type: 'POST',
|
|
|
dataType: 'json',
|
|
|
data: {
|
|
|
taskId: response.data.taskId
|
|
|
},
|
|
|
success: function (data3) {
|
|
|
//console.log(data3);
|
|
|
var messagedata = data3.data;
|
|
|
var logList = messagedata.log;
|
|
|
if (logList != "") {
|
|
|
writeToText(logList);
|
|
|
}
|
|
|
//code为2 ,则结束
|
|
|
var code = messagedata.isFinished;
|
|
|
if (code == 1) {
|
|
|
clearInterval(intervalNginx);
|
|
|
writeToText("完毕..........");
|
|
|
upHostCmdbInfo();
|
|
|
}
|
|
|
},
|
|
|
error: function (e) {
|
|
|
requestError(urlNext);
|
|
|
}
|
|
|
});
|
|
|
}, 3000);
|
|
|
},
|
|
|
error: function (e) {
|
|
|
requestError(url);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
//更新es
|
|
|
function updateEsConfig(showMessage){
|
|
|
//elasticsearch项目,更新后台ssh
|
...
|
...
|
@@ -986,7 +1055,13 @@ function getDeployProjectNames(groupName){ |
|
|
|
|
|
//缩容成功后执行
|
|
|
function unDeploy(showMessage){
|
|
|
if(scalingGroupName.indexOf("nginx")>=0){
|
|
|
if(scalingGroupName=="PCH5-memcache"){
|
|
|
//pch5的memcache
|
|
|
|
|
|
}else if(scalingGroupName=="java-gateway-memcache"){
|
|
|
//java-gateway的memcache
|
|
|
|
|
|
}else if(scalingGroupName.indexOf("nginx")>=0){
|
|
|
//什么都不用做
|
|
|
//发布完之后,显示关闭按钮
|
|
|
deployLaster();
|
...
|
...
|
|