usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From toddn...@apache.org
Subject [3/3] git commit: Added opscenter and agent installation
Date Fri, 25 Jul 2014 16:47:24 GMT
Added opscenter and agent installation

Added yourkit installation

Added graphite and REST codehale reporter

Refactored registry into a reusable class


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

Branch: refs/heads/two-dot-o
Commit: 3392c2e24be8767c140c7cfc72767f643285c596
Parents: 49ab6d2
Author: Todd Nine <toddnine@apache.org>
Authored: Fri Jul 25 10:43:40 2014 -0600
Committer: Todd Nine <toddnine@apache.org>
Committed: Fri Jul 25 10:43:40 2014 -0600

----------------------------------------------------------------------
 stack/awscluster/assembly.xml                   |  14 +++--
 .../src/main/dist/conf/Priam.properties         |  21 -------
 .../src/main/dist/init_instance/create_raid0.sh |   2 +-
 .../main/dist/init_instance/init_db_server.sh   |  19 +++---
 .../main/dist/init_instance/init_rest_server.sh |  25 ++++++--
 .../dist/init_instance/install_cassandra.sh     |  40 +------------
 .../dist/init_instance/install_elasticsearch.sh |   6 +-
 .../src/main/dist/lib/priam-agent-1.2.24.jar    | Bin 33020 -> 0 bytes
 .../dist/lib/priam-cass-extensions-1.2.24.jar   | Bin 5478 -> 0 bytes
 .../src/main/dist/webapps/priam-web-1.2.24.war  | Bin 31272443 -> 0 bytes
 .../src/main/groovy/configure_cassandra.groovy  |  29 +++------
 .../main/groovy/configure_elasticsearch.groovy  |  20 ++-----
 .../groovy/configure_opscenter_agent.groovy     |  16 ++---
 .../src/main/groovy/configure_priam.groovy      |  60 -------------------
 .../src/main/groovy/configure_usergrid.groovy   |  40 +++++++++----
 .../src/main/groovy/registry_clear.groovy       |  39 ------------
 .../src/main/groovy/registry_list.groovy        |  21 +++----
 .../src/main/groovy/registry_register.groovy    |  34 +++--------
 .../src/main/groovy/wait_for_instances.groovy   |  47 +++++++--------
 19 files changed, 128 insertions(+), 305 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/3392c2e2/stack/awscluster/assembly.xml
----------------------------------------------------------------------
diff --git a/stack/awscluster/assembly.xml b/stack/awscluster/assembly.xml
index a7fce3c..a185ca0 100644
--- a/stack/awscluster/assembly.xml
+++ b/stack/awscluster/assembly.xml
@@ -44,14 +44,10 @@
                 <include>**</include>
             </includes>
 
-            <!-- Exclude Priam for now -->
-            <excludes>
-                <exclude>**/priam**</exclude>
-                <exclude>**/Priam**</exclude>
-            </excludes>
 
         </fileSet>
 
+
         <fileSet>
             <outputDirectory>./scripts</outputDirectory>
             <directory>./src/main/groovy</directory>
@@ -60,6 +56,14 @@
             </includes>
         </fileSet>
 
+      <fileSet>
+               <outputDirectory>./cql</outputDirectory>
+               <directory>./src/main/cql</directory>
+               <includes>
+                   <include>**</include>
+               </includes>
+           </fileSet>
+
         <fileSet>
             <outputDirectory>./webapps/portal</outputDirectory>
             <directory>../../portal/dist/appsvc-ui</directory>

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/3392c2e2/stack/awscluster/src/main/dist/conf/Priam.properties
----------------------------------------------------------------------
diff --git a/stack/awscluster/src/main/dist/conf/Priam.properties b/stack/awscluster/src/main/dist/conf/Priam.properties
deleted file mode 100644
index e327526..0000000
--- a/stack/awscluster/src/main/dist/conf/Priam.properties
+++ /dev/null
@@ -1,21 +0,0 @@
-
-# priam settings to be added to SimpleDB by configure_priam.groovy
-
-priam.clustername=usergrid2
-
-priam.cass.home=/etc/cassandra
-priam.cass.startscript=/etc/init.d/cassandra start
-priam.cass.stopscript=/etc/init.d/cassandra stop
-priam.yamlLocation=/etc/cassandra/cassandra.yaml
-
-priam.commitlog.location=/mnt/data/cassandra/commitlog
-priam.data.location=/mnt/data/cassandra/data
-priam.cache.location=/mnt/data/cassandra/saved_caches
-
-priam.s3.base_dir=priam-backup
-priam.s3.bucket=priam-cassandra-archive
-priam.backup.incremental.enable=false
-
-priam.partitioner=org.apache.cassandra.dht.RandomPartitioner
-
-priam.zones.available=us-east-1a,us-east-1b,us-east-1c,us-east-1d

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/3392c2e2/stack/awscluster/src/main/dist/init_instance/create_raid0.sh
----------------------------------------------------------------------
diff --git a/stack/awscluster/src/main/dist/init_instance/create_raid0.sh b/stack/awscluster/src/main/dist/init_instance/create_raid0.sh
index 80f75d8..296cb9f 100644
--- a/stack/awscluster/src/main/dist/init_instance/create_raid0.sh
+++ b/stack/awscluster/src/main/dist/init_instance/create_raid0.sh
@@ -24,7 +24,7 @@ debconf-set-selections <<< "postfix postfix/main_mailer_type string
'Internet Si
 apt-get install -y postfix
 
 # install mdadm RAID controller
-apt-get -y install mdadm
+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

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/3392c2e2/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 fe689c7..068dfe5 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
@@ -33,9 +33,9 @@ cd /usr/share/usergrid/init_instance
 ./create_raid0.sh
 
 # Install the easy stuff
-PKGS="ntp unzip groovy tomcat7 curl"
+PKGS="ntp unzip groovy curl"
 apt-get update
-apt-get -y install ${PKGS}
+apt-get -y --force-yes install ${PKGS}
 /etc/init.d/tomcat7 stop
 
 # Install AWS Java SDK and get it into the Groovy classpath
@@ -49,6 +49,9 @@ 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 
 
@@ -64,13 +67,9 @@ cd /usr/share/usergrid/init_instance
 ./install_elasticsearch.sh
 /etc/init.d/elasticsearch start
 
-# Starting Tomcat starts Priam which starts Priam
-#/etc/init.d/tomcat7 restart
 
-# Priam consistently craps out on first run
-# making this ugly kludge necessary
-#sleep 90
-#/etc/init.d/tomcat7 restart
+#Use the CQL to crate the keyspaces
+cd /usr/share/usergrid/init_instance
+./create_keyspaces.sh
+
 
-cd /usr/share/usergrid/scripts
-groovy tag_instance.groovy

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/3392c2e2/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 7dfa2eb..b1fe8f9 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
@@ -27,7 +27,7 @@ dpkg-reconfigure -f noninteractive tzdata
 
 PKGS="openjdk-7-jdk tomcat7 s3cmd ntp unzip groovy"
 apt-get update
-apt-get -y install ${PKGS}
+apt-get -y --force-yes install ${PKGS}
 
 # 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
@@ -44,17 +44,30 @@ ln -s /home/ubuntu/.groovy /root/.groovy
 . /etc/profile.d/aws-credentials.sh
 . /etc/profile.d/usergrid-env.sh
 
+/etc/init.d/tomcat7 stop
+
+cd /usr/share/usergrid/scripts
+groovy tag_instance.groovy
+
+
 # Wait for enough Cassandra nodes then deploy and restart Tomcat 
 cd /usr/share/usergrid/scripts
-groovy wait_for_instances.groovy
+groovy wait_for_instances.groovy cassandra ${CASSANDRA_NUM_SERVERS}
+groovy wait_for_instances.groovy graphite ${GRAPHITE_NUM_SERVERS}
 
 mkdir -p /usr/share/tomcat7/lib 
-groovy configure_usergrid.groovy > /usr/share/tomcat7/lib/usergrid-deployment.properties

+groovy configure_usergrid.groovy > /usr/share/tomcat7/lib/usergrid-deployment.properties
+
 
 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 
+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 restart
-groovy tag_instance.groovy
+/etc/init.d/tomcat7 start

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/3392c2e2/stack/awscluster/src/main/dist/init_instance/install_cassandra.sh
----------------------------------------------------------------------
diff --git a/stack/awscluster/src/main/dist/init_instance/install_cassandra.sh b/stack/awscluster/src/main/dist/init_instance/install_cassandra.sh
index 76a4c09..ac9b8a9 100644
--- a/stack/awscluster/src/main/dist/init_instance/install_cassandra.sh
+++ b/stack/awscluster/src/main/dist/init_instance/install_cassandra.sh
@@ -26,7 +26,7 @@ cat >> cassandra.sources.list << EOF
 deb http://www.apache.org/dist/cassandra/debian 12x main
 EOF
 apt-get update
-apt-get -y install libcap2
+apt-get -y --force-yes install libcap2
 apt-get --force-yes -y install cassandra
 /etc/init.d/cassandra stop
 
@@ -35,8 +35,8 @@ chown cassandra /mnt/data/cassandra
 
 # Wait for other instances to start up
 cd /usr/share/usergrid/scripts
-groovy registry_register.groovy
-groovy wait_for_instances.groovy
+groovy registry_register.groovy cassandra
+groovy wait_for_instances.groovy cassandra ${CASSANDRA_NUM_SERVERS}
 
 cd /usr/share/usergrid/scripts
 groovy configure_cassandra.groovy > /etc/cassandra/cassandra.yaml
@@ -54,39 +54,5 @@ apt-get  --force-yes -y install opscenter
 sudo service opscenterd start
 
 
-
-
-
-## Configure Priam
-#groovy configure_priam.groovy
-#
-## Copy Priam extension into Cassandra and Priam WAR into Tomcat
-#rm -rf /var/lib/tomcat7/webapps/*
-#mkdir -p /usr/share/cassandra/lib 
-#cp /usr/share/usergrid/lib/priam-cass-extensions-1.2.24.jar /usr/share/cassandra/lib 
-#cp /usr/share/usergrid/webapps/priam-web-1.2.24.war /var/lib/tomcat7/webapps/Priam.war
-#
-## Make sure Priam via Tomcat can write to /etc/cassandra
-## TODO: do this without 777
-#chmod -R 777 /etc/cassandra
-#chmod 777 /etc/init.d/cassandra
-#
-## Configure sudo for no passwords to please Priam
-#cat >> /tmp/sudoers.new << EOF
-#Defaults    env_reset
-#Defaults    mail_badpass
-#Defaults    secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
-#root    ALL=(ALL:ALL) ALL
-#%admin  ALL=(ALL) ALL
-#%sudo   ALL=(ALL:ALL) NOPASSWD:ALL
-#EOF
-#visudo -c -f /tmp/sudoers.new
-#if [ "$?" -eq "0" ]; then
-#    cp /tmp/sudoers.new /etc/sudoers
-#fi
-## Add tomat user to sudoers to please Priam
-#adduser tomcat7 sudo
-#/etc/init.d/sudo restart
-
 popd
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/3392c2e2/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 432189a..7a6ad27 100644
--- a/stack/awscluster/src/main/dist/init_instance/install_elasticsearch.sh
+++ b/stack/awscluster/src/main/dist/init_instance/install_elasticsearch.sh
@@ -22,6 +22,8 @@
 # Install and stop ElasticSearch
 pushd /etc/apt/sources.list.d
 
+groovy ./registry_register.groovy elasticsarch
+
 cat >> elasticsearch.sources.list << EOF
 deb http://packages.elasticsearch.org/elasticsearch/1.0/debian stable main
 EOF
@@ -38,6 +40,8 @@ chown elasticsearch /mnt/log/elasticsearch
 # Configure and restart ElasticSearch
 update-rc.d elasticsearch defaults 95 10
 cd /usr/share/usergrid/scripts
+
+
 groovy ./configure_elasticsearch.groovy > /etc/elasticsearch/elasticsearch.yml
 
-popd
\ No newline at end of file
+popd

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/3392c2e2/stack/awscluster/src/main/dist/lib/priam-agent-1.2.24.jar
----------------------------------------------------------------------
diff --git a/stack/awscluster/src/main/dist/lib/priam-agent-1.2.24.jar b/stack/awscluster/src/main/dist/lib/priam-agent-1.2.24.jar
deleted file mode 100644
index 21e6980..0000000
Binary files a/stack/awscluster/src/main/dist/lib/priam-agent-1.2.24.jar and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/3392c2e2/stack/awscluster/src/main/dist/lib/priam-cass-extensions-1.2.24.jar
----------------------------------------------------------------------
diff --git a/stack/awscluster/src/main/dist/lib/priam-cass-extensions-1.2.24.jar b/stack/awscluster/src/main/dist/lib/priam-cass-extensions-1.2.24.jar
deleted file mode 100644
index 77c4f7b..0000000
Binary files a/stack/awscluster/src/main/dist/lib/priam-cass-extensions-1.2.24.jar and /dev/null
differ

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/3392c2e2/stack/awscluster/src/main/dist/webapps/priam-web-1.2.24.war
----------------------------------------------------------------------
diff --git a/stack/awscluster/src/main/dist/webapps/priam-web-1.2.24.war b/stack/awscluster/src/main/dist/webapps/priam-web-1.2.24.war
deleted file mode 100644
index 016eed4..0000000
Binary files a/stack/awscluster/src/main/dist/webapps/priam-web-1.2.24.war and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/3392c2e2/stack/awscluster/src/main/groovy/configure_cassandra.groovy
----------------------------------------------------------------------
diff --git a/stack/awscluster/src/main/groovy/configure_cassandra.groovy b/stack/awscluster/src/main/groovy/configure_cassandra.groovy
index eb45054..9e5ded2 100644
--- a/stack/awscluster/src/main/groovy/configure_cassandra.groovy
+++ b/stack/awscluster/src/main/groovy/configure_cassandra.groovy
@@ -26,40 +26,29 @@ import com.amazonaws.auth.*
 import com.amazonaws.services.simpledb.*
 import com.amazonaws.services.simpledb.model.*
 
-String accessKey = (String)System.getenv().get("AWS_ACCESS_KEY")
-String secretKey = (String)System.getenv().get("AWS_SECRET_KEY")
-String stackName = (String)System.getenv().get("STACK_NAME")
+
 String hostName  = (String)System.getenv().get("PUBLIC_HOSTNAME")
 String clusterName  = (String)System.getenv().get("CASSANDRA_CLUSTER_NAME")
 int cassNumServers = ((String)System.getenv().get("CASSANDRA_NUM_SERVERS")).toInteger()
 
-String domain    = stackName
-
-def creds = new BasicAWSCredentials(accessKey, secretKey)
-def sdbClient = new AmazonSimpleDBClient(creds)
 
 // build seed list by listing all Cassandra nodes found in SimpleDB domain with our stackName
-def selectResult = sdbClient.select(new SelectRequest((String)"select * from `${domain}`
where itemName() is not null order by itemName()"))
+
+NodeRegistry registry = new NodeRegistry();
+
+def selectResult = registry.searchNode('cassandra')
 def seeds = ""
 def sep = ""
-for (item in selectResult.getItems()) {
-    def att = item.getAttributes().get(0)
-    if (att.getValue().equals(stackName)) {
-        seeds = "${seeds}${sep}${item.getName()}"
-        sep = ","
-    }
+for (host in selectResult) {
+    seeds = "${seeds}${sep}${host}"
+    sep = ","
 }
 
 
-//calculate what our token should be
-selectResult = sdbClient.select(new SelectRequest((String)"select * from `${domain}` where
itemName() is not null  order by itemName()"))
-
 int index = 0;
 int count = 0;
 
-for (item in selectResult.getItems()) {
-
-    def name = item.getName()
+for (name in selectResult) {
 
     //get our index so that we know which token to get
     if (name == hostName) {

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/3392c2e2/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 5ddb040..08dbf48 100644
--- a/stack/awscluster/src/main/groovy/configure_elasticsearch.groovy
+++ b/stack/awscluster/src/main/groovy/configure_elasticsearch.groovy
@@ -28,26 +28,18 @@ import com.amazonaws.auth.*
 import com.amazonaws.services.simpledb.*
 import com.amazonaws.services.simpledb.model.*
 
-String accessKey = (String)System.getenv().get("AWS_ACCESS_KEY")
-String secretKey = (String)System.getenv().get("AWS_SECRET_KEY")
-String stackName = (String)System.getenv().get("STACK_NAME")
 String hostName  = (String)System.getenv().get("PUBLIC_HOSTNAME")
-def clusterName  = (String)System.getenv().get("CASSANDRA_CLUSTER_NAME")
-String domain    = stackName
 
-def creds = new BasicAWSCredentials(accessKey, secretKey)
-def sdbClient = new AmazonSimpleDBClient(creds)
+
+NodeRegistry registry = new NodeRegistry();
 
 // build seed list by listing all Cassandra nodes found in SimpleDB domain with our stackName
-def selectResult = sdbClient.select(new SelectRequest((String)"select * from `${domain}`"))
+def selectResult = registry.searchNode('elasticsearch')
 def seeds = ""
 def sep = ""
-for (item in selectResult.getItems()) {
-    def att = item.getAttributes().get(0)
-    if (att.getValue().equals(stackName)) {
-        seeds = "${seeds}${sep}\"${item.getName()}\""
-        sep = ","
-    }
+for (hostname in selectResult) {
+   seeds = "${seeds}${sep}\"${hostname}\""
+   sep = ","
 }
 
 def elasticSearchConfig = """

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/3392c2e2/stack/awscluster/src/main/groovy/configure_opscenter_agent.groovy
----------------------------------------------------------------------
diff --git a/stack/awscluster/src/main/groovy/configure_opscenter_agent.groovy b/stack/awscluster/src/main/groovy/configure_opscenter_agent.groovy
index 90fc2f7..741f551 100644
--- a/stack/awscluster/src/main/groovy/configure_opscenter_agent.groovy
+++ b/stack/awscluster/src/main/groovy/configure_opscenter_agent.groovy
@@ -32,22 +32,14 @@ String stackName = (String)System.getenv().get("STACK_NAME")
 
 String domain    = stackName
 
-def creds = new BasicAWSCredentials(accessKey, secretKey)
-def sdbClient = new AmazonSimpleDBClient(creds)
 
-// build seed list by listing all Cassandra nodes found in SimpleDB domain with our stackName
-def selectResult = sdbClient.select(new SelectRequest((String)"select * from `${domain}`
where itemName() is not null order by itemName()"))
+NodeRegistry registry = new NodeRegistry();
 
-def opsCenterNode = null
+// build seed list by listing all Cassandra nodes found in SimpleDB domain with our stackName
+def selectResult = registry.searchNode('cassandra')
 
-for (item in selectResult.getItems()) {
-    def att = item.getAttributes().get(0)
-    if (att.getValue().equals(stackName)) {
-            opsCenterNode = item.getName();
-        break;
-    }
+def opsCenterNode = selectResult[0]
 
-}
 
 def clientconfig = """
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/3392c2e2/stack/awscluster/src/main/groovy/configure_priam.groovy
----------------------------------------------------------------------
diff --git a/stack/awscluster/src/main/groovy/configure_priam.groovy b/stack/awscluster/src/main/groovy/configure_priam.groovy
deleted file mode 100644
index dc7bb86..0000000
--- a/stack/awscluster/src/main/groovy/configure_priam.groovy
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * 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.
- */
-
-
-//
-// configure_priam.groovy
-//
-// Put our property overrides into Priam's SimpleDB table
-//
-import com.amazonaws.auth.*
-import com.amazonaws.services.simpledb.*
-import com.amazonaws.services.simpledb.model.*
-
-String domain = "PriamProperties"
-
-String accessKey = (String)System.getenv().get("AWS_ACCESS_KEY")
-String secretKey = (String)System.getenv().get("AWS_SECRET_KEY")
-String stackName = (String)System.getenv().get("STACK_NAME")
-String hostName  = (String)System.getenv().get("PUBLIC_HOSTNAME")
-
-def creds = new BasicAWSCredentials(accessKey, secretKey)
-def sdbClient = new AmazonSimpleDBClient(creds)
-
-// creates domain or no-op if it already exists
-sdbClient.createDomain(new CreateDomainRequest(domain))
-
-def props = new Properties()
-props.load(new FileInputStream("../conf/Priam.properties"))
-
-for (name in props.stringPropertyNames()) {
-
-    def value = props.getProperty(name)
-    def key = "${stackName}${name}"
-
-    def attrs = new ArrayList()
-    attrs.add(new ReplaceableAttribute("appId", stackName, true))
-    attrs.add(new ReplaceableAttribute("property", name, true))
-    attrs.add(new ReplaceableAttribute("value", value, true))
-
-    // this will set new or update existing attributes
-    def par = new PutAttributesRequest(domain, key, attrs)
-    sdbClient.putAttributes(par);
-}
-
-println "Configured Priam."
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/3392c2e2/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 5513880..7f559df 100644
--- a/stack/awscluster/src/main/groovy/configure_usergrid.groovy
+++ b/stack/awscluster/src/main/groovy/configure_usergrid.groovy
@@ -40,18 +40,28 @@ def clusterName  = System.getenv().get("CASSANDRA_CLUSTER_NAME")
 def superUserEmail     = System.getenv().get("SUPER_USER_EMAIL")
 def testAdminUserEmail = System.getenv().get("TEST_ADMIN_USER_EMAIL")
 
+
+NodeRegistry registry = new NodeRegistry();
+
+def selectResult = registry.searchNode('cassandra')
+
 // build seed list by listing all Cassandra nodes found in SimpleDB domain with our stackName
-def creds = new BasicAWSCredentials(accessKey, secretKey)
-def sdbClient = new AmazonSimpleDBClient(creds)
-def selectResult = sdbClient.select(new SelectRequest((String)"select * from `${domain}`"))
-def seeds = ""
+def cassandras = ""
 def sep = ""
-for (item in selectResult.getItems()) {
-    def att = item.getAttributes().get(0)
-    if (att.getValue().equals(stackName)) {
-        seeds = "${seeds}${sep}${item.getName()}:9160"
-        sep = ","
-    }
+for (item in selectResult) {
+    cassandras = "${cassandras}${sep}${item}:9160"
+    sep = ","
+
+}
+
+//TODO T.N Make this the graphite url
+selectResult = registry.searchNode('graphite')
+def graphite = ""
+sep = ""
+for (item in selectResult) {
+    graphite = "${graphite}${sep}${item}"
+    sep = ","
+
 }
 
 def usergridConfig = """
@@ -59,7 +69,7 @@ def usergridConfig = """
 # Minimal Usergrid configuration properties for local Tomcat and Cassandra 
 #
 
-cassandra.url=${seeds}
+cassandra.url=${cassandras}
 cassanrda.cluster=${clusterName}
 cassandra.keyspace.strategy.options.replication_factor=${replFactor}
 cassandra.keyspace.strategy.options.us-west=${replFactor}
@@ -134,14 +144,18 @@ usergrid.view.management.users.user.activate=${baseUrl}/accounts/welcome
 usergrid.view.management.users.user.confirm=${baseUrl}/accounts/welcome
 
 usergrid.admin.confirmation.url=${baseUrl}/management/users/%s/confirm
-usergrid.user.confirmation.url=${baseUrl}/%s/%s/users/%s/confirm\n\\n\
+usergrid.user.confirmation.url=${baseUrl}/%s/%s/users/%s/confirm
+
+usergrid.organization.activation.url=${baseUrl}/management/organizations/%s/activate
 
-usergrid.organization.activation.url=${baseUrl}/management/organizations/%s/activate\n\
 usergrid.admin.activation.url=${baseUrl}/management/users/%s/activate
 usergrid.user.activation.url=${baseUrl}%s/%s/users/%s/activate
 
 usergrid.admin.resetpw.url=${baseUrl}/management/users/%s/resetpw
 usergrid.user.resetpw.url=${baseUrl}/%s/%s/users/%s/resetpw
+
+
+usergrid.metrics.graphite.host=${graphite}
 """
 
 println usergridConfig 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/3392c2e2/stack/awscluster/src/main/groovy/registry_clear.groovy
----------------------------------------------------------------------
diff --git a/stack/awscluster/src/main/groovy/registry_clear.groovy b/stack/awscluster/src/main/groovy/registry_clear.groovy
deleted file mode 100644
index b95c88f..0000000
--- a/stack/awscluster/src/main/groovy/registry_clear.groovy
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.
- */
-
-
-// 
-// registry_clear.groovy 
-// 
-// Deletes the Cassandra node registry 
-//
-import com.amazonaws.auth.*
-import com.amazonaws.services.simpledb.*
-import com.amazonaws.services.simpledb.model.*
-
-String accessKey = (String)System.getenv().get("AWS_ACCESS_KEY")
-String secretKey = (String)System.getenv().get("AWS_SECRET_KEY")
-String stackName = (String)System.getenv().get("STACK_NAME")
-String hostName  = (String)System.getenv().get("PUBLIC_HOSTNAME")
-String domain    = stackName
-
-def creds = new BasicAWSCredentials(accessKey, secretKey)
-def sdbClient = new AmazonSimpleDBClient(creds)
-
-// TODO: this should only clear out items owned by our stack, i.e. those with the same stack
name 
-sdbClient.deleteDomain(new DeleteDomainRequest(domain))

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/3392c2e2/stack/awscluster/src/main/groovy/registry_list.groovy
----------------------------------------------------------------------
diff --git a/stack/awscluster/src/main/groovy/registry_list.groovy b/stack/awscluster/src/main/groovy/registry_list.groovy
index 25bf8eb..ca3bcda 100644
--- a/stack/awscluster/src/main/groovy/registry_list.groovy
+++ b/stack/awscluster/src/main/groovy/registry_list.groovy
@@ -22,22 +22,15 @@
 // 
 // List contents of registry as debugging aid. Not used in any other scripts. 
 //
-import com.amazonaws.auth.*
-import com.amazonaws.services.simpledb.*
-import com.amazonaws.services.simpledb.model.*
+NodeRegistry registry = new NodeRegistry();
 
-String accessKey = (String)System.getenv().get("AWS_ACCESS_KEY")
-String secretKey = (String)System.getenv().get("AWS_SECRET_KEY")
-String stackName = (String)System.getenv().get("STACK_NAME")
-String hostName  = (String)System.getenv().get("PUBLIC_HOSTNAME")
-String domain    = stackName
 
-def creds = new BasicAWSCredentials(accessKey, secretKey)
-def sdbClient = new AmazonSimpleDBClient(creds)
 
-def selectResult = sdbClient.select(new SelectRequest((String)"select * from `${domain}`"))
 
-for (item in selectResult.getItems()) {
-    def att = item.getAttributes().get(0)
-    println "${item.getName()} -> ${att.getName()} : ${att.getValue()}"
+for (item in registry.selectAll()) {
+    for(att in item.getAttributes()){
+        println "${item.getName()} -> ${att.getName()} : ${att.getValue()}"
+    }
+
+    println "\n"
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/3392c2e2/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 04bc6a7..a5282c3 100644
--- a/stack/awscluster/src/main/groovy/registry_register.groovy
+++ b/stack/awscluster/src/main/groovy/registry_register.groovy
@@ -26,32 +26,14 @@ import com.amazonaws.auth.*
 import com.amazonaws.services.simpledb.*
 import com.amazonaws.services.simpledb.model.*
 
-String accessKey = (String)System.getenv().get("AWS_ACCESS_KEY")
-String secretKey = (String)System.getenv().get("AWS_SECRET_KEY")
-String stackName = (String)System.getenv().get("STACK_NAME")
-String hostName  = (String)System.getenv().get("PUBLIC_HOSTNAME")
-String domain    = stackName
 
-def creds = new BasicAWSCredentials(accessKey, secretKey)
-def sdbClient = new AmazonSimpleDBClient(creds)
+if (args.size() != 1 )  {
+  println "this script expects one argument.  registry_register.groovy nodetype"
+  // You can even print the usage here.
+  return 1;
+}
 
-// creates domain or no-op if it already exists
-sdbClient.createDomain(new CreateDomainRequest(domain))
+String nodetype = args[0];
 
-def gar = new GetAttributesRequest(domain, hostName);
-def response = sdbClient.getAttributes(gar);
-if (response.getAttributes().size() == 1) {
-    println "Already registered"
-    def attrs = response.getAttributes()
-    for (att in attrs) {
-        println("${hostName} -> ${att.getName()} : ${att.getValue()}")
-    }
-} else {
-    println "Registering..."
-    def stackAtt = new ReplaceableAttribute("stackname", stackName, true)
-    def attrs = new ArrayList()
-    attrs.add(stackAtt)
-    def par = new PutAttributesRequest(domain, hostName, attrs)
-    sdbClient.putAttributes(par);
-    println "Registraition done."
-}
+NodeRegistry registry = new NodeRegistry();
+registry.addNode(nodetype);

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/3392c2e2/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 f6cf80a..98ddc3b 100644
--- a/stack/awscluster/src/main/groovy/wait_for_instances.groovy
+++ b/stack/awscluster/src/main/groovy/wait_for_instances.groovy
@@ -17,29 +17,31 @@
  */
 
 
-// 
-// wait_for_instances.groovy 
-// 
+//
+// wait_for_instances.groovy
+//
 // Wait for enough Cassandra servers are up before proceding,
-// Enough means count greater than or equal to replication factor. 
+// 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.*
 
-String accessKey = (String)System.getenv().get("AWS_ACCESS_KEY")
-String secretKey = (String)System.getenv().get("AWS_SECRET_KEY")
-String stackName = (String)System.getenv().get("STACK_NAME")
-String domain    = stackName
 
-//def replicationFactor = System.getenv().get("CASSANDRA_REPLICATION_FACTOR")
-int cassNumServers = System.getenv().get("CASSANDRA_NUM_SERVERS").toInteger()
+if (args.size() !=2 )  {
+  println "this script expects two arguments.  wait_for_instances.groovy nodetype numberOfServers"
+  // You can even print the usage here.
+  return 1;
+}
+
+String nodetype = args[0]
+int numberOfServers = args[1].toInteger()
 
-def creds = new BasicAWSCredentials(accessKey, secretKey)
-def sdbClient = new AmazonSimpleDBClient(creds)
 
-println "Waiting for Cassandra nodes to register..."
-    
+NodeRegistry registry = new NodeRegistry();
+
+println "Waiting for ${numberOfServers} nodes of type ${nodetype} to register..."
+
 def count = 0
 
 while (true) {
@@ -47,26 +49,19 @@ while (true) {
 
 
 
-        def selectResult = sdbClient.select(new SelectRequest((String)"select * from `${domain}`
where itemName() is not null  order by itemName()"))
+        def selectResult = registry.searchNode(nodetype)
 
 
-        count = 0
+        count = selectResult.size();
 
-        for (item in selectResult.getItems()) {
-            def att = item.getAttributes().get(0)
-            if (att.getValue().equals(stackName)) {
-                count++
-            }
-        }
-        if (count >= cassNumServers) {
-            println("count = ${count}, total number of servers is ${cassNumServers}.  Breaking")
+        if (count >= numberOfServers) {
+            println("count = ${count}, total number of servers is ${numberOfServers}.  Breaking")
             break
         }
 
-        println("Found ${count} nodes but need at least ${cassNumServers}.  Waiting...")
+        println("Found ${count} nodes but need at least ${numberOfServers}.  Waiting...")
     } catch (Exception e) {
         println "ERROR waiting for Casasndra ${e.getMessage()}, will continue waiting"
-        return
     }
     Thread.sleep(2000)
 }


Mime
View raw message