You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sn...@apache.org on 2016/02/04 18:57:34 UTC
[10/50] [abbrv] usergrid git commit: Move and re-organize the AWS
cluster deployment along with updates to the Usergrid artifact and
dependencies specified.
Move and re-organize the AWS cluster deployment along with updates to the Usergrid artifact and dependencies specified.
Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/d478adb0
Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/d478adb0
Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/d478adb0
Branch: refs/heads/asf-site
Commit: d478adb0c6945a19739f063de6dbc5c2d411240a
Parents: 586dad0
Author: Michael Russo <mi...@gmail.com>
Authored: Tue Jan 26 17:50:26 2016 -0800
Committer: Michael Russo <mi...@gmail.com>
Committed: Tue Jan 26 17:50:26 2016 -0800
----------------------------------------------------------------------
deployment/aws/README.md | 172 ++
deployment/aws/assembly.xml | 74 +
deployment/aws/aws-sample.properties | 19 +
deployment/aws/gatling-cluster-cf.json | 386 ++++
deployment/aws/pom.xml | 238 ++
deployment/aws/src/main/cql/update_locks.cql | 23 +
deployment/aws/src/main/cql/update_usergrid.cql | 27 +
.../main/cql/update_usergrid_applications.cql | 46 +
.../src/main/dist/init_instance/create_raid0.sh | 54 +
.../main/dist/init_instance/init_db_server.sh | 76 +
.../main/dist/init_instance/init_es_server.sh | 71 +
.../dist/init_instance/init_graphite_server.sh | 69 +
.../dist/init_instance/init_opscenter_server.sh | 287 +++
.../main/dist/init_instance/init_rest_server.sh | 257 +++
.../dist/init_instance/install_cassandra.sh | 51 +
.../main/dist/init_instance/install_collectd.sh | 350 +++
.../dist/init_instance/install_elasticsearch.sh | 123 ++
.../init_instance/install_opscenter_agent.sh | 42 +
.../dist/init_instance/install_oraclejdk.sh | 55 +
.../main/dist/init_instance/install_yourkit.sh | 39 +
.../main/dist/init_instance/update_keyspaces.sh | 75 +
.../aws/src/main/dist/lib/log4j.properties | 53 +
deployment/aws/src/main/dist/update.sh | 35 +
.../aws/src/main/groovy/NodeRegistry.groovy | 227 ++
.../src/main/groovy/configure_cassandra.groovy | 125 ++
.../main/groovy/configure_elasticsearch.groovy | 169 ++
.../groovy/configure_opscenter_agent.groovy | 50 +
.../groovy/configure_opscenter_cassandra.groovy | 120 +
.../groovy/configure_opscenter_usergrid.groovy | 58 +
.../src/main/groovy/configure_portal_new.groovy | 28 +
.../src/main/groovy/configure_usergrid.groovy | 193 ++
.../aws/src/main/groovy/create_dashboard.groovy | 79 +
.../src/main/groovy/get_first_instance.groovy | 46 +
.../src/main/groovy/registry_register.groovy | 38 +
.../aws/src/main/groovy/tag_instance.groovy | 55 +
.../src/main/groovy/wait_for_instances.groovy | 47 +
deployment/aws/ugcluster-cf.json | 2062 ++++++++++++++++++
stack/awscluster/README.md | 163 --
stack/awscluster/assembly.xml | 74 -
stack/awscluster/aws-sample.properties | 19 -
stack/awscluster/gatling-cluster-cf.json | 386 ----
stack/awscluster/pom.xml | 237 --
stack/awscluster/src/main/cql/update_locks.cql | 23 -
.../awscluster/src/main/cql/update_usergrid.cql | 27 -
.../main/cql/update_usergrid_applications.cql | 46 -
.../src/main/dist/init_instance/create_raid0.sh | 54 -
.../main/dist/init_instance/init_db_server.sh | 76 -
.../main/dist/init_instance/init_es_server.sh | 71 -
.../dist/init_instance/init_graphite_server.sh | 69 -
.../dist/init_instance/init_opscenter_server.sh | 287 ---
.../main/dist/init_instance/init_rest_server.sh | 257 ---
.../dist/init_instance/install_cassandra.sh | 51 -
.../main/dist/init_instance/install_collectd.sh | 350 ---
.../dist/init_instance/install_elasticsearch.sh | 123 --
.../init_instance/install_opscenter_agent.sh | 42 -
.../dist/init_instance/install_oraclejdk.sh | 55 -
.../main/dist/init_instance/install_yourkit.sh | 39 -
.../main/dist/init_instance/update_keyspaces.sh | 75 -
.../src/main/dist/lib/log4j.properties | 53 -
stack/awscluster/src/main/dist/update.sh | 35 -
.../awscluster/src/main/dist/webapps/dummy.txt | 0
.../src/main/groovy/NodeRegistry.groovy | 227 --
.../src/main/groovy/configure_cassandra.groovy | 129 --
.../main/groovy/configure_elasticsearch.groovy | 169 --
.../groovy/configure_opscenter_agent.groovy | 50 -
.../groovy/configure_opscenter_cassandra.groovy | 120 -
.../groovy/configure_opscenter_usergrid.groovy | 58 -
.../src/main/groovy/configure_portal_new.groovy | 28 -
.../src/main/groovy/configure_usergrid.groovy | 193 --
.../src/main/groovy/create_dashboard.groovy | 79 -
.../src/main/groovy/get_first_instance.groovy | 46 -
.../src/main/groovy/registry_register.groovy | 38 -
.../src/main/groovy/tag_instance.groovy | 55 -
.../src/main/groovy/wait_for_instances.groovy | 47 -
stack/awscluster/ugcluster-cf.json | 2062 ------------------
75 files changed, 5919 insertions(+), 5913 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/usergrid/blob/d478adb0/deployment/aws/README.md
----------------------------------------------------------------------
diff --git a/deployment/aws/README.md b/deployment/aws/README.md
new file mode 100644
index 0000000..338948f
--- /dev/null
+++ b/deployment/aws/README.md
@@ -0,0 +1,172 @@
+AWS Cluster
+===
+
+**UNDER CONSTRUCTION**
+
+This project provides a AWS Cloud Formation template that launches and configures a complete Usergrid installation
+on Amazon EC2 including Elasticsearch instances, Tomcat instances, Cassandra instances, Security Groups, a Load Balancer
+and DNS records.
+
+Two parts:
+
+1) A Maven assembly that builds an installer tarball and uploads it to S3.
+The tarball includes scripts to install Oracle JDK, Cassandra, and Elasticsearch on the EC2 instances.
+
+2) A CloudFormation script `ugcluster-cf.json` that creates an auto-scaling cluster, security groups and some
+number of EC2 instances, The template includes a CloudInit script that runs scripts from
+the installer tarball to configure and start either Cassandra or on each instance.
+
+
+Getting set-up
+---
+To setup our AWS account to use AWS Cluster here's what you need to do:
+
+* __Create an AWS EC2 key pair__. You will need this PEM file to login to your Cassandra instances.
+
+* __Create an AWS S3 bucket__ for the AWS Cluster install bundle. e.g. Create an S3 bucket in your
+account with the name `ug-cloudformation`.
+
+* __Setup a top-level domain name__ in the AWS Route 53 DNS service. The default value of usergrid.com will not work
+(unless you happen to own that domain name).
+
+* __Upload the Oracle Java JDK__ to that same S3 bucket. Best practice is to use the Oracle Java JDK with Cassandra,
+so you must upload the JDK to the S3 bucket that we created above. The JDK must be named `jdk-8u71-linux-x64.tar.gz`.
+Java 8 is required by Usergrid 2.1.0 +.
+
+* __Create an aws.properties file__ with your AWS credentials in the same directory as this
+README file. The file is git-ignored so you don't have to worry about accidentally committing it.
+
+* __Deploy this the AWS Cluster assembly__ by running the Maven command `mvn deploy` in the same
+directory as this README file.
+
+
+Building the Installation Tarball
+---
+First you need to build the Usergrid components: the Java SDK, the Stack and the Portal.
+
+For example, here's how you would do that on a UNIX system (assuming that all Stack and Portal build pre-requisites are
+in place:
+
+ $ cd usergrid/sdks/java
+ $ mvn clean install
+
+ $ cd usergrid/stack
+ $ mvn -DskipTests=true clean install
+
+ $ cd usergrid/portal
+ $ ./build.sh
+
+Next, change back to the ```deployment/aws directory``` and run Maven deploy:
+
+ $ cd usergrid/deployment/aws
+ $ mvn deploy
+
+Maven will create the installation tarball and will copy it to your S3 bucket ```ug-cloudformation```. You can find a
+copy of the tarball in the target directory: `awscluster-1.0-SNAPSHOT.tgz`.
+
+
+Launching a new stack
+---
+Login to AWS Console and create a new CloudFormation stack. On the first screen, pick a short
+and simple name for your stack and choose the option to upload a template and upload
+the `ugcluster-cf.json` file in this very directory.
+
+On the next screen, enter the number of DB and REST servers you wish to create, the replication factor and
+the instance type you wish to use. Check the "I acknowledge that this will create IAM resources"
+and then click Next, Next, Next to take defaults and start the stack.
+
+Watch the EC2 console and see your instances come up. They will be tagged with the stack name
+that you provided.
+
+
+Accessing your new stack
+---
+Assuming everything went well then you can access your stack at the DNS sub-domain and domain name that you specified
+in the configuration. For example, if you specified DNS domain `usergrid.com` and sub-domain `test1` then you should be
+able to access Usergrid at `http://test1.usergrid.com/`.
+
+
+Initializing your stack
+---
+
+First, visit the Database setup URL: `http://<YOUR HOST NAME>/system/database/setup`
+
+When prompted to login use the username `superuser` and password `test`. If the operation is successful you should a
+message like the one below in your browser. If not, check your logs for clues about what went wrong.
+
+ {
+ "action" : "cassandra setup",
+ "status" : "ok",
+ "timestamp" : 1379424622947,
+ "duration" : 76
+ }
+
+Next, visit the Superuser setup URL: `http://<YOUR HOST NAME>/system/superuser/setup`
+
+You should not be prompted for login because you already logged into for the Database Setup. If setup works, you should
+see a message like this:
+
+ {
+ "action" : "superuser setup",
+ "status" : "ok",
+ "timestamp" : 1379424667936,
+ "duration" : 2
+ }
+
+Now you're ready to get started using Usergrid.
+
+
+Login to the Usergrid Console & get started
+---
+You should now be able to login to the Usergrid console and start configuring applications, users and more.
+
+The Usergrid Portal's URL is `http://<YOUR HOST NAME>/portal` and you can login with username `superuser` and password `test`.
+
+
+
+Exploring a Cassandra node
+---
+Take a look at your new cluster. Login to one of the instances and take a look at the Cassandra
+setup via `nodetool ring` and by looking at the following log file locations.
+
+Log File Locations
+
+`/var/log/usergrid-bootstrap.log` - log created as instance was created
+
+`/var/log/cassandra/*` - the Cassandra log files
+
+
+
+Exploring a Tomcat node
+---
+Take a look at your new cluster. Login to one of the instances and take a look at the Cassandra
+setup via `nodetool ring` and by looking at the following logs locations:
+
+Log File Locations
+
+`/var/log/usergrid-bootstrap.log` - log created as instance was created
+
+`/var/log/tomcat7/*` - the Tomcat log files
+
+
+
+How it works
+---
+Here's what happens when the stack is started.
+
+CloudFormation reads the `ugcluster-cf.json` template and uses starts the EC2 instances that it
+specifies. There are two types of instances, Cassandra instances and REST instances.
+
+When each Cassandra instance comes up CloudFormation runs the CloudInit script specified in
+`ugcluster-cf.json` and that script downloads the , sets up some environment scripts
+and calls the `init_instance/init_db_server.sh` script to complete the setup.
+
+The `init_instance/init_db_server.sh` calls `install_oraclejdk.sh` to download the JDK from S3 and
+install it. The script then installs Tomcat and Cassandra. Next it uses Groovy scripts to configure
+Cassandra and wait for other Cassandra nodes to come alive.
+
+When a REST instance comes up, it does the same things but it calls the `init_rest_server.sh` to install and configure
+Tomcat, wait for Cassandra nodes to become available and then setup the Usergrid Stack and Usergrid Portal webapps.
+
+
+
http://git-wip-us.apache.org/repos/asf/usergrid/blob/d478adb0/deployment/aws/assembly.xml
----------------------------------------------------------------------
diff --git a/deployment/aws/assembly.xml b/deployment/aws/assembly.xml
new file mode 100644
index 0000000..a0fc0aa
--- /dev/null
+++ b/deployment/aws/assembly.xml
@@ -0,0 +1,74 @@
+<assembly>
+
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+ <id>any</id>
+ <formats>
+ <format>tar.gz</format>
+ </formats>
+
+ <includeBaseDirectory>false</includeBaseDirectory>
+
+ <!-- <files>
+
+ <file>
+ <outputDirectory>webapps</outputDirectory>
+ <source>${stack.war}</source>
+ <destName>ROOT.war</destName>
+ </file>
+
+ </files> -->
+
+ <fileSets>
+
+ <fileSet>
+ <outputDirectory>.</outputDirectory>
+ <directory>${project.basedir}/src/main/dist</directory>
+ <includes>
+ <include>**</include>
+ </includes>
+ </fileSet>
+
+
+ <fileSet>
+ <outputDirectory>./scripts</outputDirectory>
+ <directory>./src/main/groovy</directory>
+ <includes>
+ <include>**</include>
+ </includes>
+ </fileSet>
+
+ <fileSet>
+ <outputDirectory>./cql</outputDirectory>
+ <directory>./src/main/cql</directory>
+ <includes>
+ <include>**</include>
+ </includes>
+ </fileSet>
+
+ <fileSet>
+ <outputDirectory>./webapps/portal</outputDirectory>
+ <directory>${portal.dir}</directory>
+ <includes>
+ <include>**</include>
+ </includes>
+ </fileSet>
+
+ </fileSets>
+
+</assembly>
http://git-wip-us.apache.org/repos/asf/usergrid/blob/d478adb0/deployment/aws/aws-sample.properties
----------------------------------------------------------------------
diff --git a/deployment/aws/aws-sample.properties b/deployment/aws/aws-sample.properties
new file mode 100644
index 0000000..b3e0917
--- /dev/null
+++ b/deployment/aws/aws-sample.properties
@@ -0,0 +1,19 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. The ASF licenses this file to You
+# under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License. For additional information regarding
+# copyright in this work, please see the NOTICE file in the top level
+# directory of this distribution.
+#
+accesskey=<YourServiceAccessKey>
+secretkey=<YourServiceSecretKey>
http://git-wip-us.apache.org/repos/asf/usergrid/blob/d478adb0/deployment/aws/gatling-cluster-cf.json
----------------------------------------------------------------------
diff --git a/deployment/aws/gatling-cluster-cf.json b/deployment/aws/gatling-cluster-cf.json
new file mode 100644
index 0000000..5f2f61b
--- /dev/null
+++ b/deployment/aws/gatling-cluster-cf.json
@@ -0,0 +1,386 @@
+{
+ "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": "ug-cloudformation",
+ "ConstraintDescription": "must be the name of an existing EC2 KeyPair."
+ },
+ "InstanceType": {
+ "Description": "WebServer EC2 instance type",
+ "Type": "String",
+ "Default": "c3.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."
+ },
+ "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."
+ },
+ "Branch": {
+ "Description": "The branch of usergrid to check out",
+ "Type": "String",
+ "Default": "master"
+ }
+ },
+
+ "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-8dcd88b7"
+ },
+ "us-east-1": {
+ "64": "ami-9301c7f8"
+ },
+ "us-west-2": {
+ "64": "ami-ed5751dd"
+ }
+ },
+ "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 M3_HOME=/usr/local/apache-maven/apache-maven-3.1.1\n",
+ "export M3=$M3_HOME/bin\n",
+ "export MAVEN_OPTS=\"-Xms256m -Xmx512m\"\n",
+ "export PATH=$M3:$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", { "Ref" : "InstanceType" }, "Arch" ] } ]},
+ "SecurityGroups" : [ { "Ref" : "InstanceSecurityGroup" } ],
+ "InstanceType" : { "Ref" : "InstanceType" },
+ "UserData" : { "Fn::Base64" : { "Fn::Join" : ["", [
+ "#!/bin/bash -xe\n",
+ "##This script is generated by cloud-init. The rendered version is usually located at /var/lib/cloud/instance/scripts/part-001\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",
+
+
+ "add-apt-repository ppa:webupd8team/java --yes\n",
+ "add-apt-repository ppa:awstools-dev/awstools --yes\n",
+ "apt-get update\n",
+ "echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections\n",
+ "apt-get install oracle-java8-installer oracle-java8-set-default expect expect-dev git ec2-api-tools maven -y --force-yes\n",
+ "update-java-alternatives -s java-8-oracle\n",
+
+ "cd ~ubuntu\n",
+ "git clone -b ",{ "Ref":"Branch" } , " https://github.com/apache/usergrid.git usergrid\n",
+ "chown -R ubuntu:ubuntu usergrid\n",
+
+ "ec2-create-tags $(curl -k http://169.254.169.254/latest/meta-data/instance-id) --region ", { "Ref" : "AWS::Region" }," --aws-access-key ",{ "Ref":"GatlingKey" }, " --aws-secret-key ", { "Fn::GetAtt":[ "GatlingKey", "SecretAccessKey" ] } ," --tag Name=", { "Ref":"AWS::StackName" }, "\n",
+ "/usr/local/bin/cfn-signal --success true --stack ", { "Ref" : "AWS::StackName" }, " --resource GatlingServerGroup --region ", { "Ref" : "AWS::Region" }, "\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" ]}]]}
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/d478adb0/deployment/aws/pom.xml
----------------------------------------------------------------------
diff --git a/deployment/aws/pom.xml b/deployment/aws/pom.xml
new file mode 100644
index 0000000..88a423b
--- /dev/null
+++ b/deployment/aws/pom.xml
@@ -0,0 +1,238 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.usergrid</groupId>
+ <artifactId>awscluster</artifactId>
+ <version>1.0-SNAPSHOT</version>
+
+ <name>awscluster</name>
+
+ <description>
+ Creates bundle for initializing a Tomcat and Cassandra Usergrid cluster via CloudFormation
+ </description>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <aws.s3.release-bucket>ug-cloudformation</aws.s3.release-bucket>
+ <!-- Pulls the file path from maven when using the dependency plugin. This doesn't work b/c it doesn't name the file properly to ROOT.war. Solve that to use the latest from the repo-->
+ <!--<stack.war>${org.apache.usergrid:usergrid-rest:war}</stack.war>-->
+ <stack.war>../../stack/rest/target/ROOT.war</stack.war>
+ <portal.dir>../../portal/dist/usergrid-portal</portal.dir>
+ </properties>
+
+ <build>
+
+ <plugins>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>make-assembly</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <descriptors>
+ <descriptor>assembly.xml</descriptor>
+ </descriptors>
+ <appendAssemblyId>false</appendAssemblyId>
+ <tarLongFileMode>gnu</tarLongFileMode>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>exec-maven-plugin</artifactId>
+ <version>1.2</version>
+ <executions>
+
+ <!-- upload the tar file-->
+ <execution>
+ <phase>deploy</phase>
+ <goals>
+ <goal>java</goal>
+ </goals>
+ <id>upload-scripts</id>
+ <configuration>
+ <includeProjectDependencies>true</includeProjectDependencies>
+ <includePluginDependencies>true</includePluginDependencies>
+ <classpathScope>runtime</classpathScope>
+ <executableDependency>
+ <groupId>net.java.dev.jets3t</groupId>
+ <artifactId>jets3t</artifactId>
+ </executableDependency>
+ <mainClass>org.jets3t.apps.synchronize.Synchronize</mainClass>
+ <arguments>
+ <argument>--nodelete</argument>
+ <argument>--properties</argument>
+ <argument>${project.basedir}/aws.properties</argument>
+ <argument>UP</argument>
+ <argument>${aws.s3.release-bucket}</argument>
+ <argument>${project.build.directory}/${project.build.finalName}.tar.gz</argument>
+ </arguments>
+ </configuration>
+ </execution>
+
+ <!-- upload the war file from our repository -->
+ <execution>
+ <phase>deploy</phase>
+ <goals>
+ <goal>java</goal>
+ </goals>
+ <id>upload-war</id>
+ <configuration>
+ <includeProjectDependencies>true</includeProjectDependencies>
+ <includePluginDependencies>true</includePluginDependencies>
+ <classpathScope>runtime</classpathScope>
+ <executableDependency>
+ <groupId>net.java.dev.jets3t</groupId>
+ <artifactId>jets3t</artifactId>
+ </executableDependency>
+ <mainClass>org.jets3t.apps.synchronize.Synchronize</mainClass>
+ <arguments>
+ <argument>--nodelete</argument>
+ <argument>--properties</argument>
+ <argument>${project.basedir}/aws.properties</argument>
+ <argument>UP</argument>
+ <argument>${aws.s3.release-bucket}</argument>
+ <argument>${stack.war}</argument>
+ </arguments>
+ </configuration>
+ </execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <groupId>net.java.dev.jets3t</groupId>
+ <artifactId>jets3t</artifactId>
+ <version>0.8.0</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-deploy-plugin</artifactId>
+ <version>2.8.1</version>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.3.2</version>
+ <dependencies>
+ <dependency>
+ <groupId>org.codehaus.groovy</groupId>
+ <artifactId>groovy-eclipse-compiler</artifactId>
+ <version>2.6.0-01</version>
+ </dependency>
+ </dependencies>
+ <configuration>
+ <compilerId>groovy-eclipse-compiler</compilerId>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>groovy-eclipse-compiler</artifactId>
+ <groupId>org.codehaus.groovy</groupId>
+ <version>2.6.0-01</version>
+ <extensions>true</extensions>
+ </plugin>
+
+ <!-- Set the dependency path in the lifecycle for the property -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <version>2.9</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>properties</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <!-- echo out the stack war -->
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>exec-maven-plugin</artifactId>
+ <version>1.2</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>exec</goal>
+ </goals>
+ <phase>generate-sources</phase>
+ </execution>
+ </executions>
+ <configuration>
+ <executable>echo</executable>
+ <arguments>
+ <argument>stack.war=</argument>
+ <argument>${stack.war}</argument>
+ </arguments>
+ </configuration>
+ </plugin>
+ </plugins>
+
+ </build>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>net.java.dev.jets3t</groupId>
+ <artifactId>synchronize</artifactId>
+ <version>0.8.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>net.java.dev.jets3t</groupId>
+ <artifactId>jets3t</artifactId>
+ <version>0.8.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.amazonaws</groupId>
+ <artifactId>aws-java-sdk</artifactId>
+ <version>1.9.7</version>
+ </dependency>
+ <dependency>
+ <artifactId>groovy-all</artifactId>
+ <groupId>org.codehaus.groovy</groupId>
+ <version>2.0.5</version>
+ </dependency>
+
+ <!-- This dependency is used for deployment -->
+ <dependency>
+ <groupId>org.apache.usergrid</groupId>
+ <artifactId>usergrid-rest</artifactId>
+ <!-- Change this if you want to deploy a specific version, otherwise the latest in the repository will be used-->
+ <version>2.1.1-SNAPSHOT</version>
+ <type>war</type>
+ </dependency>
+ </dependencies>
+
+</project>
+
http://git-wip-us.apache.org/repos/asf/usergrid/blob/d478adb0/deployment/aws/src/main/cql/update_locks.cql
----------------------------------------------------------------------
diff --git a/deployment/aws/src/main/cql/update_locks.cql b/deployment/aws/src/main/cql/update_locks.cql
new file mode 100644
index 0000000..bdb5860
--- /dev/null
+++ b/deployment/aws/src/main/cql/update_locks.cql
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. The ASF licenses this file to You
+ * under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+update keyspace Locks with placement_strategy = 'NetworkTopologyStrategy' and strategy_options = {KEYSPACE_REGION : REPLICATION_FACTOR} and durable_writes = false;
+
+use Locks;
+
+update column family HLocks with gc_grace=60 and caching=ALL and read_repair_chance=0.00 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512};
+
http://git-wip-us.apache.org/repos/asf/usergrid/blob/d478adb0/deployment/aws/src/main/cql/update_usergrid.cql
----------------------------------------------------------------------
diff --git a/deployment/aws/src/main/cql/update_usergrid.cql b/deployment/aws/src/main/cql/update_usergrid.cql
new file mode 100644
index 0000000..53622a2
--- /dev/null
+++ b/deployment/aws/src/main/cql/update_usergrid.cql
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. The ASF licenses this file to You
+ * under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+
+update keyspace Usergrid with placement_strategy = 'NetworkTopologyStrategy' and strategy_options = {KEYSPACE_REGION : REPLICATION_FACTOR} and durable_writes = true;
+
+use Usergrid;
+
+update column family Applications with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512};
+update column family PrincipalTokens with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512};
+update column family Properties with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512};
+update column family Tokens with caching=ALL and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512};
+
http://git-wip-us.apache.org/repos/asf/usergrid/blob/d478adb0/deployment/aws/src/main/cql/update_usergrid_applications.cql
----------------------------------------------------------------------
diff --git a/deployment/aws/src/main/cql/update_usergrid_applications.cql b/deployment/aws/src/main/cql/update_usergrid_applications.cql
new file mode 100644
index 0000000..e94960b
--- /dev/null
+++ b/deployment/aws/src/main/cql/update_usergrid_applications.cql
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. The ASF licenses this file to You
+ * under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+
+update keyspace Usergrid_Applications with placement_strategy = 'NetworkTopologyStrategy' and strategy_options = {KEYSPACE_REGION : REPLICATION_FACTOR} and durable_writes = true;
+
+use Usergrid_Applications;
+
+update column family Application_Aggregate_Counters with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512};
+update column family Application_Roles with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512};
+update column family Applications with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512};
+update column family Consumer_Queue_Messages_Properties with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512};
+update column family Entity_Composite_Dictionaries with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512};
+update column family Entity_Counters with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512};
+update column family Entity_Dictionaries with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512};
+update column family Entity_Id_Sets with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512};
+update column family Entity_Index with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512};
+update column family Entity_Index_Entries with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512};
+update column family Entity_Metadata with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512};
+update column family Entity_Properties with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512};
+update column family Entity_Unique with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512};
+update column family MQ_Consumers with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512};
+update column family MQ_Consumers_Timeout with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512};
+update column family MQ_Counters with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512};
+update column family MQ_Property_Index with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512};
+update column family MQ_Property_Index_Entries with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512};
+update column family Queue_Dictionaries with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512};
+update column family Queue_Inbox with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512};
+update column family Queue_Properties with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512};
+update column family Queue_Subscribers with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512};
+update column family Queue_Subscriptions with caching=KEYS_ONLY and read_repair_chance=0.1 and compaction_strategy='LeveledCompactionStrategy' and bloom_filter_fp_chance=0.1 and compaction_strategy_options={sstable_size_in_mb:512};
+
http://git-wip-us.apache.org/repos/asf/usergrid/blob/d478adb0/deployment/aws/src/main/dist/init_instance/create_raid0.sh
----------------------------------------------------------------------
diff --git a/deployment/aws/src/main/dist/init_instance/create_raid0.sh b/deployment/aws/src/main/dist/init_instance/create_raid0.sh
new file mode 100644
index 0000000..c9122d7
--- /dev/null
+++ b/deployment/aws/src/main/dist/init_instance/create_raid0.sh
@@ -0,0 +1,54 @@
+#!/bin/bash
+
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. The ASF licenses this file to You
+# under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License. For additional information regarding
+# copyright in this work, please see the NOTICE file in the top level
+# directory of this distribution.
+#
+
+
+
+# WARNING: this does not work for any instances that have more than 2 ephemeral disks
+
+
+
+# install postfix first and prevent it from prompting the user
+debconf-set-selections <<< "postfix postfix/mailname string your.hostname.com"
+debconf-set-selections <<< "postfix postfix/main_mailer_type string 'Internet Site'"
+apt-get install -y postfix
+
+# install mdadm RAID controller
+apt-get -y --force-yes install mdadm
+
+# m1.xlarge has four 414GB disks, but only /dev/xvdb is mounted
+# unmount /dev/xvdb so we can use it in our setup
+umount /mnt
+
+
+#We only support 2 ephemeral disks. Most c3.x instances only have 2 disks and they're our target
+# create striped RAID0 device with our 2 disks
+yes | mdadm --create --verbose /dev/md0 --level=0 --raid-devices=2 -c 256 /dev/xvdb /dev/xvdc
+
+
+
+
+# save config
+mdadm --detail --scan | tee /etc/mdadm/mdadm.conf
+
+# create, mount and save disk to stab
+mkfs.ext4 -b 4096 -E stride=32,stripe-width=128 -L Stripe /dev/md0
+mkdir -p /mnt
+echo "/dev/md0 /mnt/ ext4 defaults,noatime,nofail 0 0" >> /etc/fstab
+mount /dev/md0 /mnt
http://git-wip-us.apache.org/repos/asf/usergrid/blob/d478adb0/deployment/aws/src/main/dist/init_instance/init_db_server.sh
----------------------------------------------------------------------
diff --git a/deployment/aws/src/main/dist/init_instance/init_db_server.sh b/deployment/aws/src/main/dist/init_instance/init_db_server.sh
new file mode 100644
index 0000000..eb8e1ba
--- /dev/null
+++ b/deployment/aws/src/main/dist/init_instance/init_db_server.sh
@@ -0,0 +1,76 @@
+#!/bin/bash
+
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. The ASF licenses this file to You
+# under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License. For additional information regarding
+# copyright in this work, please see the NOTICE file in the top level
+# directory of this distribution.
+#
+
+
+
+
+echo "${HOSTNAME}" > /etc/hostname
+echo "127.0.0.1 ${HOSTNAME}" >> /etc/hosts
+hostname `cat /etc/hostname`
+
+echo "US/Eastern" > /etc/timezone
+dpkg-reconfigure -f noninteractive tzdata
+
+# Build environment for scripts
+. /etc/profile.d/aws-credentials.sh
+. /etc/profile.d/usergrid-env.sh
+
+
+# Install the easy stuff
+PKGS="ntp unzip groovy curl"
+apt-get update
+apt-get -y --force-yes install ${PKGS}
+/etc/init.d/tomcat7 stop
+
+# Install AWS Java SDK and get it into the Groovy classpath
+curl http://sdk-for-java.amazonwebservices.com/latest/aws-java-sdk.zip > /tmp/aws-sdk-java.zip
+cd /usr/share/
+unzip /tmp/aws-sdk-java.zip
+mkdir -p /home/ubuntu/.groovy/lib
+cp /usr/share/aws-java-sdk-*/third-party/*/*.jar /home/ubuntu/.groovy/lib
+cp /usr/share/aws-java-sdk-*/lib/* /home/ubuntu/.groovy/lib
+# except for evil stax
+rm /home/ubuntu/.groovy/lib/stax*
+ln -s /home/ubuntu/.groovy /root/.groovy
+
+
+
+# tag last so we can see in the console so that we know what's running
+cd /usr/share/usergrid/scripts
+groovy tag_instance.groovy -BUILD-IN-PROGRESS
+
+#Create our raid 0 array
+cd /usr/share/usergrid/init_instance
+./create_raid0.sh
+
+cd /usr/share/usergrid/init_instance
+./install_oraclejdk.sh
+
+# Install and stop Cassandra
+cd /usr/share/usergrid/init_instance
+./install_cassandra.sh
+
+# Install the opscenter agent
+cd /usr/share/usergrid/init_instance
+./install_opscenter_agent.sh
+
+# tag last so we can see in the console that the script ran to completion
+cd /usr/share/usergrid/scripts
+groovy tag_instance.groovy
http://git-wip-us.apache.org/repos/asf/usergrid/blob/d478adb0/deployment/aws/src/main/dist/init_instance/init_es_server.sh
----------------------------------------------------------------------
diff --git a/deployment/aws/src/main/dist/init_instance/init_es_server.sh b/deployment/aws/src/main/dist/init_instance/init_es_server.sh
new file mode 100644
index 0000000..836b1d9
--- /dev/null
+++ b/deployment/aws/src/main/dist/init_instance/init_es_server.sh
@@ -0,0 +1,71 @@
+#!/bin/bash
+
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. The ASF licenses this file to You
+# under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License. For additional information regarding
+# copyright in this work, please see the NOTICE file in the top level
+# directory of this distribution.
+#
+
+
+
+echo "${HOSTNAME}" > /etc/hostname
+echo "127.0.0.1 ${HOSTNAME}" >> /etc/hosts
+hostname `cat /etc/hostname`
+
+echo "US/Eastern" > /etc/timezone
+dpkg-reconfigure -f noninteractive tzdata
+
+# Build environment for scripts
+. /etc/profile.d/aws-credentials.sh
+. /etc/profile.d/usergrid-env.sh
+
+
+# Install the easy stuff
+PKGS="ntp unzip groovy curl"
+apt-get update
+apt-get -y --force-yes install ${PKGS}
+/etc/init.d/tomcat7 stop
+
+# Install AWS Java SDK and get it into the Groovy classpath
+curl http://sdk-for-java.amazonwebservices.com/latest/aws-java-sdk.zip > /tmp/aws-sdk-java.zip
+cd /usr/share/
+unzip /tmp/aws-sdk-java.zip
+mkdir -p /home/ubuntu/.groovy/lib
+cp /usr/share/aws-java-sdk-*/third-party/*/*.jar /home/ubuntu/.groovy/lib
+cp /usr/share/aws-java-sdk-*/lib/* /home/ubuntu/.groovy/lib
+# except for evil stax
+rm /home/ubuntu/.groovy/lib/stax*
+ln -s /home/ubuntu/.groovy /root/.groovy
+
+# tag last so we can see in the console so that we know what's running
+cd /usr/share/usergrid/scripts
+groovy tag_instance.groovy -BUILD-IN-PROGRESS
+
+
+#Configure our RAID 0 arrays
+cd /usr/share/usergrid/init_instance
+./create_raid0.sh
+
+
+cd /usr/share/usergrid/init_instance
+./install_oraclejdk.sh
+
+# Install and start ElasticSearch
+cd /usr/share/usergrid/init_instance
+./install_elasticsearch.sh
+
+# tag last so we can see in the console that the script ran to completion
+cd /usr/share/usergrid/scripts
+groovy tag_instance.groovy
http://git-wip-us.apache.org/repos/asf/usergrid/blob/d478adb0/deployment/aws/src/main/dist/init_instance/init_graphite_server.sh
----------------------------------------------------------------------
diff --git a/deployment/aws/src/main/dist/init_instance/init_graphite_server.sh b/deployment/aws/src/main/dist/init_instance/init_graphite_server.sh
new file mode 100644
index 0000000..689c08e
--- /dev/null
+++ b/deployment/aws/src/main/dist/init_instance/init_graphite_server.sh
@@ -0,0 +1,69 @@
+#!/bin/bash
+
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. The ASF licenses this file to You
+# under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License. For additional information regarding
+# copyright in this work, please see the NOTICE file in the top level
+# directory of this distribution.
+#
+
+
+
+echo "${HOSTNAME}" > /etc/hostname
+echo "127.0.0.1 ${HOSTNAME}" >> /etc/hosts
+hostname `cat /etc/hostname`
+
+echo "US/Eastern" > /etc/timezone
+dpkg-reconfigure -f noninteractive tzdata
+
+# Build environment for scripts
+. /etc/profile.d/aws-credentials.sh
+. /etc/profile.d/usergrid-env.sh
+
+
+# Install the easy stuff
+PKGS="ntp unzip groovy tomcat7 curl"
+apt-get update
+apt-get -y --force-yes install ${PKGS}
+/etc/init.d/tomcat7 stop
+
+# Install AWS Java SDK and get it into the Groovy classpath
+curl http://sdk-for-java.amazonwebservices.com/latest/aws-java-sdk.zip > /tmp/aws-sdk-java.zip
+cd /usr/share/
+unzip /tmp/aws-sdk-java.zip
+mkdir -p /home/ubuntu/.groovy/lib
+cp /usr/share/aws-java-sdk-*/third-party/*/*.jar /home/ubuntu/.groovy/lib
+cp /usr/share/aws-java-sdk-*/lib/* /home/ubuntu/.groovy/lib
+# except for evil stax
+rm /home/ubuntu/.groovy/lib/stax*
+ln -s /home/ubuntu/.groovy /root/.groovy
+
+# tag last so we can see in the console so that we know what's running
+cd /usr/share/usergrid/scripts
+groovy tag_instance.groovy -BUILD-IN-PROGRESS
+
+cd /usr/share/usergrid/init_instance
+./install_oraclejdk.sh
+
+sudo apt-get -y --force-yes install docker.io
+
+#Install graphite
+sudo docker run -d --name graphite -p 80:80 -p 2003:2003 -p 8125:8125/udp hopsoft/graphite-statsd
+
+cd /usr/share/usergrid/scripts
+groovy registry_register.groovy graphite
+
+# tag last so we can see in the console that the script ran to completion
+cd /usr/share/usergrid/scripts
+groovy tag_instance.groovy
http://git-wip-us.apache.org/repos/asf/usergrid/blob/d478adb0/deployment/aws/src/main/dist/init_instance/init_opscenter_server.sh
----------------------------------------------------------------------
diff --git a/deployment/aws/src/main/dist/init_instance/init_opscenter_server.sh b/deployment/aws/src/main/dist/init_instance/init_opscenter_server.sh
new file mode 100644
index 0000000..b63a710
--- /dev/null
+++ b/deployment/aws/src/main/dist/init_instance/init_opscenter_server.sh
@@ -0,0 +1,287 @@
+#!/bin/bash
+
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. The ASF licenses this file to You
+# under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License. For additional information regarding
+# copyright in this work, please see the NOTICE file in the top level
+# directory of this distribution.
+#
+
+
+
+
+echo "${HOSTNAME}" > /etc/hostname
+echo "127.0.0.1 ${HOSTNAME}" >> /etc/hosts
+hostname `cat /etc/hostname`
+
+echo "US/Eastern" > /etc/timezone
+dpkg-reconfigure -f noninteractive tzdata
+
+# Build environment for scripts
+. /etc/profile.d/aws-credentials.sh
+. /etc/profile.d/usergrid-env.sh
+
+# Install the easy stuff
+PKGS="ntp unzip groovy curl"
+apt-get update
+apt-get -y --force-yes install ${PKGS}
+/etc/init.d/tomcat7 stop
+
+# Install AWS Java SDK and get it into the Groovy classpath
+curl http://sdk-for-java.amazonwebservices.com/latest/aws-java-sdk.zip > /tmp/aws-sdk-java.zip
+cd /usr/share/
+unzip /tmp/aws-sdk-java.zip
+mkdir -p /home/ubuntu/.groovy/lib
+cp /usr/share/aws-java-sdk-*/third-party/*/*.jar /home/ubuntu/.groovy/lib
+cp /usr/share/aws-java-sdk-*/lib/* /home/ubuntu/.groovy/lib
+# except for evil stax
+rm /home/ubuntu/.groovy/lib/stax*
+ln -s /home/ubuntu/.groovy /root/.groovy
+
+# tag last so we can see in the console so that we know what's running
+cd /usr/share/usergrid/scripts
+groovy tag_instance.groovy -BUILD-IN-PROGRESS
+
+
+#Create the raid0 array for cassandra storage
+pushd /usr/share/usergrid/init_instance
+./create_raid0.sh
+#Install the oracle jdd
+./install_oraclejdk.sh
+popd
+
+#Install cassandra
+
+# Install and stop Cassandra
+curl -L http://debian.datastax.com/debian/repo_key | apt-key add -
+
+sudo cat >> /etc/apt/sources.list.d/cassandra.sources.list << EOF
+deb http://debian.datastax.com/community stable main
+EOF
+
+apt-get update
+apt-get -y --force-yes install libcap2 cassandra=1.2.19
+/etc/init.d/cassandra stop
+
+mkdir -p /mnt/data/cassandra
+chown cassandra /mnt/data/cassandra
+
+
+# Register ourselves
+pushd /usr/share/usergrid/scripts
+groovy registry_register.groovy opscenter
+popd
+
+pushd /usr/share/usergrid/scripts
+groovy configure_opscenter_cassandra.groovy > /etc/cassandra/cassandra.yaml
+popd
+
+/etc/init.d/cassandra start
+
+#We have to wait for cass to actually start before we can run our CQL. Sleep 5 seconds between retries
+while ! echo exit | nc localhost 9160; do sleep 5; done
+
+CASS_REGION=${EC2_REGION%-1}
+#create our keyspace
+cat >> /tmp/opscenter.cql << EOF
+CREATE KEYSPACE "OpsCenter" WITH REPLICATION = {'class' : 'NetworkTopologyStrategy', '${CASS_REGION}' : 1};
+
+USE "OpsCenter";
+
+CREATE TABLE bestpractice_results (
+ key text,
+ column1 varint,
+ value blob,
+ PRIMARY KEY (key, column1)
+) WITH COMPACT STORAGE AND
+ CLUSTERING ORDER BY (column1 DESC) AND
+ bloom_filter_fp_chance=0.010000 AND
+ caching='KEYS_ONLY' AND
+ comment='{"info": "OpsCenter management data.", "version": [5, 0, 1]}' AND
+ dclocal_read_repair_chance=0.000000 AND
+ gc_grace_seconds=0 AND
+ read_repair_chance=0.250000 AND
+ replicate_on_write='true' AND
+ populate_io_cache_on_flush='false' AND
+ compaction={'class': 'SizeTieredCompactionStrategy'} AND
+ compression={'sstable_compression': 'SnappyCompressor'};
+
+CREATE TABLE events (
+ key text PRIMARY KEY,
+ action bigint,
+ level bigint,
+ success boolean,
+ time bigint
+) WITH COMPACT STORAGE AND
+ bloom_filter_fp_chance=0.010000 AND
+ caching='KEYS_ONLY' AND
+ comment='{"info": "OpsCenter management data.", "version": [5, 0, 1]}' AND
+ dclocal_read_repair_chance=0.000000 AND
+ gc_grace_seconds=864000 AND
+ read_repair_chance=0.250000 AND
+ replicate_on_write='true' AND
+ populate_io_cache_on_flush='false' AND
+ compaction={'class': 'SizeTieredCompactionStrategy'} AND
+ compression={'sstable_compression': 'SnappyCompressor'};
+
+CREATE TABLE events_timeline (
+ key text,
+ column1 bigint,
+ value blob,
+ PRIMARY KEY (key, column1)
+) WITH COMPACT STORAGE AND
+ bloom_filter_fp_chance=0.010000 AND
+ caching='KEYS_ONLY' AND
+ comment='{"info": "OpsCenter management data.", "version": [5, 0, 1]}' AND
+ dclocal_read_repair_chance=0.000000 AND
+ gc_grace_seconds=864000 AND
+ read_repair_chance=0.250000 AND
+ replicate_on_write='true' AND
+ populate_io_cache_on_flush='false' AND
+ compaction={'class': 'SizeTieredCompactionStrategy'} AND
+ compression={'sstable_compression': 'SnappyCompressor'};
+
+CREATE TABLE pdps (
+ key text,
+ column1 text,
+ value blob,
+ PRIMARY KEY (key, column1)
+) WITH COMPACT STORAGE AND
+ bloom_filter_fp_chance=0.010000 AND
+ caching='KEYS_ONLY' AND
+ comment='{"info": "OpsCenter management data.", "version": [5, 0, 1]}' AND
+ dclocal_read_repair_chance=0.000000 AND
+ gc_grace_seconds=0 AND
+ read_repair_chance=0.250000 AND
+ replicate_on_write='true' AND
+ populate_io_cache_on_flush='false' AND
+ compaction={'class': 'SizeTieredCompactionStrategy'} AND
+ compression={'sstable_compression': 'SnappyCompressor'};
+
+CREATE TABLE rollups300 (
+ key text,
+ column1 varint,
+ value blob,
+ PRIMARY KEY (key, column1)
+) WITH COMPACT STORAGE AND
+ bloom_filter_fp_chance=0.010000 AND
+ caching='KEYS_ONLY' AND
+ comment='{"info": "OpsCenter management data.", "version": [5, 0, 1]}' AND
+ dclocal_read_repair_chance=0.000000 AND
+ gc_grace_seconds=0 AND
+ read_repair_chance=0.250000 AND
+ replicate_on_write='true' AND
+ populate_io_cache_on_flush='false' AND
+ compaction={'class': 'SizeTieredCompactionStrategy'} AND
+ compression={'sstable_compression': 'SnappyCompressor'};
+
+CREATE TABLE rollups60 (
+ key text,
+ column1 varint,
+ value blob,
+ PRIMARY KEY (key, column1)
+) WITH COMPACT STORAGE AND
+ bloom_filter_fp_chance=0.010000 AND
+ caching='KEYS_ONLY' AND
+ comment='{"info": "OpsCenter management data.", "version": [5, 0, 1]}' AND
+ dclocal_read_repair_chance=0.000000 AND
+ gc_grace_seconds=0 AND
+ read_repair_chance=0.250000 AND
+ replicate_on_write='true' AND
+ populate_io_cache_on_flush='false' AND
+ compaction={'class': 'SizeTieredCompactionStrategy'} AND
+ compression={'sstable_compression': 'SnappyCompressor'};
+
+CREATE TABLE rollups7200 (
+ key text,
+ column1 varint,
+ value blob,
+ PRIMARY KEY (key, column1)
+) WITH COMPACT STORAGE AND
+ bloom_filter_fp_chance=0.010000 AND
+ caching='KEYS_ONLY' AND
+ comment='{"info": "OpsCenter management data.", "version": [5, 0, 1]}' AND
+ dclocal_read_repair_chance=0.000000 AND
+ gc_grace_seconds=0 AND
+ read_repair_chance=0.250000 AND
+ replicate_on_write='true' AND
+ populate_io_cache_on_flush='false' AND
+ compaction={'class': 'SizeTieredCompactionStrategy'} AND
+ compression={'sstable_compression': 'SnappyCompressor'};
+
+CREATE TABLE rollups86400 (
+ key text,
+ column1 varint,
+ value blob,
+ PRIMARY KEY (key, column1)
+) WITH COMPACT STORAGE AND
+ bloom_filter_fp_chance=0.010000 AND
+ caching='KEYS_ONLY' AND
+ comment='{"info": "OpsCenter management data.", "version": [5, 0, 1]}' AND
+ dclocal_read_repair_chance=0.000000 AND
+ gc_grace_seconds=0 AND
+ read_repair_chance=0.250000 AND
+ replicate_on_write='true' AND
+ populate_io_cache_on_flush='false' AND
+ compaction={'class': 'SizeTieredCompactionStrategy'} AND
+ compression={'sstable_compression': 'SnappyCompressor'};
+
+CREATE TABLE settings (
+ key blob,
+ column1 blob,
+ value blob,
+ PRIMARY KEY (key, column1)
+) WITH COMPACT STORAGE AND
+ bloom_filter_fp_chance=0.010000 AND
+ caching='KEYS_ONLY' AND
+ comment='{"info": "OpsCenter management data.", "version": [5, 0, 1]}' AND
+ dclocal_read_repair_chance=0.000000 AND
+ gc_grace_seconds=864000 AND
+ read_repair_chance=1.000000 AND
+ replicate_on_write='true' AND
+ populate_io_cache_on_flush='false' AND
+ compaction={'class': 'SizeTieredCompactionStrategy'} AND
+ compression={'sstable_compression': 'SnappyCompressor'};
+
+EOF
+
+
+echo "Creating opscenter keyspace"
+/usr/bin/cqlsh -f /tmp/opscenter.cql
+
+
+
+
+#Install the opscenter service
+# Install opscenter
+echo "deb http://debian.datastax.com/community stable main" | sudo tee -a /etc/apt/sources.list.d/datastax.community.list
+
+apt-get update
+apt-get --force-yes -y install opscenter
+
+sudo service opscenterd stop
+
+#Configure the usergrid cluster to store data locally, not on the target cluster and auto boostrap it
+cd /usr/share/usergrid/scripts
+groovy wait_for_instances.groovy cassandra 1
+mkdir -p /etc/opscenter/clusters
+groovy configure_opscenter_usergrid.groovy > /etc/opscenter/clusters/$CASSANDRA_CLUSTER_NAME.conf
+
+
+sudo service opscenterd start
+
+# tag last so we can see in the console that the script ran to completion
+cd /usr/share/usergrid/scripts
+groovy tag_instance.groovy
+
http://git-wip-us.apache.org/repos/asf/usergrid/blob/d478adb0/deployment/aws/src/main/dist/init_instance/init_rest_server.sh
----------------------------------------------------------------------
diff --git a/deployment/aws/src/main/dist/init_instance/init_rest_server.sh b/deployment/aws/src/main/dist/init_instance/init_rest_server.sh
new file mode 100644
index 0000000..0736026
--- /dev/null
+++ b/deployment/aws/src/main/dist/init_instance/init_rest_server.sh
@@ -0,0 +1,257 @@
+#!/bin/bash
+
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. The ASF licenses this file to You
+# under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License. For additional information regarding
+# copyright in this work, please see the NOTICE file in the top level
+# directory of this distribution.
+#
+
+
+
+echo "${HOSTNAME}" > /etc/hostname
+echo "127.0.0.1 ${HOSTNAME}" >> /etc/hosts
+hostname `cat /etc/hostname`
+
+echo "US/Eastern" > /etc/timezone
+dpkg-reconfigure -f noninteractive tzdata
+
+PKGS="openjdk-7-jdk tomcat7 s3cmd ntp unzip groovy"
+apt-get update
+apt-get -y --force-yes install ${PKGS}
+/etc/init.d/tomcat7 stop
+
+# Install AWS Java SDK and get it into the Groovy classpath
+curl http://sdk-for-java.amazonwebservices.com/latest/aws-java-sdk.zip > /tmp/aws-sdk-java.zip
+cd /usr/share/
+unzip /tmp/aws-sdk-java.zip
+mkdir -p /home/ubuntu/.groovy/lib
+cp /usr/share/aws-java-sdk-*/third-party/*/*.jar /home/ubuntu/.groovy/lib
+cp /usr/share/aws-java-sdk-*/lib/* /home/ubuntu/.groovy/lib
+ln -s /home/ubuntu/.groovy /root/.groovy
+
+# Build environment for Groovy scripts
+. /etc/profile.d/aws-credentials.sh
+. /etc/profile.d/usergrid-env.sh
+
+
+# tag last so we can see in the console so that we know what's running
+cd /usr/share/usergrid/scripts
+groovy tag_instance.groovy -BUILD-IN-PROGRESS
+
+
+
+chmod +x /usr/share/usergrid/update.sh
+
+cd /usr/share/usergrid/init_instance
+./install_oraclejdk.sh
+
+cd /usr/share/usergrid/init_instance
+./install_yourkit.sh
+
+# set Tomcat memory and threads based on instance type
+# use about 70% of RAM for heap
+export NOFILE=150000
+#export TOMCAT_CONNECTIONS=10000
+export ACCEPT_COUNT=100
+export NR_OPEN=1048576
+export FILE_MAX=761773
+
+#Get the number of processors
+export NUM_PROC=$(nproc)
+
+#Configure the max amount of tomcat threads
+export TOMCAT_THREADS=$((${NUM_PROC} * ${NUM_THREAD_PROC}))
+
+case `(curl http://169.254.169.254/latest/meta-data/instance-type)` in
+'m1.small' )
+ # total of 1.7g
+ export TOMCAT_RAM=1190m
+;;
+'m1.medium' )
+ # total of 3.75g
+ export TOMCAT_RAM=2625m
+;;
+'m1.large' )
+ # total of 7.5g
+ export TOMCAT_RAM=5250m
+;;
+'m1.xlarge' )
+ # total of 15g
+ export TOMCAT_RAM=10500m
+;;
+'m3.large' )
+ # total of 7.5g
+ export TOMCAT_RAM=5250m
+;;
+'m3.xlarge' )
+ # total of 15g
+ export TOMCAT_RAM=10500m
+;;
+'c3.xlarge' )
+ # total of 7.5g
+ export TOMCAT_RAM=4096m
+;;
+'c3.2xlarge' )
+ # total of 15g
+ export TOMCAT_RAM=10500m
+;;
+'c3.4xlarge' )
+ # total of 30g
+ export TOMCAT_RAM=21000m
+esac
+
+
+sed -i.bak "s/Xmx128m/Xmx${TOMCAT_RAM} -Xms${TOMCAT_RAM} -Dlog4j\.configuration=file:\/usr\/share\/usergrid\/lib\/log4j\.properties -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=8050 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false/g" /etc/default/tomcat7
+sed -i.bak "s/<Connector/<Connector maxThreads=\"${TOMCAT_THREADS}\" acceptCount=\"${ACCEPT_COUNT}\" maxConnections=\"${TOMCAT_THREADS}\"/g" /var/lib/tomcat7/conf/server.xml
+
+
+#Append our java opts for secret key
+echo "JAVA_OPTS=\"\${JAVA_OPTS} -DAWS_SECRET_KEY=${AWS_SECRET_KEY} -DAWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY}\"" >> /etc/default/tomcat7
+echo "JAVA_OPTS=\"\${JAVA_OPTS} -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000\"" >> /etc/default/tomcat7
+
+
+ulimit -n $NOFILE
+
+# set file limits
+sed -i.bak "s/# \/etc\/init\.d\/tomcat7 -- startup script for the Tomcat 6 servlet engine/ulimit -n ${NOFILE}/" /etc/init.d/tomcat7
+
+
+cat >> /etc/security/limits.conf << EOF
+* - nofile ${NOFILE}
+root - nofile ${NOFILE}
+EOF
+
+
+
+echo "${NR_OPEN}" | sudo tee > /proc/sys/fs/nr_open
+echo "${FILE_MAX}" | sudo tee > /proc/sys/fs/file-max
+
+
+cat >> /etc/pam.d/su << EOF
+session required pam_limits.so
+EOF
+
+
+
+# increase system IP port limits (do we really need this for Tomcat?)
+sysctl -w net.ipv4.ip_local_port_range="1024 65535"
+cat >> /etc/sysctl.conf << EOF
+####
+# Set by usergrid rest setup
+####
+net.ipv4.ip_local_port_range = 1024 65535
+
+# Controls the default maxmimum size of a mesage queue
+kernel.msgmnb = 65536
+
+# Controls the maximum size of a message, in bytes
+kernel.msgmax = 65536
+
+# Controls the maximum shared segment size, in bytes
+kernel.shmmax = 68719476736
+
+# Controls the maximum number of shared memory segments, in pages
+kernel.shmall = 4294967296
+
+######
+# End usergrid setup
+######
+EOF
+
+# wait for enough Cassandra nodes then delpoy and configure Usergrid
+cd /usr/share/usergrid/scripts
+groovy wait_for_instances.groovy cassandra ${CASSANDRA_NUM_SERVERS}
+groovy wait_for_instances.groovy elasticsearch ${ES_NUM_SERVERS}
+groovy wait_for_instances.groovy graphite ${GRAPHITE_NUM_SERVERS}
+
+# link WAR and Portal into Tomcat's webapps dir
+rm -rf /var/lib/tomcat7/webapps/*
+ln -s /usr/share/usergrid/webapps/ROOT.war /var/lib/tomcat7/webapps/ROOT.war
+ln -s /usr/share/usergrid/webapps/portal /var/lib/tomcat7/webapps/portal
+chown -R tomcat7 /usr/share/usergrid/webapps
+chown -R tomcat7 /var/lib/tomcat7/webapps
+
+# configure usergrid
+mkdir -p /usr/share/tomcat7/lib
+groovy configure_usergrid.groovy > /usr/share/tomcat7/lib/usergrid-deployment.properties
+groovy configure_portal_new.groovy >> /var/lib/tomcat7/webapps/portal/config.js
+
+
+
+#Install postfix so that we can send mail
+echo "postfix postfix/mailname string your.hostname.com" | debconf-set-selections
+echo "postfix postfix/main_mailer_type string 'Internet Site'" | debconf-set-selections
+apt-get install -y postfix
+
+
+# Go
+sh /etc/init.d/tomcat7 start
+
+#Wait for tomcat to start, then run our migrations
+
+
+#Wait until tomcat starts and we can hit our status page
+until curl -m 1 -I -X GET http://localhost:8080/status | grep "200 OK"; do sleep 5; done
+
+
+#Install collectd client to report to graphite
+cd /usr/share/usergrid/init_instance
+./install_collectd.sh
+
+
+#If we're the first rest server, run the migration, the database setup, then run the Cassanda keyspace updates
+cd /usr/share/usergrid/scripts
+groovy registry_register.groovy rest
+
+FIRSTHOST="$(groovy get_first_instance.groovy rest)"
+GRAPHITE_SERVER="$(groovy get_first_instance.groovy graphite )"
+
+#First host run the migration and setup
+if [ "$FIRSTHOST"=="$PUBLIC_HOSTNAME" ]; then
+
+#Run the system database setup since migration is a no-op
+curl -X GET http://localhost:8080/system/database/setup -u superuser:test
+
+
+#Run the migration
+curl -X PUT http://localhost:8080/system/migrate/run -u superuser:test
+
+#Wait since migration is no-op just needs to ideally run to completion to bring the internal state up to date before
+#Running setup
+sleep 10
+
+
+cd /usr/share/usergrid/init_instance
+./update_keyspaces.sh
+
+fi
+
+#Always create our graphite dashboard. Last to write will implicity win, since they will have the most recent cluster state
+cd /usr/share/usergrid/scripts
+JSON_PAYLOAD="$(groovy create_dashboard.groovy rest)"
+
+echo ${JSON_PAYLOAD} > /var/lib/tomcat7/webapps/portal/graphite.json
+
+
+#Post the JSON graphite payload to graphite
+## The json is correct, but this doens't work yet. To get the generated data to save, just hit ELB/portal/graphite.json to set into graphite manually
+##curl -X POST -d "${JSON_PAYLOAD}" "http://${GRAPHITE_SERVER}/dashboard/save/Tomcats"
+
+
+
+
+# tag last so we can see in the console that the script ran to completion
+cd /usr/share/usergrid/scripts
+groovy tag_instance.groovy
http://git-wip-us.apache.org/repos/asf/usergrid/blob/d478adb0/deployment/aws/src/main/dist/init_instance/install_cassandra.sh
----------------------------------------------------------------------
diff --git a/deployment/aws/src/main/dist/init_instance/install_cassandra.sh b/deployment/aws/src/main/dist/init_instance/install_cassandra.sh
new file mode 100644
index 0000000..da025a7
--- /dev/null
+++ b/deployment/aws/src/main/dist/init_instance/install_cassandra.sh
@@ -0,0 +1,51 @@
+#!/bin/bash
+
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. The ASF licenses this file to You
+# under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License. For additional information regarding
+# copyright in this work, please see the NOTICE file in the top level
+# directory of this distribution.
+#
+
+
+# Install and stop Cassandra
+curl -L http://debian.datastax.com/debian/repo_key | apt-key add -
+
+sudo cat >> /etc/apt/sources.list.d/cassandra.sources.list << EOF
+deb http://debian.datastax.com/community stable main
+EOF
+
+apt-get update
+apt-get -y --force-yes install libcap2 cassandra=2.0.15
+/etc/init.d/cassandra stop
+
+mkdir -p /mnt/data/cassandra
+chown cassandra /mnt/data/cassandra
+
+# Wait for other instances to start up
+cd /usr/share/usergrid/scripts
+groovy registry_register.groovy cassandra
+groovy wait_for_instances.groovy cassandra ${CASSANDRA_NUM_SERVERS}
+
+#TODO make this configurable for the box sizes
+#Set or min/max heap to 8GB
+sed -i.bak s/calculate_heap_sizes\(\)/MAX_HEAP_SIZE=\"8G\"\\nHEAP_NEWSIZE=\"1200M\"\\n\\ncalculate_heap_sizes\(\)/g /etc/cassandra/cassandra-env.sh
+
+pushd /usr/share/usergrid/scripts
+groovy configure_cassandra.groovy > /etc/cassandra/cassandra.yaml
+popd
+
+/etc/init.d/cassandra start
+
+