usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sfeld...@apache.org
Subject [01/17] incubator-usergrid git commit: [APIBAAS-1391]Adding cluster configuration for gatling cluster
Date Wed, 03 Dec 2014 18:00:35 GMT
Repository: incubator-usergrid
Updated Branches:
  refs/heads/index-alias 887bb476e -> e7455e9fd


[APIBAAS-1391]Adding cluster configuration for gatling cluster


Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/3bc7a89a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/3bc7a89a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/3bc7a89a

Branch: refs/heads/index-alias
Commit: 3bc7a89a0d26b311b3dd584828d5b5adec0b6850
Parents: d70ca53
Author: ryan bridges <rbridges@apigee.com>
Authored: Thu Nov 13 16:13:12 2014 -0500
Committer: ryan bridges <rbridges@apigee.com>
Committed: Thu Nov 13 16:13:12 2014 -0500

----------------------------------------------------------------------
 stack/awscluster/gatling-cluster-cf.json | 359 ++++++++++++++++++++++++++
 1 file changed, 359 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/3bc7a89a/stack/awscluster/gatling-cluster-cf.json
----------------------------------------------------------------------
diff --git a/stack/awscluster/gatling-cluster-cf.json b/stack/awscluster/gatling-cluster-cf.json
new file mode 100644
index 0000000..16b8d5b
--- /dev/null
+++ b/stack/awscluster/gatling-cluster-cf.json
@@ -0,0 +1,359 @@
+{
+    "AWSTemplateFormatVersion" : "2010-09-09",
+    "Description" : "Gatling cluster",
+
+    "Parameters" : {
+        "InstanceCount": {
+            "Description" : "The number of gatling instances to create",
+            "Type": "Number",
+            "Default": "1",
+            "MinValue": "1"
+        },
+
+        "KeyName": {
+            "Description" : "Name of an existing EC2 KeyPair to enable SSH access to the
instance",
+            "Type": "AWS::EC2::KeyPair::KeyName",
+            "Default" : "jenkins-east",
+            "ConstraintDescription" : "must be the name of an existing EC2 KeyPair."
+        },
+
+        "InstanceType" : {
+            "Description" : "WebServer EC2 instance type",
+            "Type" : "String",
+            "Default" : "m1.xlarge",
+            "AllowedValues" : [ "t1.micro", "t2.micro", "t2.small", "t2.medium", "m1.small",
"m1.medium", "m1.large", "m1.xlarge", "m2.xlarge", "m2.2xlarge", "m2.4xlarge", "m3.medium",
"m3.large", "m3.xlarge", "m3.2xlarge", "c1.medium", "c1.xlarge", "c3.large", "c3.xlarge",
"c3.2xlarge", "c3.4xlarge", "c3.8xlarge", "g2.2xlarge", "r3.large", "r3.xlarge", "r3.2xlarge",
"r3.4xlarge", "r3.8xlarge", "i2.xlarge", "i2.2xlarge", "i2.4xlarge", "i2.8xlarge", "hi1.4xlarge",
"hs1.8xlarge", "cr1.8xlarge", "cc2.8xlarge", "cg1.4xlarge"]
+            ,
+            "ConstraintDescription" : "must be a valid EC2 instance type."
+        },
+
+        "OperatorEMail": {
+            "Description": "EMail address to notify if there are any scaling operations",
+            "Type": "String",
+            "AllowedPattern": "([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)",
+            "ConstraintDescription": "must be a valid email address.",
+            "Default":"rbridges@apigee.com"
+        },
+
+        "ReleaseBucket": {
+            "Description": "S3 Bucket where Usergrid assembly is to be found.",
+            "Type": "String",
+            "Default": "usergrid-jenkins-builds"
+        },
+
+        "SSHLocation" : {
+            "Description" : "The IP address range that can be used to SSH to the EC2 instances",
+            "Type": "String",
+            "MinLength": "9",
+            "MaxLength": "18",
+            "Default": "0.0.0.0/0",
+            "AllowedPattern": "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{1,2})",
+            "ConstraintDescription": "must be a valid IP CIDR range of the form x.x.x.x/x."
+        }
+    },
+
+    "Mappings" : {
+        "AWSInstanceType2Arch": {
+            "t1.micro": {
+                "Arch": "64"
+            },
+            "m1.small": {
+                "Arch": "64"
+            },
+            "m1.medium": {
+                "Arch": "64"
+            },
+            "m1.large": {
+                "Arch": "64"
+            },
+            "m1.xlarge": {
+                "Arch": "64"
+            },
+            "m3.large": {
+                "Arch": "64"
+            },
+            "m3.xlarge": {
+                "Arch": "64"
+            },
+            "c3.large": {
+                "Arch": "64"
+            },
+            "c3.xlarge": {
+                "Arch": "64"
+            },
+            "c3.2xlarge": {
+                "Arch": "64"
+            },
+            "c3.4xlarge": {
+                "Arch": "64"
+            }
+        },
+        "AWSRegionArch2AMI": {
+            "ap-southeast-2": {
+                "64": "ami-c1335ffb"
+            },
+            "us-east-1": {
+                "64": "ami-c43491ac"
+            },
+            "us-west-2": {
+                "64": "ami-194a0429"
+            }
+        },
+        "TwoAZs": {
+            "ap-southeast-2": {
+                "AZ1": "ap-southeast-2a",
+                "AZ2": "ap-southeast-2b"
+            },
+            "us-east-1": {
+                "AZ1": "us-east-1b",
+                "AZ2": "us-east-1c"
+            },
+            "us-west-2": {
+                "AZ1": "us-west-2a",
+                "AZ2": "us-west-2b"
+            }
+        }
+
+
+    },
+
+    "Resources" : {
+        "NotificationTopic": {
+            "Type": "AWS::SNS::Topic",
+            "Properties": {
+                "Subscription": [ { "Endpoint": { "Ref": "OperatorEMail" }, "Protocol": "email"
} ]
+            }
+        },
+        "GatlingServerGroup" : {
+            "Type" : "AWS::AutoScaling::AutoScalingGroup",
+            "CreationPolicy" : {
+                "ResourceSignal" : {
+                    "Timeout" : "PT15M",
+                    "Count"   : { "Ref" : "InstanceCount" }
+                }
+            },
+            "Properties" : {
+                "AvailabilityZones": [
+                    {
+                        "Fn::FindInMap": [
+                            "TwoAZs",
+                            {
+                                "Ref": "AWS::Region"
+                            },
+                            "AZ1"
+                        ]
+                    },
+                    {
+                        "Fn::FindInMap": [
+                            "TwoAZs",
+                            {
+                                "Ref": "AWS::Region"
+                            },
+                            "AZ2"
+                        ]
+                    }
+                ],
+                "LaunchConfigurationName" : { "Ref" : "LaunchConfig" },
+                "MinSize" : { "Ref" : "InstanceCount" },
+                "MaxSize" : "10",
+                "LoadBalancerNames" : [ { "Ref" : "ElasticLoadBalancer" } ],
+                "NotificationConfiguration" : {
+                    "TopicARN" : { "Ref" : "NotificationTopic" },
+                    "NotificationTypes" : [ "autoscaling:EC2_INSTANCE_LAUNCH","autoscaling:EC2_INSTANCE_LAUNCH_ERROR","autoscaling:EC2_INSTANCE_TERMINATE",
"autoscaling:EC2_INSTANCE_TERMINATE_ERROR"]
+                }
+            }
+        },
+
+        "LaunchConfig" : {
+            "Type" : "AWS::AutoScaling::LaunchConfiguration",
+            "Metadata" : {
+                "Comment" : "Install Gatling",
+                "AWS::CloudFormation::Init" : {
+                    "config" : {
+                        "files" : {
+                            "/etc/profile.d/aws-credentials.sh" : {
+                                "content": { "Fn::Join" : ["", [
+                                    "export AWS_ACCESS_KEY=", { "Ref":"GatlingKey" }, "\n",
+                                    "export AWS_SECRET_KEY=", { "Fn::GetAtt":[ "GatlingKey",
"SecretAccessKey" ] }, "\n"
+                                ]]}
+                            },
+
+                            "/etc/s3cfg" : {
+                                "content": { "Fn::Join" : ["", [
+                                    "access_key=", { "Ref":"GatlingKey" }, "\n",
+                                    "secret_key=", { "Fn::GetAtt":[ "GatlingKey", "SecretAccessKey"
] }, "\n"
+                                ]]}
+                            },
+                            "/etc/profile.d/maven.sh" : {
+                                "content" : { "Fn::Join" : ["", [
+                                    "export M2_HOME=/usr/local/apache-maven/apache-maven-3.1.1\n",
+                                    "export M2=$M2_HOME/bin\n",
+                                    "export MAVEN_OPTS=\"-Xms256m -Xmx512m\"\n",
+                                    "export PATH=$M2:$PATH\n"
+                                ]]}
+                            },
+
+                            "/etc/security/limits.d/gatling_filehandles.conf" : {
+                                "content": { "Fn::Join" : ["", [
+                                    "ubuntu soft nofile 80000\n",
+                                    "ubuntu hard nofile 80000\n"
+                                ]]}
+                            }
+                        }
+                    }
+                },
+                "services" : {}
+            },
+            "Properties" : {
+                "KeyName" : { "Ref" : "KeyName" },
+                "ImageId" : {
+                    "Fn::FindInMap" : [
+                        "AWSRegionArch2AMI", { "Ref" : "AWS::Region" },
+                           { "Fn::FindInMap" : [ "AWSInstanceType2Arch", "m1.xlarge", "Arch"
] } ]},
+                "SecurityGroups" : [ { "Ref" : "InstanceSecurityGroup" } ],
+                "InstanceType" : { "Ref" : "InstanceType" },
+                "UserData"       : { "Fn::Base64" : { "Fn::Join" : ["", [
+                    "#!/bin/bash -xe\n",
+                    "apt-get install zip unzip wget -y\n",
+                    "wget https://bootstrap.pypa.io/ez_setup.py -O - | python\n",
+                    "easy_install  https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-latest.tar.gz\n",
+                    "/usr/local/bin/cfn-init -v ",
+                    "         --stack ", { "Ref" : "AWS::StackName" },
+                    "         --resource LaunchConfig ",
+                    "         --region ", { "Ref" : "AWS::Region" }, "\n",
+
+                    "/usr/local/bin/cfn-signal -e $? ",
+                    "         --stack ", { "Ref" : "AWS::StackName" },
+                    "         --resource GatlingServerGroup ",
+                    "         --region ", { "Ref" : "AWS::Region" }, "\n",
+
+                    "add-apt-repository ppa:webupd8team/java\n",
+                    "apt-get update\n",
+                    "echo oracle-java7-installer shared/accepted-oracle-license-v1-1 select
true | /usr/bin/debconf-set-selections\n",
+                    "apt-get install oracle-java7-installer oracle-java7-set-default expect
expect-dev git -y --force-yes\n",
+                    "update-java-alternatives -s java-7-oracle\n",
+
+                    "mkdir -p /usr/local/apache-maven\n",
+                    "cd /usr/local/apache-maven\n",
+                    "wget http://apache.mirrors.timporter.net/maven/maven-3/3.1.1/binaries/apache-maven-3.1.1-bin.tar.gz\n",
+                    "tar -xzvf apache-maven-3.1.1-bin.tar.gz\n",
+                    "cd ~ubuntu\n",
+                    "git clone https://github.com/apache/incubator-usergrid.git usergrid\n",
+                    "chown -R ubuntu:ubuntu usergrid\n"
+                ]]}}
+            }
+        },
+
+        "GatlingUser": {
+            "Type": "AWS::IAM::User",
+            "Properties": {
+                "Path": "/",
+                "Policies": [
+                    {
+                        "PolicyName": "root",
+                        "PolicyDocument": {
+                            "Statement": [
+                                {
+                                    "Effect": "Allow",
+                                    "Action": "*",
+                                    "Resource": "*"
+                                }
+                            ]
+                        }
+                    }
+                ]
+            }
+        },
+        "GatlingKey": {
+            "Type": "AWS::IAM::AccessKey",
+            "Properties": {
+                "UserName": {
+                    "Ref": "GatlingUser"
+                }
+            }
+        },
+
+        "WebServerScaleUpPolicy" : {
+            "Type" : "AWS::AutoScaling::ScalingPolicy",
+            "Properties" : {
+                "AdjustmentType" : "ChangeInCapacity",
+                "AutoScalingGroupName" : { "Ref" : "GatlingServerGroup" },
+                "Cooldown" : "60",
+                "ScalingAdjustment" : "1"
+            }
+        },
+        "WebServerScaleDownPolicy" : {
+            "Type" : "AWS::AutoScaling::ScalingPolicy",
+            "Properties" : {
+                "AdjustmentType" : "ChangeInCapacity",
+                "AutoScalingGroupName" : { "Ref" : "GatlingServerGroup" },
+                "Cooldown" : "60",
+                "ScalingAdjustment" : "-1"
+            }
+        },
+
+        "ElasticLoadBalancer" : {
+            "Type" : "AWS::ElasticLoadBalancing::LoadBalancer",
+            "Properties" : {
+                "AvailabilityZones": [
+                    {
+                        "Fn::FindInMap": [
+                            "TwoAZs",
+                            {
+                                "Ref": "AWS::Region"
+                            },
+                            "AZ1"
+                        ]
+                    },
+                    {
+                        "Fn::FindInMap": [
+                            "TwoAZs",
+                            {
+                                "Ref": "AWS::Region"
+                            },
+                            "AZ2"
+                        ]
+                    }
+                ],
+                "Listeners" : [ {
+                    "LoadBalancerPort" : "80",
+                    "InstancePort" : "80",
+                    "Protocol" : "HTTP"
+                } ],
+                "HealthCheck" : {
+                    "Target" : "HTTP:80/",
+                    "HealthyThreshold" : "3",
+                    "UnhealthyThreshold" : "5",
+                    "Interval" : "30",
+                    "Timeout" : "5"
+                }
+            }
+        },
+
+        "InstanceSecurityGroup" : {
+            "Type" : "AWS::EC2::SecurityGroup",
+            "Properties" : {
+                "GroupDescription" : "Enable SSH access and HTTP from the load balancer only",
+                "SecurityGroupIngress" : [ {
+                    "IpProtocol" : "tcp",
+                    "FromPort" : "22",
+                    "ToPort" : "22",
+                    "CidrIp" : { "Ref" : "SSHLocation"}
+                },
+                    {
+                        "IpProtocol" : "tcp",
+                        "FromPort" : "80",
+                        "ToPort" : "80",
+                        "SourceSecurityGroupOwnerId" : {"Fn::GetAtt" : ["ElasticLoadBalancer",
"SourceSecurityGroup.OwnerAlias"]},
+                        "SourceSecurityGroupName" : {"Fn::GetAtt" : ["ElasticLoadBalancer",
"SourceSecurityGroup.GroupName"]}
+                    } ]
+            }
+        }
+    },
+
+    "Outputs" : {
+        "URL" : {
+            "Description" : "The URL of the website",
+            "Value" :  { "Fn::Join" : [ "", [ "http://", { "Fn::GetAtt" : [ "ElasticLoadBalancer",
"DNSName" ]}]]}
+        }
+    }
+}
\ No newline at end of file


Mime
View raw message