Commit 555eb665 by Feanil Patel

Move xqueue to the common cluster.

parent 49085d1e
...@@ -178,7 +178,7 @@ ...@@ -178,7 +178,7 @@
"ConstraintDescription":"must be a valid EC2 instance type." "ConstraintDescription":"must be a valid EC2 instance type."
}, },
"XqueueInstanceType":{ "XqueueInstanceType":{
"Description":"Xqueue server EC2 instance type", "Description":"Deprecated, Xqueue is now part of the commoncluster.",
"Type":"String", "Type":"String",
"Default":"m1.small", "Default":"m1.small",
"AllowedValues":[ "AllowedValues":[
...@@ -290,11 +290,6 @@ ...@@ -290,11 +290,6 @@
"Type":"Number", "Type":"Number",
"Default":"2" "Default":"2"
}, },
"XqueueDesiredCapacity":{
"Description":"The Auto-scaling group desired capacity for the xqueue hosts",
"Type":"Number",
"Default":"2"
},
"XServerDesiredCapacity":{ "XServerDesiredCapacity":{
"Description":"The Auto-scaling group desired capacity for the xserver hosts", "Description":"The Auto-scaling group desired capacity for the xserver hosts",
"Type":"Number", "Type":"Number",
...@@ -471,8 +466,6 @@ ...@@ -471,8 +466,6 @@
"Edxapp02": { "CIDR":".11.0/24" }, "Edxapp02": { "CIDR":".11.0/24" },
"XServerJail01": { "CIDR":".20.0/24" }, "XServerJail01": { "CIDR":".20.0/24" },
"XServerJail02": { "CIDR":".21.0/24" }, "XServerJail02": { "CIDR":".21.0/24" },
"Xqueue01": { "CIDR":".30.0/24" },
"Xqueue02": { "CIDR":".31.0/24" },
"CommonCluster01": { "CIDR":".46.0/24"}, "CommonCluster01": { "CIDR":".46.0/24"},
"CommonCluster02": { "CIDR":".47.0/24"}, "CommonCluster02": { "CIDR":".47.0/24"},
"CommonCluster03": { "CIDR":".48.0/24"}, "CommonCluster03": { "CIDR":".48.0/24"},
...@@ -722,102 +715,6 @@ ...@@ -722,102 +715,6 @@
] ]
} }
}, },
"XqueueSubnet01":{
"Type":"AWS::EC2::Subnet",
"Properties":{
"VpcId":{
"Ref":"EdxVPC"
},
"CidrBlock":{
"Fn::Join": ["", [
"10.", { "Ref": "ClassB"},
{"Fn::FindInMap":[
"SubnetConfig",
"Xqueue01",
"CIDR"
]}
]]
},
"AvailabilityZone":{
"Fn::FindInMap":[
"MapRegionsToAvailZones",
{ "Ref":"AWS::Region" },
"AZone0"
]
},
"Tags":[
{
"Key":"play",
"Value":"xqueue"
},
{
"Key":"Network",
"Value":"Private"
},
{
"Key" : "immutable_metadata",
"Value":{"Fn::Join":["",
["{'purpose':'",
{"Ref":"EnvironmentTag"},
"-",
{"Ref":"DeploymentTag"},
"-",
"internal-xqueue','target':'ec2'}"
]
]
}
}
]
}
},
"XqueueSubnet02":{
"Type":"AWS::EC2::Subnet",
"Properties":{
"VpcId":{
"Ref":"EdxVPC"
},
"CidrBlock":{
"Fn::Join": ["", [
"10.", { "Ref": "ClassB"},
{"Fn::FindInMap":[
"SubnetConfig",
"Xqueue02",
"CIDR"
]}
]]
},
"AvailabilityZone":{
"Fn::FindInMap":[
"MapRegionsToAvailZones",
{ "Ref":"AWS::Region" },
"AZone1"
]
},
"Tags":[
{
"Key":"play",
"Value":"xqueue"
},
{
"Key":"Network",
"Value":"Private"
},
{
"Key" : "immutable_metadata",
"Value":{"Fn::Join":["",
["{'purpose':'",
{"Ref":"EnvironmentTag"},
"-",
{"Ref":"DeploymentTag"},
"-",
"internal-xqueue','target':'ec2'}"
]
]
}
}
]
}
},
"CommonClusterSubnet01":{ "CommonClusterSubnet01":{
"Type":"AWS::EC2::Subnet", "Type":"AWS::EC2::Subnet",
"Properties":{ "Properties":{
...@@ -1926,28 +1823,6 @@ ...@@ -1926,28 +1823,6 @@
} }
} }
}, },
"PrivateSubnetRouteTableAssociationXqueue01":{
"Type":"AWS::EC2::SubnetRouteTableAssociation",
"Properties":{
"SubnetId":{
"Ref":"XqueueSubnet01"
},
"RouteTableId":{
"Ref":"PrivateRouteTable"
}
}
},
"PrivateSubnetRouteTableAssociationXqueue02":{
"Type":"AWS::EC2::SubnetRouteTableAssociation",
"Properties":{
"SubnetId":{
"Ref":"XqueueSubnet02"
},
"RouteTableId":{
"Ref":"PrivateRouteTable"
}
}
},
"PrivateSubnetRouteTableAssociationCommonCluster01":{ "PrivateSubnetRouteTableAssociationCommonCluster01":{
"Type":"AWS::EC2::SubnetRouteTableAssociation", "Type":"AWS::EC2::SubnetRouteTableAssociation",
"Properties":{ "Properties":{
...@@ -2222,28 +2097,6 @@ ...@@ -2222,28 +2097,6 @@
} }
} }
}, },
"PrivateSubnetNetworkAclAssociationXqueue01":{
"Type":"AWS::EC2::SubnetNetworkAclAssociation",
"Properties":{
"SubnetId":{
"Ref":"XqueueSubnet01"
},
"NetworkAclId":{
"Ref":"PrivateNetworkAcl"
}
}
},
"PrivateSubnetNetworkAclAssociationXqueue02":{
"Type":"AWS::EC2::SubnetNetworkAclAssociation",
"Properties":{
"SubnetId":{
"Ref":"XqueueSubnet02"
},
"NetworkAclId":{
"Ref":"PrivateNetworkAcl"
}
}
},
"PrivateSubnetNetworkAclAssociationCommonCluster01":{ "PrivateSubnetNetworkAclAssociationCommonCluster01":{
"Type":"AWS::EC2::SubnetNetworkAclAssociation", "Type":"AWS::EC2::SubnetNetworkAclAssociation",
"Properties":{ "Properties":{
...@@ -2944,49 +2797,6 @@ ...@@ -2944,49 +2797,6 @@
} ] } ]
} }
}, },
"XqueueRole": {
"Type": "AWS::IAM::Role",
"Properties": {
"AssumeRolePolicyDocument": {
"Statement": [ {
"Effect": "Allow",
"Principal": {
"Service": [ "ec2.amazonaws.com" ]
},
"Action": [ "sts:AssumeRole" ]
} ]
},
"Path": "/",
"Policies": [ {
"PolicyName": "XqueueBasePolicy",
"PolicyDocument": {
"Statement":[
{
"Effect":"Allow",
"Action":[
"cloudformation:DescribeStackResource",
"ses:SendEmail",
"ses:SendRawEmail",
"ses:GetSendQuota",
"ec2:DescribeInstances",
"ec2:DescribeTags"
],
"Resource":"*"
}
]
}
} ]
}
},
"XqueueInstanceProfile": {
"Type": "AWS::IAM::InstanceProfile",
"Properties": {
"Path": "/",
"Roles": [ {
"Ref": "XqueueRole"
} ]
}
},
"XServerRole": { "XServerRole": {
"Type": "AWS::IAM::Role", "Type": "AWS::IAM::Role",
"Properties": { "Properties": {
...@@ -3420,197 +3230,6 @@ ...@@ -3420,197 +3230,6 @@
] ]
} }
}, },
"XqueueServer":{
"Type":"AWS::AutoScaling::LaunchConfiguration",
"Properties":{
"IamInstanceProfile":{ "Ref":"XqueueInstanceProfile" },
"SecurityGroups":[
{
"Ref":"XqueueServerSecurityGroup"
}
],
"ImageId":{
"Fn::FindInMap":[
"AWSRegionArch2AMI",
{
"Ref":"AWS::Region"
},
{
"Fn::FindInMap":[
"AWSInstanceType2Arch",
{
"Ref":"XqueueInstanceType"
},
"Arch"
]
}
]
},
"KeyName":{
"Ref":"KeyName"
},
"InstanceType":{
"Ref":"XqueueInstanceType"
},
"BlockDeviceMappings":[
{
"DeviceName":"/dev/sda1",
"Ebs":{
"VolumeSize":"100"
}
}
]
}
},
"XqueueServerAsGroup":{
"Type":"AWS::AutoScaling::AutoScalingGroup",
"Properties":{
"AvailabilityZones":[
{
"Fn::GetAtt":[
"XqueueSubnet01",
"AvailabilityZone"
]
},
{
"Fn::GetAtt":[
"XqueueSubnet02",
"AvailabilityZone"
]
}
],
"VPCZoneIdentifier":[
{
"Ref":"XqueueSubnet01"
},
{
"Ref":"XqueueSubnet02"
}
],
"Tags":[
{
"Key":"Name",
"Value": {"Fn::Join": ["-",[{"Ref": "EnvironmentTag"},{"Ref": "DeploymentTag"},"xqueue"]]},
"PropagateAtLaunch":true
},
{
"Key":"play",
"Value":"xqueue",
"PropagateAtLaunch":true
},
{
"Key":"services",
"Value":"xqueue,xqueue_consumer",
"PropagateAtLaunch":true
},
{
"Key":"environment",
"Value":{
"Ref":"EnvironmentTag"
},
"PropagateAtLaunch":true
},
{
"Key":"deployment",
"Value":{
"Ref":"DeploymentTag"
},
"PropagateAtLaunch":true
}
],
"LaunchConfigurationName":{
"Ref":"XqueueServer"
},
"MinSize":{
"Ref":"XqueueDesiredCapacity"
},
"MaxSize":{
"Ref":"XqueueDesiredCapacity"
},
"DesiredCapacity":{
"Ref":"XqueueDesiredCapacity"
},
"LoadBalancerNames":[
{
"Ref":"XqueueELB"
}
]
}
},
"XqueueScaleUpPolicy":{
"Type":"AWS::AutoScaling::ScalingPolicy",
"Properties":{
"AdjustmentType":"ChangeInCapacity",
"AutoScalingGroupName":{
"Ref":"XqueueServerAsGroup"
},
"Cooldown":"60",
"ScalingAdjustment":"1"
}
},
"XqueueScaleDownPolicy":{
"Type":"AWS::AutoScaling::ScalingPolicy",
"Properties":{
"AdjustmentType":"ChangeInCapacity",
"AutoScalingGroupName":{
"Ref":"XqueueServerAsGroup"
},
"Cooldown":"60",
"ScalingAdjustment":"-1"
}
},
"XqueueCPUAlarmHigh":{
"Type":"AWS::CloudWatch::Alarm",
"Properties":{
"AlarmDescription":"Scale-up if CPU > 90% for 10 minutes",
"MetricName":"CPUUtilization",
"Namespace":"AWS/EC2",
"Statistic":"Average",
"Period":"300",
"EvaluationPeriods":"2",
"Threshold":"90",
"AlarmActions":[
{
"Ref":"XqueueScaleUpPolicy"
}
],
"Dimensions":[
{
"Name":"AutoScalingGroupName",
"Value":{
"Ref":"XqueueServerAsGroup"
}
}
],
"ComparisonOperator":"GreaterThanThreshold"
}
},
"XqueueCPUAlarmLow":{
"Type":"AWS::CloudWatch::Alarm",
"Properties":{
"AlarmDescription":"Scale-down if CPU < 70% for 10 minutes",
"MetricName":"CPUUtilization",
"Namespace":"AWS/EC2",
"Statistic":"Average",
"Period":"300",
"EvaluationPeriods":"2",
"Threshold":"70",
"AlarmActions":[
{
"Ref":"XqueueScaleDownPolicy"
}
],
"Dimensions":[
{
"Name":"AutoScalingGroupName",
"Value":{
"Ref":"XqueueServerAsGroup"
}
}
],
"ComparisonOperator":"LessThanThreshold"
}
},
"XqueueELB":{ "XqueueELB":{
"Type":"AWS::ElasticLoadBalancing::LoadBalancer", "Type":"AWS::ElasticLoadBalancing::LoadBalancer",
"Properties":{ "Properties":{
...@@ -3741,6 +3360,9 @@ ...@@ -3741,6 +3360,9 @@
}, },
{ {
"Ref":"ElasticsearchServerSecurityGroup" "Ref":"ElasticsearchServerSecurityGroup"
},
{
"Ref":"XqueueServerSecurityGroup"
} }
], ],
"ImageId":{ "ImageId":{
...@@ -3854,6 +3476,9 @@ ...@@ -3854,6 +3476,9 @@
}, },
{ {
"Ref":"ElasticSearchELB" "Ref":"ElasticSearchELB"
},
{
"Ref":"XqueueELB"
} }
] ]
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment