You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sn...@apache.org on 2014/07/25 18:58:47 UTC

[1/8] git commit: Switched properties to now use the correct entry in the properties file.

Repository: incubator-usergrid
Updated Branches:
  refs/heads/master df6b84a76 -> 7234d70aa
  refs/heads/two-dot-o 3392c2e24 -> b1e41a05d


Switched properties to now use the correct entry in the properties file.


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

Branch: refs/heads/master
Commit: 6a12e3049e08a1d787283aa37c5535120dced822
Parents: 585640e
Author: grey <gr...@apigee.com>
Authored: Tue Jul 15 15:57:16 2014 -0700
Committer: grey <gr...@apigee.com>
Committed: Tue Jul 15 15:57:16 2014 -0700

----------------------------------------------------------------------
 .../org/apache/usergrid/management/AccountCreationProps.java   | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/6a12e304/stack/services/src/main/java/org/apache/usergrid/management/AccountCreationProps.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/apache/usergrid/management/AccountCreationProps.java b/stack/services/src/main/java/org/apache/usergrid/management/AccountCreationProps.java
index 9963e8d..90263c4 100644
--- a/stack/services/src/main/java/org/apache/usergrid/management/AccountCreationProps.java
+++ b/stack/services/src/main/java/org/apache/usergrid/management/AccountCreationProps.java
@@ -69,9 +69,11 @@ public interface AccountCreationProps {
     public static final String PROPERTIES_NOTIFY_ADMIN_OF_ACTIVATION = "usergrid.management.notify_admin_of_activation";
 
     public static final String PROPERTIES_SYSADMIN_APPROVES_ADMIN_USERS =
-            "usergrid.management.admin_users_require_activation";
+            "usergrid.sysadmin.approve.users";
+            //"usergrid.management.admin_users_require_activation";
     public static final String PROPERTIES_SYSADMIN_APPROVES_ORGANIZATIONS =
-            "usergrid.management.organizations_require_activation";
+            "usergrid.sysadmin.approve.organizations";
+            //"usergrid.management.organizations_require_activation";
     public static final String PROPERTIES_NOTIFY_SYSADMIN_OF_NEW_ORGANIZATIONS =
             "usergrid.management.notify_sysadmin_of_new_organizations";
     public static final String PROPERTIES_NOTIFY_SYSADMIN_OF_NEW_ADMIN_USERS =


[7/8] git commit: Merge branch 'pr/30'

Posted by sn...@apache.org.
Merge branch 'pr/30'


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

Branch: refs/heads/master
Commit: 7234d70aa1aabcfd03904d1720ce6b8a33339cbe
Parents: a934855 17afabe
Author: Dave Johnson <sn...@apache.org>
Authored: Fri Jul 25 12:56:31 2014 -0400
Committer: Dave Johnson <sn...@apache.org>
Committed: Fri Jul 25 12:56:31 2014 -0400

----------------------------------------------------------------------
 .../cassandra/ManagementServiceImpl.java        | 13 ++++++------
 .../apache/usergrid/management/EmailFlowIT.java | 22 +++++++++++++-------
 2 files changed, 21 insertions(+), 14 deletions(-)
----------------------------------------------------------------------



[6/8] git commit: Merge branch 'pr/29'

Posted by sn...@apache.org.
Merge branch 'pr/29'


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

Branch: refs/heads/master
Commit: a934855367abdf4935f9974a491bb19647ea55fc
Parents: df6b84a 6a12e30
Author: Dave Johnson <sn...@apache.org>
Authored: Fri Jul 25 12:51:12 2014 -0400
Committer: Dave Johnson <sn...@apache.org>
Committed: Fri Jul 25 12:51:12 2014 -0400

----------------------------------------------------------------------
 .../org/apache/usergrid/management/AccountCreationProps.java   | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------



[5/8] git commit: USERGRID-195

Posted by sn...@apache.org.
USERGRID-195


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

Branch: refs/heads/two-dot-o
Commit: 96f76156d29fbbbe6c0c9089038d8a55b2f2ee06
Parents: 00dd111
Author: Salih Kardan <sk...@apache.org>
Authored: Wed Jul 23 11:18:53 2014 +0300
Committer: Salih Kardan <sk...@apache.org>
Committed: Wed Jul 23 11:18:53 2014 +0300

----------------------------------------------------------------------
 chop/example/src/main/resources/runner.sh | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/96f76156/chop/example/src/main/resources/runner.sh
----------------------------------------------------------------------
diff --git a/chop/example/src/main/resources/runner.sh b/chop/example/src/main/resources/runner.sh
index 86c985e..31a7846 100644
--- a/chop/example/src/main/resources/runner.sh
+++ b/chop/example/src/main/resources/runner.sh
@@ -41,5 +41,8 @@
 #
 # sudo rm /usr/lib/jvm/default-java
 # sudo ln -s /usr/lib/jvm/jdk1.7.0 /usr/lib/jvm/default-java
-sudo apt-get update >> /dev/null
-sudo apt-get --yes --force-yes install openjdk-7-jdk >> /dev/null
+# sudo apt-get update >> /dev/null
+# sudo apt-get --yes --force-yes install openjdk-7-jdk >> /dev/null
+
+echo "Test script started running..."
+echo -e "Test script is run successfully, $TEST_PARAM" > /home/ubuntu/runnerOut.log


[2/8] git commit: Fixed issue and added onto previous test so that the issue can be tested.

Posted by sn...@apache.org.
Fixed issue and added onto previous test so that the issue can be tested.


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

Branch: refs/heads/master
Commit: 17afabef6b658b266744e32362cad0c26ad9543e
Parents: 585640e
Author: grey <gr...@apigee.com>
Authored: Mon Jul 21 17:15:26 2014 -0700
Committer: grey <gr...@apigee.com>
Committed: Mon Jul 21 17:15:26 2014 -0700

----------------------------------------------------------------------
 .../cassandra/ManagementServiceImpl.java        | 13 ++++++------
 .../apache/usergrid/management/EmailFlowIT.java | 22 +++++++++++++-------
 2 files changed, 21 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/17afabef/stack/services/src/main/java/org/apache/usergrid/management/cassandra/ManagementServiceImpl.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/apache/usergrid/management/cassandra/ManagementServiceImpl.java b/stack/services/src/main/java/org/apache/usergrid/management/cassandra/ManagementServiceImpl.java
index 7c2cff9..ddd1f88 100644
--- a/stack/services/src/main/java/org/apache/usergrid/management/cassandra/ManagementServiceImpl.java
+++ b/stack/services/src/main/java/org/apache/usergrid/management/cassandra/ManagementServiceImpl.java
@@ -31,6 +31,11 @@ import java.util.UUID;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
+
+import org.apache.commons.codec.digest.DigestUtils;
+import org.apache.commons.lang.text.StrSubstitutor;
+import org.apache.shiro.UnavailableSecurityManagerException;
+
 import org.apache.usergrid.locking.Lock;
 import org.apache.usergrid.locking.LockManager;
 import org.apache.usergrid.management.AccountCreationProps;
@@ -91,10 +96,6 @@ import org.apache.usergrid.utils.MailUtils;
 import org.apache.usergrid.utils.StringUtils;
 import org.apache.usergrid.utils.UUIDUtils;
 
-import org.apache.commons.codec.digest.DigestUtils;
-import org.apache.commons.lang.text.StrSubstitutor;
-import org.apache.shiro.UnavailableSecurityManagerException;
-
 import com.google.common.collect.BiMap;
 import com.google.common.collect.HashBiMap;
 
@@ -2256,8 +2257,8 @@ public class ManagementServiceImpl implements ManagementService {
 
 
     public void sendAdminUserConfirmedAwaitingActivationEmail( UserInfo user ) throws Exception {
-        sendAdminUserEmail( user, "User Account Confirmed",
-                properties.getProperty( PROPERTIES_EMAIL_ADMIN_CONFIRMED_AWAITING_ACTIVATION ) );
+        sendAdminUserEmail(user, "User Account Confirmed",
+                emailMsg( hashMap("confirmed_email",user.getEmail() ),PROPERTIES_EMAIL_ADMIN_CONFIRMED_AWAITING_ACTIVATION ) );
     }
 
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/17afabef/stack/services/src/test/java/org/apache/usergrid/management/EmailFlowIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/management/EmailFlowIT.java b/stack/services/src/test/java/org/apache/usergrid/management/EmailFlowIT.java
index b4a7023..ab4b34c 100644
--- a/stack/services/src/test/java/org/apache/usergrid/management/EmailFlowIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/management/EmailFlowIT.java
@@ -35,6 +35,10 @@ import org.junit.rules.TestName;
 import org.jvnet.mock_javamail.Mailbox;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang.text.StrSubstitutor;
+
 import org.apache.usergrid.ServiceITSetup;
 import org.apache.usergrid.ServiceITSetupImpl;
 import org.apache.usergrid.cassandra.CassandraResource;
@@ -46,15 +50,7 @@ import org.apache.usergrid.persistence.cassandra.CassandraService;
 import org.apache.usergrid.persistence.entities.Application;
 import org.apache.usergrid.persistence.entities.User;
 
-import org.apache.commons.lang.StringUtils;
-import org.apache.commons.lang.text.StrSubstitutor;
-
 import static org.apache.commons.lang.StringUtils.isNotBlank;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNotSame;
-import static org.junit.Assert.assertTrue;
 import static org.apache.usergrid.management.AccountCreationProps.PROPERTIES_ADMIN_USERS_REQUIRE_CONFIRMATION;
 import static org.apache.usergrid.management.AccountCreationProps.PROPERTIES_EMAIL_ADMIN_ACTIVATED;
 import static org.apache.usergrid.management.AccountCreationProps.PROPERTIES_EMAIL_ADMIN_CONFIRMATION;
@@ -76,6 +72,11 @@ import static org.apache.usergrid.management.AccountCreationProps.PROPERTIES_SYS
 import static org.apache.usergrid.management.AccountCreationProps.PROPERTIES_USER_ACTIVATION_URL;
 import static org.apache.usergrid.management.AccountCreationProps.PROPERTIES_USER_CONFIRMATION_URL;
 import static org.apache.usergrid.management.AccountCreationProps.PROPERTIES_USER_RESETPW_URL;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNotSame;
+import static org.junit.Assert.assertTrue;
 
 
 /**
@@ -165,6 +166,11 @@ public class EmailFlowIT {
         assertEquals( ActivationState.CONFIRMED_AWAITING_ACTIVATION, state );
 
         confirmation = user_inbox.get( 1 );
+        String body = ( ( MimeMultipart ) confirmation.getContent() ).getBodyPart( 0 ).getContent().toString();
+        Boolean subbedEmailed = StringUtils.contains( body, "$" );
+
+        assertFalse( subbedEmailed );
+
         assertEquals( "User Account Confirmed", confirmation.getSubject() );
 
         List<Message> sysadmin_inbox = Mailbox.get( "sysadmin-2@mockserver.com" );


[3/8] git commit: USERGRID-195

Posted by sn...@apache.org.
USERGRID-195


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

Branch: refs/heads/two-dot-o
Commit: b4cee12c0c57377b3897ce6712a694ab80bb08f5
Parents: 54f045f
Author: Salih Kardan <sk...@apache.org>
Authored: Wed Jul 23 11:11:26 2014 +0300
Committer: Salih Kardan <sk...@apache.org>
Committed: Wed Jul 23 11:11:26 2014 +0300

----------------------------------------------------------------------
 chop/example/src/main/resources/runner.sh       |  45 ++++++++
 chop/example/src/main/resources/stack.json      |   1 +
 .../usergrid/chop/stack/BasicInstanceSpec.java  |  12 +++
 .../usergrid/chop/stack/InstanceSpec.java       |   8 ++
 chop/webapp/chop-webapp                         | 104 +++++++++++++++++++
 chop/webapp/pom.xml                             |  26 +++--
 .../webapp/coordinator/CoordinatorUtils.java    |  59 ++++++++++-
 7 files changed, 244 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/b4cee12c/chop/example/src/main/resources/runner.sh
----------------------------------------------------------------------
diff --git a/chop/example/src/main/resources/runner.sh b/chop/example/src/main/resources/runner.sh
new file mode 100644
index 0000000..1d13cbf
--- /dev/null
+++ b/chop/example/src/main/resources/runner.sh
@@ -0,0 +1,45 @@
+#!/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.
+#
+
+# NOTE: To install oracle jdk, we need to accept licence aggrement, therefore we could not download
+#       tar ball from oracle's website. We need to put tar ball elsewhere for example S3 like Dave
+#       just did here : https://github.com/apache/incubator-usergrid/blob/two-dot-o/stack/awscluster/src/main/dist/init_instance/install_oraclejdk.sh
+
+# Get JDK
+# wget http://download.oracle.com/otn-pub/java/jdk/7u65-b17/jdk-7u65-linux-x64.tar.gz
+
+# Install it as they do here:
+# http://askubuntu.com/questions/56104/how-can-i-install-sun-oracles-proprietary-java-6-7-jre-or-jdk
+# tar -xf jdk-7u65-linux-x64.tar.gz
+# mkdir -p /usr/lib/jvm
+# mv ./jdk1.7.0_65 /usr/lib/jvm/jdk1.7.0
+#
+# update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.7.0/bin/java" 2000
+# update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.7.0/bin/javac" 2000
+# update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.7.0/bin/javaws" 2000
+#
+# chmod a+x /usr/bin/java
+# 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
+sudo apt-get update >> /dev/null
+sudo apt-get --yes --force-yes install openjdk-7-jdk >> /dev/null
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/b4cee12c/chop/example/src/main/resources/stack.json
----------------------------------------------------------------------
diff --git a/chop/example/src/main/resources/stack.json b/chop/example/src/main/resources/stack.json
index efeb563..7f28963 100644
--- a/chop/example/src/main/resources/stack.json
+++ b/chop/example/src/main/resources/stack.json
@@ -8,6 +8,7 @@
       "type" : "m1.large",
       "keyName" : "TestKeyPair",
       "setupScripts" : [ "file://./test_script.sh" ],
+      "runnerScripts" : [ "file://./runner.sh" ],
       "scriptEnvironment" : {
           "TEST_PARAM" : "Test Param Value"
       }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/b4cee12c/chop/stack/src/main/java/org/apache/usergrid/chop/stack/BasicInstanceSpec.java
----------------------------------------------------------------------
diff --git a/chop/stack/src/main/java/org/apache/usergrid/chop/stack/BasicInstanceSpec.java b/chop/stack/src/main/java/org/apache/usergrid/chop/stack/BasicInstanceSpec.java
index d388cd6..452e8ff 100644
--- a/chop/stack/src/main/java/org/apache/usergrid/chop/stack/BasicInstanceSpec.java
+++ b/chop/stack/src/main/java/org/apache/usergrid/chop/stack/BasicInstanceSpec.java
@@ -34,6 +34,7 @@ public class BasicInstanceSpec implements InstanceSpec
     private String type;
     private String keyName;
     private List<URL> setupScripts = new ArrayList<URL>();
+    private List<URL> runnerScripts = new ArrayList<URL>();
     private Properties scriptEnvironment = new Properties();
 
 
@@ -79,6 +80,11 @@ public class BasicInstanceSpec implements InstanceSpec
         return setupScripts;
     }
 
+    @Override
+    public List<URL> getRunnerScripts() {
+        return runnerScripts;
+    }
+
 
     public BasicInstanceSpec setSetupScripts( final List<URL> setupScripts ) {
         this.setupScripts = setupScripts;
@@ -86,6 +92,12 @@ public class BasicInstanceSpec implements InstanceSpec
     }
 
 
+    public BasicInstanceSpec setRunnerScripts( final List<URL> runnerScripts ) {
+        this.runnerScripts = runnerScripts;
+        return this;
+    }
+
+
     public BasicInstanceSpec addSetupScript( URL setupScript ) {
         this.setupScripts.add( setupScript );
         return this;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/b4cee12c/chop/stack/src/main/java/org/apache/usergrid/chop/stack/InstanceSpec.java
----------------------------------------------------------------------
diff --git a/chop/stack/src/main/java/org/apache/usergrid/chop/stack/InstanceSpec.java b/chop/stack/src/main/java/org/apache/usergrid/chop/stack/InstanceSpec.java
index 5e14f0b..6891118 100644
--- a/chop/stack/src/main/java/org/apache/usergrid/chop/stack/InstanceSpec.java
+++ b/chop/stack/src/main/java/org/apache/usergrid/chop/stack/InstanceSpec.java
@@ -66,6 +66,14 @@ public interface InstanceSpec {
     List<URL> getSetupScripts();
 
     /**
+     * A list of scripts executed on newly created runner instances of this instance specification.
+     *
+     * @return the runner scripts
+     */
+    @JsonProperty
+    List<URL> getRunnerScripts();
+
+    /**
      * The environment properties to inject into the shell before executing setup scripts.
      */
     @JsonProperty

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/b4cee12c/chop/webapp/chop-webapp
----------------------------------------------------------------------
diff --git a/chop/webapp/chop-webapp b/chop/webapp/chop-webapp
new file mode 100644
index 0000000..80b2976
--- /dev/null
+++ b/chop/webapp/chop-webapp
@@ -0,0 +1,104 @@
+#!/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.
+#
+
+
+# Starts and stops chop web application.
+
+NAME=chop-webapp
+PIDFILE=/var/run/$NAME/$NAME.pid
+DESC="Chop Webapp"
+CMD_PATT="chop-webapp"
+LOGFILE=/var/log/chop-webapp.log
+. /lib/lsb/init-functions
+
+if [ `id -u` -ne 0 ]; then
+        echo "You need root privileges to run this script"
+        exit 1
+fi
+
+if [ "x$CHOP_HOME" = "x" ]; then
+    CHOP_HOME=/opt/chop
+fi
+
+is_running()
+{
+    if [ -f $PIDFILE ]; then
+        pid=`cat $PIDFILE`
+        grep -Eq "$CMD_PATT" "/proc/$pid/cmdline" 2>/dev/null && return 0
+        return 1
+    fi
+    return 3
+}
+
+case "$1" in
+start)
+        is_running
+        stat=$?
+        case "$stat" in
+                0) echo $DESC "is already running..." ;;
+                1) echo "Could not access pidfile for $DESC" ;;
+                *)
+                echo "Starting "$DESC" ... "
+                [ -e `dirname "$PIDFILE"` ] || \
+                        install -d -m755 `dirname $PIDFILE`
+                DAEMON="/usr/bin/java"
+                ARGS=" -jar -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 $CHOP_HOME/webapp/chop-webapp-2.0.0-SNAPSHOT-shaded.jar -e -d /var/lib/elasticsearch"
+		start-stop-daemon --start --quiet --make-pidfile --pidfile "$PIDFILE" --background  --exec /bin/bash -- -c "exec ${DAEMON} ${ARGS} > ${LOGFILE} 2>&1"
+	;;
+        esac
+;;
+
+stop)
+        is_running
+        stat=$?
+        case "$stat" in
+        0)
+                echo "Stopping" $DESC
+                echo "PID: " $PIDFILE
+                start-stop-daemon -K -p "$PIDFILE" -R TERM/30/KILL/5 >/dev/null
+                rm -f "$PIDFILE";;
+        1) echo "Could not access pidfile for $DESC" ;;
+        *) echo $DESC" is not running..." ;;
+        esac
+;;
+
+restart)
+        $0 stop
+        $0 start
+;;
+
+status)
+        is_running
+        stat=$?
+        case "$stat" in
+                0) log_success_msg "$DESC is running" ;;
+                1) log_failure_msg "could not access pidfile for $DESC" ;;
+                *) log_success_msg "$DESC is not running" ;;
+        esac
+        exit "$stat"
+;;
+kill)
+        start-stop-daemon -K -p "$PIDFILE" -R TERM/30/KILL/5 >/dev/null
+        rm -f "$PIDFILE"
+        echo $DESC "is killed..."
+;;
+*)
+        echo "Usage: $0 {start|stop|restart|status|kill}"
+        exit 1
+esac

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/b4cee12c/chop/webapp/pom.xml
----------------------------------------------------------------------
diff --git a/chop/webapp/pom.xml b/chop/webapp/pom.xml
index f50a82e..d770361 100644
--- a/chop/webapp/pom.xml
+++ b/chop/webapp/pom.xml
@@ -23,6 +23,7 @@
       <wagon.plugin.version>1.0-beta-5</wagon.plugin.version>
       <webapp-shaded-jar>${project.artifactId}-${project.version}-shaded.${project.packaging}</webapp-shaded-jar>
       <wagon.webapp.copy.file>${project.build.directory}/${webapp-shaded-jar}</wagon.webapp.copy.file>
+      <wagon.target.dir>${project.basedir}</wagon.target.dir>
       <wagon.temp.directory>/tmp</wagon.temp.directory>
       <chop.home.directory>/opt/chop</chop.home.directory>
       <chop.webapp.directory>${chop.home.directory}/webapp</chop.webapp.directory>
@@ -71,21 +72,26 @@
         <groupId>org.codehaus.mojo</groupId>
         <artifactId>wagon-maven-plugin</artifactId>
         <version>${wagon.plugin.version}</version>
-        <configuration>
-          <serverId>ec2-coordinator-instance</serverId>
-          <fromFile>${wagon.webapp.copy.file}</fromFile>
-          <url>scp://${chop.coordinator.url}${wagon.temp.directory}</url>
-          <commands>
-            <command>sudo mv ${wagon.temp.directory}/${webapp-shaded-jar} ${chop.webapp.directory}</command>
-            <command>sudo service chop-webapp restart</command>
-          </commands>
-        </configuration>
+          <configuration>
+            <serverId>ec2-coordinator-instance</serverId>
+            <fromDir>${wagon.target.dir}</fromDir>
+            <includes>target/${webapp-shaded-jar},jssecacerts,chop-webapp</includes>
+            <url>scp://${chop.coordinator.url}${wagon.temp.directory}</url>
+            <commands>
+              <command>if [ ! -f /etc/init.d/chop-webapp ]; then sudo cp ${wagon.temp.directory}/chop-webapp /etc/init.d/; fi</command>
+              <command>sudo chmod +x /etc/init.d/chop-webapp</command>
+              <command>if [ ! -f ${chop.webapp.java.home}/lib/security/jssecacerts ]; then sudo cp ${wagon.temp.directory}/jssecacerts ${chop.webapp.java.home}/jre/lib/security/; fi</command>
+              <command>if [ ! -d ${chop.webapp.directory} ]; then sudo mkdir -p ${chop.webapp.directory}; fi</command>
+              <command>sudo cp ${wagon.temp.directory}/target/${webapp-shaded-jar} ${chop.webapp.directory}</command>
+              <command>sudo service chop-webapp restart</command>
+            </commands>
+          </configuration>
         <executions>
           <execution>
             <id>upload-webapp-jar</id>
             <phase>deploy</phase>
             <goals>
-              <goal>upload-single</goal>
+              <goal>upload</goal>
               <goal>sshexec</goal>
             </goals>
           </execution>

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/b4cee12c/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/CoordinatorUtils.java
----------------------------------------------------------------------
diff --git a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/CoordinatorUtils.java b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/CoordinatorUtils.java
index 87f8c5b..a52abb5 100644
--- a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/CoordinatorUtils.java
+++ b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/CoordinatorUtils.java
@@ -31,6 +31,7 @@ import java.util.Collection;
 import java.util.HashSet;
 import java.util.concurrent.ExecutionException;
 
+import org.apache.usergrid.chop.stack.Cluster;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -124,7 +125,7 @@ public class CoordinatorUtils {
         InputStream stream = null;
         URLClassLoader classLoader = null;
         try {
-             // Access the jar file resources after adding it to a new ClassLoader
+            // Access the jar file resources after adding it to a new ClassLoader
             classLoader = new URLClassLoader( new URL[] { runnerJar.toURL() },
                     Thread.currentThread().getContextClassLoader() );
 
@@ -352,6 +353,62 @@ public class CoordinatorUtils {
         String destFile = sb.toString();
         commands.add( new SCPCommand( runnerJar.getAbsolutePath(), destFile ) );
 
+        sb = new StringBuilder();
+
+        /** Get runner scripts out of the jar file and prepare ssh & scp commands */
+        for ( Cluster cluster : stack.getClusters() ){
+
+            // Prepare setup environment variables
+            for( Object obj: cluster.getInstanceSpec().getScriptEnvironment().keySet() ) {
+
+                String envVar = obj.toString();
+                String value = cluster.getInstanceSpec().getScriptEnvironment().getProperty( envVar );
+                sb.append( "export " )
+                        .append( envVar )
+                        .append( "=\"" )
+                        .append( value )
+                        .append( "\";" );
+            }
+
+            String exportVars = sb.toString();
+
+            // Prepare SSH and SCP commands
+            for( URL scriptFile : cluster.getInstanceSpec().getRunnerScripts() ) {
+                /** First save file beside runner.jar */
+                File file = new File( scriptFile.getPath() );
+                File fileToSave = new File( runnerJar.getParentFile(), file.getName() );
+                writeToFile( getResourceAsStreamFromRunnerJar( runnerJar, file.getName() ), fileToSave.getPath() );
+
+                /** SCP the script to instance **/
+                sb = new StringBuilder();
+                sb.append( "/home/" )
+                        .append( Utils.DEFAULT_USER )
+                        .append( "/" )
+                        .append( fileToSave.getName() );
+
+                String destinationFile = sb.toString();
+                commands.add( new SCPCommand( fileToSave.getAbsolutePath(), destinationFile ) );
+
+                /** calling chmod first just in case **/
+                sb = new StringBuilder();
+                sb.append( "chmod 0755 " )
+                        .append( "/home/" )
+                        .append( Utils.DEFAULT_USER )
+                        .append( "/" )
+                        .append( fileToSave.getName() )
+                        .append( ";" );
+
+                /** Run the script command */
+                sb.append( exportVars )
+                        .append( "sudo -E " )
+                        .append( destinationFile );
+
+
+                commands.add( new SSHCommand( sb.toString() ) );
+            }
+        }
+
+
         /**
          * Start the runner.jar on instance.
          * This assumes an appropriate java is existing at /usr/bin/java on given instances,


[8/8] git commit: Merge branch 'pr/31' into two-dot-o

Posted by sn...@apache.org.
Merge branch 'pr/31' into two-dot-o


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

Branch: refs/heads/two-dot-o
Commit: b1e41a05d19ffc2fcc6c16b13de743755af23aab
Parents: 3392c2e 96f7615
Author: Dave Johnson <sn...@apache.org>
Authored: Fri Jul 25 12:58:25 2014 -0400
Committer: Dave Johnson <sn...@apache.org>
Committed: Fri Jul 25 12:58:25 2014 -0400

----------------------------------------------------------------------
 chop/example/src/main/resources/runner.sh       |  48 +++++++++
 chop/example/src/main/resources/stack.json      |   1 +
 .../usergrid/chop/stack/BasicInstanceSpec.java  |  12 +++
 .../usergrid/chop/stack/InstanceSpec.java       |   8 ++
 chop/webapp/chop-webapp                         | 104 +++++++++++++++++++
 chop/webapp/pom.xml                             |  26 +++--
 .../webapp/coordinator/CoordinatorUtils.java    |  59 ++++++++++-
 7 files changed, 247 insertions(+), 11 deletions(-)
----------------------------------------------------------------------



[4/8] git commit: Update runner.sh

Posted by sn...@apache.org.
Update runner.sh

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

Branch: refs/heads/two-dot-o
Commit: 00dd11160208b8372a6cc72ba8a116eb5e7be995
Parents: b4cee12
Author: Salih Kardan <sa...@gmail.com>
Authored: Wed Jul 23 11:15:33 2014 +0300
Committer: Salih Kardan <sa...@gmail.com>
Committed: Wed Jul 23 11:15:33 2014 +0300

----------------------------------------------------------------------
 chop/example/src/main/resources/runner.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/00dd1116/chop/example/src/main/resources/runner.sh
----------------------------------------------------------------------
diff --git a/chop/example/src/main/resources/runner.sh b/chop/example/src/main/resources/runner.sh
index 1d13cbf..86c985e 100644
--- a/chop/example/src/main/resources/runner.sh
+++ b/chop/example/src/main/resources/runner.sh
@@ -42,4 +42,4 @@
 # sudo rm /usr/lib/jvm/default-java
 # sudo ln -s /usr/lib/jvm/jdk1.7.0 /usr/lib/jvm/default-java
 sudo apt-get update >> /dev/null
-sudo apt-get --yes --force-yes install openjdk-7-jdk >> /dev/null
\ No newline at end of file
+sudo apt-get --yes --force-yes install openjdk-7-jdk >> /dev/null