usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject [5/6] git commit: Bug fixes and cleanups in awscluster scripts, mostly around ElasticSearch installation and configuration.
Date Tue, 29 Jul 2014 14:14:01 GMT
Bug fixes and cleanups in awscluster scripts, mostly around ElasticSearch installation and configuration.


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

Branch: refs/heads/two-dot-o
Commit: eb20781dc0d9be42556476b7a8fd73444e2d5b5a
Parents: adfac04
Author: Dave Johnson <dmjohnson@apigee.com>
Authored: Tue Jul 29 09:59:59 2014 -0400
Committer: Dave Johnson <dmjohnson@apigee.com>
Committed: Tue Jul 29 09:59:59 2014 -0400

----------------------------------------------------------------------
 .../main/dist/init_instance/create_keyspaces.sh |    5 +-
 .../main/dist/init_instance/init_db_server.sh   |    6 +-
 .../dist/init_instance/init_graphite_server.sh  |    9 +-
 .../main/dist/init_instance/init_rest_server.sh |    8 +-
 .../dist/init_instance/install_elasticsearch.sh |   14 +-
 .../main/dist/init_instance/install_yourkit.sh  |   28 +-
 .../src/main/groovy/NodeRegistry.groovy         |   20 +-
 .../main/groovy/configure_elasticsearch.groovy  |   12 +-
 .../src/main/groovy/configure_usergrid.groovy   |   17 +-
 .../src/main/groovy/registry_register.groovy    |    3 +-
 .../src/main/groovy/wait_for_instances.groovy   |   11 +-
 stack/awscluster/ugcluster-cf.json              | 1028 +++++++++++++-----
 .../resources/corepersistence-UNIT.properties   |   17 -
 .../src/test/resources/usergrid-CHOP.properties |   17 -
 14 files changed, 816 insertions(+), 379 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/eb20781d/stack/awscluster/src/main/dist/init_instance/create_keyspaces.sh
----------------------------------------------------------------------
diff --git a/stack/awscluster/src/main/dist/init_instance/create_keyspaces.sh b/stack/awscluster/src/main/dist/init_instance/create_keyspaces.sh
index 9aa1fe7..811fce2 100644
--- a/stack/awscluster/src/main/dist/init_instance/create_keyspaces.sh
+++ b/stack/awscluster/src/main/dist/init_instance/create_keyspaces.sh
@@ -21,9 +21,8 @@
 pushd /etc/apt/sources.list.d
 
 
-
-#Run the cassandra cql to create the keyspaces.  Note this only works for the us-east region for the replication factor
-#on the keyspaces
+# Run the cassandra cql to create the keyspaces.  Note this only works for 
+# the us-east region for the replication factor on the keyspaces
 
 cd /usr/share/usergrid/scripts
 FIRSTHOST="$(groovy get_first_instance.groovy cassandra)"

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/eb20781d/stack/awscluster/src/main/dist/init_instance/init_db_server.sh
----------------------------------------------------------------------
diff --git a/stack/awscluster/src/main/dist/init_instance/init_db_server.sh b/stack/awscluster/src/main/dist/init_instance/init_db_server.sh
index 197dd57..b9c4f56 100644
--- a/stack/awscluster/src/main/dist/init_instance/init_db_server.sh
+++ b/stack/awscluster/src/main/dist/init_instance/init_db_server.sh
@@ -49,9 +49,6 @@ cp /usr/share/aws-java-sdk-*/lib/* /home/ubuntu/.groovy/lib
 rm /home/ubuntu/.groovy/lib/stax*
 ln -s /home/ubuntu/.groovy /root/.groovy
 
-cd /usr/share/usergrid/scripts
-groovy tag_instance.groovy
-
 cd /usr/share/usergrid/init_instance
 ./install_oraclejdk.sh 
 
@@ -70,3 +67,6 @@ cd /usr/share/usergrid/init_instance
 cd /usr/share/usergrid/init_instance
 ./create_keyspaces.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/incubator-usergrid/blob/eb20781d/stack/awscluster/src/main/dist/init_instance/init_graphite_server.sh
----------------------------------------------------------------------
diff --git a/stack/awscluster/src/main/dist/init_instance/init_graphite_server.sh b/stack/awscluster/src/main/dist/init_instance/init_graphite_server.sh
index 91b1601..a9d74c0 100644
--- a/stack/awscluster/src/main/dist/init_instance/init_graphite_server.sh
+++ b/stack/awscluster/src/main/dist/init_instance/init_graphite_server.sh
@@ -49,15 +49,12 @@ cp /usr/share/aws-java-sdk-*/lib/* /home/ubuntu/.groovy/lib
 rm /home/ubuntu/.groovy/lib/stax*
 ln -s /home/ubuntu/.groovy /root/.groovy
 
-cd /usr/share/usergrid/scripts
-groovy tag_instance.groovy
-
 cd /usr/share/usergrid/init_instance
 ./install_oraclejdk.sh
 
-
 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/incubator-usergrid/blob/eb20781d/stack/awscluster/src/main/dist/init_instance/init_rest_server.sh
----------------------------------------------------------------------
diff --git a/stack/awscluster/src/main/dist/init_instance/init_rest_server.sh b/stack/awscluster/src/main/dist/init_instance/init_rest_server.sh
index 6ace352..11ce597 100644
--- a/stack/awscluster/src/main/dist/init_instance/init_rest_server.sh
+++ b/stack/awscluster/src/main/dist/init_instance/init_rest_server.sh
@@ -28,6 +28,7 @@ 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
@@ -67,11 +68,12 @@ rm -rf /var/lib/tomcat7/webapps/*
 cp -r /usr/share/usergrid/webapps/* /var/lib/tomcat7/webapps
 groovy configure_portal_new.groovy >> /var/lib/tomcat7/webapps/portal/config.js
 
-
-
-
 cd /usr/share/usergrid/init_instance
 ./install_yourkit.sh
 
 # Go
 /etc/init.d/tomcat7 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/incubator-usergrid/blob/eb20781d/stack/awscluster/src/main/dist/init_instance/install_elasticsearch.sh
----------------------------------------------------------------------
diff --git a/stack/awscluster/src/main/dist/init_instance/install_elasticsearch.sh b/stack/awscluster/src/main/dist/init_instance/install_elasticsearch.sh
index 460588c..f7b5f3c 100644
--- a/stack/awscluster/src/main/dist/init_instance/install_elasticsearch.sh
+++ b/stack/awscluster/src/main/dist/init_instance/install_elasticsearch.sh
@@ -21,8 +21,6 @@
 
 pushd /etc/apt/sources.list.d
 
-groovy ./registry_register.groovy elasticsearch
-
 # Install and stop ElasticSearch
 cat >> elasticsearch.sources.list << EOF
 deb http://packages.elasticsearch.org/elasticsearch/1.2/debian stable main
@@ -38,16 +36,20 @@ mkdir -p /mnt/log/elasticsearch
 chown elasticsearch /mnt/log/elasticsearch
 
 # Configure ElasticSearch
+cd /usr/share/usergrid/scripts
+
+# No need to do this, elasticsearch nodes are also cassandra nodes
+#groovy registry_register.groovy elasticsearch
+#groovy wait_for_instances.groovy elasticsearch ${CASSANDRA_NUM_SERVERS}
+
 cat >> /etc/default/elasticsearch << EOF
 JAVA_HOME=/usr/lib/jvm/jdk1.7.0
 EOF
 
-update-rc.d elasticsearch defaults 95 10
-cd /usr/share/usergrid/scripts
-
-
 groovy ./configure_elasticsearch.groovy > /etc/elasticsearch/elasticsearch.yml
 
+update-rc.d elasticsearch defaults 95 10
+
 # Go!
 /etc/init.d/elasticsearch start
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/eb20781d/stack/awscluster/src/main/dist/init_instance/install_yourkit.sh
----------------------------------------------------------------------
diff --git a/stack/awscluster/src/main/dist/init_instance/install_yourkit.sh b/stack/awscluster/src/main/dist/init_instance/install_yourkit.sh
index 37936cd..b1e29a3 100644
--- a/stack/awscluster/src/main/dist/init_instance/install_yourkit.sh
+++ b/stack/awscluster/src/main/dist/init_instance/install_yourkit.sh
@@ -1,9 +1,27 @@
+#!/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.
+#
+
 
-#####
 # Optional, install yourkit remote profiler
-#####
 
-if [ $YOURKIT = "true" ]; then
+if [[ $YOURKIT = "true" ]]; then
 
 mkdir -p /tmp/yourkit
 cd /tmp/yourkit
@@ -19,7 +37,3 @@ JAVA_OPTS="${JAVA_OPTS} -agentpath:/tmp/yourkit/yjp-2013-build-13088/bin/linux-x
 EOF
 
 fi
-
-######
-# End yourkit installation
-######

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/eb20781d/stack/awscluster/src/main/groovy/NodeRegistry.groovy
----------------------------------------------------------------------
diff --git a/stack/awscluster/src/main/groovy/NodeRegistry.groovy b/stack/awscluster/src/main/groovy/NodeRegistry.groovy
index 38c44be..2f955ba 100644
--- a/stack/awscluster/src/main/groovy/NodeRegistry.groovy
+++ b/stack/awscluster/src/main/groovy/NodeRegistry.groovy
@@ -74,16 +74,24 @@ class NodeRegistry {
      * Add the node to the database if it doesn't exist
      */
     def addNode(def nodeType) {
+
         def gar = new GetAttributesRequest(domain, hostName);
         def response = sdbClient.getAttributes(gar);
-        if (response.getAttributes().size() == 1) {
-            println "Already registered"
+
+        if (response.getAttributes().size() > 0) {
             def attrs = response.getAttributes()
             for (att in attrs) {
-                println("${hostName} -> ${att.getName()} : ${att.getValue()}")
             }
+        }
 
-            return false;
+        if (response.getAttributes().size() > 1) {
+            def attrs = response.getAttributes()
+            for (att in attrs) {
+                if ( att.getValue().equals(nodeType)) {
+                    println "Already registered"
+                    return false;
+                }
+            }
 
         } else {
             println "Registering..."
@@ -92,11 +100,9 @@ class NodeRegistry {
             attrs.add(stackAtt)
             def par = new PutAttributesRequest(domain, hostName, attrs)
             sdbClient.putAttributes(par);
-            println "Registraition done."
+            println "Registration done."
             return true;
         }
-
-
     }
 
     def deleteRegistry(){

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/eb20781d/stack/awscluster/src/main/groovy/configure_elasticsearch.groovy
----------------------------------------------------------------------
diff --git a/stack/awscluster/src/main/groovy/configure_elasticsearch.groovy b/stack/awscluster/src/main/groovy/configure_elasticsearch.groovy
index 79dfa53..ce8e3c5 100644
--- a/stack/awscluster/src/main/groovy/configure_elasticsearch.groovy
+++ b/stack/awscluster/src/main/groovy/configure_elasticsearch.groovy
@@ -24,27 +24,29 @@
 // Emits Cassandra config file based on environment and Cassandra node 
 // registry in SimpleDB
 //
+
 import com.amazonaws.auth.*
 import com.amazonaws.services.simpledb.*
 import com.amazonaws.services.simpledb.model.*
 
 String hostName  = (String)System.getenv().get("PUBLIC_HOSTNAME")
-
+def clusterName  = (String)System.getenv().get("CASSANDRA_CLUSTER_NAME")
 
 NodeRegistry registry = new NodeRegistry();
 
 // build seed list by listing all Cassandra nodes found in SimpleDB domain with our stackName
-def selectResult = registry.searchNode('elasticsearch')
-def seeds = ""
+// works because cassandra nodes are also elasticsearch nodes
+def selectResult = registry.searchNode('cassandra')
+def esnodes = ""
 def sep = ""
 for (hostname in selectResult) {
-   seeds = "${seeds}${sep}\"${hostname}\""
+   esnodes = "${esnodes}${sep}\"${hostname}\""
    sep = ","
 }
 
 def elasticSearchConfig = """
 cluster.name: ${clusterName}
-discovery.zen.ping.multicast.enabled: true
+discovery.zen.ping.multicast.enabled: false
 discovery.zen.ping.unicast.hosts: [${esnodes}]
 node:
     name: ${hostName} 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/eb20781d/stack/awscluster/src/main/groovy/configure_usergrid.groovy
----------------------------------------------------------------------
diff --git a/stack/awscluster/src/main/groovy/configure_usergrid.groovy b/stack/awscluster/src/main/groovy/configure_usergrid.groovy
index 124a323..f85b2cb 100644
--- a/stack/awscluster/src/main/groovy/configure_usergrid.groovy
+++ b/stack/awscluster/src/main/groovy/configure_usergrid.groovy
@@ -51,34 +51,31 @@ def sep = ""
 for (item in selectResult) {
     cassandras = "${cassandras}${sep}${item}:9160"
     sep = ","
-
 }
 
-//TODO T.N Make this the graphite url
+// TODO T.N Make this the graphite url
 selectResult = registry.searchNode('graphite')
 def graphite = ""
 sep = ""
 for (item in selectResult) {
     graphite = "${graphite}${sep}${item}"
     sep = ","
-
 }
 
+// cassandra nodes are also our elasticsearch nodes
+selectResult = registry.searchNode('cassandra')
 def esnodes = ""
 sep = ""
-for (item in selectResult.getItems()) {
-    def att = item.getAttributes().get(0)
-    if (att.getValue().equals(stackName)) {
-        esnodes = "${esnodes}${sep}${item.getName()}"
-        sep = ","
-    }
+for (item in selectResult) {
+    esnodes = "${esnodes}${sep}${item}"
+    sep = ","
 }
 
 def usergridConfig = """
 ######################################################
 # Minimal Usergrid configuration properties for local Tomcat and Cassandra 
 
-cassandra.url=${seeds}
+cassandra.url=${cassandras}
 cassandra.cluster=${clusterName}
 cassandra.keyspace.strategy=org.apache.cassandra.locator.SimpleStrategy
 cassandra.keyspace.replication=${replFactor}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/eb20781d/stack/awscluster/src/main/groovy/registry_register.groovy
----------------------------------------------------------------------
diff --git a/stack/awscluster/src/main/groovy/registry_register.groovy b/stack/awscluster/src/main/groovy/registry_register.groovy
index a5282c3..144b18b 100644
--- a/stack/awscluster/src/main/groovy/registry_register.groovy
+++ b/stack/awscluster/src/main/groovy/registry_register.groovy
@@ -28,8 +28,7 @@ import com.amazonaws.services.simpledb.model.*
 
 
 if (args.size() != 1 )  {
-  println "this script expects one argument.  registry_register.groovy nodetype"
-  // You can even print the usage here.
+  println "This script expects one argument. registry_register.groovy nodetype"
   return 1;
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/eb20781d/stack/awscluster/src/main/groovy/wait_for_instances.groovy
----------------------------------------------------------------------
diff --git a/stack/awscluster/src/main/groovy/wait_for_instances.groovy b/stack/awscluster/src/main/groovy/wait_for_instances.groovy
index 98ddc3b..9aec033 100644
--- a/stack/awscluster/src/main/groovy/wait_for_instances.groovy
+++ b/stack/awscluster/src/main/groovy/wait_for_instances.groovy
@@ -16,18 +16,16 @@
  * directory of this distribution.
  */
 
-
 //
 // wait_for_instances.groovy
 //
 // Wait for enough Cassandra servers are up before proceding,
 // Enough means count greater than or equal to replication factor.
-//
+
 import com.amazonaws.auth.*
 import com.amazonaws.services.simpledb.*
 import com.amazonaws.services.simpledb.model.*
 
-
 if (args.size() !=2 )  {
   println "this script expects two arguments.  wait_for_instances.groovy nodetype numberOfServers"
   // You can even print the usage here.
@@ -37,7 +35,6 @@ if (args.size() !=2 )  {
 String nodetype = args[0]
 int numberOfServers = args[1].toInteger()
 
-
 NodeRegistry registry = new NodeRegistry();
 
 println "Waiting for ${numberOfServers} nodes of type ${nodetype} to register..."
@@ -46,20 +43,16 @@ def count = 0
 
 while (true) {
     try {
-
-
-
         def selectResult = registry.searchNode(nodetype)
 
-
         count = selectResult.size();
 
         if (count >= numberOfServers) {
             println("count = ${count}, total number of servers is ${numberOfServers}.  Breaking")
             break
         }
-
         println("Found ${count} nodes but need at least ${numberOfServers}.  Waiting...")
+
     } catch (Exception e) {
         println "ERROR waiting for Casasndra ${e.getMessage()}, will continue waiting"
     }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/eb20781d/stack/awscluster/ugcluster-cf.json
----------------------------------------------------------------------
diff --git a/stack/awscluster/ugcluster-cf.json b/stack/awscluster/ugcluster-cf.json
index 66f326b..dcd3221 100644
--- a/stack/awscluster/ugcluster-cf.json
+++ b/stack/awscluster/ugcluster-cf.json
@@ -20,7 +20,7 @@
         "RestMinServers": {
             "Description": "Minimum number of REST servers.",
             "Type": "Number",
-            "Default": "3",
+            "Default": "1",
             "MinValue": "1"
         },
         "RestMaxServers": {
@@ -32,8 +32,16 @@
         "RestInstanceType": {
             "Description": "Instance type for REST servers",
             "Type": "String",
-            "Default": "m1.large",
-            "AllowedValues": ["m1.small", "m1.medium", "m1.large", "m1.xlarge", "m3.xlarge", "m3.large", "c3.4xlarge"],
+            "Default": "m3.large",
+            "AllowedValues": [
+                "m1.small",
+                "m1.medium",
+                "m1.large",
+                "m1.xlarge",
+                "m3.xlarge",
+                "m3.large",
+                "c3.4xlarge"
+            ],
             "ConstraintDescription": "must be valid instance type."
         },
         "KeyPair": {
@@ -55,8 +63,16 @@
         "CassInstanceType": {
             "Description": "Instance type for Cass servers",
             "Type": "String",
-            "Default": "m1.xlarge",
-            "AllowedValues": ["m1.small", "m1.medium", "m1.large", "m1.xlarge", "m3.xlarge", "m3.2xlarge", "c3.4xlarge"],
+            "Default": "c3.4xlarge",
+            "AllowedValues": [
+                "m1.small",
+                "m1.medium",
+                "m1.large",
+                "m1.xlarge",
+                "m3.xlarge",
+                "m3.2xlarge",
+                "c3.4xlarge"
+            ],
             "ConstraintDescription": "must be valid instance type."
         },
         "CassReplicationFactor": {
@@ -79,145 +95,417 @@
             "Description": "Email for notifications",
             "Type": "String",
             "Default": "dmjohnson+super@apigee.com"
+        },
+        "GraphiteInstanceType": {
+            "Description": "Instance type for Graphite server",
+            "Type": "String",
+            "Default": "m3.large",
+            "AllowedValues": [
+                "t1.micro",
+                "m1.small",
+                "m1.medium",
+                "m1.large",
+                "m3.large",
+                "m1.xlarge",
+                "m3.xlarge",
+                "m3.2xlarge",
+                "c3.4xlarge"
+            ],
+            "ConstraintDescription": "must be valid instance type."
+        },
+        "GraphiteNumServers": {
+            "Description": "Minimum number of graphite servers. There should only be one",
+            "Type": "Number",
+            "Default": "1",
+            "MinValue": "1"
+        },
+        "InstallYourkit": {
+            "Description": "Install the yourkit remote profiling agent into tomcat.  Valid values are 'true' or 'false'",
+            "Type": "String",
+            "Default": "false"
         }
     },
     "Mappings": {
         "AWSInstanceType2Arch": {
-            "m1.small": {"Arch": "64"},
-            "m1.medium": {"Arch": "64"},
-            "m1.large": {"Arch": "64"},
-            "m1.xlarge": {"Arch": "64"},
-            "m3.large": {"Arch": "64"},
-            "c3.4xlarge": {"Arch": "64"}
+            "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.2xlarge": {
+                "Arch": "64"
+            },
+            "c3.4xlarge": {
+                "Arch": "64"
+            }
         },
         "AWSRegionArch2AMI": {
-            "ap-southeast-2": {"64": "ami-5993f663"},
-            "us-east-1": {"64": "ami-7cbd4f14"},
-            "us-west-2": {"64": "ami-2598ea15"}
+            "ap-southeast-2": {
+                "64": "ami-5993f663"
+            },
+            "us-east-1": {
+                "64": "ami-7cbd4f14"
+            },
+            "us-west-2": {
+                "64": "ami-2598ea15"
+            }
         },
         "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"}
+            "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": {
-                "RestUser": {
+        "GraphiteUser": {
             "Type": "AWS::IAM::User",
             "Properties": {
                 "Path": "/",
-                "Policies": [{
+                "Policies": [
+                    {
                         "PolicyName": "root",
-                        "PolicyDocument": {"Statement": [{
+                        "PolicyDocument": {
+                            "Statement": [
+                                {
                                     "Effect": "Allow",
                                     "Action": "*",
                                     "Resource": "*"
-                                }]}
-                    }]
+
+                                }
+                            ]
+                        }
+                    }
+                ]
+            }
+        },
+        "GraphiteKey": {
+            "Type": "AWS::IAM::AccessKey",
+            "Properties": {
+                "UserName": {
+                    "Ref": "GraphiteUser"
+                }
+            }
+        },
+       "GraphiteAutoScalingLaunchConfiguration":{
+         "Type":"AWS::AutoScaling::LaunchConfiguration",
+         "Properties":{
+            "UserData":{
+               "Fn::Base64":{
+                  "Fn::Join":[
+                     "",
+                     [
+                      "#!/bin/bash -x\n",
+                      "sudo git clone https://github.com/hopsoft/docker-graphite-statsd.git \n",
+                      "sudo ./docker-graphite-statsd/bin/start \n",
+                      "sudo git clone https://github.com/dotcloud/collectd-graphite.git \n",
+                      "sudo collectd-graphite/docker build -t collectd-graphite . \n",
+
+                      "#!/bin/bash -ex\n",
+                      "# REST SERVER STARTUP \n",
+                      "exec >/var/log/usergrid-bootstrap.log 2>&1\n",
+                      "\n",
+                      "mkdir -p /usr/share/usergrid\n",
+                      "\n",
+                      "# create script that sets our environment variables\n",
+                      "cat >/etc/profile.d/usergrid-env.sh <<EOF\n",
+                      "alias sudo='sudo -E'\n",
+                      "\n",
+                      "export TYPE=graphite\n",
+                      "export STACK_NAME=", { "Ref":"AWS::StackName" }, "\n",
+                      "\n",
+                      "export DNS_NAME=", { "Ref":"DnsSubDomain" }, "\n",
+                      "export DNS_DOMAIN=", { "Ref":"DnsDomain" },
+                      "\n",
+                      "export PUBLIC_HOSTNAME=`(curl -s http://169.254.169.254/latest/meta-data/public-hostname)`\n",
+                      "export INTERNAL_HOSTNAME=`(curl http://169.254.169.254/latest/meta-data/local-ipv4)`\n",
+                      "export ELB_NAME=", { "Ref":"RestElasticLoadBalancer" }, "\n",
+                      "\n",
+                      "export EC2_INSTANCE_ID=`ec2metadata --instance-id`\n",
+                      "export EC2_REGION=", { "Ref":"AWS::Region" },
+                      "\n",
+                      "export EC2_URL=https://ec2.amazonaws.com/\n",
+                      "\n",
+                      "export REST_SECURITY_GROUP_NAME=", { "Ref":"RestSecurityGroup" }, "\n",
+                      "export GRAPHITE_NUM_SERVERS=", { "Ref":"GraphiteNumServers" }, "\n",
+                      "EOF\n",
+                      "\n",
+                      "# put AWS creds in environment\n",
+                      "cat >/etc/profile.d/aws-credentials.sh <<EOF\n",
+                      "export AWS_ACCESS_KEY=", { "Ref":"RestKey" }, "\n",
+                      "export AWS_SECRET_KEY=", { "Fn::GetAtt":[ "RestKey", "SecretAccessKey" ] }, "\n",
+                      "EOF\n",
+                      "\n",
+                      "# setup s3cmd (will be installed by init script) \n",
+                      "cat >/etc/s3cfg <<EOF\n",
+                      "access_key=", { "Ref":"RestKey" }, "\n",
+                      "secret_key=", { "Fn::GetAtt":[ "RestKey", "SecretAccessKey" ] }, "\n",
+                      "EOF\n",
+                      "chmod 644 /etc/s3cfg\n",
+                      "ln -s /etc/s3cfg ~ubuntu/.s3cfg\n",
+                      "ln -s /etc/s3cfg ~root/.s3cfg\n",
+                      "\n",
+                      "# download usergrid and init script bundle from S3\n",
+                      "wget -O- -q http://s3tools.org/repo/deb-all/stable/s3tools.key | apt-key add -\n",
+                      "wget -O/etc/apt/sources.list.d/s3tools.list http://s3tools.org/repo/deb-all/stable/s3tools.list\n",
+                      "apt-get update\n",
+                      "apt-get -y install s3cmd\n",
+                      "cd /usr/share/usergrid\n",
+                      "s3cmd --config=/etc/s3cfg get s3://", { "Ref":"ReleaseBucket" }, "/awscluster-1.0-SNAPSHOT-any.tar.gz\n",
+                      "tar xvf awscluster-1.0-SNAPSHOT-any.tar.gz\n",
+                      "rm -fr awscluster-1.0-SNAPSHOT-any.tar.gz\n",
+                      "chmod 755 ./init_instance/*.sh\n",
+                      "cd ./init_instance\n",
+                      "# Init as a REST intance \n",
+                      "sh ./init_graphite_server.sh\n"
+                   ]
+                  ]
+
+               }
+            },
+            "KeyName":{
+               "Ref":"KeyPair"
+            },
+            "ImageId":{
+               "Fn::FindInMap":[
+                  "AWSRegionArch2AMI",
+                  {
+                     "Ref":"AWS::Region"
+                  },
+                  {
+                     "Fn::FindInMap":[
+                        "AWSInstanceType2Arch",
+                        {
+                           "Ref":"GraphiteInstanceType"
+                        },
+                        "Arch"
+                     ]
+                  }
+               ]
+            },
+            "InstanceType":{
+               "Ref":"GraphiteInstanceType"
+            },
+            "IamInstanceProfile":{
+               "Ref":"RootInstanceProfile"
+            },
+            "SecurityGroups":[
+                            {
+                               "Ref":"GraphiteSecurityGroup"
+                            }
+                         ]
+
+         }
+      },
+        "GraphiteAutoScalingGroup": {
+            "Type": "AWS::AutoScaling::AutoScalingGroup",
+            "Version": "2014-07-24",
+            "Properties": {
+                "AvailabilityZones": [
+                    {
+                        "Fn::FindInMap": [
+                            "TwoAZs",
+                            {
+                                "Ref": "AWS::Region"
+                            },
+                            "AZ1"
+                        ]
+                    },
+                    {
+                        "Fn::FindInMap": [
+                            "TwoAZs",
+                            {
+                                "Ref": "AWS::Region"
+                            },
+                            "AZ2"
+                        ]
+                    }
+                ],
+                "LaunchConfigurationName": {
+                    "Ref": "GraphiteAutoScalingLaunchConfiguration"
+                },
+                "MinSize": {
+                    "Ref": "GraphiteNumServers"
+                },
+                "MaxSize": {
+                    "Ref": "GraphiteNumServers"
+                },
+                "NotificationConfiguration": {
+                    "TopicARN": {
+                        "Ref": "NotificationTopic"
+                    },
+                    "NotificationTypes": [
+                        "autoscaling:EC2_INSTANCE_LAUNCH",
+                        "autoscaling:EC2_INSTANCE_LAUNCH_ERROR",
+                        "autoscaling:EC2_INSTANCE_TERMINATE",
+                        "autoscaling:EC2_INSTANCE_TERMINATE_ERROR"
+                    ]
+                }
+            }
+        },
+        "RestUser": {
+            "Type": "AWS::IAM::User",
+            "Properties": {
+                "Path": "/",
+                "Policies": [
+                    {
+                        "PolicyName": "root",
+                        "PolicyDocument": {
+                            "Statement": [
+                                {
+                                    "Effect": "Allow",
+                                    "Action": "*",
+                                    "Resource": "*"
+                                }
+                            ]
+                        }
+                    }
+                ]
             }
         },
         "RestKey": {
             "Type": "AWS::IAM::AccessKey",
             "Properties": {
-                "UserName": {"Ref": "RestUser"}
+                "UserName": {
+                    "Ref": "RestUser"
+                }
             }
         },
         "CassUser": {
             "Type": "AWS::IAM::User",
             "Properties": {
                 "Path": "/",
-                "Policies": [{
+                "Policies": [
+                    {
                         "PolicyName": "root",
-                        "PolicyDocument": {"Statement": [{
+                        "PolicyDocument": {
+                            "Statement": [
+                                {
                                     "Effect": "Allow",
                                     "Action": "*",
                                     "Resource": "*"
-                                }]}
-                    }]
+                                }
+                            ]
+                        }
+                    }
+                ]
             }
         },
         "CassKey": {
             "Type": "AWS::IAM::AccessKey",
             "Properties": {
-                "UserName": {"Ref": "CassUser"}
+                "UserName": {
+                    "Ref": "CassUser"
+                }
             }
         },
-        "CassAutoScalingLaunchConfiguration": {
-            "Type": "AWS::AutoScaling::LaunchConfiguration",
-            "Properties": {
-                "UserData": {
-                    "Fn::Base64": {"Fn::Join": ["", [
-
-                                "#!/bin/bash -ex\n",
-
-                                "# CASSANDRA NODE STARTUP \n",
-
-                                "exec >/var/log/usergrid-bootstrap.log 2>&1\n",
-                                "\n",
-                                "mkdir -p /usr/share/usergrid\n",
-                                "\n",
-
-                                "# create script that sets our environment variables\n",
-                                "cat >/etc/profile.d/usergrid-env.sh <<EOF\n",
-                                    "alias sudo='sudo -E'\n",
-                                    "\n",
-                                    "export TYPE=cass\n",
-                                    "export STACK_NAME=", {"Ref": "AWS::StackName"}, "\n",
-                                    "\n",
-                                    "export PUBLIC_HOSTNAME=`(curl -s http://169.254.169.254/latest/meta-data/public-hostname)`\n",
-                                    "export INTERNAL_HOSTNAME=`(curl http://169.254.169.254/latest/meta-data/local-ipv4)`\n",
-                                    "\n",
-                                    "export EC2_INSTANCE_ID=`ec2metadata --instance-id`\n",
-                                    "export EC2_REGION=", {"Ref": "AWS::Region"}, "\n",
-                                    "export EC2_URL=https://ec2.amazonaws.com/\n",
-                                    "\n",
-                                    "export CASS_SECURITY_GROUP_NAME=", {"Ref": "CassSecurityGroup"}, "\n",
-                                    "\n",
-                                    "export CASSANDRA_CLUSTER_NAME=", {"Ref": "CassClusterName"}, "\n",
-                                    "export CASSANDRA_NUM_SERVERS=", {"Ref": "CassNumServers"}, "\n",
-                                    "export CASSANDRA_KEYSPACE_NAME=usergrid", "\n",
-                                    "export CASSANDRA_REPLICATION_FACTOR=", {"Ref": "CassReplicationFactor"}, "\n",
-                                    "\n",
-                                    "export RELEASE_BUCKET=", {"Ref": "ReleaseBucket"}, "\n",
-                                    "\n",
-                                "EOF\n",
-                                "\n",
-
-                                "# put AWS creds in environment\n",
-                                "cat >/etc/profile.d/aws-credentials.sh <<EOF\n",
-                                "export AWS_ACCESS_KEY=", {"Ref": "CassKey"}, "\n",
-                                "export AWS_SECRET_KEY=", {"Fn::GetAtt": ["CassKey", "SecretAccessKey"]}, "\n",
-                                "EOF\n",
-                                "\n",
-
-                                "# setup s3cmd (will be installed by init script) \n",
-                                "cat >/etc/s3cfg <<EOF\n",
-                                "access_key=", {"Ref": "CassKey"}, "\n",
-                                "secret_key=", {"Fn::GetAtt": ["CassKey", "SecretAccessKey"]}, "\n",
-                                "EOF\n",
-                                "chmod 644 /etc/s3cfg\n",
-                                "ln -s /etc/s3cfg ~ubuntu/.s3cfg\n",
-                                "ln -s /etc/s3cfg ~root/.s3cfg\n",
-                                "\n",
-
-                                "# download usergrid and init script bundle from S3\n",
-                                "wget -O- -q http://s3tools.org/repo/deb-all/stable/s3tools.key | apt-key add -\n",
-                                "wget -O/etc/apt/sources.list.d/s3tools.list http://s3tools.org/repo/deb-all/stable/s3tools.list\n",
-                                "apt-get update\n",
-                                "apt-get -y install s3cmd\n",
-                                "cd /usr/share/usergrid\n",
-                                "s3cmd --config=/etc/s3cfg get s3://", {"Ref": "ReleaseBucket"}, "/awscluster-1.0-SNAPSHOT-any.tar.gz\n",
-                                "tar xvf awscluster-1.0-SNAPSHOT-any.tar.gz\n",
-                                "rm -fr awscluster-1.0-SNAPSHOT-any.tar.gz\n",
-                                "chmod 755 ./init_instance/*.sh\n",
-                                "cd ./init_instance\n",
-
-                                "# init as a Cassandra node \n",
-                                "sh ./init_db_server.sh\n"
-
-                            ]]}
+      "CassAutoScalingLaunchConfiguration":{
+         "Type":"AWS::AutoScaling::LaunchConfiguration",
+         "Properties":{
+            "UserData":{
+               "Fn::Base64":{
+                  "Fn::Join":[
+                     "",
+                     [
+                        "#!/bin/bash -ex\n",
+                        "# CASSANDRA NODE STARTUP \n",
+                        "exec >/var/log/usergrid-bootstrap.log 2>&1\n",
+                        "\n",
+                        "mkdir -p /usr/share/usergrid\n",
+                        "\n",
+                        "# create script that sets our environment variables\n",
+                        "cat >/etc/profile.d/usergrid-env.sh <<EOF\n",
+                        "alias sudo='sudo -E'\n", "\n",
+                        "export TYPE=cass\n",
+                        "export STACK_NAME=", { "Ref":"AWS::StackName" }, "\n", "\n",
+                        "export PUBLIC_HOSTNAME=`(curl -s http://169.254.169.254/latest/meta-data/public-hostname)`\n",
+                        "export INTERNAL_HOSTNAME=`(curl http://169.254.169.254/latest/meta-data/local-ipv4)`\n", 
+                        "\n",
+                        "export EC2_INSTANCE_ID=`ec2metadata --instance-id`\n",
+                        "export EC2_REGION=", { "Ref":"AWS::Region" },
+                        "\n",
+                        "export EC2_URL=https://ec2.amazonaws.com/\n",
+                        "\n",
+                        "export CASS_SECURITY_GROUP_NAME=", { "Ref":"CassSecurityGroup" }, "\n",
+                        "\n",
+                        "\n",
+                        "export CASSANDRA_CLUSTER_NAME=", { "Ref":"CassClusterName" }, "\n",
+                        "export CASSANDRA_NUM_SERVERS=", { "Ref":"CassNumServers" }, "\n",
+                        "export GRAPHITE_NUM_SERVERS=", { "Ref":"GraphiteNumServers" }, "\n",
+                        "export CASSANDRA_KEYSPACE_NAME=usergrid", "\n",
+                        "export CASSANDRA_REPLICATION_FACTOR=", { "Ref":"CassReplicationFactor" }, "\n",
+                        "\n",
+                        "export RELEASE_BUCKET=", { "Ref":"ReleaseBucket" }, "\n",
+                        "\n",
+                        "EOF\n",
+                        "\n",
+                        "# put AWS creds in environment\n",
+                        "cat >/etc/profile.d/aws-credentials.sh <<EOF\n",
+                        "export AWS_ACCESS_KEY=", { "Ref":"CassKey" }, "\n",
+                        "export AWS_SECRET_KEY=", { "Fn::GetAtt":[ "CassKey", "SecretAccessKey" ] }, "\n",
+                        "EOF\n",
+                        "\n",
+                        "# put AWS creds Priam's config file\n",
+                        "cat >/etc/awscredential.properties <<EOF\n",
+                        "AWSACCESSID=", { "Ref":"CassKey" }, "\n",
+                        "AWSKEY=", { "Fn::GetAtt":[ "CassKey", "SecretAccessKey" ] },
+                        "\n",
+                        "EOF\n",
+                        "\n",
+                        "# setup s3cmd (will be installed by init script) \n",
+                        "cat >/etc/s3cfg <<EOF\n",
+                        "access_key=", { "Ref":"CassKey" }, "\n",
+                        "secret_key=", { "Fn::GetAtt":[ "CassKey", "SecretAccessKey" ] },
+                        "\n",
+                        "EOF\n",
+                        "chmod 644 /etc/s3cfg\n",
+                        "ln -s /etc/s3cfg ~ubuntu/.s3cfg\n",
+                        "ln -s /etc/s3cfg ~root/.s3cfg\n",
+                        "\n",
+                        "# download usergrid and init script bundle from S3\n",
+                        "wget -O- -q http://s3tools.org/repo/deb-all/stable/s3tools.key | apt-key add -\n",
+                        "wget -O/etc/apt/sources.list.d/s3tools.list http://s3tools.org/repo/deb-all/stable/s3tools.list\n",
+                        "apt-get update\n",
+                        "apt-get -y install s3cmd\n",
+                        "cd /usr/share/usergrid\n",
+                        "s3cmd --config=/etc/s3cfg get s3://", { "Ref":"ReleaseBucket" }, "/awscluster-1.0-SNAPSHOT-any.tar.gz\n",
+                        "tar xvf awscluster-1.0-SNAPSHOT-any.tar.gz\n",
+                        "rm -fr awscluster-1.0-SNAPSHOT-any.tar.gz\n",
+                        "chmod 755 ./init_instance/*.sh\n",
+                        "cd ./init_instance\n",
+                        "# init as a Cassandra node \n",
+                        "sh ./init_db_server.sh\n"
+                     ]
+                  ]
+               }
+            },
+                "KeyName": {
+                    "Ref": "KeyPair"
                 },
-                "KeyName": {"Ref": "KeyPair"},
                 "ImageId": {
                     "Fn::FindInMap": [
                         "AWSRegionArch2AMI",
@@ -241,23 +529,50 @@
                 "IamInstanceProfile": {
                     "Ref": "RootInstanceProfile"
                 },
-                "SecurityGroups": [{"Ref": "CassSecurityGroup"}]
+                "SecurityGroups": [
+                    {
+                        "Ref": "CassSecurityGroup"
+                    }
+                ]
             }
-        },
+      },
         "CassAutoScalingGroup": {
             "Type": "AWS::AutoScaling::AutoScalingGroup",
             "Version": "2009-05-15",
             "Properties": {
-                "AvailabilityZones": {
-                    "Fn::GetAZs": ""
-                },
+                "AvailabilityZones": [
+                    {
+                        "Fn::FindInMap": [
+                            "TwoAZs",
+                            {
+                                "Ref": "AWS::Region"
+                            },
+                            "AZ1"
+                        ]
+                    },
+                    {
+                        "Fn::FindInMap": [
+                            "TwoAZs",
+                            {
+                                "Ref": "AWS::Region"
+                            },
+                            "AZ2"
+                        ]
+                    }
+                ],
                 "LaunchConfigurationName": {
                     "Ref": "CassAutoScalingLaunchConfiguration"
                 },
-                "MinSize": {"Ref": "CassNumServers"},
-                "MaxSize": {"Ref": "CassNumServers"},
+                "MinSize": {
+                    "Ref": "CassNumServers"
+                },
+                "MaxSize": {
+                    "Ref": "CassNumServers"
+                },
                 "NotificationConfiguration": {
-                    "TopicARN": {"Ref": "NotificationTopic"},
+                    "TopicARN": {
+                        "Ref": "NotificationTopic"
+                    },
                     "NotificationTypes": [
                         "autoscaling:EC2_INSTANCE_LAUNCH",
                         "autoscaling:EC2_INSTANCE_LAUNCH_ERROR",
@@ -267,134 +582,162 @@
                 }
             }
         },
-        "RestAutoScalingLaunchConfiguration": {
-            "Type": "AWS::AutoScaling::LaunchConfiguration",
-            "Properties": {
-                "UserData": {
-                    "Fn::Base64": {"Fn::Join": ["", [
-
-                                "#!/bin/bash -ex\n",
-
-                                "# REST SERVER STARTUP \n",
-
-                                "exec >/var/log/usergrid-bootstrap.log 2>&1\n",
-
-                                "\n",
-                                "mkdir -p /usr/share/usergrid\n",
-                                "\n",
-
-                                "# create script that sets our environment variables\n",
-                                "cat >/etc/profile.d/usergrid-env.sh <<EOF\n",
-                                    "alias sudo='sudo -E'\n",
-                                    "\n",
-                                    "export TYPE=rest\n",
-                                    "export STACK_NAME=", {"Ref": "AWS::StackName"}, "\n",
-                                    "\n",
-                                    "export DNS_NAME=", {"Ref": "DnsSubDomain"}, "\n",
-                                    "export DNS_DOMAIN=", {"Ref": "DnsDomain"}, "\n",
-                                    "export PUBLIC_HOSTNAME=`(curl -s http://169.254.169.254/latest/meta-data/public-hostname)`\n",
-                                    "export INTERNAL_HOSTNAME=`(curl http://169.254.169.254/latest/meta-data/local-ipv4)`\n",
-                                    "export ELB_NAME=", {"Ref": "RestElasticLoadBalancer"}, "\n",
-                                    "\n",
-                                    "export EC2_INSTANCE_ID=`ec2metadata --instance-id`\n",
-                                    "export EC2_REGION=", {"Ref": "AWS::Region"}, "\n",
-                                    "export EC2_URL=https://ec2.amazonaws.com/\n",
-                                    "\n",
-                                    "export REST_SECURITY_GROUP_NAME=", {"Ref": "RestSecurityGroup"}, "\n",
-                                    "export DB_SECURITY_GROUP_NAME=", {"Ref": "CassSecurityGroup"}, "\n",
-                                    "\n",
-                                    "export CASSANDRA_CLUSTER_NAME=", {"Ref": "CassClusterName"}, "\n",
-                                    "export CASSANDRA_KEYSPACE_NAME=usergrid", "\n",
-                                    "export CASSANDRA_NUM_SERVERS=", {"Ref": "CassNumServers"}, "\n",
-                                    "export CASSANDRA_REPLICATION_FACTOR=", {"Ref": "CassReplicationFactor"}, "\n",
-                                    "\n",
-                                    "export RELEASE_BUCKET=", {"Ref": "ReleaseBucket"}, "\n",
-                                    "\n",
-                                    "export SUPER_USER_EMAIL=", {"Ref": "SuperUserEmail"}, "\n",
-                                    "export TEST_ADMIN_USER_EMAIL=", {"Ref": "TestAdminUserEmail"}, "\n",
-                                    "\n",
-                                "EOF\n",
-                                "\n",
-
-                                "# put AWS creds in environment\n",
-                                "cat >/etc/profile.d/aws-credentials.sh <<EOF\n",
-                                "export AWS_ACCESS_KEY=", {"Ref": "RestKey"}, "\n",
-                                "export AWS_SECRET_KEY=", {"Fn::GetAtt": ["RestKey", "SecretAccessKey"]}, "\n",
-                                "EOF\n",
-                                "\n",
-
-                                "# setup s3cmd (will be installed by init script) \n",
-                                "cat >/etc/s3cfg <<EOF\n",
-                                "access_key=", {"Ref": "RestKey"}, "\n",
-                                "secret_key=", {"Fn::GetAtt": ["RestKey", "SecretAccessKey"]}, "\n",
-                                "EOF\n",
-                                "chmod 644 /etc/s3cfg\n",
-                                "ln -s /etc/s3cfg ~ubuntu/.s3cfg\n",
-                                "ln -s /etc/s3cfg ~root/.s3cfg\n",
-                                "\n",
-
-                                "# download usergrid and init script bundle from S3\n",
-                                "wget -O- -q http://s3tools.org/repo/deb-all/stable/s3tools.key | apt-key add -\n",
-                                "wget -O/etc/apt/sources.list.d/s3tools.list http://s3tools.org/repo/deb-all/stable/s3tools.list\n",
-                                "apt-get update\n",
-                                "apt-get -y install s3cmd\n",
-                                "cd /usr/share/usergrid\n",
-                                "s3cmd --config=/etc/s3cfg get s3://", {"Ref": "ReleaseBucket"}, "/awscluster-1.0-SNAPSHOT-any.tar.gz\n",
-                                "tar xvf awscluster-1.0-SNAPSHOT-any.tar.gz\n",
-                                "rm -fr awscluster-1.0-SNAPSHOT-any.tar.gz\n",
-                                "chmod 755 ./init_instance/*.sh\n",
-                                "cd ./init_instance\n",
-
-                                "# Init as a REST intance \n",
-                                "sh ./init_rest_server.sh\n"
-
-                            ]]}
-                },
-                "KeyName": {"Ref": "KeyPair"},
-                "ImageId": {
-                    "Fn::FindInMap": [
-                        "AWSRegionArch2AMI",
+      "RestAutoScalingLaunchConfiguration":{
+         "Type":"AWS::AutoScaling::LaunchConfiguration",
+         "Properties":{
+            "UserData":{
+               "Fn::Base64":{
+                  "Fn::Join":[
+                     "",
+                     [
+                        "#!/bin/bash -ex\n",
+                        "# REST SERVER STARTUP \n",
+                        "exec >/var/log/usergrid-bootstrap.log 2>&1\n",
+                        "\n",
+                        "mkdir -p /usr/share/usergrid\n",
+                        "\n",
+                        "# create script that sets our environment variables\n",
+                        "cat >/etc/profile.d/usergrid-env.sh <<EOF\n",
+                        "alias sudo='sudo -E'\n",
+                        "\n",
+                        "export TYPE=rest\n",
+                        "export STACK_NAME=", { "Ref":"AWS::StackName" }, "\n",
+                        "export YOURKIT=", { "Ref":"InstallYourkit" }, "\n",
+                        "export DNS_NAME=", { "Ref":"DnsSubDomain" }, "\n",
+                        "export DNS_DOMAIN=", { "Ref":"DnsDomain" }, "\n",
+                        "export PUBLIC_HOSTNAME=`(curl -s http://169.254.169.254/latest/meta-data/public-hostname)`\n",
+                        "export INTERNAL_HOSTNAME=`(curl http://169.254.169.254/latest/meta-data/local-ipv4)`\n",
+                        "export ELB_NAME=", { "Ref":"RestElasticLoadBalancer" }, "\n",
+                        "\n",
+                        "export EC2_INSTANCE_ID=`ec2metadata --instance-id`\n",
+                        "export EC2_REGION=", { "Ref":"AWS::Region" }, "\n",
+                        "export EC2_URL=https://ec2.amazonaws.com/\n", "\n",
+                        "export REST_SECURITY_GROUP_NAME=", { "Ref":"RestSecurityGroup" }, "\n",
+                        "export DB_SECURITY_GROUP_NAME=", { "Ref":"CassSecurityGroup" }, "\n",
+                        "\n",
+                        "export CASSANDRA_CLUSTER_NAME=", { "Ref":"CassClusterName" }, "\n",
+                        "export CASSANDRA_KEYSPACE_NAME=usergrid", "\n",
+                        "export CASSANDRA_NUM_SERVERS=", { "Ref":"CassNumServers" }, "\n",
+                         "export GRAPHITE_NUM_SERVERS=", { "Ref":"GraphiteNumServers" }, "\n",
+                        "\n",
+                        "export CASSANDRA_REPLICATION_FACTOR=", { "Ref":"CassReplicationFactor" }, "\n",
+                        "\n",
+                        "export RELEASE_BUCKET=", { "Ref":"ReleaseBucket" }, "\n",
+                        "\n",
+                        "export SUPER_USER_EMAIL=", { "Ref":"SuperUserEmail" }, "\n",
+                        "export TEST_ADMIN_USER_EMAIL=", { "Ref":"TestAdminUserEmail" }, "\n",
+                        "\n",
+                        "EOF\n",
+                        "\n",
+                        "# put AWS creds in environment\n",
+                        "cat >/etc/profile.d/aws-credentials.sh <<EOF\n",
+                        "export AWS_ACCESS_KEY=", { "Ref":"RestKey" }, "\n",
+                        "export AWS_SECRET_KEY=", { "Fn::GetAtt":[ "RestKey", "SecretAccessKey" ] }, "\n",
+                        "EOF\n",
+                        "\n",
+                        "# setup s3cmd (will be installed by init script) \n",
+                        "cat >/etc/s3cfg <<EOF\n",
+                        "access_key=", { "Ref":"RestKey" }, "\n",
+                        "secret_key=", { "Fn::GetAtt":[ "RestKey", "SecretAccessKey" ] }, "\n",
+                        "EOF\n",
+                        "chmod 644 /etc/s3cfg\n",
+                        "ln -s /etc/s3cfg ~ubuntu/.s3cfg\n",
+                        "ln -s /etc/s3cfg ~root/.s3cfg\n",
+                        "\n",
+                        "# download usergrid and init script bundle from S3\n",
+                        "wget -O- -q http://s3tools.org/repo/deb-all/stable/s3tools.key | apt-key add -\n",
+                        "wget -O/etc/apt/sources.list.d/s3tools.list http://s3tools.org/repo/deb-all/stable/s3tools.list\n",
+                        "apt-get update\n",
+                        "apt-get -y install s3cmd\n",
+                        "cd /usr/share/usergrid\n",
+                        "s3cmd --config=/etc/s3cfg get s3://", { "Ref":"ReleaseBucket" }, "/awscluster-1.0-SNAPSHOT-any.tar.gz\n",
+                        "tar xvf awscluster-1.0-SNAPSHOT-any.tar.gz\n",
+                        "rm -fr awscluster-1.0-SNAPSHOT-any.tar.gz\n",
+                        "chmod 755 ./init_instance/*.sh\n",
+                        "cd ./init_instance\n",
+                        "# Init as a REST intance \n",
+                        "sh ./init_rest_server.sh\n"
+                     ]
+                  ]
+               }
+            },
+            "KeyName":{
+               "Ref":"KeyPair"
+            },
+            "ImageId":{
+               "Fn::FindInMap":[
+                  "AWSRegionArch2AMI",
+                  {
+                     "Ref":"AWS::Region"
+                  },
+                  {
+                     "Fn::FindInMap":[
+                        "AWSInstanceType2Arch",
                         {
-                            "Ref": "AWS::Region"
+                           "Ref":"RestInstanceType"
                         },
-                        {
-                            "Fn::FindInMap": [
-                                "AWSInstanceType2Arch",
-                                {
-                                    "Ref": "RestInstanceType"
-                                },
-                                "Arch"
-                            ]
-                        }
-                    ]
-                },
-                "InstanceType": {
-                    "Ref": "RestInstanceType"
-                },
-                "IamInstanceProfile": {
-                    "Ref": "RootInstanceProfile"
-                },
-                "SecurityGroups": [{"Ref": "RestSecurityGroup"}]
-            }
-        },
+                        "Arch"
+                     ]
+                  }
+               ]
+            },
+            "InstanceType":{
+               "Ref":"RestInstanceType"
+            },
+            "IamInstanceProfile":{
+               "Ref":"RootInstanceProfile"
+            },
+            "SecurityGroups":[
+               {
+                  "Ref":"RestSecurityGroup"
+               }
+            ]
+         }
+      },
         "RestAutoScalingGroup": {
             "Type": "AWS::AutoScaling::AutoScalingGroup",
             "Version": "2009-05-15",
             "Properties": {
                 "AvailabilityZones": [
-                    {"Fn::FindInMap": ["TwoAZs", {"Ref": "AWS::Region"}, "AZ1"]},
-                    {"Fn::FindInMap": ["TwoAZs", {"Ref": "AWS::Region"}, "AZ2"]}
+                    {
+                        "Fn::FindInMap": [
+                            "TwoAZs",
+                            {
+                                "Ref": "AWS::Region"
+                            },
+                            "AZ1"
+                        ]
+                    },
+                    {
+                        "Fn::FindInMap": [
+                            "TwoAZs",
+                            {
+                                "Ref": "AWS::Region"
+                            },
+                            "AZ2"
+                        ]
+                    }
                 ],
                 "LaunchConfigurationName": {
                     "Ref": "RestAutoScalingLaunchConfiguration"
                 },
-                "MinSize": {"Ref": "RestMinServers"},
-                "MaxSize": {"Ref": "RestMaxServers"},
+                "MinSize": {
+                    "Ref": "RestMinServers"
+                },
+                "MaxSize": {
+                    "Ref": "RestMaxServers"
+                },
                 "HealthCheckType": "ELB",
                 "HealthCheckGracePeriod": "1800",
-                "LoadBalancerNames": [{"Ref": "RestElasticLoadBalancer"}],
+                "LoadBalancerNames": [
+                    {
+                        "Ref": "RestElasticLoadBalancer"
+                    }
+                ],
                 "NotificationConfiguration": {
-                    "TopicARN": {"Ref": "NotificationTopic"},
+                    "TopicARN": {
+                        "Ref": "NotificationTopic"
+                    },
                     "NotificationTypes": [
                         "autoscaling:EC2_INSTANCE_LAUNCH",
                         "autoscaling:EC2_INSTANCE_LAUNCH_ERROR",
@@ -436,16 +779,19 @@
                 "Period": "600",
                 "EvaluationPeriods": "2",
                 "Threshold": "60",
-                "AlarmActions": [{
+                "AlarmActions": [
+                    {
                         "Ref": "RestServerScaleUpPolicy"
-                    }],
+                    }
+                ],
                 "Dimensions": [
                     {
                         "Name": "AutoScalingGroupName",
                         "Value": {
                             "Ref": "RestAutoScalingGroup"
                         }
-                    }],
+                    }
+                ],
                 "ComparisonOperator": "GreaterThanThreshold"
             }
         },
@@ -459,16 +805,19 @@
                 "Period": "600",
                 "EvaluationPeriods": "2",
                 "Threshold": "10",
-                "AlarmActions": [{
+                "AlarmActions": [
+                    {
                         "Ref": "RestServerScaleDownPolicy"
-                    }],
+                    }
+                ],
                 "Dimensions": [
                     {
                         "Name": "AutoScalingGroupName",
                         "Value": {
                             "Ref": "RestAutoScalingGroup"
                         }
-                    }],
+                    }
+                ],
                 "ComparisonOperator": "LessThanThreshold"
             }
         },
@@ -476,14 +825,32 @@
             "Type": "AWS::ElasticLoadBalancing::LoadBalancer",
             "Properties": {
                 "AvailabilityZones": [
-                    {"Fn::FindInMap": ["TwoAZs", {"Ref": "AWS::Region"}, "AZ1"]},
-                    {"Fn::FindInMap": ["TwoAZs", {"Ref": "AWS::Region"}, "AZ2"]}
+                    {
+                        "Fn::FindInMap": [
+                            "TwoAZs",
+                            {
+                                "Ref": "AWS::Region"
+                            },
+                            "AZ1"
+                        ]
+                    },
+                    {
+                        "Fn::FindInMap": [
+                            "TwoAZs",
+                            {
+                                "Ref": "AWS::Region"
+                            },
+                            "AZ2"
+                        ]
+                    }
                 ],
-                "Listeners": [{
+                "Listeners": [
+                    {
                         "LoadBalancerPort": "80",
                         "InstancePort": "8080",
                         "Protocol": "HTTP"
-                    }],
+                    }
+                ],
                 "HealthCheck": {
                     "Target": "HTTP:8080/status",
                     "HealthyThreshold": "2",
@@ -496,27 +863,64 @@
         "NotificationTopic": {
             "Type": "AWS::SNS::Topic",
             "Properties": {
-                "Subscription": [{
-                        "Endpoint": {"Ref": "NotificationEmail"},
+                "Subscription": [
+                    {
+                        "Endpoint": {
+                            "Ref": "NotificationEmail"
+                        },
                         "Protocol": "email"
-                    }]
+                    }
+                ]
             }
         },
         "DnsRecord": {
             "Type": "AWS::Route53::RecordSetGroup",
             "Properties": {
-                "HostedZoneName": {"Fn::Join": [".", [{"Ref": "DnsDomain"}, ""]]},
-                "RecordSets": [{
-                        "Name": {"Fn::Join": [".", [{"Ref": "DnsSubDomain"}, {"Ref": "DnsDomain"}]]},
+                "HostedZoneName": {
+                    "Fn::Join": [
+                        ".",
+                        [
+                            {
+                                "Ref": "DnsDomain"
+                            },
+                            ""
+                        ]
+                    ]
+                },
+                "RecordSets": [
+                    {
+                        "Name": {
+                            "Fn::Join": [
+                                ".",
+                                [
+                                    {
+                                        "Ref": "DnsSubDomain"
+                                    },
+                                    {
+                                        "Ref": "DnsDomain"
+                                    }
+                                ]
+                            ]
+                        },
                         "Type": "A",
                         "AliasTarget": {
-                            "HostedZoneId": {"Fn::GetAtt": ["RestElasticLoadBalancer", "CanonicalHostedZoneNameID"]},
-                            "DNSName": {"Fn::GetAtt": ["RestElasticLoadBalancer", "CanonicalHostedZoneName"]}
+                            "HostedZoneId": {
+                                "Fn::GetAtt": [
+                                    "RestElasticLoadBalancer",
+                                    "CanonicalHostedZoneNameID"
+                                ]
+                            },
+                            "DNSName": {
+                                "Fn::GetAtt": [
+                                    "RestElasticLoadBalancer",
+                                    "CanonicalHostedZoneName"
+                                ]
+                            }
                         }
-                    }]
+                    }
+                ]
             }
         },
-
         "RootRole": {
             "Type": "AWS::IAM::Role",
             "Properties": {
@@ -573,81 +977,137 @@
             "Type": "AWS::EC2::SecurityGroup",
             "Properties": {
                 "GroupDescription": "Database Machines",
-                "SecurityGroupIngress": [{
+                "SecurityGroupIngress": [
+                    {
                         "IpProtocol": "tcp",
                         "FromPort": "22",
                         "ToPort": "22",
                         "CidrIp": "0.0.0.0/0"
-                    }]
+                    }
+                ]
             }
         },
-        "CassAllow7000FromCass": {
+        "AllowCassToCassOnAllPorts": {
             "Type": "AWS::EC2::SecurityGroupIngress",
             "Properties": {
-                "GroupName": {"Ref": "CassSecurityGroup"},
+                "GroupName": {
+                    "Ref": "CassSecurityGroup"
+                },
                 "IpProtocol": "tcp",
-                "FromPort": "7000",
-                "ToPort": "7000",
-                "SourceSecurityGroupName": {"Ref": "CassSecurityGroup"}
+                "FromPort": "1",
+                "ToPort": "65535",
+                "SourceSecurityGroupName": {
+                    "Ref": "CassSecurityGroup"
+                }
             }
         },
-        "CassAllow9160FromCass": {
+        "AllowCassToRestOnAllPorts": {
             "Type": "AWS::EC2::SecurityGroupIngress",
             "Properties": {
-                "GroupName": {"Ref": "CassSecurityGroup"},
+                "GroupName": {
+                    "Ref": "RestSecurityGroup"
+                },
                 "IpProtocol": "tcp",
-                "FromPort": "9160",
-                "ToPort": "9160",
-                "SourceSecurityGroupName": {"Ref": "CassSecurityGroup"}
+                "FromPort": "0",
+                "ToPort": "65535",
+                "SourceSecurityGroupName": {
+                    "Ref": "CassSecurityGroup"
+                }
             }
         },
-        "CassAllow9300FromCass": {
+        "AllowCassToCassOnAllPorts": {
             "Type": "AWS::EC2::SecurityGroupIngress",
             "Properties": {
-                "GroupName": {"Ref": "CassSecurityGroup"},
+                "GroupName": {
+                    "Ref": "CassSecurityGroup"
+                },
                 "IpProtocol": "tcp",
-                "FromPort": "9300",
-                "ToPort": "9300",
-                "SourceSecurityGroupName": {"Ref": "CassSecurityGroup"}
+                "FromPort": "0",
+                "ToPort": "65535",
+                "SourceSecurityGroupName": {
+                    "Ref": "CassSecurityGroup"
+                }
             }
         },
-        "RestAllowAllFromCass": {
+        "AllowAllToCassOnPort8888": {
             "Type": "AWS::EC2::SecurityGroupIngress",
             "Properties": {
-                "GroupName": {"Ref": "RestSecurityGroup"},
+                "GroupName": {
+                    "Ref": "CassSecurityGroup"
+                },
                 "IpProtocol": "tcp",
-                "FromPort": "0",
-                "ToPort": "65535",
-                "SourceSecurityGroupName": {"Ref": "CassSecurityGroup"}
-            }
-        },
-        "CassAlllowAllFromRest" : {
-                 "Type" : "AWS::EC2::SecurityGroupIngress",
-                 "Properties" : {
-                     "GroupName" : { "Ref" : "CassSecurityGroup" },
-                     "IpProtocol": "tcp",
-                    "FromPort": "0",
-                    "ToPort": "65535",
-                    "SourceSecurityGroupName": {"Ref": "RestSecurityGroup"}
-                 }
-         },
+                "FromPort": "8888",
+                "ToPort": "8888",
+                "CidrIp": "0.0.0.0/0"
+            }
+        },
         "RestSecurityGroup": {
             "Type": "AWS::EC2::SecurityGroup",
             "Properties": {
                 "GroupDescription": "REST Machines",
-                "SecurityGroupIngress": [{
+                "SecurityGroupIngress": [
+                    {
                         "IpProtocol": "tcp",
                         "FromPort": "22",
                         "ToPort": "22",
                         "CidrIp": "0.0.0.0/0"
-                    }, {
+                    },
+                    {
                         "IpProtocol": "tcp",
                         "FromPort": "8080",
                         "ToPort": "8080",
                         "CidrIp": "0.0.0.0/0"
-                    }]
+                    }
+                ]
+            }
+        },
+        "GraphiteSecurityGroup": {
+            "Type": "AWS::EC2::SecurityGroup",
+            "Properties": {
+                "GroupDescription": "Graphic Machines",
+                "SecurityGroupIngress": [
+                    {
+                        "IpProtocol": "tcp",
+                        "FromPort": "22",
+                        "ToPort": "22",
+                        "CidrIp": "0.0.0.0/0"
+                    },
+                    {
+                        "IpProtocol": "tcp",
+                        "FromPort": "80",
+                        "ToPort": "80",
+                        "CidrIp": "0.0.0.0/0"
+                    }
+                ]
+            }
+        },
+        "AllowCassToGraphiteAllPorts": {
+            "Type": "AWS::EC2::SecurityGroupIngress",
+            "Properties": {
+                "GroupName": {
+                    "Ref": "GraphiteSecurityGroup"
+                },
+                "IpProtocol": "tcp",
+                "FromPort": "0",
+                "ToPort": "65535",
+                "SourceSecurityGroupName": {
+                    "Ref": "CassSecurityGroup"
+                }
+            }
+        },
+        "AllowRestToGraphiteAllPorts": {
+            "Type": "AWS::EC2::SecurityGroupIngress",
+            "Properties": {
+                "GroupName": {
+                    "Ref": "GraphiteSecurityGroup"
+                },
+                "IpProtocol": "tcp",
+                "FromPort": "0",
+                "ToPort": "65535",
+                "SourceSecurityGroupName": {
+                    "Ref": "RestSecurityGroup"
+                }
             }
         }
     }
-
-}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/eb20781d/stack/core/src/test/resources/corepersistence-UNIT.properties
----------------------------------------------------------------------
diff --git a/stack/core/src/test/resources/corepersistence-UNIT.properties b/stack/core/src/test/resources/corepersistence-UNIT.properties
deleted file mode 100644
index a09c0fb..0000000
--- a/stack/core/src/test/resources/corepersistence-UNIT.properties
+++ /dev/null
@@ -1,17 +0,0 @@
-# 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.
-
-# Overrides

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/eb20781d/stack/core/src/test/resources/usergrid-CHOP.properties
----------------------------------------------------------------------
diff --git a/stack/core/src/test/resources/usergrid-CHOP.properties b/stack/core/src/test/resources/usergrid-CHOP.properties
deleted file mode 100644
index a09c0fb..0000000
--- a/stack/core/src/test/resources/usergrid-CHOP.properties
+++ /dev/null
@@ -1,17 +0,0 @@
-# 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.
-
-# Overrides


Mime
View raw message