You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by sa...@apache.org on 2013/12/12 13:18:10 UTC

[1/2] git commit: Adding puppet configuration for cartridge deployment and payload changes, for issue STRATOS-228

Updated Branches:
  refs/heads/master e2c0a2a25 -> 081f9fc95


Adding puppet configuration for cartridge deployment and payload changes, for issue STRATOS-228


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

Branch: refs/heads/master
Commit: 3e1c83e3be22c0d860db20b663096e15afc7ee26
Parents: 61d4106
Author: Sajith Kariyawasam <sa...@wso2.com>
Authored: Thu Dec 12 17:45:58 2013 +0530
Committer: Sajith Kariyawasam <sa...@wso2.com>
Committed: Thu Dec 12 17:45:58 2013 +0530

----------------------------------------------------------------------
 .../src/conf/cartridge-config.properties        |   2 +
 .../manager/CartridgeSubscriptionManager.java   |   2 +-
 .../stratos/adc/mgt/payload/CarbonPayload.java  |   8 +-
 .../apache/stratos/adc/mgt/payload/Payload.java |   7 +-
 .../adc/mgt/utils/CartridgeConstants.java       |   1 +
 .../resources/conf/cartridge-config.properties  |   2 +
 .../puppet/etc/puppet/files/cartridge-agent.sh  | 108 ++++++++
 tools/puppet/etc/puppet/files/environment       |  22 ++
 .../puppet/etc/puppet/files/event-publisher.sh  |  28 ++
 .../puppet/etc/puppet/files/event-subscriber.sh |  28 ++
 .../etc/puppet/files/get-launch-params.rb       |  54 ++++
 .../puppet/etc/puppet/files/health-publisher.sh |  33 +++
 tools/puppet/etc/puppet/files/healthcheck.sh    |  31 +++
 tools/puppet/etc/puppet/fileserver.conf         |  35 +++
 tools/puppet/manifests/classes/apt.pp           |  43 ++++
 tools/puppet/manifests/classes/hosts.pp         |  29 +++
 tools/puppet/manifests/classes/java.pp          |  65 +++++
 tools/puppet/manifests/classes/mcollective.pp   |  84 ++++++
 tools/puppet/manifests/classes/php_cartridge.pp | 141 ++++++++++
 tools/puppet/manifests/classes/ssh.pp           |  61 +++++
 tools/puppet/manifests/classes/system_config.pp |  77 ++++++
 tools/puppet/manifests/nodes.pp                 |  63 +++++
 tools/puppet/manifests/site.pp                  |  23 ++
 tools/puppet/modules/apt/files/90forceyes       |  23 ++
 .../modules/commons/files/bin/puppet_init.sh    |  53 ++++
 .../modules/commons/files/bin/sign_jars.sh      |  39 +++
 .../configs/bin/native/wrapper-linux-x86-32     | Bin 0 -> 111027 bytes
 .../commons/files/configs/lib/home/favicon.ico  | Bin 0 -> 1150 bytes
 tools/puppet/modules/commons/files/environment  |  23 ++
 .../java/files/jars/copy_java_patches_here      |  22 ++
 .../java/files/jdk-7u7-linux-x64.tar.gz.file    |  22 ++
 .../php_cartridge/etc/apache2/apache2.conf.erb  | 256 +++++++++++++++++++
 .../etc/apache2/sites-available/default-ssl.erb | 195 ++++++++++++++
 .../etc/apache2/sites-available/default.erb     |  64 +++++
 34 files changed, 1638 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/3e1c83e3/components/org.apache.stratos.adc.mgt/src/conf/cartridge-config.properties
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt/src/conf/cartridge-config.properties b/components/org.apache.stratos.adc.mgt/src/conf/cartridge-config.properties
index 3fddaa6..2f7c7f9 100644
--- a/components/org.apache.stratos.adc.mgt/src/conf/cartridge-config.properties
+++ b/components/org.apache.stratos.adc.mgt/src/conf/cartridge-config.properties
@@ -60,3 +60,5 @@ max.attempts=1000
 cartridge.key=KEYPATH
 
 repository.info.epr=https://stratos_ip:9445/services/RepositoryInformationService
+
+puppet.ip=127.0.0.1

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/3e1c83e3/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/manager/CartridgeSubscriptionManager.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/manager/CartridgeSubscriptionManager.java b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/manager/CartridgeSubscriptionManager.java
index 7c30fbe..7f1d50e 100644
--- a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/manager/CartridgeSubscriptionManager.java
+++ b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/manager/CartridgeSubscriptionManager.java
@@ -495,7 +495,7 @@ public class CartridgeSubscriptionManager {
             
             // populate payload from UI here
             payloadArg.setTenantRange(tenantRange);
-            payloadArg.setDeployment("default");   
+            //payloadArg.setDeployment("default");   
             payloadArg.setServiceDomain(cartridgeAlias+"."+cartridgeInfo.getHostName()+".domain"); // This is cluster id
             cartridgeSubscription.setPayload(payload);
         }

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/3e1c83e3/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/payload/CarbonPayload.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/payload/CarbonPayload.java b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/payload/CarbonPayload.java
index 0d96069..3244e8e 100644
--- a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/payload/CarbonPayload.java
+++ b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/payload/CarbonPayload.java
@@ -33,10 +33,10 @@ public class CarbonPayload extends Payload {
         payloadBuilder.append(",");
 
         //carbon specific
-        payloadBuilder.append("DEPLOYMENT=" + payloadArg.getDeployment());
-        payloadBuilder.append(",");
-        payloadBuilder.append("SC_IP=" + System.getProperty(CartridgeConstants.SC_IP));
-        payloadBuilder.append(",");
+        //payloadBuilder.append("DEPLOYMENT=" + payloadArg.getDeployment());
+        //payloadBuilder.append(",");
+        //payloadBuilder.append("PUPPET_IP=" + System.getProperty(CartridgeConstants.PUPPET_IP));
+        //payloadBuilder.append(",");
         payloadBuilder.append("MULTITENANT=" + payloadArg.getCartridgeInfo().getMultiTenant());
 
     }

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/3e1c83e3/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/payload/Payload.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/payload/Payload.java b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/payload/Payload.java
index 9eba510..4956e6b 100644
--- a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/payload/Payload.java
+++ b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/payload/Payload.java
@@ -75,10 +75,15 @@ public abstract class Payload implements Serializable {
         payloadBuilder.append("CLUSTER_ID=" + payloadArg.getServiceDomain());
         payloadBuilder.append(",");
         payloadBuilder.append("CARTRIDGE_KEY=" + payloadArg.getSubscriptionKey());
+        payloadBuilder.append(",");
+        payloadBuilder.append("DEPLOYMENT=" + "default"); // hard coded to default
+        payloadBuilder.append(",");
+        payloadBuilder.append("PUPPET_IP=" + System.getProperty(CartridgeConstants.PUPPET_IP));       
+        
         
         if(payloadArg.getCartridgeInfo() != null) {
             payloadBuilder.append(",");
-            payloadBuilder.append("SERVICE=" + payloadArg.getCartridgeInfo().getType());  // TODO -- rename to SERVICE_NAME and rename puppet agent too
+            payloadBuilder.append("SERVICE_NAME=" + payloadArg.getCartridgeInfo().getType());
         }
 
         //add the user defined payload String (if any)

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/3e1c83e3/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/utils/CartridgeConstants.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/utils/CartridgeConstants.java b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/utils/CartridgeConstants.java
index bb2f102..42172d6 100644
--- a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/utils/CartridgeConstants.java
+++ b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/utils/CartridgeConstants.java
@@ -39,6 +39,7 @@ public class CartridgeConstants {
     public static final String MB_PORT = "mb.port";
     public static final String CEP_IP = "cep.ip";
     public static final String CEP_PORT = "cep.port";
+    public static final String PUPPET_IP = "puppet.ip";
 
 
 	public static final String DB_DATASOURCE = "adc.datasource";

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/3e1c83e3/features/adc/org.apache.stratos.adc.mgt.server.feature/src/main/resources/conf/cartridge-config.properties
----------------------------------------------------------------------
diff --git a/features/adc/org.apache.stratos.adc.mgt.server.feature/src/main/resources/conf/cartridge-config.properties b/features/adc/org.apache.stratos.adc.mgt.server.feature/src/main/resources/conf/cartridge-config.properties
index 3fddaa6..2f7c7f9 100644
--- a/features/adc/org.apache.stratos.adc.mgt.server.feature/src/main/resources/conf/cartridge-config.properties
+++ b/features/adc/org.apache.stratos.adc.mgt.server.feature/src/main/resources/conf/cartridge-config.properties
@@ -60,3 +60,5 @@ max.attempts=1000
 cartridge.key=KEYPATH
 
 repository.info.epr=https://stratos_ip:9445/services/RepositoryInformationService
+
+puppet.ip=127.0.0.1

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/3e1c83e3/tools/puppet/etc/puppet/files/cartridge-agent.sh
----------------------------------------------------------------------
diff --git a/tools/puppet/etc/puppet/files/cartridge-agent.sh b/tools/puppet/etc/puppet/files/cartridge-agent.sh
new file mode 100755
index 0000000..86cc982
--- /dev/null
+++ b/tools/puppet/etc/puppet/files/cartridge-agent.sh
@@ -0,0 +1,108 @@
+#!/bin/bash
+# --------------------------------------------------------------
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# --------------------------------------------------------------
+
+# This script will be called from /etc/rc.local when the cartridge
+# instance is spawned. It will initiate all the tasks that needs to 
+# be run to bring the cartridge instance to operational state.
+
+source /etc/environment
+
+set -e # Terminate on any error
+export LOG=/var/log/apache-stratos/cartridge-agent.log
+instance_path=/opt/apache-stratos-cartridge-agent # Cartridge agent home
+event_publisher_path=/opt/apache-stratos-cartridge-agent/event-publisher # Event publisher home
+event_subscriber_path=/opt/apache-stratos-cartridge-agent/event-subscriber # Event subscriber home
+health_publisher_path=/opt/apache-stratos-cartridge-agent/health-publisher # Health publisher home
+temp_payload_path=/tmp/payload/launch-params
+puppet_payload_path=/tmp/puppet-payload
+
+
+#-----
+# Unzip packs
+#-----
+pushd ${instance_path}
+unzip apache-stratos-event-publisher-4.0.0-SNAPSHOT-bin.zip
+unzip apache-stratos-event-subscriber-4.0.0-SNAPSHOT-bin.zip
+unzip apache-stratos-health-publisher-4.0.0-SNAPSHOT-bin.zip
+mv apache-stratos-event-publisher-4.0.0-SNAPSHOT event-publisher
+mv apache-stratos-event-subscriber-4.0.0-SNAPSHOT event-subscriber
+mv apache-stratos-health-publisher-4.0.0-SNAPSHOT health-publisher
+popd
+
+# ---------------------------------------------
+# Download payload.zip
+# ---------------------------------------------
+if [ ! -d ${instance_path}/payload ]; then
+    echo "creating payload directory... " | tee -a $LOG
+    mkdir ${instance_path}/payload
+    echo "payload directory created" | tee -a $LOG
+    #wget http://169.254.169.254/latest/user-data -O ${instance_path}/payload/launch-params -- payload already downloaded
+    #echo "payload copied"  | tee -a $LOG
+
+    # Concat puppet payload and instance payload into ${instance_path}/payload/launch-params
+    #Read puppet configs
+    puppet_config=`cat /tmp/puppet-payload`
+    echo "puppet_config"
+    sed "s|$|${puppet_config}|" ${temp_payload_path} > ${instance_path}/payload/launch-params
+
+    for i in `/usr/bin/ruby ${instance_path}/get-launch-params.rb`
+    do
+        # Add double quotes on both sides of the value
+        value=`echo "${i}" | sed -e s@=@=\"@g`
+        value=${value}"\""
+        if [[ ${value} == PORTS* ]]; then
+            # Replace port separator | with ,
+            value=`echo ${value} | sed -e s@'|'@,@g`
+        fi
+        echo "writing to launch.params ${value}" | tee -a $LOG
+        echo "export" ${value} >> ${instance_path}/launch.params
+    done    
+fi
+
+source ${instance_path}/launch.params
+
+
+
+#---------------------------
+# Starting Topic Subscriber
+#---------------------------
+# change mb ip port in conf/jndi.properties
+pushd $event_subscriber_path/conf
+cp -rf jndi.properties jndi.properties.tmp
+cat jndi.properties.tmp | sed -e "s@MB-PORT@$MB_PORT@g" > jndi.properties
+cp -rf jndi.properties jndi.properties.tmp
+cat jndi.properties.tmp | sed -e "s@MB-IP-ADDRESS@$MB_IP@g" > jndi.properties
+rm -f jndi.properties.tmp
+popd
+
+pushd $event_subscriber_path/bin
+echo "Executing: event-subscriber.sh "
+sh event-subscriber.sh  &
+echo "Event subscribed" | tee -a $LOG
+popd
+
+
+pushd $health_publisher_path/bin
+echo "Executing: health-publisher.sh"
+sh health-publisher.sh $MEMBER_ID $CEP_IP $CEP_PORT $PORTS $CLUSTER_ID
+echo "Health stat published" | tee -a $LOG
+popd

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/3e1c83e3/tools/puppet/etc/puppet/files/environment
----------------------------------------------------------------------
diff --git a/tools/puppet/etc/puppet/files/environment b/tools/puppet/etc/puppet/files/environment
new file mode 100644
index 0000000..f2e160b
--- /dev/null
+++ b/tools/puppet/etc/puppet/files/environment
@@ -0,0 +1,22 @@
+# --------------------------------------------------------------
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# --------------------------------------------------------------
+PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/opt/java/bin"
+JAVA_HOME="/opt/java"

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/3e1c83e3/tools/puppet/etc/puppet/files/event-publisher.sh
----------------------------------------------------------------------
diff --git a/tools/puppet/etc/puppet/files/event-publisher.sh b/tools/puppet/etc/puppet/files/event-publisher.sh
new file mode 100755
index 0000000..a446eb2
--- /dev/null
+++ b/tools/puppet/etc/puppet/files/event-publisher.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+# --------------------------------------------------------------
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# --------------------------------------------------------------
+
+echo "Starting event publisher..."
+lib_path=./../lib/
+class_path=${lib_path}commons-io-2.0.jar:${lib_path}andes-client-0.13.wso2v8.jar:${lib_path}apache-stratos-event-publisher-4.0.0-SNAPSHOT.jar:${lib_path}commons-codec-1.8.jar:${lib_path}commons-logging-1.1.1.jar:${lib_path}geronimo-jms_1.1_spec-1.1.0.wso2v1.jar:${lib_path}geronimo-jms_1.1_spec-1.1.jar:${lib_path}gson-2.2.4.jar:${lib_path}log4j-1.2.13.jar:${lib_path}org.apache.log4j-1.2.13.v200706111418.jar:${lib_path}org.apache.stratos.messaging-4.0.0-SNAPSHOT.jar:${lib_path}org.wso2.carbon.logging-4.1.0.jar:${lib_path}slf4j-api-1.7.5.jar:${lib_path}slf4j-log4j12-1.7.5.jar
+
+${JAVA_HOME}/bin/java -cp $class_path org.apache.stratos.cartridge.agent.event.publisher.Main $*
+echo "Event publisher completed"

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/3e1c83e3/tools/puppet/etc/puppet/files/event-subscriber.sh
----------------------------------------------------------------------
diff --git a/tools/puppet/etc/puppet/files/event-subscriber.sh b/tools/puppet/etc/puppet/files/event-subscriber.sh
new file mode 100755
index 0000000..0e96985
--- /dev/null
+++ b/tools/puppet/etc/puppet/files/event-subscriber.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+# --------------------------------------------------------------
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# --------------------------------------------------------------
+
+echo "Starting event subscriber..."
+lib_path=./../lib/
+class_path=`echo ${lib_path}/*.jar | tr ' ' ':'`
+
+${JAVA_HOME}/bin/java -cp "${class_path}" org.apache.stratos.cartridge.agent.event.subscriber.Main ../conf /opt/apache-stratos-cartridge-agent/payload/launch-params
+echo "Event subscriber completed"

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/3e1c83e3/tools/puppet/etc/puppet/files/get-launch-params.rb
----------------------------------------------------------------------
diff --git a/tools/puppet/etc/puppet/files/get-launch-params.rb b/tools/puppet/etc/puppet/files/get-launch-params.rb
new file mode 100644
index 0000000..0631b2b
--- /dev/null
+++ b/tools/puppet/etc/puppet/files/get-launch-params.rb
@@ -0,0 +1,54 @@
+#! /usr/bin/ruby
+# --------------------------------------------------------------
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# --------------------------------------------------------------
+
+### get-launch-params.rb
+
+# The following script obtains the launch parameters from 
+# the file /tmp/payload/launch-params, then parses out the 
+# parameters for this instance by using the launch index
+# of this particular EC2 instance.
+#
+# Pass the command the -e flag to output the instance 
+# parameters as exports of shell variables. Any other 
+# arguments are ignored.
+
+def get_launch_params(launch_params_file)
+  IO.readlines launch_params_file
+end
+
+export_stmt = ""
+
+launch_params = get_launch_params(
+  "/opt/apache-stratos-cartridge-agent/payload/launch-params")
+
+if launch_params.length > 0
+  instance_params_str = launch_params[0]
+
+  instance_params = instance_params_str.split(',')
+
+  export_stmt = "export " if ARGV.length > 0 && ARGV.include?("-e")
+
+  instance_params.each { |param|
+    puts export_stmt + param
+  }
+
+end

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/3e1c83e3/tools/puppet/etc/puppet/files/health-publisher.sh
----------------------------------------------------------------------
diff --git a/tools/puppet/etc/puppet/files/health-publisher.sh b/tools/puppet/etc/puppet/files/health-publisher.sh
new file mode 100755
index 0000000..756a52f
--- /dev/null
+++ b/tools/puppet/etc/puppet/files/health-publisher.sh
@@ -0,0 +1,33 @@
+#!/bin/bash
+# --------------------------------------------------------------
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# --------------------------------------------------------------
+
+echo "Starting health publisher..."
+
+lib_path=./../lib/
+
+class_path=${lib_path}andes-client-0.13.wso2v8.jar:${lib_path}ant-1.7.0.jar:${lib_path}ant-1.7.0.wso2v1.jar:${lib_path}ant-launcher-1.7.0.jar:${lib_path}apache-stratos-health-publisher-4.0.0-SNAPSHOT.jar:${lib_path}axiom-1.2.11.wso2v4.jar:${lib_path}axiom-api-1.2.11.jar:${lib_path}axiom-impl-1.2.11.jar:${lib_path}axis2-1.6.1.wso2v10.jar:${lib_path}commons-cli-1.0.jar:${lib_path}commons-codec-1.8.jar:${lib_path}commons-fileupload-1.2.0.wso2v1.jar:${lib_path}commons-fileupload-1.2.jar:${lib_path}commons-httpclient-3.1.0.wso2v2.jar:${lib_path}commons-httpclient-3.1.jar:${lib_path}commons-io-2.0.jar:${lib_path}commons-lang-1.0.jar:${lib_path}commons-lang3-3.1.jar:${lib_path}commons-logging-1.1.1.jar:${lib_path}commons-pool-1.5.0.wso2v1.jar:${lib_path}commons-pool-1.5.jar:${lib_path}dom4j-1.6.1.jar:${lib_path}geronimo-activation_1.1_spec-1.0.2.jar:${lib_path}geronimo-javamail_1.4_spec-1.6.jar:${lib_path}geronimo-jms_1.1_spec-1.1.0.wso2v1.jar:${lib_path}geronimo-jms_1.1_spec-1.1.jar:${lib
 _path}geronimo-stax-api_1.0_spec-1.0.1.jar:${lib_path}gson-2.2.4.jar:${lib_path}httpclient-4.1.1-wso2v1.jar:${lib_path}httpclient-4.2.5.jar:${lib_path}httpcore-4.1.0-wso2v1.jar:${lib_path}httpcore-4.2.4.jar:${lib_path}icu4j-2.6.1.jar:${lib_path}javax.servlet-3.0.0.v201112011016.jar:${lib_path}jaxen-1.1.1.jar:${lib_path}jdom-1.0.jar:${lib_path}jline-0.9.94.jar:${lib_path}json-2.0.0.wso2v1.jar:${lib_path}junit-3.8.1.jar:${lib_path}libthrift-0.7.wso2v1.jar:${lib_path}libthrift-0.9.1.jar:${lib_path}log4j-1.2.13.jar:${lib_path}not-yet-commons-ssl-0.3.9.jar:${lib_path}org.apache.log4j-1.2.13.v200706111418.jar:${lib_path}org.apache.stratos.messaging-4.0.0-SNAPSHOT.jar:${lib_path}org.eclipse.osgi-3.8.1.v20120830-144521.jar:${lib_path}org.eclipse.osgi.services-3.3.100.v20120522-1822.jar:${lib_path}org.wso2.carbon.base-4.2.0.jar:${lib_path}org.wso2.carbon.core.common-4.2.0.jar:${lib_path}org.wso2.carbon.databridge.agent.thrift-4.2.0.jar:${lib_path}org.wso2.carbon.databridge.commons-4.2.0.jar:
 ${lib_path}org.wso2.carbon.databridge.commons.thrift-4.2.0.jar:${lib_path}org.wso2.carbon.logging-4.1.0.jar:${lib_path}org.wso2.carbon.queuing-4.2.0.jar:${lib_path}org.wso2.carbon.registry.api-4.2.0.jar:${lib_path}org.wso2.carbon.securevault-4.2.0.jar:${lib_path}org.wso2.carbon.user.api-4.2.0.jar:${lib_path}org.wso2.carbon.utils-4.2.0.jar:${lib_path}org.wso2.securevault-1.0.0-wso2v2.jar:${lib_path}slf4j-1.5.10.wso2v1.jar:${lib_path}slf4j-api-1.7.5.jar:${lib_path}slf4j-log4j12-1.7.5.jar:${lib_path}smack-3.0.4.wso2v1.jar:${lib_path}smackx-3.0.4.wso2v1.jar:${lib_path}wstx-asl-3.2.9.jar:${lib_path}xalan-2.6.0.jar:${lib_path}xercesImpl-2.6.2.jar:${lib_path}xml-apis-1.3.02.jar:${lib_path}xmlParserAPIs-2.6.2.jar:${lib_path}xom-1.0.jar
+
+current_path=`pwd`
+
+${JAVA_HOME}/bin/java -cp $class_path -Dmember.id=$1 -Dkey.file.path=$current_path/../security/client-truststore.jks -Dthrift.receiver.ip=$2 -Dthrift.receiver.port=$3 -Dopen.ports=$4 -Dcluster.id=$5 -Dpartition.id=$6 org.apache.stratos.cartridge.agent.health.publisher.Main $*
+
+echo "Health publisher completed"

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/3e1c83e3/tools/puppet/etc/puppet/files/healthcheck.sh
----------------------------------------------------------------------
diff --git a/tools/puppet/etc/puppet/files/healthcheck.sh b/tools/puppet/etc/puppet/files/healthcheck.sh
new file mode 100755
index 0000000..2940718
--- /dev/null
+++ b/tools/puppet/etc/puppet/files/healthcheck.sh
@@ -0,0 +1,31 @@
+#!/bin/bash
+# --------------------------------------------------------------
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# --------------------------------------------------------------
+
+
+var=`nc -z localhost 80; echo $?`;
+if [ $var -eq 0 ]
+then
+    echo "port 80 is available" > /dev/null 2>&1
+else
+    echo "port 80 is not available" > /dev/null 2>&1
+    /etc/init.d/apache2 restart
+fi

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/3e1c83e3/tools/puppet/etc/puppet/fileserver.conf
----------------------------------------------------------------------
diff --git a/tools/puppet/etc/puppet/fileserver.conf b/tools/puppet/etc/puppet/fileserver.conf
new file mode 100644
index 0000000..47b46ef
--- /dev/null
+++ b/tools/puppet/etc/puppet/fileserver.conf
@@ -0,0 +1,35 @@
+# --------------------------------------------------------------
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# --------------------------------------------------------------
+
+[files]
+   path /etc/puppet/
+   allow *
+
+[plugins]
+   allow *
+
+[stratos2]
+  path /mnt/puppet/stratos2/
+  allow *
+
+[commons]
+  path /etc/puppet/files
+  allow *

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/3e1c83e3/tools/puppet/manifests/classes/apt.pp
----------------------------------------------------------------------
diff --git a/tools/puppet/manifests/classes/apt.pp b/tools/puppet/manifests/classes/apt.pp
new file mode 100755
index 0000000..66ee782
--- /dev/null
+++ b/tools/puppet/manifests/classes/apt.pp
@@ -0,0 +1,43 @@
+## --------------------------------------------------------------
+##
+## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.
+##
+## --------------------------------------------------------------
+#
+
+class apt {
+#	$packages = ["lsof","unzip","sysstat","telnet","nmap","less","nagios-nrpe-server","ganglia-monitor"]
+	$packages = ["lsof","unzip","sysstat","telnet","nmap","less"]
+
+        file { "/etc/apt/apt.conf.d/90forceyes":
+                ensure  => present,
+                source  => "puppet:///apt/90forceyes";
+        }
+
+#        exec { "update-apt":
+#                path    => ['/bin', '/usr/bin'],
+#                command => "apt-get update > /dev/null 2>&1 &",
+#                require => File["/etc/apt/apt.conf.d/90forceyes"],
+#        }
+
+        package { $packages:
+                provider        => apt,
+                ensure          => installed,
+                require         => File["/etc/apt/apt.conf.d/90forceyes"],
+        }	
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/3e1c83e3/tools/puppet/manifests/classes/hosts.pp
----------------------------------------------------------------------
diff --git a/tools/puppet/manifests/classes/hosts.pp b/tools/puppet/manifests/classes/hosts.pp
new file mode 100755
index 0000000..8e4ef3e
--- /dev/null
+++ b/tools/puppet/manifests/classes/hosts.pp
@@ -0,0 +1,29 @@
+# --------------------------------------------------------------
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# --------------------------------------------------------------
+
+class hosts {
+    file { "/etc/hosts":
+        owner   => root,
+        group   => root,
+        mode    => 775,
+        content	=> template("hosts.erb"),
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/3e1c83e3/tools/puppet/manifests/classes/java.pp
----------------------------------------------------------------------
diff --git a/tools/puppet/manifests/classes/java.pp b/tools/puppet/manifests/classes/java.pp
new file mode 100755
index 0000000..a9acf8e
--- /dev/null
+++ b/tools/puppet/manifests/classes/java.pp
@@ -0,0 +1,65 @@
+# --------------------------------------------------------------
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# --------------------------------------------------------------
+
+class java { 
+
+	$java_home 	= "jdk1.7.0_07"
+	$package 	= "jdk-7u7-linux-x64.tar.gz"
+
+	file {  "/opt/${package}":
+		owner	=> root,
+		group	=> root,
+		mode	=> 755,
+		source	=> "puppet:///java/${package}",
+		ignore	=> ".svn",
+		ensure  => present;
+
+		"/opt/java/jre/lib/security/":
+                owner   => root,
+                group   => root,
+                source  => ["puppet:///java/jars/"],
+		ignore	=> ".svn",
+                ensure  => present,
+                recurse => true,
+                require => File["/opt/java"];
+
+		"/opt/java":
+		ensure 	=> link,
+		target	=> "/opt/${java_home}",
+		require	=> Exec["install_java"];
+
+		"/etc/environment":
+		owner => root,
+		group => root,
+		source => 'puppet:///commons/environment';
+	}
+    
+	exec {  "install_java":
+		cwd	=> "/opt",
+		command => "/bin/tar xzf ${package}",
+		unless	=> "/usr/bin/test -d /opt/${java_home}",
+		creates	=> "/opt/${java_home}/COPYRIGHT",
+		require	=> File["/opt/${package}"],
+	} 
+
+
+}
+ 

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/3e1c83e3/tools/puppet/manifests/classes/mcollective.pp
----------------------------------------------------------------------
diff --git a/tools/puppet/manifests/classes/mcollective.pp b/tools/puppet/manifests/classes/mcollective.pp
new file mode 100755
index 0000000..c32d492
--- /dev/null
+++ b/tools/puppet/manifests/classes/mcollective.pp
@@ -0,0 +1,84 @@
+# --------------------------------------------------------------
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# --------------------------------------------------------------
+
+class mcollective {
+
+	$package_list = ["ruby","rubygems","libstomp-ruby"]
+
+	package { $package_list:
+                ensure 		=> installed;
+
+		"mcollective-server":
+                provider 	=> dpkg,
+                ensure 		=> installed,
+                source 		=> "/opt/mcollective/mcollective_2.0.0-2_all.deb",
+                require 	=> [ File["/opt/mcollective/"], Package["mcollective-common"], Class["apt"] ];
+
+                "mcollective-common":
+                provider 	=> dpkg,
+                ensure 		=> installed,
+                source 		=> "/opt/mcollective/mcollective-common_2.0.0-2_all.deb",
+                require 	=> [ File["/opt/mcollective/"], Class["apt"] ],
+
+        }
+	
+        file {  "/etc/mcollective/server.cfg":
+                ensure  	=> present,
+                source 		=> "puppet:///mcollective/config/server.cfg",
+                require 	=> [ Package["mcollective-server"], Package["mcollective-common"] ];
+
+		"/opt/mcollective/":
+                owner   	=> root,
+                group   	=> root,
+                source  	=> "puppet:///mcollective/packages/",
+		ignore		=> ".svn",
+                recurse 	=> true,
+                ensure  	=> present,
+                require 	=> Package[$package_list];
+
+		"/etc/mcollective/facts.yaml":
+                owner    	=> root,
+                group    	=> root,
+                mode     	=> 400,
+                content  	=> inline_template("<%= scope.to_hash.reject { |k,v| k.to_s =~ /(uptime_seconds|timestamp|free)/ }.to_yaml %>"),
+                require 	=> [ Package["mcollective-server"], Package["mcollective-common"] ];
+
+		"/usr/share/mcollective/plugins/mcollective/agent/":
+                owner   	=> root,
+                group   	=> root,
+		mode		=> 644,
+                source  	=> ["puppet:///mcollective/agents/puppet/",
+                		    "puppet:///mcollective/agents/package/",
+                		    "puppet:///mcollective/agents/nettest/",
+                		    "puppet:///mcollective/agents/process/"],
+		sourceselect	=> all,
+		ignore		=> ".svn",
+                recurse 	=> true,
+                ensure  	=> present,
+                require 	=> [ File["/opt/mcollective/"], Package["mcollective-common"], Package["mcollective-server"] ],
+
+        }
+
+	exec { "restart_mcollective":
+		command 	=> "/etc/init.d/mcollective restart",
+		require 	=> [ File["/etc/mcollective/server.cfg"], Package["mcollective-server"], Package["mcollective-common"] ],
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/3e1c83e3/tools/puppet/manifests/classes/php_cartridge.pp
----------------------------------------------------------------------
diff --git a/tools/puppet/manifests/classes/php_cartridge.pp b/tools/puppet/manifests/classes/php_cartridge.pp
new file mode 100755
index 0000000..2800db8
--- /dev/null
+++ b/tools/puppet/manifests/classes/php_cartridge.pp
@@ -0,0 +1,141 @@
+# --------------------------------------------------------------
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# --------------------------------------------------------------
+
+
+class php_cartridge (syslog,docroot,samlalias,serverport,mb_ip,mb_port,cep_ip,cep_port){
+	
+	$packages = ["nano","zip","build-essential","mysql-client","apache2","php5","php5-cli","libapache2-mod-php5","php5-gd","php5-mysql","php-db","php-pear","php5-curl","curl","wget","php5-ldap","php5-adodb","mailutils","php5-imap","php5-sqlite","php5-xmlrpc","php5-xsl","openssl","ssl-cert","ldap-utils","php5-mcrypt","mcrypt","ufw","fail2ban","git","libboost-all-dev","ruby"]
+
+        file { "/etc/apt/apt.conf.d/90forceyes":
+                ensure  => present,
+                source  => "puppet:///apt/90forceyes";
+        }
+
+        exec { "update-apt":
+                path    => ['/bin', '/usr/bin'],
+                command => "apt-get update > /dev/null 2>&1 ",
+                require => File["/etc/apt/apt.conf.d/90forceyes"],
+        }
+
+        package { $packages:
+                provider        => apt,
+                ensure          => installed,
+                require         => Exec["update-apt"],
+        }	
+	
+	file { 
+		"/etc/apache2/apache2.conf":
+        	owner   => root,
+        	group   => root,
+        	mode    => 775,
+        	content => template("php_cartridge/etc/apache2/apache2.conf.erb"),
+                require         => Package['apache2'];
+    	
+	        "/etc/apache2/sites-available/default":
+        	owner   => root,
+        	group   => root,
+        	mode    => 775,
+        	content => template("php_cartridge/etc/apache2/sites-available/default.erb"),
+                require         => File["/etc/apache2/apache2.conf"];
+	
+		"/etc/apache2/sites-available/default-ssl":
+        	owner   => root,
+        	group   => root,
+        	mode    => 775,
+        	content => template("php_cartridge/etc/apache2/sites-available/default-ssl.erb"),
+                require         => File["/etc/apache2/sites-available/default"];
+    	}
+	
+	exec { "enable ssl module":
+                path    => ['/bin', '/usr/bin','/usr/sbin/'],
+                command => "a2enmod ssl",
+                require         => File["/etc/apache2/sites-available/default-ssl"];
+	
+		"enable ssl":
+                path    => ['/bin', '/usr/bin','/usr/sbin/'],
+                command => "a2enmod ssl",
+                require         => Exec["enable ssl module"];
+		
+		"apache2 restart":
+                path    => ['/bin', '/usr/bin','/usr/sbin/'],
+                command => "/etc/init.d/apache2 restart",
+                require         => Exec["enable ssl"];
+	}
+
+
+	# -----  port check failed for port 443 -- recheck
+	#exec {"wait_for_server-$deployment_code":
+        #    command => "/usr/bin/wget --spider --tries 100 --retry-connrefused --no-check-certificate https://$ipaddress:$serverport",
+        #    require => Exec["apache2 restart"];
+        # }
+
+
+	# Copy and configure agent packs
+        file {  "/opt/apache-stratos-cartridge-agent/apache-stratos-event-publisher-4.0.0-SNAPSHOT-bin.zip":
+        	source          => "puppet:///commons/apache-stratos-event-publisher-4.0.0-SNAPSHOT-bin.zip",
+                ensure          => present,
+	} 	
+
+        file {  "/opt/apache-stratos-cartridge-agent/apache-stratos-event-subscriber-4.0.0-SNAPSHOT-bin.zip":
+                source          => "puppet:///commons/apache-stratos-event-subscriber-4.0.0-SNAPSHOT-bin.zip",
+                ensure          => present,
+        }
+
+
+        file {  "/opt/apache-stratos-cartridge-agent/apache-stratos-health-publisher-4.0.0-SNAPSHOT-bin.zip":
+                source          => "puppet:///commons/apache-stratos-health-publisher-4.0.0-SNAPSHOT-bin.zip",
+                ensure          => present,
+        }
+
+
+        file {  "/opt/apache-stratos-cartridge-agent/cartridge-agent.sh":
+                source          => "puppet:///commons/cartridge-agent.sh",
+                ensure          => present,
+        }
+
+
+        file {  "/opt/apache-stratos-cartridge-agent/get-launch-params.rb":
+                source          => "puppet:///commons/get-launch-params.rb",
+                ensure          => present,
+        }
+
+
+        file {  "/opt/apache-stratos-cartridge-agent/healthcheck.sh":
+                source          => "puppet:///commons/healthcheck.sh",
+                ensure          => present,
+        }
+
+
+	file {"/tmp/puppet-payload":
+		 ensure  => present,
+		 content => ",MB_IP=${mb_ip},MB_PORT=${mb_port},CEP_IP=${cep_ip},CEP_PORT=${cep_port}",
+                 require => Exec["apache2 restart"];
+	}
+
+        exec {"run_agent_script-$deployment_code":
+                command => "/opt/apache-stratos-cartridge-agent/cartridge-agent.sh",
+                require => File["/tmp/puppet-payload"];
+        }
+	
+
+
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/3e1c83e3/tools/puppet/manifests/classes/ssh.pp
----------------------------------------------------------------------
diff --git a/tools/puppet/manifests/classes/ssh.pp b/tools/puppet/manifests/classes/ssh.pp
new file mode 100755
index 0000000..1154dff
--- /dev/null
+++ b/tools/puppet/manifests/classes/ssh.pp
@@ -0,0 +1,61 @@
+# --------------------------------------------------------------
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# --------------------------------------------------------------
+
+class ssh ( $port=22, $bind_address, $root_login=no, $pubkey_auth=yes, $password_auth=yes, $use_pam=yes ) {
+	
+	$service      = "ssh"
+       	$template     = "sshd_config.erb"
+        $provider     = "apt"
+
+	package { "openssh-server":
+		provider	=> $provider,
+                ensure 		=> installed,
+        }
+
+        service { $service:
+                ensure    	=> running,
+                enable    	=> true,
+                subscribe 	=> File["/etc/ssh/sshd_config"],
+                require   	=> Package["openssh-server"],
+        }
+
+        file { "/etc/ssh/sshd_config":
+                ensure  	=> present,
+                content 	=> template("ssh/${template}"),
+                require 	=> Package["openssh-server"],
+                notify  	=> Service[$service];
+
+		"/etc/pam.d/sshd":
+                ensure  	=> present,
+                source  	=> "puppet:///ssh/pam/sshd",
+                require 	=> Package["openssh-server"],
+                notify  	=> Service[$service];
+	
+		"/home/ubuntu/.ssh/authorized_keys":
+		ensure 		=> present,
+		source		=> "puppet:///ssh/authorized_keys",
+		require		=> Package["openssh-server"];
+
+		"/home/kurumba/.ssh":
+		ensure		=> directory;
+        }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/3e1c83e3/tools/puppet/manifests/classes/system_config.pp
----------------------------------------------------------------------
diff --git a/tools/puppet/manifests/classes/system_config.pp b/tools/puppet/manifests/classes/system_config.pp
new file mode 100755
index 0000000..fc2c39c
--- /dev/null
+++ b/tools/puppet/manifests/classes/system_config.pp
@@ -0,0 +1,77 @@
+## --------------------------------------------------------------
+##
+## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.
+##
+## --------------------------------------------------------------
+#
+
+class system_config {
+
+	include hosts
+	include apt
+#	include nrpe
+#	include ganglia
+        include java
+#	include mcollective
+
+#	class { "ssh":
+#                port => 1984,
+#                bind_address => $ipaddress,
+#                root_login => yes,
+#                pubkey_auth => yes,
+#                password_auth => yes,
+#                use_pam => yes,
+#        }
+	
+	user { "kurumba": 
+  		password   => "1Mmhh30pWiMz2N720hC4",
+  		ensure     => present,                            
+ 	 	managehome => true,
+	}
+
+	file {  "/root/bin":
+                owner   => root,
+                group   => root,
+                ensure  => "directory";
+
+#		"/root/bin/firewall":
+#                owner   => root,
+#                group   => root,
+#                ensure  => "directory",
+#                require => File["/root/bin"];
+
+#		"/root/bin/puppet_init.sh":
+#                owner   => root,
+#                group   => root,
+#                mode    => 0755,
+#                source  => "puppet:///commons/bin/puppet_init.sh",
+#                require => File["/root/bin/firewall"];
+
+#		"/root/bin/puppet_clean.sh":
+#                owner   => root,
+#                group   => root,
+#                mode    => 0755,
+#                content => template("puppet_clean.sh.erb"),
+#                require => File["/root/bin/firewall"],
+		
+        }
+
+        Exec {  path    => "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java/bin/"  }
+        #Exec {  path    => "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"  }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/3e1c83e3/tools/puppet/manifests/nodes.pp
----------------------------------------------------------------------
diff --git a/tools/puppet/manifests/nodes.pp b/tools/puppet/manifests/nodes.pp
new file mode 100755
index 0000000..47833cf
--- /dev/null
+++ b/tools/puppet/manifests/nodes.pp
@@ -0,0 +1,63 @@
+## --------------------------------------------------------------
+##
+## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.
+##
+## --------------------------------------------------------------
+
+stage { 'configure': require => Stage['main'] }
+stage { 'deploy': require => Stage['configure'] }
+
+node basenode {
+	$local_package_dir	= "/mnt/packs/"
+	$deploy_new_packs	= "true"
+}
+
+node confignode inherits basenode  {
+	## Service subdomains
+	$stratos_domain 	= "stratos.org"
+
+	## Server details for billing
+	$time_zone		= "GMT-8:00"
+
+}
+
+node 'puppet.novalocal' inherits confignode {
+	$server_ip 	= $ipaddress
+	
+	include system_config
+
+
+}
+
+
+node /[0-9]{1,12}.default.php/ {
+       
+	 include java
+ 
+	class {"php_cartridge":
+                        syslog            => "syslog:local2",
+                        docroot           => "/var/www/www",
+                        samlalias         => "/var/www/simplesamlphp/www",
+                        serverport         => "443",
+                        mb_ip         => "54.251.211.89",
+                        mb_port         => "5677",
+                        cep_ip         => "54.251.211.89",
+                        cep_port         => "7615",
+        }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/3e1c83e3/tools/puppet/manifests/site.pp
----------------------------------------------------------------------
diff --git a/tools/puppet/manifests/site.pp b/tools/puppet/manifests/site.pp
new file mode 100755
index 0000000..ff991f8
--- /dev/null
+++ b/tools/puppet/manifests/site.pp
@@ -0,0 +1,23 @@
+# --------------------------------------------------------------
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# --------------------------------------------------------------
+
+import "nodes"
+import "classes/*"

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/3e1c83e3/tools/puppet/modules/apt/files/90forceyes
----------------------------------------------------------------------
diff --git a/tools/puppet/modules/apt/files/90forceyes b/tools/puppet/modules/apt/files/90forceyes
new file mode 100755
index 0000000..a3dd00e
--- /dev/null
+++ b/tools/puppet/modules/apt/files/90forceyes
@@ -0,0 +1,23 @@
+# --------------------------------------------------------------
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# --------------------------------------------------------------
+
+APT::Get::Assume-Yes "true";
+APT::Get::force-yes "true";

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/3e1c83e3/tools/puppet/modules/commons/files/bin/puppet_init.sh
----------------------------------------------------------------------
diff --git a/tools/puppet/modules/commons/files/bin/puppet_init.sh b/tools/puppet/modules/commons/files/bin/puppet_init.sh
new file mode 100755
index 0000000..50a7a8b
--- /dev/null
+++ b/tools/puppet/modules/commons/files/bin/puppet_init.sh
@@ -0,0 +1,53 @@
+#!/bin/bash
+# --------------------------------------------------------------
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# --------------------------------------------------------------
+
+WHICH=`/usr/bin/which which` 
+PUPPETD=`${WHICH} puppetd`
+GREP=`${WHICH} grep`
+PS=`${WHICH} ps`
+SLEEP=`${WHICH} sleep`
+
+if [ $# -eq 1 ]; then 
+	SERVICES=$@; COMMAND="${PUPPETD} -vt --tags ${SERVICES}"
+elif [ $# -eq 0 ]; then
+	COMMAND="${PUPPETD} -vt"
+fi
+
+read_master() {
+	local COUNT=0
+	[ ${COUNT} == 10 ] && exit 1 || true
+	${COMMAND}
+	${PS} -auwx | ${GREP} java | ${GREP} wso2
+#	[ $? == 0 ] && true || (read_master ; COUNT=`expr ${COUNT} + 1`)
+}
+
+echo "Asia/Colombo" > /etc/timezone
+dpkg-reconfigure --frontend noninteractive tzdata
+
+${PUPPETD} --enable
+
+read_master
+
+${PUPPETD} --disable
+
+exit 0
+

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/3e1c83e3/tools/puppet/modules/commons/files/bin/sign_jars.sh
----------------------------------------------------------------------
diff --git a/tools/puppet/modules/commons/files/bin/sign_jars.sh b/tools/puppet/modules/commons/files/bin/sign_jars.sh
new file mode 100755
index 0000000..d78d48b
--- /dev/null
+++ b/tools/puppet/modules/commons/files/bin/sign_jars.sh
@@ -0,0 +1,39 @@
+#!/bin/bash
+# --------------------------------------------------------------
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# --------------------------------------------------------------
+
+export JAVA_HOME=/opt/java
+export PATH=$PATH:$JAVA_HOME/bin
+
+keystore=/mnt/<%= server_ip %>/<%= service_dir %>/repository/resources/security/stratos-jar-sign.jks
+keyalias=stratoslive
+keypass='TdTXVW7mzxu3oqWaHYm2mEgxoX88hHCVKMJ7K1rp'
+root=/mnt/<%= server_ip %>/<%= service_dir %>
+
+for p in $root/repository/components/plugins $root/repository/components/lib $root/lib $root/lib/patches $root/lib/api $root/lib/xboot $root/bin $root/lib/xboot
+do
+	for i in `find -iname "*.jar"`
+	do
+		echo $i
+		jarsigner -keystore $keystore -storepass $keypass $i $keyalias
+	done
+done
+

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/3e1c83e3/tools/puppet/modules/commons/files/configs/bin/native/wrapper-linux-x86-32
----------------------------------------------------------------------
diff --git a/tools/puppet/modules/commons/files/configs/bin/native/wrapper-linux-x86-32 b/tools/puppet/modules/commons/files/configs/bin/native/wrapper-linux-x86-32
new file mode 100755
index 0000000..3128b95
Binary files /dev/null and b/tools/puppet/modules/commons/files/configs/bin/native/wrapper-linux-x86-32 differ

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/3e1c83e3/tools/puppet/modules/commons/files/configs/lib/home/favicon.ico
----------------------------------------------------------------------
diff --git a/tools/puppet/modules/commons/files/configs/lib/home/favicon.ico b/tools/puppet/modules/commons/files/configs/lib/home/favicon.ico
new file mode 100755
index 0000000..4b9e7d6
Binary files /dev/null and b/tools/puppet/modules/commons/files/configs/lib/home/favicon.ico differ

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/3e1c83e3/tools/puppet/modules/commons/files/environment
----------------------------------------------------------------------
diff --git a/tools/puppet/modules/commons/files/environment b/tools/puppet/modules/commons/files/environment
new file mode 100644
index 0000000..b9dc10b
--- /dev/null
+++ b/tools/puppet/modules/commons/files/environment
@@ -0,0 +1,23 @@
+# --------------------------------------------------------------
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# --------------------------------------------------------------
+
+PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
+JAVA_HOME="/opt/java"

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/3e1c83e3/tools/puppet/modules/java/files/jars/copy_java_patches_here
----------------------------------------------------------------------
diff --git a/tools/puppet/modules/java/files/jars/copy_java_patches_here b/tools/puppet/modules/java/files/jars/copy_java_patches_here
new file mode 100644
index 0000000..825724b
--- /dev/null
+++ b/tools/puppet/modules/java/files/jars/copy_java_patches_here
@@ -0,0 +1,22 @@
+# --------------------------------------------------------------
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# --------------------------------------------------------------
+
+# Empty file

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/3e1c83e3/tools/puppet/modules/java/files/jdk-7u7-linux-x64.tar.gz.file
----------------------------------------------------------------------
diff --git a/tools/puppet/modules/java/files/jdk-7u7-linux-x64.tar.gz.file b/tools/puppet/modules/java/files/jdk-7u7-linux-x64.tar.gz.file
new file mode 100644
index 0000000..28ecd6b
--- /dev/null
+++ b/tools/puppet/modules/java/files/jdk-7u7-linux-x64.tar.gz.file
@@ -0,0 +1,22 @@
+# --------------------------------------------------------------
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# --------------------------------------------------------------
+
+#Empty file

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/3e1c83e3/tools/puppet/templates/php_cartridge/etc/apache2/apache2.conf.erb
----------------------------------------------------------------------
diff --git a/tools/puppet/templates/php_cartridge/etc/apache2/apache2.conf.erb b/tools/puppet/templates/php_cartridge/etc/apache2/apache2.conf.erb
new file mode 100755
index 0000000..7fcf304
--- /dev/null
+++ b/tools/puppet/templates/php_cartridge/etc/apache2/apache2.conf.erb
@@ -0,0 +1,256 @@
+## --------------------------------------------------------------
+##
+## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.
+##
+## --------------------------------------------------------------
+#
+# Based upon the NCSA server configuration files originally by Rob McCool.
+#
+# This is the main Apache server configuration file.  It contains the
+# configuration directives that give the server its instructions.
+# See http://httpd.apache.org/docs/2.2/ for detailed information about
+# the directives.
+#
+# Do NOT simply read the instructions in here without understanding
+# what they do.  They're here only as hints or reminders.  If you are unsure
+# consult the online docs. You have been warned.  
+#
+# The configuration directives are grouped into three basic sections:
+#  1. Directives that control the operation of the Apache server process as a
+#     whole (the 'global environment').
+#  2. Directives that define the parameters of the 'main' or 'default' server,
+#     which responds to requests that aren't handled by a virtual host.
+#     These directives also provide default values for the settings
+#     of all virtual hosts.
+#  3. Settings for virtual hosts, which allow Web requests to be sent to
+#     different IP addresses or hostnames and have them handled by the
+#     same Apache server process.
+#
+# Configuration and logfile names: If the filenames you specify for many
+# of the server's control files begin with "/" (or "drive:/" for Win32), the
+# server will use that explicit path.  If the filenames do *not* begin
+# with "/", the value of ServerRoot is prepended -- so "foo.log"
+# with ServerRoot set to "/etc/apache2" will be interpreted by the
+# server as "/etc/apache2/foo.log".
+
+### Section 1: Global Environment
+#
+# The directives in this section affect the overall operation of Apache,
+# such as the number of concurrent requests it can handle or where it
+# can find its configuration files.
+#
+
+#
+# ServerRoot: The top of the directory tree under which the server's
+# configuration, error, and log files are kept.
+#
+# NOTE!  If you intend to place this on an NFS (or otherwise network)
+# mounted filesystem then please read the LockFile documentation (available
+# at <URL:http://httpd.apache.org/docs/2.2/mod/mpm_common.html#lockfile>);
+# you will save yourself a lot of trouble.
+#
+# Do NOT add a slash at the end of the directory path.
+#
+#ServerRoot "/etc/apache2"
+
+#
+# The accept serialization lock file MUST BE STORED ON A LOCAL DISK.
+#
+LockFile ${APACHE_LOCK_DIR}/accept.lock
+
+#
+# PidFile: The file in which the server should record its process
+# identification number when it starts.
+# This needs to be set in /etc/apache2/envvars
+#
+PidFile ${APACHE_PID_FILE}
+
+#
+# Timeout: The number of seconds before receives and sends time out.
+#
+Timeout 300
+
+#
+# KeepAlive: Whether or not to allow persistent connections (more than
+# one request per connection). Set to "Off" to deactivate.
+#
+KeepAlive On
+
+#
+# MaxKeepAliveRequests: The maximum number of requests to allow
+# during a persistent connection. Set to 0 to allow an unlimited amount.
+# We recommend you leave this number high, for maximum performance.
+#
+MaxKeepAliveRequests 100
+
+#
+# KeepAliveTimeout: Number of seconds to wait for the next request from the
+# same client on the same connection.
+#
+KeepAliveTimeout 5
+
+##
+## Server-Pool Size Regulation (MPM specific)
+## 
+
+# prefork MPM
+# StartServers: number of server processes to start
+# MinSpareServers: minimum number of server processes which are kept spare
+# MaxSpareServers: maximum number of server processes which are kept spare
+# MaxClients: maximum number of server processes allowed to start
+# MaxRequestsPerChild: maximum number of requests a server process serves
+<IfModule mpm_prefork_module>
+    StartServers          5
+    MinSpareServers       5
+    MaxSpareServers      10
+    MaxClients          150
+    MaxRequestsPerChild   0
+</IfModule>
+
+# worker MPM
+# StartServers: initial number of server processes to start
+# MinSpareThreads: minimum number of worker threads which are kept spare
+# MaxSpareThreads: maximum number of worker threads which are kept spare
+# ThreadLimit: ThreadsPerChild can be changed to this maximum value during a
+#              graceful restart. ThreadLimit can only be changed by stopping
+#              and starting Apache.
+# ThreadsPerChild: constant number of worker threads in each server process
+# MaxClients: maximum number of simultaneous client connections
+# MaxRequestsPerChild: maximum number of requests a server process serves
+<IfModule mpm_worker_module>
+    StartServers          2
+    MinSpareThreads      25
+    MaxSpareThreads      75 
+    ThreadLimit          64
+    ThreadsPerChild      25
+    MaxClients          150
+    MaxRequestsPerChild   0
+</IfModule>
+
+# event MPM
+# StartServers: initial number of server processes to start
+# MinSpareThreads: minimum number of worker threads which are kept spare
+# MaxSpareThreads: maximum number of worker threads which are kept spare
+# ThreadsPerChild: constant number of worker threads in each server process
+# MaxClients: maximum number of simultaneous client connections
+# MaxRequestsPerChild: maximum number of requests a server process serves
+<IfModule mpm_event_module>
+    StartServers          2
+    MinSpareThreads      25
+    MaxSpareThreads      75 
+    ThreadLimit          64
+    ThreadsPerChild      25
+    MaxClients          150
+    MaxRequestsPerChild   0
+</IfModule>
+
+# These need to be set in /etc/apache2/envvars
+User ${APACHE_RUN_USER}
+Group ${APACHE_RUN_GROUP}
+
+#
+# AccessFileName: The name of the file to look for in each directory
+# for additional configuration directives.  See also the AllowOverride
+# directive.
+#
+
+AccessFileName .htaccess
+
+#
+# The following lines prevent .htaccess and .htpasswd files from being 
+# viewed by Web clients. 
+#
+<Files ~ "^\.ht">
+    Order allow,deny
+    Deny from all
+    Satisfy all
+</Files>
+
+#
+# DefaultType is the default MIME type the server will use for a document
+# if it cannot otherwise determine one, such as from filename extensions.
+# If your server contains mostly text or HTML documents, "text/plain" is
+# a good value.  If most of your content is binary, such as applications
+# or images, you may want to use "application/octet-stream" instead to
+# keep browsers from trying to display binary files as though they are
+# text.
+#
+# It is also possible to omit any default MIME type and let the
+# client's browser guess an appropriate action instead. Typically the
+# browser will decide based on the file's extension then. In cases
+# where no good assumption can be made, letting the default MIME type
+# unset is suggested  instead of forcing the browser to accept
+# incorrect  metadata.
+#
+DefaultType None
+
+
+#
+# HostnameLookups: Log the names of clients or just their IP addresses
+# e.g., www.apache.org (on) or 204.62.129.132 (off).
+# The default is off because it'd be overall better for the net if people
+# had to knowingly turn this feature on, since enabling it means that
+# each client request will result in AT LEAST one lookup request to the
+# nameserver.
+#
+HostnameLookups Off
+
+# ErrorLog: The location of the error log file.
+# If you do not specify an ErrorLog directive within a <VirtualHost>
+# container, error messages relating to that virtual host will be
+# logged here.  If you *do* define an error logfile for a <VirtualHost>
+# container, that host's errors will be logged there and not here.
+#
+ErrorLog <%= syslog %> 
+
+#
+# LogLevel: Control the number of messages logged to the error_log.
+# Possible values include: debug, info, notice, warn, error, crit,
+# alert, emerg.
+#
+LogLevel warn
+
+# Include module configuration:
+Include mods-enabled/*.load
+Include mods-enabled/*.conf
+
+# Include all the user configurations:
+Include httpd.conf
+
+# Include ports listing
+Include ports.conf
+
+#
+# The following directives define some format nicknames for use with
+# a CustomLog directive (see below).
+# If you are behind a reverse proxy, you might want to change %h into %{X-Forwarded-For}i
+#
+LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
+LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
+LogFormat "%h %l %u %t \"%r\" %>s %O" common
+LogFormat "%{Referer}i -> %U" referer
+LogFormat "%{User-agent}i" agent
+
+# Include of directories ignores editors' and dpkg's backup files,
+# see README.Debian for details.
+
+# Include generic snippets of statements
+Include conf.d/
+
+# Include the virtual host configurations:
+Include sites-enabled/

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/3e1c83e3/tools/puppet/templates/php_cartridge/etc/apache2/sites-available/default-ssl.erb
----------------------------------------------------------------------
diff --git a/tools/puppet/templates/php_cartridge/etc/apache2/sites-available/default-ssl.erb b/tools/puppet/templates/php_cartridge/etc/apache2/sites-available/default-ssl.erb
new file mode 100755
index 0000000..1320328
--- /dev/null
+++ b/tools/puppet/templates/php_cartridge/etc/apache2/sites-available/default-ssl.erb
@@ -0,0 +1,195 @@
+## --------------------------------------------------------------
+##
+## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.
+##
+## --------------------------------------------------------------
+#
+
+<IfModule mod_ssl.c>
+<VirtualHost _default_:443>
+	ServerAdmin webmaster@localhost
+
+	DocumentRoot <%= docroot %>
+        Alias /simplesaml <%= samlalias %>
+	<Directory />
+		Options FollowSymLinks
+		AllowOverride All
+	</Directory>
+	<Directory /var/www/>
+		Options Indexes FollowSymLinks MultiViews
+		AllowOverride All
+		Order allow,deny
+		allow from all
+	</Directory>
+
+	ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
+	<Directory "/usr/lib/cgi-bin">
+		AllowOverride None
+		Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
+		Order allow,deny
+		Allow from all
+	</Directory>
+
+	ErrorLog ${APACHE_LOG_DIR}/error.log
+
+	# Possible values include: debug, info, notice, warn, error, crit,
+	# alert, emerg.
+	LogLevel warn
+
+	CustomLog ${APACHE_LOG_DIR}/ssl_access.log combined
+
+	Alias /doc/ "/usr/share/doc/"
+	<Directory "/usr/share/doc/">
+		Options Indexes MultiViews FollowSymLinks
+		AllowOverride None
+		Order deny,allow
+		Deny from all
+		Allow from 127.0.0.0/255.0.0.0 ::1/128
+	</Directory>
+
+	#   SSL Engine Switch:
+	#   Enable/Disable SSL for this virtual host.
+	SSLEngine on
+
+	#   A self-signed (snakeoil) certificate can be created by installing
+	#   the ssl-cert package. See
+	#   /usr/share/doc/apache2.2-common/README.Debian.gz for more info.
+	#   If both key and certificate are stored in the same file, only the
+	#   SSLCertificateFile directive is needed.
+	SSLCertificateFile    /etc/ssl/certs/ssl-cert-snakeoil.pem
+	SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
+
+	#   Server Certificate Chain:
+	#   Point SSLCertificateChainFile at a file containing the
+	#   concatenation of PEM encoded CA certificates which form the
+	#   certificate chain for the server certificate. Alternatively
+	#   the referenced file can be the same as SSLCertificateFile
+	#   when the CA certificates are directly appended to the server
+	#   certificate for convinience.
+	#SSLCertificateChainFile /etc/apache2/ssl.crt/server-ca.crt
+
+	#   Certificate Authority (CA):
+	#   Set the CA certificate verification path where to find CA
+	#   certificates for client authentication or alternatively one
+	#   huge file containing all of them (file must be PEM encoded)
+	#   Note: Inside SSLCACertificatePath you need hash symlinks
+	#         to point to the certificate files. Use the provided
+	#         Makefile to update the hash symlinks after changes.
+	#SSLCACertificatePath /etc/ssl/certs/
+	#SSLCACertificateFile /etc/apache2/ssl.crt/ca-bundle.crt
+
+	#   Certificate Revocation Lists (CRL):
+	#   Set the CA revocation path where to find CA CRLs for client
+	#   authentication or alternatively one huge file containing all
+	#   of them (file must be PEM encoded)
+	#   Note: Inside SSLCARevocationPath you need hash symlinks
+	#         to point to the certificate files. Use the provided
+	#         Makefile to update the hash symlinks after changes.
+	#SSLCARevocationPath /etc/apache2/ssl.crl/
+	#SSLCARevocationFile /etc/apache2/ssl.crl/ca-bundle.crl
+
+	#   Client Authentication (Type):
+	#   Client certificate verification type and depth.  Types are
+	#   none, optional, require and optional_no_ca.  Depth is a
+	#   number which specifies how deeply to verify the certificate
+	#   issuer chain before deciding the certificate is not valid.
+	#SSLVerifyClient require
+	#SSLVerifyDepth  10
+
+	#   Access Control:
+	#   With SSLRequire you can do per-directory access control based
+	#   on arbitrary complex boolean expressions containing server
+	#   variable checks and other lookup directives.  The syntax is a
+	#   mixture between C and Perl.  See the mod_ssl documentation
+	#   for more details.
+	#<Location />
+	#SSLRequire (    %{SSL_CIPHER} !~ m/^(EXP|NULL)/ \
+	#            and %{SSL_CLIENT_S_DN_O} eq "Snake Oil, Ltd." \
+	#            and %{SSL_CLIENT_S_DN_OU} in {"Staff", "CA", "Dev"} \
+	#            and %{TIME_WDAY} >= 1 and %{TIME_WDAY} <= 5 \
+	#            and %{TIME_HOUR} >= 8 and %{TIME_HOUR} <= 20       ) \
+	#           or %{REMOTE_ADDR} =~ m/^192\.76\.162\.[0-9]+$/
+	#</Location>
+
+	#   SSL Engine Options:
+	#   Set various options for the SSL engine.
+	#   o FakeBasicAuth:
+	#     Translate the client X.509 into a Basic Authorisation.  This means that
+	#     the standard Auth/DBMAuth methods can be used for access control.  The
+	#     user name is the `one line' version of the client's X.509 certificate.
+	#     Note that no password is obtained from the user. Every entry in the user
+	#     file needs this password: `xxj31ZMTZzkVA'.
+	#   o ExportCertData:
+	#     This exports two additional environment variables: SSL_CLIENT_CERT and
+	#     SSL_SERVER_CERT. These contain the PEM-encoded certificates of the
+	#     server (always existing) and the client (only existing when client
+	#     authentication is used). This can be used to import the certificates
+	#     into CGI scripts.
+	#   o StdEnvVars:
+	#     This exports the standard SSL/TLS related `SSL_*' environment variables.
+	#     Per default this exportation is switched off for performance reasons,
+	#     because the extraction step is an expensive operation and is usually
+	#     useless for serving static content. So one usually enables the
+	#     exportation for CGI and SSI requests only.
+	#   o StrictRequire:
+	#     This denies access when "SSLRequireSSL" or "SSLRequire" applied even
+	#     under a "Satisfy any" situation, i.e. when it applies access is denied
+	#     and no other module can change it.
+	#   o OptRenegotiate:
+	#     This enables optimized SSL connection renegotiation handling when SSL
+	#     directives are used in per-directory context.
+	#SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire
+	<FilesMatch "\.(cgi|shtml|phtml|php)$">
+		SSLOptions +StdEnvVars
+	</FilesMatch>
+	<Directory /usr/lib/cgi-bin>
+		SSLOptions +StdEnvVars
+	</Directory>
+
+	#   SSL Protocol Adjustments:
+	#   The safe and default but still SSL/TLS standard compliant shutdown
+	#   approach is that mod_ssl sends the close notify alert but doesn't wait for
+	#   the close notify alert from client. When you need a different shutdown
+	#   approach you can use one of the following variables:
+	#   o ssl-unclean-shutdown:
+	#     This forces an unclean shutdown when the connection is closed, i.e. no
+	#     SSL close notify alert is send or allowed to received.  This violates
+	#     the SSL/TLS standard but is needed for some brain-dead browsers. Use
+	#     this when you receive I/O errors because of the standard approach where
+	#     mod_ssl sends the close notify alert.
+	#   o ssl-accurate-shutdown:
+	#     This forces an accurate shutdown when the connection is closed, i.e. a
+	#     SSL close notify alert is send and mod_ssl waits for the close notify
+	#     alert of the client. This is 100% SSL/TLS standard compliant, but in
+	#     practice often causes hanging connections with brain-dead browsers. Use
+	#     this only for browsers where you know that their SSL implementation
+	#     works correctly.
+	#   Notice: Most problems of broken clients are also related to the HTTP
+	#   keep-alive facility, so you usually additionally want to disable
+	#   keep-alive for those clients, too. Use variable "nokeepalive" for this.
+	#   Similarly, one has to force some clients to use HTTP/1.0 to workaround
+	#   their broken HTTP/1.1 implementation. Use variables "downgrade-1.0" and
+	#   "force-response-1.0" for this.
+	BrowserMatch "MSIE [2-6]" \
+		nokeepalive ssl-unclean-shutdown \
+		downgrade-1.0 force-response-1.0
+	# MSIE 7 and newer should be able to use keepalive
+	BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
+
+</VirtualHost>
+</IfModule>

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/3e1c83e3/tools/puppet/templates/php_cartridge/etc/apache2/sites-available/default.erb
----------------------------------------------------------------------
diff --git a/tools/puppet/templates/php_cartridge/etc/apache2/sites-available/default.erb b/tools/puppet/templates/php_cartridge/etc/apache2/sites-available/default.erb
new file mode 100755
index 0000000..4b416ac
--- /dev/null
+++ b/tools/puppet/templates/php_cartridge/etc/apache2/sites-available/default.erb
@@ -0,0 +1,64 @@
+## --------------------------------------------------------------
+##
+## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.
+##
+## --------------------------------------------------------------
+#
+#
+<VirtualHost *:80>
+	ServerAdmin webmaster@localhost
+
+	DocumentRoot <%= docroot %>
+	Alias /simplesaml <%= samlalias %>
+	<Directory />
+		Options FollowSymLinks
+		AllowOverride All
+	</Directory>
+	<Directory /var/www/>
+		Options Indexes FollowSymLinks MultiViews
+		AllowOverride All
+		Order allow,deny
+		allow from all
+	</Directory>
+
+	ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
+	<Directory "/usr/lib/cgi-bin">
+		AllowOverride None
+		Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
+		Order allow,deny
+		Allow from all
+	</Directory>
+
+	ErrorLog ${APACHE_LOG_DIR}/error.log
+
+	# Possible values include: debug, info, notice, warn, error, crit,
+	# alert, emerg.
+	LogLevel warn
+
+	CustomLog ${APACHE_LOG_DIR}/access.log combined
+
+    Alias /doc/ "/usr/share/doc/"
+    <Directory "/usr/share/doc/">
+        Options Indexes MultiViews FollowSymLinks
+        AllowOverride None
+        Order deny,allow
+        Deny from all
+        Allow from 127.0.0.0/255.0.0.0 ::1/128
+    </Directory>
+
+</VirtualHost>


[2/2] git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incubator-stratos

Posted by sa...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incubator-stratos


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

Branch: refs/heads/master
Commit: 081f9fc950f1fd032bb0c803d611010a9246f000
Parents: 3e1c83e e2c0a2a
Author: Sajith Kariyawasam <sa...@wso2.com>
Authored: Thu Dec 12 17:47:44 2013 +0530
Committer: Sajith Kariyawasam <sa...@wso2.com>
Committed: Thu Dec 12 17:47:44 2013 +0530

----------------------------------------------------------------------
 .../adc/mgt/client/AutoscalerServiceClient.java |   6 +-
 .../adc/mgt/client/CartridgeAgentClient.java    |   4 +-
 .../client/CloudControllerServiceClient.java    |   2 +-
 .../mgt/publisher/TenantSynzhronizerTask.java   |   4 +-
 .../adc/mgt/utils/CartridgeConstants.java       |   3 +-
 .../org.apache.stratos.autoscaler/pom.xml       |   4 +-
 .../src/main/resources/META-INF/component.xml   |   5 +-
 .../apache/stratos/cli/CartridgeInfoBean.java   |  18 ++++
 .../stratos/cli/RestCommandLineService.java     |  27 +++--
 .../apache/stratos/cli/StratosApplication.java  |  11 ++
 .../stratos/cli/commands/SubscribeCommand.java  |  54 +++++++---
 .../apache/stratos/cli/utils/CliConstants.java  |  24 +++--
 .../impl/CloudControllerServiceImpl.java        | 103 ++++++-------------
 .../cloud/controller/pojo/Cartridge.java        |   9 --
 .../runtime/FasterLookUpDataHolder.java         |   4 +
 .../controller/topology/TopologyBuilder.java    |  52 ++++------
 .../topology/TopologyEventSender.java           |   4 +-
 .../controller/util/CloudControllerUtil.java    |   5 +-
 .../bean/util/converter/PojoConverter.java      |   4 +-
 .../AverageLoadAverageEventFormatter.xml        |   2 +-
 .../AverageMemoryConsumptionEventFormatter.xml  |   2 +-
 .../FaultMessageEventFormatter.xml              |   2 +-
 .../GradientLoadAverageEventFormatter.xml       |   2 +-
 .../GradientMemoryConsumptionEventFormatter.xml |   2 +-
 ...econdDerivativeLoadAverageEventFormatter.xml |   2 +-
 ...erivativeMemoryConsumptionEventFormatter.xml |   2 +-
 .../execution-plans/AverageHeathRequest.xml     |   6 +-
 .../AverageInFlightRequestsFinder.xml           |   2 +-
 .../execution-plans/GradientOfHealthRequest.xml |   6 +-
 .../GradientOfRequestsInFlightFinder.xml        |   2 +-
 .../SecondDerivativeOfHealthRequest.xml         |   4 +-
 ...SecondDerivativeOfRequestsInFlightFinder.xml |   2 +-
 .../stream-manager-config.xml                   |   6 --
 .../pom.xml                                     |   8 ++
 .../ec2/load-balancer/cartridge-agent.sh        |  89 ++++++++++++++++
 .../ec2/load-balancer/start-load-balancer.sh    |   7 ++
 .../templates/loadbalancer.conf.template        |  10 +-
 .../agent/health/publisher/HealthPublisher.java |  10 +-
 .../modules/distribution/src/assembly/bin.xml   |   3 +-
 .../src/main/conf/cartridge-config.properties   |  65 ++++++++++++
 .../resources/stratos_foundation.sql            |   2 +-
 41 files changed, 389 insertions(+), 190 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/081f9fc9/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/utils/CartridgeConstants.java
----------------------------------------------------------------------