usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject [1/4] git commit: Update PriamCluster to launch ElasticSearch in addition to Cassandra, and to use new Priam 1.2.24 tagged code.
Date Mon, 03 Feb 2014 16:20:41 GMT
Updated Branches:
  refs/heads/elasticsearch-cluster [deleted] 69b9c632e
  refs/heads/two-dot-o 3f1f841d8 -> 50a3f748f
  refs/pull/46/head [created] 69b9c632e


Update PriamCluster to launch ElasticSearch in addition to Cassandra, and to use new Priam
1.2.24 tagged code.

Work done for https://issues.apache.org/jira/browse/USERGRID-44


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

Branch: refs/heads/two-dot-o
Commit: ced42e11ac022a39a72d22cde4e5fbde7f0c402d
Parents: 2c6e7e4
Author: Dave Johnson <dmjohnson@apigee.com>
Authored: Fri Jan 31 14:39:13 2014 -0500
Committer: Dave Johnson <dmjohnson@apigee.com>
Committed: Fri Jan 31 14:39:13 2014 -0500

----------------------------------------------------------------------
 .../priamcluster/cassandra-cf.json              |  29 +++-----
 stack/corepersistence/priamcluster/pom.xml      |  29 +++++++-
 .../src/main/dist/conf/Priam.properties         |   4 +-
 .../src/main/dist/init_instance/init_cass.sh    |  73 -------------------
 .../main/dist/init_instance/init_instance.sh    |  50 +++++++++++++
 .../dist/init_instance/install_cassandra.sh     |  55 ++++++++++++++
 .../dist/init_instance/install_elasticsearch.sh |  18 +++++
 .../dist/init_instance/install_oraclejdk.sh     |   3 +
 .../src/main/dist/lib/priam-agent-1.2.24.jar    | Bin 0 -> 33020 bytes
 .../dist/lib/priam-cass-extensions-1.2.24.jar   | Bin 0 -> 5478 bytes
 .../priam-cass-extensions-2.0.0-SNAPSHOT.jar    | Bin 5478 -> 0 bytes
 .../src/main/dist/webapps/priam-web-1.2.24.war  | Bin 0 -> 31272443 bytes
 .../dist/webapps/priam-web-2.0.0-SNAPSHOT.war   | Bin 31266622 -> 0 bytes
 .../src/main/groovy/configure_cassandra.groovy  |   6 +-
 .../main/groovy/configure_elasticsearch.groovy  |  44 +++++++++++
 .../src/main/groovy/registry_clear.groovy       |   2 +-
 .../src/main/groovy/registry_list.groovy        |   2 +-
 .../src/main/groovy/registry_register.groovy    |   3 +-
 .../src/main/groovy/wait_for_cassandra.groovy   |  42 -----------
 .../src/main/groovy/wait_for_instances.groovy   |  44 +++++++++++
 20 files changed, 260 insertions(+), 144 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ced42e11/stack/corepersistence/priamcluster/cassandra-cf.json
----------------------------------------------------------------------
diff --git a/stack/corepersistence/priamcluster/cassandra-cf.json b/stack/corepersistence/priamcluster/cassandra-cf.json
index de40cec..8711a23 100644
--- a/stack/corepersistence/priamcluster/cassandra-cf.json
+++ b/stack/corepersistence/priamcluster/cassandra-cf.json
@@ -105,10 +105,12 @@
                                     "export EC2_REGION=", {"Ref": "AWS::Region"}, "\n",
                                     "export EC2_URL=https://ec2.amazonaws.com/\n",
                                     "\n",
-                                    "export DB_SECURITY_GROUP_NAME=", {"Ref": "CassSecurityGroup"},
"\n",
+                                    "export CASS_SECURITY_GROUP_NAME=", {"Ref": "CassSecurityGroup"},
"\n",
+                                    "\n",
+                                    "export JVM_EXTRA_OPTS=-javaagent:/usr/share/cassandra/lib/priam-cass-extensions-1.2.24.jar",
"\n",
                                     "\n",
-                                    "export JVM_EXTRA_OPTS=-javaagent:/usr/share/cassandra/lib/priam-cass-extensions-2.0.0-SNAPSHOT.jar",
"\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",
@@ -152,7 +154,7 @@
                                 "cd ./init_instance\n",
 
                                 "# init as a Cassandra node \n",
-                                "sh ./init_cass.sh\n"
+                                "sh ./init_instance.sh\n"
 
                             ]]}
                 },
@@ -304,21 +306,14 @@
                 "SourceSecurityGroupName": {"Ref": "CassSecurityGroup"}
             }
         },
-        "RestSecurityGroup": {
-            "Type": "AWS::EC2::SecurityGroup",
+        "CassSecurityGroupPort9200": {
+            "Type": "AWS::EC2::SecurityGroupIngress",
             "Properties": {
-                "GroupDescription": "REST Machines",
-                "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"
-                    }]
+                "GroupName": {"Ref": "CassSecurityGroup"},
+                "IpProtocol": "tcp",
+                "FromPort": "9200",
+                "ToPort": "9200",
+                "SourceSecurityGroupName": {"Ref": "CassSecurityGroup"}
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ced42e11/stack/corepersistence/priamcluster/pom.xml
----------------------------------------------------------------------
diff --git a/stack/corepersistence/priamcluster/pom.xml b/stack/corepersistence/priamcluster/pom.xml
index 3737e39..358f24e 100644
--- a/stack/corepersistence/priamcluster/pom.xml
+++ b/stack/corepersistence/priamcluster/pom.xml
@@ -84,8 +84,27 @@
                 <configuration>
                     <skip>true</skip>
                 </configuration>
-            </plugin> 
-            
+            </plugin>
+            <plugin>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <version>2.3.2</version>
+                <dependencies>
+                    <dependency>
+                        <groupId>org.codehaus.groovy</groupId>
+                        <artifactId>groovy-eclipse-compiler</artifactId>
+                        <version>2.6.0-01</version>
+                    </dependency>
+                </dependencies>
+                <configuration>
+                    <compilerId>groovy-eclipse-compiler</compilerId>
+                </configuration>
+            </plugin>
+            <plugin>
+                <artifactId>groovy-eclipse-compiler</artifactId>
+                <groupId>org.codehaus.groovy</groupId>
+                <version>2.6.0-01</version>
+                <extensions>true</extensions>
+            </plugin>
         </plugins>
 
     </build>
@@ -109,7 +128,11 @@
             <artifactId>aws-java-sdk</artifactId>
             <version>1.6.7</version>
         </dependency>
-   
+        <dependency>
+            <artifactId>groovy-all</artifactId>
+            <groupId>org.codehaus.groovy</groupId>
+            <version>2.0.5</version>
+        </dependency>
     </dependencies>
 
 </project>

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ced42e11/stack/corepersistence/priamcluster/src/main/dist/conf/Priam.properties
----------------------------------------------------------------------
diff --git a/stack/corepersistence/priamcluster/src/main/dist/conf/Priam.properties b/stack/corepersistence/priamcluster/src/main/dist/conf/Priam.properties
index 0b8fb40..eb90064 100644
--- a/stack/corepersistence/priamcluster/src/main/dist/conf/Priam.properties
+++ b/stack/corepersistence/priamcluster/src/main/dist/conf/Priam.properties
@@ -1,7 +1,7 @@
 
 # priam settings to be added to SimpleDB by configure_priam.groovy
 
-priam.clustername=usergrid
+priam.clustername=usergrid2
 
 priam.cass.home=/etc/cassandra
 priam.cass.startscript=/etc/init.d/cassandra start
@@ -14,8 +14,8 @@ priam.cache.location=/var/lib/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/ced42e11/stack/corepersistence/priamcluster/src/main/dist/init_instance/init_cass.sh
----------------------------------------------------------------------
diff --git a/stack/corepersistence/priamcluster/src/main/dist/init_instance/init_cass.sh b/stack/corepersistence/priamcluster/src/main/dist/init_instance/init_cass.sh
deleted file mode 100644
index e2e8d81..0000000
--- a/stack/corepersistence/priamcluster/src/main/dist/init_instance/init_cass.sh
+++ /dev/null
@@ -1,73 +0,0 @@
-#!/bin/bash
-echo "${HOSTNAME}" > /etc/hostname
-echo "127.0.0.1 ${HOSTNAME}" >> /etc/hosts
-hostname `cat /etc/hostname`
-
-echo "US/Eastern" > /etc/timezone
-dpkg-reconfigure -f noninteractive tzdata
-
-# Build environment for scripts
-. /etc/profile.d/aws-credentials.sh
-. /etc/profile.d/usergrid-env.sh
-
-# Install Oracle JDK from our S3 bucket
-./install_oraclejdk.sh 
-
-# Install the easy stuff
-PKGS="ntp unzip groovy tomcat7"
-apt-get update
-apt-get -y 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
-cd /usr/share/
-unzip /tmp/aws-sdk-java.zip 
-mkdir -p /home/ubuntu/.groovy/lib
-cp /usr/share/aws-java-sdk-*/third-party/*/*.jar /home/ubuntu/.groovy/lib
-cp /usr/share/aws-java-sdk-*/lib/* /home/ubuntu/.groovy/lib 
-# except for evil stax
-rm /home/ubuntu/.groovy/lib/stax*
-ln -s /home/ubuntu/.groovy /root/.groovy
-
-# Install and stop Cassandra
-cd /etc/apt/sources.list.d
-cat >> cassandra.sources.list << EOF
-deb http://www.apache.org/dist/cassandra/debian 12x main
-EOF
-sudo apt-get update
-sudo apt-get -y install libcap2
-sudo apt-get --force-yes -y install cassandra
-/etc/init.d/cassandra stop
-rm -rf /var/log/cassandra/*
-
-# Provide initial configuration to Cassandra 
-cd /usr/share/usergrid/scripts
-groovy registry_register.groovy
-groovy wait_for_cassandra.groovy
-cd /usr/share/usergrid/init_instance
-cd /usr/share/usergrid/scripts
-groovy configure_cassandra.groovy > /etc/cassandra/cassandra.yaml
-
-# Configure Priam
-cd /usr/share/usergrid/scripts
-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-2.0.0-SNAPSHOT.jar /usr/share/cassandra/lib

-cp /usr/share/usergrid/webapps/priam-web-2.0.0-SNAPSHOT.war /var/lib/tomcat7/webapps/Priam.war
-
-# Make sure Priam via Tomcat can write to /etc/cassandra
-chmod -R 777 /etc/cassandra
-chmod 777 /etc/init.d/cassandra
-# TODO: need to do something like this instead (not sure why it does not work):
-#chmod 770 /etc/cassandra
-#chmod -R 660 /etc/cassandra/*
-#usermod -a -G cassandra tomcat7
-#chgrp -R cassandra /etc/cassandra
-
-# Start Priam via Tomcat, should cause Cassandra to start
-/etc/init.d/tomcat7 restart
-
-groovy tag_instance.groovy

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ced42e11/stack/corepersistence/priamcluster/src/main/dist/init_instance/init_instance.sh
----------------------------------------------------------------------
diff --git a/stack/corepersistence/priamcluster/src/main/dist/init_instance/init_instance.sh
b/stack/corepersistence/priamcluster/src/main/dist/init_instance/init_instance.sh
new file mode 100644
index 0000000..c733705
--- /dev/null
+++ b/stack/corepersistence/priamcluster/src/main/dist/init_instance/init_instance.sh
@@ -0,0 +1,50 @@
+#!/bin/bash
+echo "${HOSTNAME}" > /etc/hostname
+echo "127.0.0.1 ${HOSTNAME}" >> /etc/hosts
+hostname `cat /etc/hostname`
+
+echo "US/Eastern" > /etc/timezone
+dpkg-reconfigure -f noninteractive tzdata
+
+# Build environment for scripts
+. /etc/profile.d/aws-credentials.sh
+. /etc/profile.d/usergrid-env.sh
+
+# Install the easy stuff
+PKGS="ntp unzip groovy tomcat7 curl"
+apt-get update
+apt-get -y install ${PKGS}
+/etc/init.d/tomcat7 stop
+
+# Install AWS Java SDK and get it into the Groovy classpath
+curl http://sdk-for-java.amazonwebservices.com/latest/aws-java-sdk.zip > /tmp/aws-sdk-java.zip
+cd /usr/share/
+unzip /tmp/aws-sdk-java.zip 
+mkdir -p /home/ubuntu/.groovy/lib
+cp /usr/share/aws-java-sdk-*/third-party/*/*.jar /home/ubuntu/.groovy/lib
+cp /usr/share/aws-java-sdk-*/lib/* /home/ubuntu/.groovy/lib 
+# except for evil stax
+rm /home/ubuntu/.groovy/lib/stax*
+ln -s /home/ubuntu/.groovy /root/.groovy
+
+./install_oraclejdk.sh 
+
+# Install and stop Cassandra 
+cd /usr/share/usergrid/init_instance
+./install_cassandra.sh
+
+# Install and start ElasticSearch
+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
+
+cd /usr/share/usergrid/scripts
+groovy tag_instance.groovy

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ced42e11/stack/corepersistence/priamcluster/src/main/dist/init_instance/install_cassandra.sh
----------------------------------------------------------------------
diff --git a/stack/corepersistence/priamcluster/src/main/dist/init_instance/install_cassandra.sh
b/stack/corepersistence/priamcluster/src/main/dist/init_instance/install_cassandra.sh
new file mode 100644
index 0000000..af6ae01
--- /dev/null
+++ b/stack/corepersistence/priamcluster/src/main/dist/init_instance/install_cassandra.sh
@@ -0,0 +1,55 @@
+#!/bin/bash
+
+# Install and stop Cassandra
+pushd /etc/apt/sources.list.d
+
+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 --force-yes -y install cassandra
+/etc/init.d/cassandra stop
+mkdir -p /var/lib/cassandra
+chown cassandra /var/lib/cassandra
+
+# Wait for other instances to start up
+cd /usr/share/usergrid/scripts
+groovy registry_register.groovy
+groovy wait_for_instances.groovy
+
+# Configure Priam
+cd /usr/share/usergrid/scripts
+groovy configure_cassandra.groovy > /etc/cassandra/cassandra.yaml
+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/ced42e11/stack/corepersistence/priamcluster/src/main/dist/init_instance/install_elasticsearch.sh
----------------------------------------------------------------------
diff --git a/stack/corepersistence/priamcluster/src/main/dist/init_instance/install_elasticsearch.sh
b/stack/corepersistence/priamcluster/src/main/dist/init_instance/install_elasticsearch.sh
new file mode 100644
index 0000000..5b69e8a
--- /dev/null
+++ b/stack/corepersistence/priamcluster/src/main/dist/init_instance/install_elasticsearch.sh
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+# Install and stop ElasticSearch
+pushd /etc/apt/sources.list.d
+
+cat >> elasticsearch.sources.list << EOF
+deb http://packages.elasticsearch.org/elasticsearch/1.0/debian stable main
+EOF
+apt-get update
+apt-get --force-yes -y install elasticsearch
+/etc/init.d/elasticsearch stop
+
+# 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

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ced42e11/stack/corepersistence/priamcluster/src/main/dist/init_instance/install_oraclejdk.sh
----------------------------------------------------------------------
diff --git a/stack/corepersistence/priamcluster/src/main/dist/init_instance/install_oraclejdk.sh
b/stack/corepersistence/priamcluster/src/main/dist/init_instance/install_oraclejdk.sh
index 09afc0e..f81c5fa 100644
--- a/stack/corepersistence/priamcluster/src/main/dist/init_instance/install_oraclejdk.sh
+++ b/stack/corepersistence/priamcluster/src/main/dist/init_instance/install_oraclejdk.sh
@@ -25,4 +25,7 @@ chmod a+x /usr/bin/javac
 chmod a+x /usr/bin/javaws
 chown -R root:root /usr/lib/jvm/jdk1.7.0
 
+sudo rm /usr/lib/jvm/default-java
+sudo ln -s /usr/lib/jvm/jdk1.7.0 /usr/lib/jvm/default-java
+
 popd
\ No newline at end of file

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

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

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ced42e11/stack/corepersistence/priamcluster/src/main/dist/lib/priam-cass-extensions-2.0.0-SNAPSHOT.jar
----------------------------------------------------------------------
diff --git a/stack/corepersistence/priamcluster/src/main/dist/lib/priam-cass-extensions-2.0.0-SNAPSHOT.jar
b/stack/corepersistence/priamcluster/src/main/dist/lib/priam-cass-extensions-2.0.0-SNAPSHOT.jar
deleted file mode 100644
index 7941e7d..0000000
Binary files a/stack/corepersistence/priamcluster/src/main/dist/lib/priam-cass-extensions-2.0.0-SNAPSHOT.jar
and /dev/null differ

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

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ced42e11/stack/corepersistence/priamcluster/src/main/dist/webapps/priam-web-2.0.0-SNAPSHOT.war
----------------------------------------------------------------------
diff --git a/stack/corepersistence/priamcluster/src/main/dist/webapps/priam-web-2.0.0-SNAPSHOT.war
b/stack/corepersistence/priamcluster/src/main/dist/webapps/priam-web-2.0.0-SNAPSHOT.war
deleted file mode 100644
index 2666a52..0000000
Binary files a/stack/corepersistence/priamcluster/src/main/dist/webapps/priam-web-2.0.0-SNAPSHOT.war
and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ced42e11/stack/corepersistence/priamcluster/src/main/groovy/configure_cassandra.groovy
----------------------------------------------------------------------
diff --git a/stack/corepersistence/priamcluster/src/main/groovy/configure_cassandra.groovy
b/stack/corepersistence/priamcluster/src/main/groovy/configure_cassandra.groovy
index ee878ea..cbcf5c7 100644
--- a/stack/corepersistence/priamcluster/src/main/groovy/configure_cassandra.groovy
+++ b/stack/corepersistence/priamcluster/src/main/groovy/configure_cassandra.groovy
@@ -1,19 +1,19 @@
 // 
 // configure_cassandra.groovy 
 // 
-// Emits Cassandra config file based on environment and Cassandra node registry in SimpleDB
+// 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 domain = "UGCloudFormation"
-
 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)

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ced42e11/stack/corepersistence/priamcluster/src/main/groovy/configure_elasticsearch.groovy
----------------------------------------------------------------------
diff --git a/stack/corepersistence/priamcluster/src/main/groovy/configure_elasticsearch.groovy
b/stack/corepersistence/priamcluster/src/main/groovy/configure_elasticsearch.groovy
new file mode 100644
index 0000000..b80314d
--- /dev/null
+++ b/stack/corepersistence/priamcluster/src/main/groovy/configure_elasticsearch.groovy
@@ -0,0 +1,44 @@
+
+// 
+// configure_cassandra.groovy 
+// 
+// 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 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)
+
+// 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 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 = ","
+    }
+}
+
+def elasticSearchConfig = """
+cluster.name: usergrid2
+discovery.zen.ping.multicast.enabled: false
+discovery.zen.ping.unicast.hosts: [${seeds}]
+node:
+    name: ${hostName} 
+network:
+    host: ${hostName}
+"""
+
+println elasticSearchConfig

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ced42e11/stack/corepersistence/priamcluster/src/main/groovy/registry_clear.groovy
----------------------------------------------------------------------
diff --git a/stack/corepersistence/priamcluster/src/main/groovy/registry_clear.groovy b/stack/corepersistence/priamcluster/src/main/groovy/registry_clear.groovy
index 24b62e9..5baa537 100644
--- a/stack/corepersistence/priamcluster/src/main/groovy/registry_clear.groovy
+++ b/stack/corepersistence/priamcluster/src/main/groovy/registry_clear.groovy
@@ -7,11 +7,11 @@ import com.amazonaws.auth.*
 import com.amazonaws.services.simpledb.*
 import com.amazonaws.services.simpledb.model.*
 
-String domain = "UGCloudFormation"
 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)

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ced42e11/stack/corepersistence/priamcluster/src/main/groovy/registry_list.groovy
----------------------------------------------------------------------
diff --git a/stack/corepersistence/priamcluster/src/main/groovy/registry_list.groovy b/stack/corepersistence/priamcluster/src/main/groovy/registry_list.groovy
index 01c52ca..9871a21 100644
--- a/stack/corepersistence/priamcluster/src/main/groovy/registry_list.groovy
+++ b/stack/corepersistence/priamcluster/src/main/groovy/registry_list.groovy
@@ -7,11 +7,11 @@ import com.amazonaws.auth.*
 import com.amazonaws.services.simpledb.*
 import com.amazonaws.services.simpledb.model.*
 
-String domain = "UGCloudFormation"
 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)

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ced42e11/stack/corepersistence/priamcluster/src/main/groovy/registry_register.groovy
----------------------------------------------------------------------
diff --git a/stack/corepersistence/priamcluster/src/main/groovy/registry_register.groovy b/stack/corepersistence/priamcluster/src/main/groovy/registry_register.groovy
index c988a93..739c04e 100644
--- a/stack/corepersistence/priamcluster/src/main/groovy/registry_register.groovy
+++ b/stack/corepersistence/priamcluster/src/main/groovy/registry_register.groovy
@@ -7,12 +7,11 @@ import com.amazonaws.auth.*
 import com.amazonaws.services.simpledb.*
 import com.amazonaws.services.simpledb.model.*
 
-String domain = "UGCloudFormation"
-
 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)

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ced42e11/stack/corepersistence/priamcluster/src/main/groovy/wait_for_cassandra.groovy
----------------------------------------------------------------------
diff --git a/stack/corepersistence/priamcluster/src/main/groovy/wait_for_cassandra.groovy
b/stack/corepersistence/priamcluster/src/main/groovy/wait_for_cassandra.groovy
deleted file mode 100644
index 4ccb080..0000000
--- a/stack/corepersistence/priamcluster/src/main/groovy/wait_for_cassandra.groovy
+++ /dev/null
@@ -1,42 +0,0 @@
-// 
-// wait_for_cassandra.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.*
-
-String domain    = "UGCloudFormation"
-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")
-def replicationFactor = System.getenv().get("CASSANDRA_REPLICATION_FACTOR")
-
-def creds = new BasicAWSCredentials(accessKey, secretKey)
-def sdbClient = new AmazonSimpleDBClient(creds)
-
-println "Waiting..."
-    
-def count = 0
-while (true) {
-    try {
-        def selectResult = sdbClient.select(new SelectRequest((String)"select * from ${domain}"))
-        for (item in selectResult.getItems()) {
-            def att = item.getAttributes().get(0)
-            if (att.getValue().equals(stackName)) {
-                count++
-            }
-        }
-        if (count >= replicationFactor || count > 300) {
-            break
-        }
-    } catch (Exception e) {
-        println "ERROR waiting for Casasndra ${e.getMessage()}, will continue waiting"
-        return
-    }
-    Thread.sleep(1000)
-}
-
-println "Waiting done."

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ced42e11/stack/corepersistence/priamcluster/src/main/groovy/wait_for_instances.groovy
----------------------------------------------------------------------
diff --git a/stack/corepersistence/priamcluster/src/main/groovy/wait_for_instances.groovy
b/stack/corepersistence/priamcluster/src/main/groovy/wait_for_instances.groovy
new file mode 100644
index 0000000..4f125b6
--- /dev/null
+++ b/stack/corepersistence/priamcluster/src/main/groovy/wait_for_instances.groovy
@@ -0,0 +1,44 @@
+// 
+// wait_for_cassandra.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.*
+
+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")
+def cassNumServers = System.getenv().get("CASSANDRA_NUM_SERVERS")
+
+def creds = new BasicAWSCredentials(accessKey, secretKey)
+def sdbClient = new AmazonSimpleDBClient(creds)
+
+println "Waiting..."
+    
+def count = 0
+while (true) {
+    try {
+        def selectResult = sdbClient.select(new SelectRequest((String)"select * from ${domain}"))
+        for (item in selectResult.getItems()) {
+            def att = item.getAttributes().get(0)
+            if (att.getValue().equals(stackName)) {
+                count++
+            }
+        }
+        if (count >= cassNumServers || count > 300) {
+            break
+        }
+    } catch (Exception e) {
+        println "ERROR waiting for Casasndra ${e.getMessage()}, will continue waiting"
+        return
+    }
+    Thread.sleep(1000)
+}
+
+println "Waiting done."


Mime
View raw message