|
@@ -537,6 +537,9 @@ function deploy(ips){ |
|
@@ -537,6 +537,9 @@ function deploy(ips){ |
537
|
requestError(url);
|
537
|
requestError(url);
|
538
|
}
|
538
|
}
|
539
|
});
|
539
|
});
|
|
|
540
|
+ }else if(scalingGroupName.indexOf("ELASTICSEARCH")>=0){
|
|
|
541
|
+ //伸缩ELASTICSEARCH机器
|
|
|
542
|
+ updateEsConfig();
|
540
|
}else if(scalingGroupName.indexOf("PCH5")>=0){
|
543
|
}else if(scalingGroupName.indexOf("PCH5")>=0){
|
541
|
//node项目
|
544
|
//node项目
|
542
|
writeToText(">>>node项目,请稍后...");
|
545
|
writeToText(">>>node项目,请稍后...");
|
|
@@ -555,6 +558,27 @@ function deploy(ips){ |
|
@@ -555,6 +558,27 @@ function deploy(ips){ |
555
|
}
|
558
|
}
|
556
|
}
|
559
|
}
|
557
|
|
560
|
|
|
|
561
|
+//更新es
|
|
|
562
|
+function updateEsConfig(showMessage){
|
|
|
563
|
+ //elasticsearch项目,更新后台ssh
|
|
|
564
|
+ writeToText(">>>elasticsearch项目,请稍后...");
|
|
|
565
|
+ $.ajax({
|
|
|
566
|
+ url: contextPath + "autoScalingTool/updateEsConfig",
|
|
|
567
|
+ type: "post",
|
|
|
568
|
+ dataType: "json",
|
|
|
569
|
+ data: {
|
|
|
570
|
+ allIps:newInstanceIps
|
|
|
571
|
+ },
|
|
|
572
|
+ success: function (response) {
|
|
|
573
|
+ writeToText("elasticsearch伸缩完毕");
|
|
|
574
|
+ upHostCmdbInfo(showMessage);
|
|
|
575
|
+ },
|
|
|
576
|
+ error: function (e) {
|
|
|
577
|
+ requestError(url);
|
|
|
578
|
+ }
|
|
|
579
|
+ });
|
|
|
580
|
+}
|
|
|
581
|
+
|
558
|
//发布成功和失败都执行
|
582
|
//发布成功和失败都执行
|
559
|
function deployLaster(){
|
583
|
function deployLaster(){
|
560
|
//发布完之后,显示关闭按钮
|
584
|
//发布完之后,显示关闭按钮
|
|
@@ -657,41 +681,6 @@ function deployProjectForNode(ips){ |
|
@@ -657,41 +681,6 @@ function deployProjectForNode(ips){ |
657
|
return returnMessageId;
|
681
|
return returnMessageId;
|
658
|
}
|
682
|
}
|
659
|
|
683
|
|
660
|
-/*function deployProjectForNode(ips){
|
|
|
661
|
- var cloudType = "aws";
|
|
|
662
|
- if(2==$("#cloudType").val()){
|
|
|
663
|
- cloudType="qcloud";
|
|
|
664
|
- }
|
|
|
665
|
- var returnMessageId = "";
|
|
|
666
|
- var proj_array=souProjectNames.split(",");
|
|
|
667
|
- for(var i=0;i<proj_array.length;i++){
|
|
|
668
|
- var url = contextPath + 'autoScalingTool/deployCloudProjectForNode?projectName='+proj_array[i]+'&ips='+ips+'&branch=' + souBranch + '&environment='+cloudType;
|
|
|
669
|
- $.ajax({
|
|
|
670
|
- url: url,
|
|
|
671
|
- type: 'POST',
|
|
|
672
|
- dataType: 'json',
|
|
|
673
|
- async: false,
|
|
|
674
|
- success: function (data) {
|
|
|
675
|
- if (!data || data.code != 200) {
|
|
|
676
|
- responseError(data);
|
|
|
677
|
- }else{
|
|
|
678
|
- if(returnMessageId.length>0){
|
|
|
679
|
- returnMessageId += ";";
|
|
|
680
|
- }
|
|
|
681
|
- returnMessageId += data.data.messageids.split(',')[0];
|
|
|
682
|
- returnMessageId += ",";
|
|
|
683
|
- returnMessageId += data.data.messageList[0].currentProject;
|
|
|
684
|
- }
|
|
|
685
|
- },
|
|
|
686
|
- error: function (e) {
|
|
|
687
|
- requestError(url);
|
|
|
688
|
- }
|
|
|
689
|
- });
|
|
|
690
|
- }
|
|
|
691
|
-
|
|
|
692
|
- return returnMessageId;
|
|
|
693
|
-}*/
|
|
|
694
|
-
|
|
|
695
|
//3.1:发布项目的同时获取发布的消息
|
684
|
//3.1:发布项目的同时获取发布的消息
|
696
|
function deployProjectGetMsg(msgId, ips){
|
685
|
function deployProjectGetMsg(msgId, ips){
|
697
|
var count=0;
|
686
|
var count=0;
|
|
@@ -775,45 +764,6 @@ function deployProjectForNodeGetMsg(msgId, ips){ |
|
@@ -775,45 +764,6 @@ function deployProjectForNodeGetMsg(msgId, ips){ |
775
|
}, 10000);
|
764
|
}, 10000);
|
776
|
}
|
765
|
}
|
777
|
|
766
|
|
778
|
-//4:集成测试
|
|
|
779
|
-/*function integrationTest(ips){
|
|
|
780
|
- var url = contextPath + 'autoScalingTool/integrationTest?cloudType='+$("#cloudType").val()+'&projectName='+scalingGroupName+'&ips='+ips;
|
|
|
781
|
- $.ajax({
|
|
|
782
|
- url: url,
|
|
|
783
|
- type: 'POST',
|
|
|
784
|
- dataType: 'json',
|
|
|
785
|
- async: false,
|
|
|
786
|
- success: function (data) {
|
|
|
787
|
- if (!data || data.code != 200) {
|
|
|
788
|
- responseError(data);
|
|
|
789
|
- }else{
|
|
|
790
|
- writeToText(" ");
|
|
|
791
|
- var dataJson = data.data;
|
|
|
792
|
- for (var i = 0; i < dataJson.length; i ++) {
|
|
|
793
|
- writeToText(dataJson[i].ip + ":请求url:" + dataJson[i].url);
|
|
|
794
|
- var state = dataJson[i].state;
|
|
|
795
|
- var stateMsg;
|
|
|
796
|
- if(state == 200){
|
|
|
797
|
- stateMsg = "成功访问";
|
|
|
798
|
- writeToText("状态为:" + state + " - " + stateMsg);
|
|
|
799
|
- writeToText("第 4 步:集成测试完毕!");
|
|
|
800
|
-
|
|
|
801
|
- writeToText(">>>正在更新git-iptables,请稍后...");
|
|
|
802
|
- //5:更新git文件
|
|
|
803
|
- editToGit();
|
|
|
804
|
- }else{
|
|
|
805
|
- stateMsg = "访问失败";
|
|
|
806
|
- writeToText("状态为:" + state + " - " + stateMsg);
|
|
|
807
|
- deployLaster();
|
|
|
808
|
- }
|
|
|
809
|
- }
|
|
|
810
|
- }
|
|
|
811
|
- },
|
|
|
812
|
- error: function (e) {
|
|
|
813
|
- requestError(url);
|
|
|
814
|
- }
|
|
|
815
|
- });
|
|
|
816
|
-}*/
|
|
|
817
|
function updateAnsibleDeployForNode(showMessage){
|
767
|
function updateAnsibleDeployForNode(showMessage){
|
818
|
var upDownFlag="up";//伸缩标志 :1 伸
|
768
|
var upDownFlag="up";//伸缩标志 :1 伸
|
819
|
if(showMessage != null && showMessage != undefined){
|
769
|
if(showMessage != null && showMessage != undefined){
|
|
@@ -953,10 +903,26 @@ function editToGit(showMessage){ |
|
@@ -953,10 +903,26 @@ function editToGit(showMessage){ |
953
|
});
|
903
|
});
|
954
|
}
|
904
|
}
|
955
|
|
905
|
|
|
|
906
|
+ upHostCmdbInfo(showMessage);
|
|
|
907
|
+
|
|
|
908
|
+}
|
956
|
|
909
|
|
957
|
- //更新主机信息到cmdb
|
910
|
+//更新主机信息到cmdb
|
|
|
911
|
+function upHostCmdbInfo(showMessage){
|
958
|
writeToText(">>>更新主机信息到cmdb,请稍后...");
|
912
|
writeToText(">>>更新主机信息到cmdb,请稍后...");
|
959
|
- url=contextPath+'autoScalingTool/updateToHost';
|
913
|
+ var upDownFlag="up";//伸缩标志 :1 伸
|
|
|
914
|
+ if(showMessage != null && showMessage != undefined){
|
|
|
915
|
+ upDownFlag="down"; //缩减
|
|
|
916
|
+ }
|
|
|
917
|
+ var paramFront={};
|
|
|
918
|
+ paramFront.cloudType=$("#cloudType").val();
|
|
|
919
|
+ paramFront.scalingGroupName=scalingGroupName;
|
|
|
920
|
+ paramFront.scalingGroupId=souScalingGroupId;
|
|
|
921
|
+ paramFront.oldInstanceIps=souInstanceIps;
|
|
|
922
|
+ paramFront.newInstanceIps=newInstanceIps;
|
|
|
923
|
+ paramFront.upDownFlag=upDownFlag;
|
|
|
924
|
+
|
|
|
925
|
+ var url=contextPath+'autoScalingTool/updateToHost';
|
960
|
$.ajax({
|
926
|
$.ajax({
|
961
|
url: url,
|
927
|
url: url,
|
962
|
type: 'POST',
|
928
|
type: 'POST',
|
|
@@ -1018,6 +984,8 @@ function unDeploy(showMessage){ |
|
@@ -1018,6 +984,8 @@ function unDeploy(showMessage){ |
1018
|
if(scalingGroupName.indexOf("nginx")>=0){
|
984
|
if(scalingGroupName.indexOf("nginx")>=0){
|
1019
|
//什么都不用做
|
985
|
//什么都不用做
|
1020
|
|
986
|
|
|
|
987
|
+ }else if(scalingGroupName.indexOf("ELASTICSEARCH")>=0){
|
|
|
988
|
+ updateEsConfig(showMessage);
|
1021
|
}else if(scalingGroupName.indexOf("PCH5")>=0){
|
989
|
}else if(scalingGroupName.indexOf("PCH5")>=0){
|
1022
|
writeToText("node项目缩,正在更新ansible deploy配置文件,请稍后...");
|
990
|
writeToText("node项目缩,正在更新ansible deploy配置文件,请稍后...");
|
1023
|
updateAnsibleDeployForNode(showMessage);
|
991
|
updateAnsibleDeployForNode(showMessage);
|