You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by im...@apache.org on 2013/12/03 17:44:30 UTC

[1/4] Renamed folder cartridge_create to cartridge-create and init_scripts to init-scripts

Updated Branches:
  refs/heads/master 00569d41e -> b60d2c7d9


http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b60d2c7d/tools/cartridge_create/init_scripts/php/ec2/stratos-init.sh
----------------------------------------------------------------------
diff --git a/tools/cartridge_create/init_scripts/php/ec2/stratos-init.sh b/tools/cartridge_create/init_scripts/php/ec2/stratos-init.sh
deleted file mode 100644
index aab01ad..0000000
--- a/tools/cartridge_create/init_scripts/php/ec2/stratos-init.sh
+++ /dev/null
@@ -1,304 +0,0 @@
-#!/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.
-
-export LOG=/var/log/stratos-cartridge.log
-instance_path=/opt
-PUBLIC_IP=""
-KEY=`uuidgen`
-CRON_DURATION=1
-RETRY_COUNT=30
-SLEEP_DURATION=3
-
-if [ ! -d ${instance_path}/payload ]; then
-
-    echo "creating payload dir ... " >> $LOG
-    mkdir ${instance_path}/payload
-    echo "payload dir created ... " >> $LOG
-    wget http://169.254.169.254/latest/user-data -O ${instance_path}/payload/payload.zip    
-    echo "payload copied  ... "  >> $LOG
-    unzip -d ${instance_path}/payload ${instance_path}/payload/payload.zip
-    echo "unzippeddd..." >> $LOG
-
-    for i in `/usr/bin/ruby /opt/get-launch-params.rb`
-    do
-    echo "exporting to bashrc $i ... " >> $LOG
-        echo "export" ${i} >> /home/ubuntu/.bashrc
-    done
-    source /home/ubuntu/.bashrc
-
-fi
-
-
-echo ---------------------------- >> $LOG
-echo "getting public ip from metadata service" >> $LOG
-
-wget http://169.254.169.254/latest/meta-data/public-ipv4
-files="`cat public-ipv4`"
-if [[ -z ${files} ]]; then
-    echo "getting public ip" >> $LOG
-    for i in {1..30}
-    do
-      rm -f ./public-ipv4
-      wget http://169.254.169.254/latest/meta-data/public-ipv4
-      files="`cat public-ipv4`"
-      if [ -z $files ]; then
-          echo "Public ip is not yet assigned. Wait and continue for $i the time ..." >> $LOG
-          sleep $SLEEP_DURATION
-      else
-          echo "Public ip assigned" >> $LOG
-          break
-      fi
-    done
-
-    if [ -z $files ]; then
-      echo "Public ip is not yet assigned. So exit" >> $LOG
-      exit 0
-    fi
-    for x in $files
-    do
-        PUBLIC_IP="$x"
-    done
-
-
-else 
-   PUBLIC_IP="$files"
-fi
-
-
-for i in `/usr/bin/ruby /opt/get-launch-params.rb`
-do
-    export ${i}
-done
-
-
-cp -f ${instance_path}/payload/ssl-cert-snakeoil.pem /etc/ssl/certs/ssl-cert-snakeoil.pem
-cp -f ${instance_path}/payload/ssl-cert-snakeoil.key /etc/ssl/private/ssl-cert-snakeoil.key
-echo "Restarting apache..." >> $LOG
-
-/etc/init.d/apache2 restart
-
-echo "Apache restarted..." >> $LOG
-
-
-echo "Logging sys variables .. PUBLIC_IP:${PUBLIC_IP}, HOST_NAME:${HOST_NAME}, KEY:${KEY}, PORTS=${PORTS}, BAM:${BAM_IP}, GITREPO:${GIT_REPO}" >> $LOG
-
-mkdir -p  /etc/agent/conf
-
-echo "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:agen=\"http://service.agent.cartridge.stratos.apache.org\">
-  <soapenv:Header/>
-  <soapenv:Body>
-     <agen:register>
-        <registrant> 
-           <alarmingLowerRate>${ALARMING_LOWER_RATE}</alarmingLowerRate>
-           <alarmingUpperRate>${ALARMING_UPPER_RATE}</alarmingUpperRate>
-           <hostName>${HOST_NAME}</hostName>
-           <key>${KEY}</key>
-          <maxInstanceCount>${MAX}</maxInstanceCount>
-	  <maxRequestsPerSecond>${MAX_REQUESTS_PER_SEC}</maxRequestsPerSecond>
-          <minInstanceCount>${MIN}</minInstanceCount> " > /etc/agent/conf/request.xml
-
-IFS='|' read -ra PT <<< "${PORTS}"
-for i in "${PT[@]}"; do
-IFS=':' read -ra PP <<< "$i"
-echo "          <portMappings>
-                        <primaryPort>${PP[1]}</primaryPort>
-                        <proxyPort>${PP[2]}</proxyPort>
-                        <type>${PP[0]}</type>
-                </portMappings>">> /etc/agent/conf/request.xml
-done
-
-echo "          <remoteHost>${PUBLIC_IP}</remoteHost>
-           <service>${SERVICE}</service>
-	   <remoteHost>${PUBLIC_IP}</remoteHost>
-           <roundsToAverage>${ROUNDS_TO_AVERAGE}</roundsToAverage>
-           <scaleDownFactor>${SCALE_DOWN_FACTOR}</scaleDownFactor>
-           <tenantRange>${TENANT_RANGE}</tenantRange>
-        </registrant>
-     </agen:register>
-  </soapenv:Body>
-</soapenv:Envelope>
-" >> /etc/agent/conf/request.xml
-
-echo "Creating repoinfo request  " >> $LOG
-echo "TENANT_ID and SERVICE ${TENANT_ID} and ${SERVICE} " >> $LOG
-set -- "${HOST_NAME}" 
-IFS="."; declare -a Array=($*)
-ALIAS="${Array[0]}"
-echo "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsd=\"http://org.apache.axis2/xsd\">
-   <soapenv:Header/>
-   <soapenv:Body>
-      <xsd:getRepositoryCredentials>
-         <xsd:tenantId>${TENANT_ID}</xsd:tenantId>
-         <xsd:cartridgeType>${SERVICE}</xsd:cartridgeType>
-         <xsd:alias>${ALIAS}</xsd:alias>
-      </xsd:getRepositoryCredentials>
-   </soapenv:Body>
-</soapenv:Envelope>" > /opt/repoinforequest.xml
-
-echo "Repoinfo request created " >> $LOG
-
-echo "Private Key....Copying to .ssh  " >> $LOG
-
-cp ${instance_path}/payload/id_rsa /root/.ssh/id_rsa
-chmod 0600 /root/.ssh/id_rsa
-echo "StrictHostKeyChecking no" >> /root/.ssh/config
-
-
-
-
-#echo "Getting repo username password from repoInfoService" >> $LOG
-#curl -X POST -H "Content-Type: text/xml" -d @/etc/agent/conf/request.xml --silent --output /dev/null "${CARTRIDGE_AGENT_EPR}"
-
-echo "Git repo sync" >> $LOG
-
-# If repo is available do a git pull, else clone
-echo "#!/bin/bash
-if [ -d \"${APP_PATH}/.git\" ]; then
-    cd ${APP_PATH}
-    
-    curl -X POST -H \"Content-Type: text/xml\" -H \"SOAPAction: urn:getRepositoryCredentials\" -d @/opt/repoinforequest.xml --silent  \"${REPO_INFO_EPR}\" --insecure > /tmp/git.xml
-   sed '1,5d' /tmp/git.xml > /tmp/git1.xml
-   sed '2d' /tmp/git1.xml > /tmp/git.xml
-   username=\`xml_grep 'ax29:userName' /tmp/git.xml --text_only\`
-   password=\`xml_grep 'ax29:password' /tmp/git.xml --text_only\`
-   repo=\`xml_grep 'ax29:url' /tmp/git.xml --text_only\`
-   rm /tmp/git1.xml
-   rm /tmp/git.xml
-   url=\`echo \$repo |sed 's/http.*\/\///g' |sed 's/\:.*//g' |sed 's/\/.*//g'\`
-   echo \"machine \${url} login \${username} password \${password}\" > ~/.netrc
-   sudo echo \"machine \${url} login \${username} password \${password}\" > /root/.netrc
-   chmod 600 ~/.netrc
-   sudo chmod 600 /root/.netrc
-   git config --global --bool --add http.sslVerify false
-   sudo git pull
-   rm ~/.netrc
-   sudo rm /root/.netrc
-
-    sudo chown -R www-data:www-data ${APP_PATH}/www
-    if [ -f \"${APP_PATH}/sql/alter.sql\" ]; then
-    	mysql -h ${MYSQL_HOST} -u ${MYSQL_USER} -p${MYSQL_PASSWORD} < ${APP_PATH}/sql/alter.sql
-    fi
-else
-    sudo rm -f ${APP_PATH}/index.html
-   curl -X POST -H \"Content-Type: text/xml\" -H \"SOAPAction: urn:getRepositoryCredentials\" -d @/opt/repoinforequest.xml --silent  \"${REPO_INFO_EPR}\" --insecure > /tmp/git.xml
-   sed '1,5d' /tmp/git.xml > /tmp/git1.xml
-   sed '2d' /tmp/git1.xml > /tmp/git.xml
-   username=\`xml_grep 'ax29:userName' /tmp/git.xml --text_only\`
-   password=\`xml_grep 'ax29:password' /tmp/git.xml --text_only\`
-   repo=\`xml_grep 'ax29:url' /tmp/git.xml --text_only\`
-   rm /tmp/git1.xml
-   rm /tmp/git.xml
-   url=\`echo \$repo |sed 's/http.*\/\///g' |sed 's/\:.*//g' |sed 's/\/.*//g'\`
-   echo \"machine \${url} login \${username} password \${password}\" > ~/.netrc
-   sudo echo \"machine \${url} login \${username} password \${password}\" > /root/.netrc
-   chmod 600 ~/.netrc
-   sudo chmod 600 /root/.netrc
-   git config --global --bool --add http.sslVerify false
-   sudo git clone \${repo} ${APP_PATH}
-   rm ~/.netrc
-   sudo rm /root/.netrc
- 
-
-    if [ -f \"${APP_PATH}/sql/init.sql\" ]; then
-        mysql -h ${MYSQL_HOST} -u ${MYSQL_USER} -p${MYSQL_PASSWORD} < ${APP_PATH}/sql/init.sql
-    fi
-    echo \"SetEnv STRATOS_MYSQL_USER ${MYSQL_USER}
-    SetEnv STRATOS_MYSQL_HOST ${MYSQL_HOST}
-    SetEnv STRATOS_MYSQL_PASSWORD ${MYSQL_PASSWORD}
-    \" > /tmp/.htaccess
-    sudo mv /tmp/.htaccess ${APP_PATH}/
-    sudo chown -R www-data:www-data ${APP_PATH}/www
-    
-
-
-fi" > /opt/git.sh
-echo "File created.." >> $LOG
-chmod 755 /opt/git.sh
-
-
-
-while true
-do
-var=`nc -z localhost 80; echo $?`;
-if [ $var -eq 0 ]
-   then
-       echo "port 80 is available" >> $LOG
-       break
-   else
-       echo "port 80 is not available" >> $LOG
-   fi
-   sleep 1
-done
-
-
-while true
-do
-var=`nc -z localhost 443; echo $?`;
-if [ $var -eq 0 ]
-   then
-       echo "port 443 is available" >> $LOG
-       break
-   else
-       echo "port 443 is not available" >> $LOG
-   fi
-   sleep 1
-done
-
-
-
-echo "Sending register request to Cartridge agent service" >> $LOG
-
-curl -X POST -H "Content-Type: text/xml" -H "SOAPAction: urn:register" -d @/etc/agent/conf/request.xml -k --silent --output /dev/null "${CARTRIDGE_AGENT_EPR}"
-
-echo "Registered cartridge..." >> $LOG
-
-echo "running git clone........" >> $LOG
-su - ubuntu /opt/git.sh
-
-
-echo "setting up logging conf" >> $LOG
-
-
-echo "host:     ${BAM_IP}
-thriftPort:     ${BAM_PORT}
-
-#cartridge configs
-cartridgeAlias:  ${CARTRIDGE_ALIAS}
-tenantName:      ${HOST_NAME}
-tenantId:        ${TENANT_ID}
-localIP:         ${PUBLIC_IP}" > /opt/cartridge_data_publisher_1.0.2/conf/data_publisher.conf
-
-
-
-echo "started loggin ........."
-cd /opt/cartridge_data_publisher_1.0.2/dist/Debug/GNU-Linux-x86/
-nohup ./cartridge_data_publisher_1.0.2 /var/log/apache2/access.log /var/log/apache2/error.log >> /var/log/startos-data-publisher.log  &
-
-
-
-
-
-# ========================== // End of script ===========================================================

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b60d2c7d/tools/cartridge_create/init_scripts/php/get-launch-params.rb
----------------------------------------------------------------------
diff --git a/tools/cartridge_create/init_scripts/php/get-launch-params.rb b/tools/cartridge_create/init_scripts/php/get-launch-params.rb
deleted file mode 100644
index c6368ca..0000000
--- a/tools/cartridge_create/init_scripts/php/get-launch-params.rb
+++ /dev/null
@@ -1,55 +0,0 @@
-#! /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(
-  "/var/lib/cloud/instance/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/b60d2c7d/tools/cartridge_create/init_scripts/php/openstack/get-launch-params.rb
----------------------------------------------------------------------
diff --git a/tools/cartridge_create/init_scripts/php/openstack/get-launch-params.rb b/tools/cartridge_create/init_scripts/php/openstack/get-launch-params.rb
deleted file mode 100644
index c6368ca..0000000
--- a/tools/cartridge_create/init_scripts/php/openstack/get-launch-params.rb
+++ /dev/null
@@ -1,55 +0,0 @@
-#! /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(
-  "/var/lib/cloud/instance/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/b60d2c7d/tools/cartridge_create/init_scripts/php/openstack/healthcheck.sh
----------------------------------------------------------------------
diff --git a/tools/cartridge_create/init_scripts/php/openstack/healthcheck.sh b/tools/cartridge_create/init_scripts/php/openstack/healthcheck.sh
deleted file mode 100644
index 4194608..0000000
--- a/tools/cartridge_create/init_scripts/php/openstack/healthcheck.sh
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/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/b60d2c7d/tools/cartridge_create/init_scripts/php/openstack/stratos-init.sh
----------------------------------------------------------------------
diff --git a/tools/cartridge_create/init_scripts/php/openstack/stratos-init.sh b/tools/cartridge_create/init_scripts/php/openstack/stratos-init.sh
deleted file mode 100755
index 503790f..0000000
--- a/tools/cartridge_create/init_scripts/php/openstack/stratos-init.sh
+++ /dev/null
@@ -1,293 +0,0 @@
-#!/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.
-
-export LOG=/var/log/stratos-cartridge.log
-instance_path=/var/lib/cloud/instance
-PUBLIC_IP=""
-KEY=`uuidgen`
-CRON_DURATION=1
-RETRY_COUNT=30
-SLEEP_DURATION=3
-ACCESSLOG="/var/log/apache2/access.log"
-ERRORLOG="/var/log/apache2/error.log"
-
-
-if [ ! -d ${instance_path}/payload ]; then
-
-    echo "creating payload dir ... " >> $LOG
-    mkdir ${instance_path}/payload
-    echo "payload dir created ... " >> $LOG
-    cp ${instance_path}/user-data.txt ${instance_path}/payload/user-data.zip
-    echo "payload copied  ... "  >> $LOG
-    unzip -d ${instance_path}/payload ${instance_path}/payload/user-data.zip
-    echo "unzippeddd..." >> $LOG
-
-    for i in `/usr/bin/ruby /opt/get-launch-params.rb`
-    do
-    echo "exporting to bashrc $i ... " >> $LOG
-        echo "export" ${i} >> /home/ubuntu/.bashrc
-    done
-    source /home/ubuntu/.bashrc
-
-fi
-
-
-echo ---------------------------- >> $LOG
-echo "getting public ip from metadata service" >> $LOG
-
-wget http://169.254.169.254/latest/meta-data/public-ipv4
-files="`cat public-ipv4`"
-if [[ -z ${files} ]]; then
-    echo "getting public ip" >> $LOG
-    for i in {1..30}
-    do
-      rm -f ./public-ipv4
-      wget http://169.254.169.254/latest/meta-data/public-ipv4
-      files="`cat public-ipv4`"
-      if [ -z $files ]; then
-          echo "Public ip is not yet assigned. Wait and continue for $i the time ..." >> $LOG
-          sleep $SLEEP_DURATION
-      else
-          echo "Public ip assigned" >> $LOG
-          break
-      fi
-    done
-
-    if [ -z $files ]; then
-      echo "Public ip is not yet assigned. So exit" >> $LOG
-      exit 0
-    fi
-    for x in $files
-    do
-        PUBLIC_IP="$x"
-    done
-
-
-else 
-   PUBLIC_IP="$files"
-fi
-
-
-for i in `/usr/bin/ruby /opt/get-launch-params.rb`
-do
-    export ${i}
-done
-
-
-cp -f ${instance_path}/payload/ssl-cert-snakeoil.pem /etc/ssl/certs/ssl-cert-snakeoil.pem
-cp -f ${instance_path}/payload/ssl-cert-snakeoil.key /etc/ssl/private/ssl-cert-snakeoil.key
-echo "Restarting apache..." >> $LOG
-
-/etc/init.d/apache2 restart
-
-echo "Apache restarted..." >> $LOG
-
-
-echo "Logging sys variables .. PUBLIC_IP:${PUBLIC_IP}, HOST_NAME:${HOST_NAME}, KEY:${KEY}, PORTS=${PORTS}, BAM:${BAM_IP}, GITREPO:${GIT_REPO}" >> $LOG
-
-mkdir -p  /etc/agent/conf
-
-echo "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:agen=\"http://service.agent.cartridge.stratos.apache.org\">
-  <soapenv:Header/>
-  <soapenv:Body>
-     <agen:register>
-        <registrant> 
-           <alarmingLowerRate>${ALARMING_LOWER_RATE}</alarmingLowerRate>
-           <alarmingUpperRate>${ALARMING_UPPER_RATE}</alarmingUpperRate>
-           <hostName>${HOST_NAME}</hostName>
-           <key>${KEY}</key>
-          <maxInstanceCount>${MAX}</maxInstanceCount>
-	  <maxRequestsPerSecond>${MAX_REQUESTS_PER_SEC}</maxRequestsPerSecond>
-          <minInstanceCount>${MIN}</minInstanceCount> " > /etc/agent/conf/request.xml
-
-IFS='|' read -ra PT <<< "${PORTS}"
-for i in "${PT[@]}"; do
-IFS=':' read -ra PP <<< "$i"
-echo "          <portMappings>
-                        <primaryPort>${PP[1]}</primaryPort>
-                        <proxyPort>${PP[2]}</proxyPort>
-                        <type>${PP[0]}</type>
-                </portMappings>">> /etc/agent/conf/request.xml
-done
-
-echo "          <remoteHost>${PUBLIC_IP}</remoteHost>
-           <service>${SERVICE}</service>
-	   <remoteHost>${PUBLIC_IP}</remoteHost>
-           <roundsToAverage>${ROUNDS_TO_AVERAGE}</roundsToAverage>
-           <scaleDownFactor>${SCALE_DOWN_FACTOR}</scaleDownFactor>
-           <tenantRange>${TENANT_RANGE}</tenantRange>
-        </registrant>
-     </agen:register>
-  </soapenv:Body>
-</soapenv:Envelope>
-" >> /etc/agent/conf/request.xml
-
-echo "Creating repoinfo request  " >> $LOG
-echo "TENANT_ID and SERVICE ${TENANT_ID} and ${SERVICE} " >> $LOG
-set -- "${HOST_NAME}" 
-IFS="."; declare -a Array=($*)
-ALIAS="${Array[0]}"
-echo "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsd=\"http://org.apache.axis2/xsd\">
-   <soapenv:Header/>
-   <soapenv:Body>
-      <xsd:getRepositoryCredentials>
-         <xsd:tenantId>${TENANT_ID}</xsd:tenantId>
-         <xsd:cartridgeType>${SERVICE}</xsd:cartridgeType>
-         <xsd:alias>${ALIAS}</xsd:alias>
-      </xsd:getRepositoryCredentials>
-   </soapenv:Body>
-</soapenv:Envelope>" > /opt/repoinforequest.xml
-
-echo "Repoinfo request created " >> $LOG
-
-
-echo "Git repo sync" >> $LOG
-
-# If repo is available do a git pull, else clone
-echo "#!/bin/bash
-if [ -d \"${APP_PATH}/.git\" ]; then
-    cd ${APP_PATH}
-
-    curl -X POST -H \"Content-Type: text/xml\" -H \"SOAPAction: urn:getRepositoryCredentials\" -d @/opt/repoinforequest.xml --silent  \"${REPO_INFO_EPR}\" --insecure > /tmp/git.xml
-   sed '1,5d' /tmp/git.xml > /tmp/git1.xml
-   sed '2d' /tmp/git1.xml > /tmp/git.xml
-   username=\`xml_grep 'ax29:userName' /tmp/git.xml --text_only\`
-   password=\`xml_grep 'ax29:password' /tmp/git.xml --text_only\`
-   repo=\`xml_grep 'ax29:url' /tmp/git.xml --text_only\`
-   rm /tmp/git1.xml
-   rm /tmp/git.xml
-   url=\`echo \$repo |sed 's/http.*\/\///g' |sed 's/\:.*//g' |sed 's/\/.*//g'\`
-   echo \"machine \${url} login \${username} password \${password}\" > ~/.netrc
-   sudo echo \"machine \${url} login \${username} password \${password}\" > /root/.netrc
-   chmod 600 ~/.netrc
-   sudo chmod 600 /root/.netrc
-   git config --global --bool --add http.sslVerify false
-   sudo git pull
-   rm ~/.netrc
-   sudo rm /root/.netrc
-
-    sudo chown -R www-data:www-data ${APP_PATH}/www
-    if [ -f \"${APP_PATH}/sql/alter.sql\" ]; then
-    	mysql -h ${MYSQL_HOST} -u ${MYSQL_USER} -p${MYSQL_PASSWORD} < ${APP_PATH}/sql/alter.sql
-    fi
-else
-    sudo rm -f ${APP_PATH}/index.html
-   curl -X POST -H \"Content-Type: text/xml\" -H \"SOAPAction: urn:getRepositoryCredentials\" -d @/opt/repoinforequest.xml --silent  \"${REPO_INFO_EPR}\" --insecure > /tmp/git.xml
-   sed '1,5d' /tmp/git.xml > /tmp/git1.xml
-   sed '2d' /tmp/git1.xml > /tmp/git.xml
-   username=\`xml_grep 'ax29:userName' /tmp/git.xml --text_only\`
-   password=\`xml_grep 'ax29:password' /tmp/git.xml --text_only\`
-   repo=\`xml_grep 'ax29:url' /tmp/git.xml --text_only\`
-   rm /tmp/git1.xml
-   rm /tmp/git.xml
-   url=\`echo \$repo |sed 's/http.*\/\///g' |sed 's/\:.*//g' |sed 's/\/.*//g'\`
-   echo \"machine \${url} login \${username} password \${password}\" > ~/.netrc
-   sudo echo \"machine \${url} login \${username} password \${password}\" > /root/.netrc
-   chmod 600 ~/.netrc
-   sudo chmod 600 /root/.netrc
-   git config --global --bool --add http.sslVerify false
-   sudo git clone \${repo} ${APP_PATH}
-   rm ~/.netrc
-   sudo rm /root/.netrc
- 
-
-    if [ -f \"${APP_PATH}/sql/init.sql\" ]; then
-        mysql -h ${MYSQL_HOST} -u ${MYSQL_USER} -p${MYSQL_PASSWORD} < ${APP_PATH}/sql/init.sql
-    fi
-    echo \"SetEnv STRATOS_MYSQL_USER ${MYSQL_USER}
-    SetEnv STRATOS_MYSQL_HOST ${MYSQL_HOST}
-    SetEnv STRATOS_MYSQL_PASSWORD ${MYSQL_PASSWORD}
-    \" > /tmp/.htaccess
-    sudo mv /tmp/.htaccess ${APP_PATH}/
-    sudo chown -R www-data:www-data ${APP_PATH}/www
-    
-
-
-fi" > /opt/git.sh
-echo "File created.." >> $LOG
-chmod 755 /opt/git.sh
-
-
-
-while true
-do
-var=`nc -z localhost 80; echo $?`;
-if [ $var -eq 0 ]
-   then
-       echo "port 80 is available" >> $LOG
-       break
-   else
-       echo "port 80 is not available" >> $LOG
-   fi
-   sleep 1
-done
-
-
-while true
-do
-var=`nc -z localhost 443; echo $?`;
-if [ $var -eq 0 ]
-   then
-       echo "port 443 is available" >> $LOG
-       break
-   else
-       echo "port 443 is not available" >> $LOG
-   fi
-   sleep 1
-done
-
-
-
-echo "Sending register request to Cartridge agent service" >> $LOG
-
-curl -X POST -H "Content-Type: text/xml" -H "SOAPAction: urn:register" -d @/etc/agent/conf/request.xml -k --silent --output /dev/null "${CARTRIDGE_AGENT_EPR}"
-
-echo "Registered cartridge..." >> $LOG
-
-echo "running git clone........" >> $LOG
-su - ubuntu /opt/git.sh
-
-
-echo "setting up logging conf" >> $LOG
-
-
-echo "host:     ${BAM_IP}
-thriftPort:     ${BAM_PORT}
-
-#cartridge configs
-cartridgeAlias:  ${SERVICE}
-tenantName:      ${HOST_NAME}
-tenantId:      ${TENANT_ID}
-localIP:         ${PUBLIC_IP}" > /opt/cartridge_data_publisher_1.0.2/conf/data_publisher.conf
-
-
-echo "started loggin ........."
-cd /opt/cartridge_data_publisher_1.0.2/dist/Debug/GNU-Linux-x86/
-nohup ./cartridge_data_publisher_1.0.2 ${ACCESSLOG} ${ERRORLOG} 2>&1> /dev/null &
-
-echo "logging started........."
-
-# ========================== // End of script ===========================================================

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b60d2c7d/tools/cartridge_create/init_scripts/php/php
----------------------------------------------------------------------
diff --git a/tools/cartridge_create/init_scripts/php/php b/tools/cartridge_create/init_scripts/php/php
deleted file mode 100644
index 9fe5339..0000000
--- a/tools/cartridge_create/init_scripts/php/php
+++ /dev/null
@@ -1,49 +0,0 @@
-#!/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.
-#
-# ----------------------------------------------------------------------------
-
-INSTANCE=$1
-INSTANCE_USER=$2
-KEY=$3
-SOFTWARE=$4
-
-SCP="scp -i ./$KEY"
-SSH="ssh -i ./$KEY"
-
-$SCP ./openstack/wso2-cartridge-init.sh $INSTANCE_USER@$INSTANCE:
-$SCP ./php.ctrg $INSTANCE_USER@$INSTANCE:
-$SCP ./openstack/get-launch-params.rb $INSTANCE_USER@$INSTANCE:
-$SCP ./cc/ssl-cert-snakeoil.pem $INSTANCE_USER@$INSTANCE:
-$SCP ./cc/ssl-cert-snakeoil.key $INSTANCE_USER@$INSTANCE:
-$SCP ./ $INSTANCE_USER@$INSTANCE:
-$SCP ./thrift-0.8.0.tar.gz $INSTANCE_USER@$INSTANCE:
-$SCP ./default $INSTANCE_USER@$INSTANCE:
-$SCP ./default-ssl $INSTANCE_USER@$INSTANCE:
-
-# Copy additional software
-arr=$(echo $SOFTWARE | tr ":" "\n")
-for x in $arr
-do
-   $SCP $x $INSTANCE_USER@$INSTANCE:
-done
-
-# Execute the cartridge creation process in the remoter server
-$SSH $INSTANCE_USER@$INSTANCE "sudo chmod 755 ./php.ctrg;sudo ./php.ctrg"

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b60d2c7d/tools/cartridge_create/init_scripts/php/php.ctrg
----------------------------------------------------------------------
diff --git a/tools/cartridge_create/init_scripts/php/php.ctrg b/tools/cartridge_create/init_scripts/php/php.ctrg
deleted file mode 100644
index cbaf639..0000000
--- a/tools/cartridge_create/init_scripts/php/php.ctrg
+++ /dev/null
@@ -1,65 +0,0 @@
-#!/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.
-#
-# ----------------------------------------------------------------------------
-
-    mv ./wso2-cartridge-init.sh /opt/
-    mv ./get-launch-params.rb /opt/
-    mv ./ssl-cert-snakeoil.pem /etc/ssl/certs/
-    mv ./ssl-cert-snakeoil.key /etc/ssl/private/
-    mv ./cartridge_data_publisher_1.0.2.zip /opt/
-    mv ./thrift-0.8.0.tar.gz /opt/
-    mv ./*.tar.gz /opt/
-    mv ./*.zip /opt/
-    cp -f ./default /etc/apache2/sites-available/
-    cp -f ./default-ssl /etc/apache2/sites-available/
-    rm ./default
-    rm ./default-ssl
-    
-
-	apt-get update
-	# Next, all the packages.
-	
-	apt-get install -y \
-	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-intl php5-sqlite php5-xmlrpc php5-xsl \
-	openssl ssl-cert ldap-utils php5-mcrypt mcrypt ufw fail2ban git libboost-all-dev ruby xml-twig-tools
-
-    # Install the thrift library
-    tar -zxf /opt/thrift-0.8.0.tar.gz -C/opt
-    cd /opt/thrift-0.8.0
-    ./configure --libdir=/usr/lib;make;make install
-    cd /opt
-    unzip cartridge_data_publisher_1.0.2.zip
-    cd /opt/cartridge_data_publisher_1.0.2
-    make
-
-
-	# Enable HTTPS:
-	a2enmod ssl
-	a2ensite default-ssl	
-
-    echo "#!/bin/bash -e
-chmod 755 /opt/wso2-cartridge-init.sh
-/opt/wso2-cartridge-init.sh > /var/log/wso2-cartridge-init.log
-exit 0
-    " > /etc/rc.local
-
-

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b60d2c7d/tools/cartridge_create/init_scripts/php/thrift-0.8.0.tar.gz
----------------------------------------------------------------------
diff --git a/tools/cartridge_create/init_scripts/php/thrift-0.8.0.tar.gz b/tools/cartridge_create/init_scripts/php/thrift-0.8.0.tar.gz
deleted file mode 100644
index 46a1a23..0000000
Binary files a/tools/cartridge_create/init_scripts/php/thrift-0.8.0.tar.gz and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b60d2c7d/tools/cartridge_create/init_scripts/php/wso2.pem
----------------------------------------------------------------------
diff --git a/tools/cartridge_create/init_scripts/php/wso2.pem b/tools/cartridge_create/init_scripts/php/wso2.pem
deleted file mode 100644
index f4260f9..0000000
--- a/tools/cartridge_create/init_scripts/php/wso2.pem
+++ /dev/null
@@ -1,16 +0,0 @@
------BEGIN RSA PRIVATE KEY-----
-MIICXQIBAAKBgQCp31ZRD9kPwKoxW3sh+4x2IfldCKEfHbo18LhvOnGPJcNzqHDy
-6WWxpxPAHNAMyvrAv+hUfX4fwSRctieTim0N+fTr+mRP0q4HHhEkvEmxoXs4Y7lz
-jrh5vhMBZBAXsSurHVp2Bpie1xyjW+ksuAziT2gw6KvipjJiGTjuLTnLmQIDAQAB
-AoGAMFvtNbx+PbbKfKyfXChBb2vykmKfg70xwqNZzghkRa0pfCaKqQx6r91xiPJq
-5Alw4yh+2nazThTs5hvRHnZ83tPFxKyekrOdFpFEwAdibmvM3ckfAmUqJErteFhp
-o524O37kWpzwBgk1rxwLHVxyoscVHF8vWSjk9jzvdor9XbUCQQDdPp+F/X5qQLZw
-xaYyHrWmLkRnFRaxxmiOQmvAxYKybMp0Ei8euy+wKHiNPBVPxn143hrag7a2GKIn
-hq6LwoiHAkEAxI7GYK47woZJHI6rjskjxT+DBNKjTmoDZVTa4KrWUVY1NfTC+/jI
-Ajm3cQ1QYnGEYyvlczgD3jvRdDtjJjGy3wJAV4JnkpX7pIdIIj7rR7PB4aM3Rxae
-TV7PCEXZXPxCf9RsF5EBtkQPzruTQznarB00j9Q6BuhGIqyHpt6st3cQjQJBAKtf
-oG7i+o+b7VrMuZ+Al4N+4Ijv7hqMK/HJjhycVsgL1dD5Wpe+TQRDtkEHTrLGLpsY
-xrEygYzdsr0YmlXOtxkCQQC46OoYuk/bZhp1gnFNtWXp73ZESphNOC/FovNKu5Os
-fbxKoqUbosXAi6wxuU1L+eojN0UNx98xyKjG/lyUog/m
------END RSA PRIVATE KEY-----
-

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b60d2c7d/tools/cartridge_create/init_scripts/php/x.sh
----------------------------------------------------------------------
diff --git a/tools/cartridge_create/init_scripts/php/x.sh b/tools/cartridge_create/init_scripts/php/x.sh
deleted file mode 100644
index 1f42589..0000000
--- a/tools/cartridge_create/init_scripts/php/x.sh
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/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.
-#
-#
-LOG=/tmp/me.log
-CARTRIDGE_AGENT_EPR="http://localhost/me.html"
-echo "Sending register request to Cartridge agent service\n" > $LOG
-for i in {1..2}
-do
-    #curl --write-out "%{http_code}\n" --silent --output /dev/null $CARTRIDGE_AGENT_EPR
-    curl -X POST -H "Content-Type: text/xml" -d @/tmp/request.xml --silent --output /dev/null "$CARTRIDGE_AGENT_EPR"
-    ret=$?
-    echo "return value:$ret" > $LOG
-    if [[ $ret -eq 2  ]]; then
-        echo "[curl] Failed to initialize" >> $LOG
-    fi
-    if [[ $ret -eq 5 || $ret -eq 6 || $ret -eq 7  ]]; then
-        echo "[curl] Resolving host failed" >> $LOG
-    fi
-    if [[ $ret -eq 28 ]]; then
-        echo "[curl] Operation timeout" >> $LOG
-    fi
-    if [[ $ret -eq 55 || $ret -eq 56 ]]; then
-        echo "[curl] Failed sending/receiving network data" >> $LOG
-    fi
-    if [[ $ret -eq 28 ]]; then
-        echo "Operation timeout" >> $LOG
-    fi
-done
-if [[ $ret -gt 0 ]]; then
-    echo "Sending cluster join message failed. So shutdown instance and exit" >> $LOG
-    exit 0
-fi

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b60d2c7d/tools/cartridge_create/init_scripts/php/y.sh
----------------------------------------------------------------------
diff --git a/tools/cartridge_create/init_scripts/php/y.sh b/tools/cartridge_create/init_scripts/php/y.sh
deleted file mode 100644
index a786460..0000000
--- a/tools/cartridge_create/init_scripts/php/y.sh
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/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.
-#
-#
-LOG=/tmp/me.log
-CARTRIDGE_AGENT_EPR="http://localhost/me.html"
-echo "Sending register request to Cartridge agent service\n" > $LOG
-for i in {1..1}
-do
-    ret=`curl --write-out "%{http_code}\n" --silent --output /dev/null $CARTRIDGE_AGENT_EPR`
-    echo "return value:$ret" > $LOG
-    #if [[ $ret -eq 2  ]]; then
-    #    echo "[curl] Failed to initialize" >> $LOG
-    #fi
-done

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b60d2c7d/tools/cartridge_create/init_scripts/tomcat/get-launch-params.rb
----------------------------------------------------------------------
diff --git a/tools/cartridge_create/init_scripts/tomcat/get-launch-params.rb b/tools/cartridge_create/init_scripts/tomcat/get-launch-params.rb
deleted file mode 100644
index 0948d6a..0000000
--- a/tools/cartridge_create/init_scripts/tomcat/get-launch-params.rb
+++ /dev/null
@@ -1,53 +0,0 @@
-#! /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(
-  "/var/lib/cloud/instance/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/b60d2c7d/tools/cartridge_create/init_scripts/tomcat/openstack/get-launch-params.rb
----------------------------------------------------------------------
diff --git a/tools/cartridge_create/init_scripts/tomcat/openstack/get-launch-params.rb b/tools/cartridge_create/init_scripts/tomcat/openstack/get-launch-params.rb
deleted file mode 100644
index c6368ca..0000000
--- a/tools/cartridge_create/init_scripts/tomcat/openstack/get-launch-params.rb
+++ /dev/null
@@ -1,55 +0,0 @@
-#! /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(
-  "/var/lib/cloud/instance/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/b60d2c7d/tools/cartridge_create/init_scripts/tomcat/openstack/healthcheck.sh
----------------------------------------------------------------------
diff --git a/tools/cartridge_create/init_scripts/tomcat/openstack/healthcheck.sh b/tools/cartridge_create/init_scripts/tomcat/openstack/healthcheck.sh
deleted file mode 100644
index 27ab926..0000000
--- a/tools/cartridge_create/init_scripts/tomcat/openstack/healthcheck.sh
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/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 8080; echo $?`;
-if [ $var -eq 0 ]
-then
-    echo "port 8080 is available" > /dev/null 2>&1
-else
-    echo "port 8080 is not available" > /dev/null 2>&1
-    /etc/init.d/apache2 restart
-fi

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b60d2c7d/tools/cartridge_create/init_scripts/tomcat/openstack/stratos-init.sh
----------------------------------------------------------------------
diff --git a/tools/cartridge_create/init_scripts/tomcat/openstack/stratos-init.sh b/tools/cartridge_create/init_scripts/tomcat/openstack/stratos-init.sh
deleted file mode 100755
index ba30b44..0000000
--- a/tools/cartridge_create/init_scripts/tomcat/openstack/stratos-init.sh
+++ /dev/null
@@ -1,289 +0,0 @@
-#!/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.
-
-export LOG=/var/log/stratos-cartridge.log
-instance_path=/var/lib/cloud/instance
-PUBLIC_IP=""
-KEY=`uuidgen`
-CRON_DURATION=1
-RETRY_COUNT=30
-SLEEP_DURATION=3
-
-if [ ! -d ${instance_path}/payload ]; then
-
-    echo "creating payload dir ... " >> $LOG
-    mkdir ${instance_path}/payload
-    echo "payload dir created ... " >> $LOG
-    cp ${instance_path}/user-data.txt ${instance_path}/payload/user-data.zip
-    echo "payload copied  ... "  >> $LOG
-    unzip -d ${instance_path}/payload ${instance_path}/payload/user-data.zip
-    echo "unzippeddd..." >> $LOG
-
-    for i in `/usr/bin/ruby /opt/get-launch-params.rb`
-    do
-    echo "exporting to bashrc $i ... " >> $LOG
-        echo "export" ${i} >> /home/ubuntu/.bashrc
-    done
-    source /home/ubuntu/.bashrc
-
-fi
-
-
-echo ---------------------------- >> $LOG
-echo "getting public ip from metadata service" >> $LOG
-
-wget http://169.254.169.254/latest/meta-data/public-ipv4
-files="`cat public-ipv4`"
-if [[ -z ${files} ]]; then
-    echo "getting public ip" >> $LOG
-    for i in {1..30}
-    do
-      rm -f ./public-ipv4
-      wget http://169.254.169.254/latest/meta-data/public-ipv4
-      files="`cat public-ipv4`"
-      if [ -z $files ]; then
-          echo "Public ip is not yet assigned. Wait and continue for $i the time ..." >> $LOG
-          sleep $SLEEP_DURATION
-      else
-          echo "Public ip assigned" >> $LOG
-          break
-      fi
-    done
-
-    if [ -z $files ]; then
-      echo "Public ip is not yet assigned. So exit" >> $LOG
-      exit 0
-    fi
-    for x in $files
-    do
-        PUBLIC_IP="$x"
-    done
-
-
-else 
-   PUBLIC_IP="$files"
-fi
-
-
-for i in `/usr/bin/ruby /opt/get-launch-params.rb`
-do
-    export ${i}
-done
-
-
-echo "Restarting apache..." >> $LOG
-
-/etc/init.d/apache2 restart
-
-echo "Apache restarted..." >> $LOG
-
-
-echo "Logging sys variables .. PUBLIC_IP:${PUBLIC_IP}, HOST_NAME:${HOST_NAME}, KEY:${KEY}, PORTS=${PORTS}, BAM:${BAM_IP}, GITREPO:${GIT_REPO}" >> $LOG
-
-mkdir -p  /etc/agent/conf
-
-echo "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:agen=\"http://service.agent.cartridge.stratos.apache.org\">
-  <soapenv:Header/>
-  <soapenv:Body>
-     <agen:register>
-        <registrant> 
-           <alarmingLowerRate>${ALARMING_LOWER_RATE}</alarmingLowerRate>
-           <alarmingUpperRate>${ALARMING_UPPER_RATE}</alarmingUpperRate>
-           <hostName>${HOST_NAME}</hostName>
-           <key>${KEY}</key>
-          <maxInstanceCount>${MAX}</maxInstanceCount>
-	  <maxRequestsPerSecond>${MAX_REQUESTS_PER_SEC}</maxRequestsPerSecond>
-          <minInstanceCount>${MIN}</minInstanceCount> " > /etc/agent/conf/request.xml
-
-IFS='|' read -ra PT <<< "${PORTS}"
-for i in "${PT[@]}"; do
-IFS=':' read -ra PP <<< "$i"
-echo "          <portMappings>
-                        <primaryPort>${PP[1]}</primaryPort>
-                        <proxyPort>${PP[2]}</proxyPort>
-                        <type>${PP[0]}</type>
-                </portMappings>">> /etc/agent/conf/request.xml
-done
-
-echo "          <remoteHost>${PUBLIC_IP}</remoteHost>
-           <service>${SERVICE}</service>
-	   <remoteHost>${PUBLIC_IP}</remoteHost>
-           <roundsToAverage>${ROUNDS_TO_AVERAGE}</roundsToAverage>
-           <scaleDownFactor>${SCALE_DOWN_FACTOR}</scaleDownFactor>
-           <tenantRange>${TENANT_RANGE}</tenantRange>
-        </registrant>
-     </agen:register>
-  </soapenv:Body>
-</soapenv:Envelope>
-" >> /etc/agent/conf/request.xml
-
-echo "Creating repoinfo request  " >> $LOG
-echo "TENANT_ID and SERVICE ${TENANT_ID} and ${SERVICE} " >> $LOG
-set -- "${HOST_NAME}" 
-IFS="."; declare -a Array=($*)
-ALIAS="${Array[0]}"
-echo "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsd=\"http://org.apache.axis2/xsd\">
-   <soapenv:Header/>
-   <soapenv:Body>
-      <xsd:getRepositoryCredentials>
-         <xsd:tenantId>${TENANT_ID}</xsd:tenantId>
-         <xsd:cartridgeType>${SERVICE}</xsd:cartridgeType>
-         <xsd:alias>${ALIAS}</xsd:alias>
-      </xsd:getRepositoryCredentials>
-   </soapenv:Body>
-</soapenv:Envelope>" > /opt/repoinforequest.xml
-
-echo "Repoinfo request created " >> $LOG
-
-echo "Private Key....Copying to .ssh  " >> $LOG
-
-cp ${instance_path}/payload/id_rsa /root/.ssh/id_rsa
-chmod 0600 /root/.ssh/id_rsa
-echo "StrictHostKeyChecking no" >> /root/.ssh/config
-
-
-
-
-#echo "Getting repo username password from repoInfoService" >> $LOG
-#curl -X POST -H "Content-Type: text/xml" -d @/etc/agent/conf/request.xml --silent --output /dev/null "${CARTRIDGE_AGENT_EPR}"
-
-echo "Git repo sync" >> $LOG
-
-# If repo is available do a git pull, else clone
-
-echo "#!/bin/bash
-if [ -d \"${APP_PATH}/.git\" ]; then
-    cd ${APP_PATH}
-
-    curl -X POST -H \"Content-Type: text/xml\" -H \"SOAPAction: urn:getRepositoryCredentials\" -d @/opt/repoinforequest.xml --silent  \"${REPO_INFO_EPR}\" --insecure > /tmp/git.xml
-   sed '1,5d' /tmp/git.xml > /tmp/git1.xml
-   sed '2d' /tmp/git1.xml > /tmp/git.xml
-   username=\`xml_grep 'ax29:userName' /tmp/git.xml --text_only\`
-   password=\`xml_grep 'ax29:password' /tmp/git.xml --text_only\`
-   repo=\`xml_grep 'ax29:url' /tmp/git.xml --text_only\`
-   rm /tmp/git1.xml
-   rm /tmp/git.xml
-   url=\`echo \$repo |sed 's/http.*\/\///g' |sed 's/\:.*//g' |sed 's/\/.*//g'\`
-   echo \"machine \${url} login \${username} password \${password}\" > ~/.netrc
-   sudo echo \"machine \${url} login \${username} password \${password}\" > /root/.netrc
-   chmod 600 ~/.netrc
-   sudo chmod 600 /root/.netrc
-   git config --global --bool --add http.sslVerify false
-   sudo git pull
-   rm ~/.netrc
-   sudo rm /root/.netrc
-
-else
-   curl -X POST -H \"Content-Type: text/xml\" -H \"SOAPAction: urn:getRepositoryCredentials\" -d @/opt/repoinforequest.xml --silent  \"${REPO_INFO_EPR}\" --insecure > /tmp/git.xml
-   sed '1,5d' /tmp/git.xml > /tmp/git1.xml
-   sed '2d' /tmp/git1.xml > /tmp/git.xml
-   username=\`xml_grep 'ax29:userName' /tmp/git.xml --text_only\`
-   password=\`xml_grep 'ax29:password' /tmp/git.xml --text_only\`
-   repo=\`xml_grep 'ax29:url' /tmp/git.xml --text_only\`
-   rm /tmp/git1.xml
-   rm /tmp/git.xml
-   url=\`echo \$repo |sed 's/http.*\/\///g' |sed 's/\:.*//g' |sed 's/\/.*//g'\`
-   echo \"machine \${url} login \${username} password \${password}\" > ~/.netrc
-   sudo echo \"machine \${url} login \${username} password \${password}\" > /root/.netrc
-   chmod 600 ~/.netrc
-   sudo chmod 600 /root/.netrc
-    git config --global --bool --add http.sslVerify false
-    cd ${APP_PATH}
-    sudo mv ROOT ../
-    sudo git clone \${repo} ${APP_PATH}
-    sudo mv ../ROOT .
-   rm ~/.netrc
-   sudo rm /root/.netrc
- 
-
-fi" > /opt/git.sh
-echo "File created.." >> $LOG
-chmod 755 /opt/git.sh
-                       
-
-
-while true
-do
-var=`nc -z localhost 8080; echo $?`;
-if [ $var -eq 0 ]
-   then
-       echo "port 8080 is available" >> $LOG
-       break
-   else
-       echo "port 8080 is not available" >> $LOG
-   fi
-   sleep 1
-done
-
-
-while true
-do
-var=`nc -z localhost 8443; echo $?`;
-if [ $var -eq 0 ]
-   then
-       echo "port 8443 is available" >> $LOG
-       break
-   else
-       echo "port 8443 is not available" >> $LOG
-   fi
-   sleep 1
-done
-
-
-
-echo "Sending register request to Cartridge agent service" >> $LOG
-
-curl -X POST -H "Content-Type: text/xml" -H "SOAPAction: urn:register" -d @/etc/agent/conf/request.xml -k --silent --output /dev/null "${CARTRIDGE_AGENT_EPR}"
-
-echo "Registered cartridge..." >> $LOG
-
-echo "running git clone........" >> $LOG
-su - ubuntu /opt/git.sh
-
-
-echo "setting up logging conf" >> $LOG
-
-
-echo "host:     ${BAM_IP}
-thriftPort:     ${BAM_PORT}
-
-#cartridge configs
-cartridgeAlias:  ${CARTRIDGE_ALIAS}
-tenantName:      ${HOST_NAME}
-tenantId:        ${TENANT_ID}
-localIP:         ${PUBLIC_IP}" > /opt/cartridge_data_publisher_1.0.2/conf/data_publisher.conf
-
-
-
-echo "started loggin ........."
-cd /opt/cartridge_data_publisher_1.0.2/dist/Debug/GNU-Linux-x86/
-nohup ./cartridge_data_publisher_1.0.2 /var/lib/tomcat7/logs/catalina.out >> /var/log/stratos-data-publisher.log  &
-
-echo "logging started........."
-
-
-# ========================== // End of script ===========================================================
-

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b60d2c7d/tools/cartridge_create/init_scripts/tomcat/payload/README
----------------------------------------------------------------------
diff --git a/tools/cartridge_create/init_scripts/tomcat/payload/README b/tools/cartridge_create/init_scripts/tomcat/payload/README
deleted file mode 100644
index 0e6c864..0000000
--- a/tools/cartridge_create/init_scripts/tomcat/payload/README
+++ /dev/null
@@ -1,21 +0,0 @@
-This folder is a sample payload sent to a php instance when it is created.
-
-
-Replace the values in launch_params file with correct values of your environment.
-
-Now pack this payload as payload.zip and pass this when creating php instances.
-
-
-Following is the /etc/rc.local file of the php instance
-
-#!/bin/sh -e
-/opt/wso2-openstack-init.sh > /var/log/wso2-openstack-init.log
-exit 0
-
-By the time rc.local file is invokded in the newly created tomcat instance, the payload is already
-passed to the instance and reside in /var/lib/cloud/instance/payload
-
-You can see that rc.local invoke the wso2-openstack-init.sh script in the payload.
-
-
-

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b60d2c7d/tools/cartridge_create/init_scripts/tomcat/payload/launch-params
----------------------------------------------------------------------
diff --git a/tools/cartridge_create/init_scripts/tomcat/payload/launch-params b/tools/cartridge_create/init_scripts/tomcat/payload/launch-params
deleted file mode 100644
index 70eda77..0000000
--- a/tools/cartridge_create/init_scripts/tomcat/payload/launch-params
+++ /dev/null
@@ -1,18 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#  http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-TENANT=1,SVNPASS=g,SVNURL=http://11.0.0.1:80/svn,APP=tomcat7

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b60d2c7d/tools/cartridge_create/init_scripts/tomcat/stratos-init.sh
----------------------------------------------------------------------
diff --git a/tools/cartridge_create/init_scripts/tomcat/stratos-init.sh b/tools/cartridge_create/init_scripts/tomcat/stratos-init.sh
deleted file mode 100644
index 0495b7b..0000000
--- a/tools/cartridge_create/init_scripts/tomcat/stratos-init.sh
+++ /dev/null
@@ -1,274 +0,0 @@
-#!/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 LOG=/var/log/stratos-init.log
-instance_path=/opt
-PUBLIC_IP=""
-KEY=`uuidgen`
-CRON_DURATION=1
-RETRY_COUNT=30
-SLEEP_DURATION=3
-
-if [ ! -d ${instance_path}/payload ]; then
-
-    echo "creating payload dir ... " >> $LOG
-    mkdir ${instance_path}/payload
-    echo "payload dir created ... " >> $LOG
-    wget http://169.254.169.254/latest/user-data -O ${instance_path}/payload/payload.zip    
-    echo "payload copied  ... "  >> $LOG
-    unzip -d ${instance_path}/payload ${instance_path}/payload/payload.zip
-    echo "unzippeddd..." >> $LOG
-
-    for i in `/usr/bin/ruby /opt/get-launch-params.rb`
-    do
-    echo "exporting to bashrc $i ... " >> $LOG
-        echo "export" ${i} >> /home/ubuntu/.bashrc
-    done
-    source /home/ubuntu/.bashrc
-
-fi
-
-
-echo ---------------------------- >> $LOG
-echo "getting public ip from metadata service" >> $LOG
-
-wget http://169.254.169.254/latest/meta-data/public-ipv4
-files="`cat public-ipv4`"
-if [[ -z ${files} ]]; then
-    echo "getting public ip" >> $LOG
-    for i in {1..30}
-    do
-      rm -f ./public-ipv4
-      wget http://169.254.169.254/latest/meta-data/public-ipv4
-      files="`cat public-ipv4`"
-      if [ -z $files ]; then
-          echo "Public ip is not yet assigned. Wait and continue for $i the time ..." >> $LOG
-          sleep $SLEEP_DURATION
-      else
-          echo "Public ip assigned" >> $LOG
-          break
-      fi
-    done
-
-    if [ -z $files ]; then
-      echo "Public ip is not yet assigned. So exit" >> $LOG
-      exit 0
-    fi
-    for x in $files
-    do
-        PUBLIC_IP="$x"
-    done
-
-
-else 
-   PUBLIC_IP="$files"
-fi
-
-
-for i in `/usr/bin/ruby /opt/get-launch-params.rb`
-do
-    export ${i}
-done
-
-
-echo "Restarting apache..." >> $LOG
-
-/etc/init.d/apache2 restart
-
-echo "Apache restarted..." >> $LOG
-
-
-echo "Logging sys variables .. PUBLIC_IP:${PUBLIC_IP}, HOST_NAME:${HOST_NAME}, KEY:${KEY}, PORTS=${PORTS}, BAM:${BAM_IP}, GITREPO:${GIT_REPO}" >> $LOG
-
-mkdir -p  /etc/agent/conf
-
-echo "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:agen=\"http://service.agent.cartridge.stratos.apache.org\">
-  <soapenv:Header/>
-  <soapenv:Body>
-     <agen:register>
-        <registrant> 
-           <alarmingLowerRate>${ALARMING_LOWER_RATE}</alarmingLowerRate>
-           <alarmingUpperRate>${ALARMING_UPPER_RATE}</alarmingUpperRate>
-           <hostName>${HOST_NAME}</hostName>
-           <key>${KEY}</key>
-          <maxInstanceCount>${MAX}</maxInstanceCount>
-	  <maxRequestsPerSecond>${MAX_REQUESTS_PER_SEC}</maxRequestsPerSecond>
-          <minInstanceCount>${MIN}</minInstanceCount> " > /etc/agent/conf/request.xml
-
-IFS='|' read -ra PT <<< "${PORTS}"
-for i in "${PT[@]}"; do
-IFS=':' read -ra PP <<< "$i"
-echo "          <portMappings>
-                        <primaryPort>${PP[1]}</primaryPort>
-                        <proxyPort>${PP[2]}</proxyPort>
-                        <type>${PP[0]}</type>
-                </portMappings>">> /etc/agent/conf/request.xml
-done
-
-echo "          <remoteHost>${PUBLIC_IP}</remoteHost>
-           <service>${SERVICE}</service>
-	   <remoteHost>${PUBLIC_IP}</remoteHost>
-           <roundsToAverage>${ROUNDS_TO_AVERAGE}</roundsToAverage>
-           <scaleDownFactor>${SCALE_DOWN_FACTOR}</scaleDownFactor>
-           <tenantRange>${TENANT_RANGE}</tenantRange>
-        </registrant>
-     </agen:register>
-  </soapenv:Body>
-</soapenv:Envelope>
-" >> /etc/agent/conf/request.xml
-
-echo "Creating repoinfo request  " >> $LOG
-echo "TENANT_ID and SERVICE ${TENANT_ID} and ${SERVICE} " >> $LOG
-set -- "${HOST_NAME}" 
-IFS="."; declare -a Array=($*)
-ALIAS="${Array[0]}"
-echo "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsd=\"http://org.apache.axis2/xsd\">
-   <soapenv:Header/>
-   <soapenv:Body>
-      <xsd:getRepositoryCredentials>
-         <xsd:tenantId>${TENANT_ID}</xsd:tenantId>
-         <xsd:cartridgeType>${SERVICE}</xsd:cartridgeType>
-         <xsd:alias>${ALIAS}</xsd:alias>
-      </xsd:getRepositoryCredentials>
-   </soapenv:Body>
-</soapenv:Envelope>" > /opt/repoinforequest.xml
-
-echo "Repoinfo request created " >> $LOG
-
-echo "Private Key....Copying to .ssh  " >> $LOG
-
-cp ${instance_path}/payload/id_rsa /root/.ssh/id_rsa
-chmod 0600 /root/.ssh/id_rsa
-echo "StrictHostKeyChecking no" >> /root/.ssh/config
-
-
-
-
-#echo "Getting repo username password from repoInfoService" >> $LOG
-#curl -X POST -H "Content-Type: text/xml" -d @/etc/agent/conf/request.xml --silent --output /dev/null "${CARTRIDGE_AGENT_EPR}"
-
-echo "Git repo sync" >> $LOG
-
-# If repo is available do a git pull, else clone
-
-echo "#!/bin/bash
-if [ -d \"${APP_PATH}/.git\" ]; then
-    cd ${APP_PATH}
-    
-    curl -X POST -H \"Content-Type: text/xml\" -H \"SOAPAction: urn:getRepositoryCredentials\" -d @/opt/repoinforequest.xml --silent  \"${REPO_INFO_EPR}\" --insecure > /tmp/git.xml
-   sed '1,5d' /tmp/git.xml > /tmp/git1.xml
-   sed '2d' /tmp/git1.xml > /tmp/git.xml
-   username=\`xml_grep 'ax29:userName' /tmp/git.xml --text_only\`
-   password=\`xml_grep 'ax29:password' /tmp/git.xml --text_only\`
-   repo=\`xml_grep 'ax29:url' /tmp/git.xml --text_only\`
-   rm /tmp/git1.xml
-   rm /tmp/git.xml
-   url=\`echo \$repo |sed 's/http.*\/\///g' |sed 's/\:.*//g' |sed 's/\/.*//g'\`
-   echo \"machine \${url} login \${username} password \${password}\" > ~/.netrc
-   sudo echo \"machine \${url} login \${username} password \${password}\" > /root/.netrc
-   chmod 600 ~/.netrc
-   sudo chmod 600 /root/.netrc
-   git config --global --bool --add http.sslVerify false
-   sudo git pull
-   rm ~/.netrc
-   sudo rm /root/.netrc
-
-else
-   curl -X POST -H \"Content-Type: text/xml\" -H \"SOAPAction: urn:getRepositoryCredentials\" -d @/opt/repoinforequest.xml --silent  \"${REPO_INFO_EPR}\" --insecure > /tmp/git.xml
-   sed '1,5d' /tmp/git.xml > /tmp/git1.xml
-   sed '2d' /tmp/git1.xml > /tmp/git.xml
-   username=\`xml_grep 'ax29:userName' /tmp/git.xml --text_only\`
-   password=\`xml_grep 'ax29:password' /tmp/git.xml --text_only\`
-   repo=\`xml_grep 'ax29:url' /tmp/git.xml --text_only\`
-   rm /tmp/git1.xml
-   rm /tmp/git.xml
-   url=\`echo \$repo |sed 's/http.*\/\///g' |sed 's/\:.*//g' |sed 's/\/.*//g'\`
-   echo \"machine \${url} login \${username} password \${password}\" > ~/.netrc
-   sudo echo \"machine \${url} login \${username} password \${password}\" > /root/.netrc
-   chmod 600 ~/.netrc
-   sudo chmod 600 /root/.netrc
-    git config --global --bool --add http.sslVerify false
-    cd ${APP_PATH}
-    sudo mv ROOT ../
-    sudo git clone \${repo} ${APP_PATH}
-    sudo mv ../ROOT .
-   rm ~/.netrc
-   sudo rm /root/.netrc
- 
-
-fi" > /opt/git.sh
-echo "File created.." >> $LOG
-chmod 755 /opt/git.sh
-                       
-
-
-while true
-do
-var=`nc -z localhost 8080; echo $?`;
-if [ $var -eq 0 ]
-   then
-       echo "port 8080 is available" >> $LOG
-       break
-   else
-       echo "port 8080 is not available" >> $LOG
-   fi
-   sleep 1
-done
-
-
-
-
-
-echo "Sending register request to Cartridge agent service" >> $LOG
-
-curl -X POST -H "Content-Type: text/xml" -H "SOAPAction: urn:register" -d @/etc/agent/conf/request.xml -k --silent --output /dev/null "${CARTRIDGE_AGENT_EPR}"
-
-echo "Registered cartridge..." >> $LOG
-
-echo "running git clone........" >> $LOG
-su - ubuntu /opt/git.sh
-
-
-echo "setting up logging conf" >> $LOG
-
-
-echo "host:     ${BAM_IP}
-thriftPort:     ${BAM_PORT}
-
-#cartridge configs
-cartridgeAlias:  ${CARTRIDGE_ALIAS}
-tenantName:      ${HOST_NAME}
-tenantId:        ${TENANT_ID}
-localIP:         ${PUBLIC_IP}" > /opt/cartridge_data_publisher_1.0.2/conf/data_publisher.conf
-
-
-
-echo "started loggin ........."
-cd /opt/cartridge_data_publisher_1.0.2/dist/Debug/GNU-Linux-x86/
-nohup ./cartridge_data_publisher_1.0.2 /var/lib/tomcat7/logs/catalina.out >> /var/log/stratos-data-publisher.log  &
-
-
-
-
-
-# ========================== // End of script ===========================================================

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b60d2c7d/tools/cartridge_create/init_scripts/tomcat/stratos.pem
----------------------------------------------------------------------
diff --git a/tools/cartridge_create/init_scripts/tomcat/stratos.pem b/tools/cartridge_create/init_scripts/tomcat/stratos.pem
deleted file mode 100644
index f4260f9..0000000
--- a/tools/cartridge_create/init_scripts/tomcat/stratos.pem
+++ /dev/null
@@ -1,16 +0,0 @@
------BEGIN RSA PRIVATE KEY-----
-MIICXQIBAAKBgQCp31ZRD9kPwKoxW3sh+4x2IfldCKEfHbo18LhvOnGPJcNzqHDy
-6WWxpxPAHNAMyvrAv+hUfX4fwSRctieTim0N+fTr+mRP0q4HHhEkvEmxoXs4Y7lz
-jrh5vhMBZBAXsSurHVp2Bpie1xyjW+ksuAziT2gw6KvipjJiGTjuLTnLmQIDAQAB
-AoGAMFvtNbx+PbbKfKyfXChBb2vykmKfg70xwqNZzghkRa0pfCaKqQx6r91xiPJq
-5Alw4yh+2nazThTs5hvRHnZ83tPFxKyekrOdFpFEwAdibmvM3ckfAmUqJErteFhp
-o524O37kWpzwBgk1rxwLHVxyoscVHF8vWSjk9jzvdor9XbUCQQDdPp+F/X5qQLZw
-xaYyHrWmLkRnFRaxxmiOQmvAxYKybMp0Ei8euy+wKHiNPBVPxn143hrag7a2GKIn
-hq6LwoiHAkEAxI7GYK47woZJHI6rjskjxT+DBNKjTmoDZVTa4KrWUVY1NfTC+/jI
-Ajm3cQ1QYnGEYyvlczgD3jvRdDtjJjGy3wJAV4JnkpX7pIdIIj7rR7PB4aM3Rxae
-TV7PCEXZXPxCf9RsF5EBtkQPzruTQznarB00j9Q6BuhGIqyHpt6st3cQjQJBAKtf
-oG7i+o+b7VrMuZ+Al4N+4Ijv7hqMK/HJjhycVsgL1dD5Wpe+TQRDtkEHTrLGLpsY
-xrEygYzdsr0YmlXOtxkCQQC46OoYuk/bZhp1gnFNtWXp73ZESphNOC/FovNKu5Os
-fbxKoqUbosXAi6wxuU1L+eojN0UNx98xyKjG/lyUog/m
------END RSA PRIVATE KEY-----
-

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b60d2c7d/tools/cartridge_create/stratos-image
----------------------------------------------------------------------
diff --git a/tools/cartridge_create/stratos-image b/tools/cartridge_create/stratos-image
deleted file mode 100755
index e11e5de..0000000
--- a/tools/cartridge_create/stratos-image
+++ /dev/null
@@ -1,100 +0,0 @@
-#!/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.
-# ----------------------------------------------------------------------------
-
-
-# Die on any error:
-set -e
-
-# This script will create an cartridge image from a running virtual machine instance in Openstack using a given cartridge template. Then it will be
-# uploaded into the Glance Server. This script should be executed after logging into the Openstack controller with a valid user account that can
-# upload images to the glance server.
-
-vm_instance_ip=""
-cartridge_template=""
-vm_instance_user=""
-vm_instance_private_key=""
-software=""
-function help {
-    echo ""
-    echo "    This script  will upload the cartridge template execution file into the remote virtual machine from"
-    echo "            which you need to create the image, and execute it. At the end of the execution, image is ready for"
-    echo "            upload"
-    echo "    Usage for action create:"
-    echo ""
-    echo "    stratos-image -s <software> create <ip/hostname of the virtual machine> <cartridge template> <vm instance user> <vm instance private key>"
-    echo ""
-    echo "    -s : Softwared to be copied to the new image, separated by colon(:). Default is none. These will be"
-    echo "         copied into the /opt folder of the instance"
-    echo "    <ip/hostname of the virtual machine> : ip or hostname of the virtual machine using which image will be created from"
-    echo "    <cartridge template> : Template for the new image"
-    echo "    <vm instance user> : User name of the instance from which you need to create the image"
-    echo "    <vm instance private key> : Name of the private key of the user for logging into the virtual machine instance."
-    echo "            Copy the private key to init_scripts/<cartridge template> (e.g., init_scripts/php) folder"
-    echo ""
-}
-
-function image_validate {
-
-if [[ -z $vm_instance_ip || -z $cartridge_template || -z $vm_instance_user || -z $vm_instance_private_key ]]; then
-    help
-    exit 1
-fi
-
-}
-
-while getopts s: opts
-do
-  case $opts in
-    s)
-        software=${OPTARG}
-        ;;
-    *)
-        help
-        exit 1
-        ;;
-  esac
-done
-shift $((OPTIND-1))
-
-vm_instance_ip=$1
-echo $vm_instance_ip
-cartridge_template=$2
-echo $cartridge_template
-vm_instance_user=$3
-vm_instance_private_key=$4
-
-image_validate
-
-echo "Install from cartridge_template $cartridge_template"
-pushd ./init_scripts/$cartridge_template
-chmod 755 ./$cartridge_template
-./$cartridge_template $vm_instance_ip $vm_instance_user $vm_instance_private_key $software
-popd
-echo "Installed from cartridge_template $cartridge_template"
-echo "Now upload the image by using Openstack nova command"
-echo "nova image-create <vm instance id> <image name>"
-echo "where"
-echo "<vm instance id> is the id of the virtual machine instance from which you need to create the image"
-echo "<image name> is the name you wish to give for your new cartridge image"
-
-
-echo "Done"
-

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b60d2c7d/tools/cartridge_create/stratos-image-local
----------------------------------------------------------------------
diff --git a/tools/cartridge_create/stratos-image-local b/tools/cartridge_create/stratos-image-local
deleted file mode 100755
index 816fd92..0000000
--- a/tools/cartridge_create/stratos-image-local
+++ /dev/null
@@ -1,310 +0,0 @@
-#!/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.
-# ----------------------------------------------------------------------------
-
-
-# Die on any error:
-set -e
-
-work_dir=""
-new_image=""
-image_root="/tmp"
-image_template="default"
-software=""
-new_image_size="" #In GB
-action=""
-original_image=""
-image_type="qcow2"
-
-function help {
-    echo "Usage: stratos-image-local [optional arguments] <action> <mandatory arguments>"
-    echo "    Action can be one of the following"
-    echo "        create : Mount the base image and customize it according to the given arguments"
-    echo "        pack : Archive the newly created image and unmount the base image"
-    echo ""
-    echo "    Mandatory and optional arguments depend on the action. Following is the list of usages for each action"
-    echo ""
-    echo "    Usage for action create:"
-    echo "        stratos-image-local -r <image root> -t <image template> -s <software> -n <new image size(just enter number without G suffix)> "
-    echo "                            create <path to original image>"
-    echo ""
-    echo "            -r : Image root - This is where the base image is mounted. Default is /tmp"
-    echo "            -t : Template for the new image. Default is no template"
-    echo "            -s : Softwared to be copied to the new image, separated by colon(:). Default is none"
-    echo "            -n : Image size of the new image in GB(just enter number without G suffix). Default is the size of the base image"
-    echo "            -v : Image type. This is one of qcow2 or row. Default is qcow2"
-    echo ""
-    echo "    Usage for action pack:"
-    echo "        stratos-image-local -r <image root> -t <image template> pack <new image archive name in tar.gz format>"
-    echo ""
-    echo "            -r : Image root - This is where the base image is mounted. Default is /tmp"
-    echo "            -t : Template for the new image. Default is no template"
-    echo "            -v : Image type. This is one of qcow2 or row. Default is qcow2"
-    echo ""
-    echo "    Usage for action mount:"
-    echo "        stratos-image-local -r <image root> -t <image template> -n <new image size(just enter number without G suffix)> mount <path to original image>"
-    echo ""
-    echo "            -r : Image root - This is where the base image is mounted. Default is /tmp"
-    echo "            -t : Template for the new image. Default is no template"
-    echo "            -n : Resize the image to this size in GB(just enter number wihout G suffix) before mounting. Default is the size of the base image"
-    echo "            -v : Image type. This is one of qcow2 or row. Default is qcow2"
-    echo ""
-    echo "    eg:sudo ./stratos-image-local -r /tmp/ -n 8 mount /opt/lxc/precise-server-carbon-cloudimg-amd64-disk1.img"
-    echo ""
-    echo "    Usage for action unmount:"
-    echo "        stratos-image-local -r <image root> -t <image template>  unmount"
-    echo ""
-    echo "            -r : Image root - This is where the base image is mounted. Default is /tmp"
-    echo "            -t : Template for the new image. Default is no template"
-    echo "            -v : Image type. This is one of qcow2 or row. Default is qcow2"
-    echo ""
-    echo "    eg:sudo ./stratos-image-local -r /tmp unmount"
-}
-
-function image_validate {
-
-if [[ ( -z $action || ( -n $action && $action == "help" ) ) ]]; then
-    help
-    exit 1
-fi
-
-if [[ ( -z $action || ( -n $action && !( $action == "create" || $action == "pack" || $action == "mount" || $action == "unmount" ) ) ) ]]; then
-        echo "Mandatory parameter action with value create or pack should be provided"
-        echo "    create : Mount the base image and customize it according to the given arguments"
-        echo "    pack : Archive the newly created image and unmount the base image"
-        echo ""
-        exit 1
-    fi
-
-if [[ ( -n $action && $action == "create" && -z $original_image ) ]]; then
-        echo "Usage:"
-        echo "    stratos-image-local -r <image root> -t <image template> -s <software> -n <new image size(just enter number without G suffix)> -v <image type> create <path to original image>"
-        echo ""
-        echo "        -r : Image root - This is where the base image is mounted. Default is /tmp"
-        echo "        -t : Template for the new image. Default is no template"
-        echo "        -s : Softwared to be copied to the new image, separated by colon(:). Default is none"
-        echo "        -n : Image size of the new image in GB. Default is the size of the base image"
-        echo "        -v : Image type. qcow2 or raw. Default is qcow2"
-        echo ""
-        exit 1
-fi
-
-if [[ ( -n $action && $action == "pack" && -z $new_image ) ]]; then
-        echo "Usage:"
-        echo "    stratos-image-local -r <image root> -t <image template> pack <new image archive name in tar.gz format>"
-        echo ""
-        echo "        -r : Image root - This is where the base image is mounted. Default is /tmp"
-        echo "        -t : Template for the new image. Default is no template"
-        echo "        -v : Image type. qcow2 or raw. Default is qcow2"
-        echo ""
-        exit 1
-fi
-
-if [[ ( -n $action && $action == "mount" && -z $original_image ) ]]; then
-        echo "Usage:"
-        echo "    stratos-image-local -r <image root> -t <image template> -n <new image size(just enter number without G suffix)> -v <image type> mount <path to original image>"
-        echo ""
-        echo "        -r : Image root - This is where the base image is mounted. Default is /tmp"
-        echo "        -t : Template for the new image. Default is no template"
-        echo "        -n : Resize the image to this size in GB(just enter number without G suffix) before mounting. Default is the size of the base image"
-        echo "        -v : Image type. qcow2 or raw. Default is qcow2"
-        echo ""
-        echo "    eg:sudo ./stratos-image-local -r /tmp/ -n 8 mount /opt/lxc/precise-server-carbon-cloudimg-amd64-disk1.img"
-        exit 1
-fi
-
-}
-
-# Make sure the user is running as root.
-if [ "$UID" -ne "0" ]; then
-	echo ; echo "  You must be root to run $0.  (Try running 'sudo bash' first.)" ; echo 
-	exit 69
-fi
-
-while getopts r:t:s:n:v: opts
-do
-  case $opts in
-    r)
-        image_root=${OPTARG}
-        ;;
-    t)
-        image_template=${OPTARG}
-        ;;
-    s)
-        software=${OPTARG}
-        ;;
-    n)
-        new_image_size=${OPTARG}
-        ;;
-    v)
-        image_type=${OPTARG}
-        ;;
-    *)
-        help
-        exit 1
-        ;;
-  esac
-done
-shift $((OPTIND-1))
-action=$1
-if [[ $action == "create" ]]; then
-    original_image=$2
-elif [[ $action == "pack" ]]; then
-    new_image=$2
-elif [[ $action == "mount" ]]; then
-    original_image=$2
-fi
-
-image_validate
-
-work_dir="$image_root/$image_template"
-img_dir="$work_dir/image"
-
-if [[ $action == "create" || $action == "mount" ]]; then
-    if [ $image_type = "qcow2" ]; then
-        let "new_image_size=$new_image_size*1024*1024*1024"
-        new_image_size=$new_image_size
-        echo "qcow2 new_image_size:$new_image_size"
-    else
-        new_image_size=$new_image_size"G"
-        echo "raw new_image_size:$new_image_size"
-    fi
-fi
-
-if [[ $action == "create" ]]; then
-
-    if [ -d ./$work_dir ]; then
-        rm -rf ./$work_dir
-    fi
-
-    mkdir -p $work_dir
-
-    if [ ! -d $img_dir ]; then
-        mkdir -p $img_dir
-    fi
-
-    pushd $img_dir
-    type=`echo $original_image|awk -F . '{print $NF}'`
-    if [[ $type == "zip" ]]; then
-        zip -rq $original_image
-    elif [[ $type == "gz" || $type == "tgz" ]]; then
-        tar -zxf $original_image
-    else
-        cp -f $original_image ./
-    fi
-    popd
-    echo $img_dir
-    image_image=`ls $img_dir/*.img`
-    echo $image_image
-    if [ -z $new_image_size ]; then
-        echo "Image will not be resized since new image size is not provided"
-    else
-        echo "Resizing the original image"
-        if [ $image_type = "qcow2" ]; then
-            qemu-img resize $image_image $new_image_size
-        else
-            fsck.ext3 -f $image_image
-            e2fsck -f $image_image
-            resize2fs $image_image $new_image_size
-        fi
-    fi
-
-    echo "Mount the original image"
-    ./image_action.sh action=mount image-template=$image_template image-root=$image_root image-image=$image_image image-type=$image_type
-    echo "Original image mounted"
-    read
-
-    if [[ !( $image_template == "default" ) ]]; then
-    	echo "Customizing the original image"
-    	./image_action.sh action=create image-template=$image_template image-root=$image_root software=$software image-type=$image_type
-    fi
-
-fi
-
-if [[ $action == "pack" ]]; then
-    echo "Archiving the new image"
-    pushd $work_dir/image
-    type=`echo $new_image|awk -F . '{print $NF}'`
-    if [[ $type == "zip" ]]; then
-        zip -rq $new_image ./*
-    elif [[ $type == "gz" || $type == "tgz" ]]; then
-        tar -zcf $new_image ./*
-    elif [[ $type == "img" ]]; then
-        mv *.img $new_image
-    fi
-
-    popd
-    echo "Unmounting"
-    ./image_action.sh action=unmount image-template=$image_template image-root=$image_root image-type=$image_type
-fi
-
-if [[ $action == "mount" ]]; then
-    if [ -d ./$work_dir ]; then
-        rm -rf ./$work_dir
-    fi
-
-    mkdir -p $work_dir
-
-    if [ ! -d $img_dir ]; then
-        mkdir -p $img_dir
-    fi
-
-    pushd $img_dir
-    type=`echo $original_image|awk -F . '{print $NF}'`
-    if [[ $type == "zip" ]]; then
-        zip -rq $original_image
-    elif [[ $type == "gz" || $type == "tgz" ]]; then
-        tar -zxf $original_image
-    else
-        cp -f $original_image ./
-    fi
-    popd
-    echo $img_dir
-    image_image=`ls $img_dir/*.img`
-    echo $image_image
-
-    if [ -z $new_image_size ]; then
-        echo "Image will not be resized since new image size is not provided"
-    else
-        echo "Resizing the original image"
-        if [ $image_type = "qcow2" ]; then
-            qemu-img resize $image_image $new_image_size
-        else
-            echo "image:"$image_image
-            fsck.ext3 -f $image_image
-            e2fsck -f $image_image
-            resize2fs $image_image $new_image_size
-        fi
-    fi
-
-    echo "Mount the image"
-    ./image_action.sh action=mount image-template=$image_template image-root=$image_root image-image=$image_image image-type=$image_type
-    echo "Mounted the image"
-fi
-
-if [[ $action == "unmount" ]]; then
-    echo "Unmount the image"
-
-    ./image_action.sh action=unmount image-template=$image_template image-root=$image_root image-type=$image_type
-    echo "Unmounted the image"
-fi
-
-echo "Done"
-

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b60d2c7d/tools/cartridge_create/uploadimg.sh
----------------------------------------------------------------------
diff --git a/tools/cartridge_create/uploadimg.sh b/tools/cartridge_create/uploadimg.sh
deleted file mode 100755
index 2afec21..0000000
--- a/tools/cartridge_create/uploadimg.sh
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/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.
-# ----------------------------------------------------------------------------
-
-
-ip=$1
-imagename=$2
-userrc=$3
-mysqlpass=$4
-source ./$userrc
-ret=`mysql -u root -p$mysqlpass nova -e "select i.uuid from instances i, fixed_ips x, floating_ips f where i.id=x.instance_id and x.id=f.fixed_ip_id and f.address='$ip' and i.vm_state='ACTIVE'"`
-tok_str=(`echo $ret | tr '.' ' '`)
-id=${tok_str[1]}
-echo $id > /tmp/test
-nova image-create $id $imagename


[3/4] Renamed folder cartridge_create to cartridge-create and init_scripts to init-scripts

Posted by im...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b60d2c7d/tools/cartridge-create/init-scripts/php/ec2/healthcheck.sh
----------------------------------------------------------------------
diff --git a/tools/cartridge-create/init-scripts/php/ec2/healthcheck.sh b/tools/cartridge-create/init-scripts/php/ec2/healthcheck.sh
new file mode 100644
index 0000000..eb06412
--- /dev/null
+++ b/tools/cartridge-create/init-scripts/php/ec2/healthcheck.sh
@@ -0,0 +1,32 @@
+#!/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/b60d2c7d/tools/cartridge-create/init-scripts/php/ec2/stratos-init.sh
----------------------------------------------------------------------
diff --git a/tools/cartridge-create/init-scripts/php/ec2/stratos-init.sh b/tools/cartridge-create/init-scripts/php/ec2/stratos-init.sh
new file mode 100644
index 0000000..aab01ad
--- /dev/null
+++ b/tools/cartridge-create/init-scripts/php/ec2/stratos-init.sh
@@ -0,0 +1,304 @@
+#!/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.
+
+export LOG=/var/log/stratos-cartridge.log
+instance_path=/opt
+PUBLIC_IP=""
+KEY=`uuidgen`
+CRON_DURATION=1
+RETRY_COUNT=30
+SLEEP_DURATION=3
+
+if [ ! -d ${instance_path}/payload ]; then
+
+    echo "creating payload dir ... " >> $LOG
+    mkdir ${instance_path}/payload
+    echo "payload dir created ... " >> $LOG
+    wget http://169.254.169.254/latest/user-data -O ${instance_path}/payload/payload.zip    
+    echo "payload copied  ... "  >> $LOG
+    unzip -d ${instance_path}/payload ${instance_path}/payload/payload.zip
+    echo "unzippeddd..." >> $LOG
+
+    for i in `/usr/bin/ruby /opt/get-launch-params.rb`
+    do
+    echo "exporting to bashrc $i ... " >> $LOG
+        echo "export" ${i} >> /home/ubuntu/.bashrc
+    done
+    source /home/ubuntu/.bashrc
+
+fi
+
+
+echo ---------------------------- >> $LOG
+echo "getting public ip from metadata service" >> $LOG
+
+wget http://169.254.169.254/latest/meta-data/public-ipv4
+files="`cat public-ipv4`"
+if [[ -z ${files} ]]; then
+    echo "getting public ip" >> $LOG
+    for i in {1..30}
+    do
+      rm -f ./public-ipv4
+      wget http://169.254.169.254/latest/meta-data/public-ipv4
+      files="`cat public-ipv4`"
+      if [ -z $files ]; then
+          echo "Public ip is not yet assigned. Wait and continue for $i the time ..." >> $LOG
+          sleep $SLEEP_DURATION
+      else
+          echo "Public ip assigned" >> $LOG
+          break
+      fi
+    done
+
+    if [ -z $files ]; then
+      echo "Public ip is not yet assigned. So exit" >> $LOG
+      exit 0
+    fi
+    for x in $files
+    do
+        PUBLIC_IP="$x"
+    done
+
+
+else 
+   PUBLIC_IP="$files"
+fi
+
+
+for i in `/usr/bin/ruby /opt/get-launch-params.rb`
+do
+    export ${i}
+done
+
+
+cp -f ${instance_path}/payload/ssl-cert-snakeoil.pem /etc/ssl/certs/ssl-cert-snakeoil.pem
+cp -f ${instance_path}/payload/ssl-cert-snakeoil.key /etc/ssl/private/ssl-cert-snakeoil.key
+echo "Restarting apache..." >> $LOG
+
+/etc/init.d/apache2 restart
+
+echo "Apache restarted..." >> $LOG
+
+
+echo "Logging sys variables .. PUBLIC_IP:${PUBLIC_IP}, HOST_NAME:${HOST_NAME}, KEY:${KEY}, PORTS=${PORTS}, BAM:${BAM_IP}, GITREPO:${GIT_REPO}" >> $LOG
+
+mkdir -p  /etc/agent/conf
+
+echo "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:agen=\"http://service.agent.cartridge.stratos.apache.org\">
+  <soapenv:Header/>
+  <soapenv:Body>
+     <agen:register>
+        <registrant> 
+           <alarmingLowerRate>${ALARMING_LOWER_RATE}</alarmingLowerRate>
+           <alarmingUpperRate>${ALARMING_UPPER_RATE}</alarmingUpperRate>
+           <hostName>${HOST_NAME}</hostName>
+           <key>${KEY}</key>
+          <maxInstanceCount>${MAX}</maxInstanceCount>
+	  <maxRequestsPerSecond>${MAX_REQUESTS_PER_SEC}</maxRequestsPerSecond>
+          <minInstanceCount>${MIN}</minInstanceCount> " > /etc/agent/conf/request.xml
+
+IFS='|' read -ra PT <<< "${PORTS}"
+for i in "${PT[@]}"; do
+IFS=':' read -ra PP <<< "$i"
+echo "          <portMappings>
+                        <primaryPort>${PP[1]}</primaryPort>
+                        <proxyPort>${PP[2]}</proxyPort>
+                        <type>${PP[0]}</type>
+                </portMappings>">> /etc/agent/conf/request.xml
+done
+
+echo "          <remoteHost>${PUBLIC_IP}</remoteHost>
+           <service>${SERVICE}</service>
+	   <remoteHost>${PUBLIC_IP}</remoteHost>
+           <roundsToAverage>${ROUNDS_TO_AVERAGE}</roundsToAverage>
+           <scaleDownFactor>${SCALE_DOWN_FACTOR}</scaleDownFactor>
+           <tenantRange>${TENANT_RANGE}</tenantRange>
+        </registrant>
+     </agen:register>
+  </soapenv:Body>
+</soapenv:Envelope>
+" >> /etc/agent/conf/request.xml
+
+echo "Creating repoinfo request  " >> $LOG
+echo "TENANT_ID and SERVICE ${TENANT_ID} and ${SERVICE} " >> $LOG
+set -- "${HOST_NAME}" 
+IFS="."; declare -a Array=($*)
+ALIAS="${Array[0]}"
+echo "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsd=\"http://org.apache.axis2/xsd\">
+   <soapenv:Header/>
+   <soapenv:Body>
+      <xsd:getRepositoryCredentials>
+         <xsd:tenantId>${TENANT_ID}</xsd:tenantId>
+         <xsd:cartridgeType>${SERVICE}</xsd:cartridgeType>
+         <xsd:alias>${ALIAS}</xsd:alias>
+      </xsd:getRepositoryCredentials>
+   </soapenv:Body>
+</soapenv:Envelope>" > /opt/repoinforequest.xml
+
+echo "Repoinfo request created " >> $LOG
+
+echo "Private Key....Copying to .ssh  " >> $LOG
+
+cp ${instance_path}/payload/id_rsa /root/.ssh/id_rsa
+chmod 0600 /root/.ssh/id_rsa
+echo "StrictHostKeyChecking no" >> /root/.ssh/config
+
+
+
+
+#echo "Getting repo username password from repoInfoService" >> $LOG
+#curl -X POST -H "Content-Type: text/xml" -d @/etc/agent/conf/request.xml --silent --output /dev/null "${CARTRIDGE_AGENT_EPR}"
+
+echo "Git repo sync" >> $LOG
+
+# If repo is available do a git pull, else clone
+echo "#!/bin/bash
+if [ -d \"${APP_PATH}/.git\" ]; then
+    cd ${APP_PATH}
+    
+    curl -X POST -H \"Content-Type: text/xml\" -H \"SOAPAction: urn:getRepositoryCredentials\" -d @/opt/repoinforequest.xml --silent  \"${REPO_INFO_EPR}\" --insecure > /tmp/git.xml
+   sed '1,5d' /tmp/git.xml > /tmp/git1.xml
+   sed '2d' /tmp/git1.xml > /tmp/git.xml
+   username=\`xml_grep 'ax29:userName' /tmp/git.xml --text_only\`
+   password=\`xml_grep 'ax29:password' /tmp/git.xml --text_only\`
+   repo=\`xml_grep 'ax29:url' /tmp/git.xml --text_only\`
+   rm /tmp/git1.xml
+   rm /tmp/git.xml
+   url=\`echo \$repo |sed 's/http.*\/\///g' |sed 's/\:.*//g' |sed 's/\/.*//g'\`
+   echo \"machine \${url} login \${username} password \${password}\" > ~/.netrc
+   sudo echo \"machine \${url} login \${username} password \${password}\" > /root/.netrc
+   chmod 600 ~/.netrc
+   sudo chmod 600 /root/.netrc
+   git config --global --bool --add http.sslVerify false
+   sudo git pull
+   rm ~/.netrc
+   sudo rm /root/.netrc
+
+    sudo chown -R www-data:www-data ${APP_PATH}/www
+    if [ -f \"${APP_PATH}/sql/alter.sql\" ]; then
+    	mysql -h ${MYSQL_HOST} -u ${MYSQL_USER} -p${MYSQL_PASSWORD} < ${APP_PATH}/sql/alter.sql
+    fi
+else
+    sudo rm -f ${APP_PATH}/index.html
+   curl -X POST -H \"Content-Type: text/xml\" -H \"SOAPAction: urn:getRepositoryCredentials\" -d @/opt/repoinforequest.xml --silent  \"${REPO_INFO_EPR}\" --insecure > /tmp/git.xml
+   sed '1,5d' /tmp/git.xml > /tmp/git1.xml
+   sed '2d' /tmp/git1.xml > /tmp/git.xml
+   username=\`xml_grep 'ax29:userName' /tmp/git.xml --text_only\`
+   password=\`xml_grep 'ax29:password' /tmp/git.xml --text_only\`
+   repo=\`xml_grep 'ax29:url' /tmp/git.xml --text_only\`
+   rm /tmp/git1.xml
+   rm /tmp/git.xml
+   url=\`echo \$repo |sed 's/http.*\/\///g' |sed 's/\:.*//g' |sed 's/\/.*//g'\`
+   echo \"machine \${url} login \${username} password \${password}\" > ~/.netrc
+   sudo echo \"machine \${url} login \${username} password \${password}\" > /root/.netrc
+   chmod 600 ~/.netrc
+   sudo chmod 600 /root/.netrc
+   git config --global --bool --add http.sslVerify false
+   sudo git clone \${repo} ${APP_PATH}
+   rm ~/.netrc
+   sudo rm /root/.netrc
+ 
+
+    if [ -f \"${APP_PATH}/sql/init.sql\" ]; then
+        mysql -h ${MYSQL_HOST} -u ${MYSQL_USER} -p${MYSQL_PASSWORD} < ${APP_PATH}/sql/init.sql
+    fi
+    echo \"SetEnv STRATOS_MYSQL_USER ${MYSQL_USER}
+    SetEnv STRATOS_MYSQL_HOST ${MYSQL_HOST}
+    SetEnv STRATOS_MYSQL_PASSWORD ${MYSQL_PASSWORD}
+    \" > /tmp/.htaccess
+    sudo mv /tmp/.htaccess ${APP_PATH}/
+    sudo chown -R www-data:www-data ${APP_PATH}/www
+    
+
+
+fi" > /opt/git.sh
+echo "File created.." >> $LOG
+chmod 755 /opt/git.sh
+
+
+
+while true
+do
+var=`nc -z localhost 80; echo $?`;
+if [ $var -eq 0 ]
+   then
+       echo "port 80 is available" >> $LOG
+       break
+   else
+       echo "port 80 is not available" >> $LOG
+   fi
+   sleep 1
+done
+
+
+while true
+do
+var=`nc -z localhost 443; echo $?`;
+if [ $var -eq 0 ]
+   then
+       echo "port 443 is available" >> $LOG
+       break
+   else
+       echo "port 443 is not available" >> $LOG
+   fi
+   sleep 1
+done
+
+
+
+echo "Sending register request to Cartridge agent service" >> $LOG
+
+curl -X POST -H "Content-Type: text/xml" -H "SOAPAction: urn:register" -d @/etc/agent/conf/request.xml -k --silent --output /dev/null "${CARTRIDGE_AGENT_EPR}"
+
+echo "Registered cartridge..." >> $LOG
+
+echo "running git clone........" >> $LOG
+su - ubuntu /opt/git.sh
+
+
+echo "setting up logging conf" >> $LOG
+
+
+echo "host:     ${BAM_IP}
+thriftPort:     ${BAM_PORT}
+
+#cartridge configs
+cartridgeAlias:  ${CARTRIDGE_ALIAS}
+tenantName:      ${HOST_NAME}
+tenantId:        ${TENANT_ID}
+localIP:         ${PUBLIC_IP}" > /opt/cartridge_data_publisher_1.0.2/conf/data_publisher.conf
+
+
+
+echo "started loggin ........."
+cd /opt/cartridge_data_publisher_1.0.2/dist/Debug/GNU-Linux-x86/
+nohup ./cartridge_data_publisher_1.0.2 /var/log/apache2/access.log /var/log/apache2/error.log >> /var/log/startos-data-publisher.log  &
+
+
+
+
+
+# ========================== // End of script ===========================================================

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b60d2c7d/tools/cartridge-create/init-scripts/php/get-launch-params.rb
----------------------------------------------------------------------
diff --git a/tools/cartridge-create/init-scripts/php/get-launch-params.rb b/tools/cartridge-create/init-scripts/php/get-launch-params.rb
new file mode 100644
index 0000000..c6368ca
--- /dev/null
+++ b/tools/cartridge-create/init-scripts/php/get-launch-params.rb
@@ -0,0 +1,55 @@
+#! /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(
+  "/var/lib/cloud/instance/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/b60d2c7d/tools/cartridge-create/init-scripts/php/openstack/get-launch-params.rb
----------------------------------------------------------------------
diff --git a/tools/cartridge-create/init-scripts/php/openstack/get-launch-params.rb b/tools/cartridge-create/init-scripts/php/openstack/get-launch-params.rb
new file mode 100644
index 0000000..c6368ca
--- /dev/null
+++ b/tools/cartridge-create/init-scripts/php/openstack/get-launch-params.rb
@@ -0,0 +1,55 @@
+#! /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(
+  "/var/lib/cloud/instance/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/b60d2c7d/tools/cartridge-create/init-scripts/php/openstack/healthcheck.sh
----------------------------------------------------------------------
diff --git a/tools/cartridge-create/init-scripts/php/openstack/healthcheck.sh b/tools/cartridge-create/init-scripts/php/openstack/healthcheck.sh
new file mode 100644
index 0000000..4194608
--- /dev/null
+++ b/tools/cartridge-create/init-scripts/php/openstack/healthcheck.sh
@@ -0,0 +1,30 @@
+#!/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/b60d2c7d/tools/cartridge-create/init-scripts/php/openstack/stratos-init.sh
----------------------------------------------------------------------
diff --git a/tools/cartridge-create/init-scripts/php/openstack/stratos-init.sh b/tools/cartridge-create/init-scripts/php/openstack/stratos-init.sh
new file mode 100755
index 0000000..503790f
--- /dev/null
+++ b/tools/cartridge-create/init-scripts/php/openstack/stratos-init.sh
@@ -0,0 +1,293 @@
+#!/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.
+
+export LOG=/var/log/stratos-cartridge.log
+instance_path=/var/lib/cloud/instance
+PUBLIC_IP=""
+KEY=`uuidgen`
+CRON_DURATION=1
+RETRY_COUNT=30
+SLEEP_DURATION=3
+ACCESSLOG="/var/log/apache2/access.log"
+ERRORLOG="/var/log/apache2/error.log"
+
+
+if [ ! -d ${instance_path}/payload ]; then
+
+    echo "creating payload dir ... " >> $LOG
+    mkdir ${instance_path}/payload
+    echo "payload dir created ... " >> $LOG
+    cp ${instance_path}/user-data.txt ${instance_path}/payload/user-data.zip
+    echo "payload copied  ... "  >> $LOG
+    unzip -d ${instance_path}/payload ${instance_path}/payload/user-data.zip
+    echo "unzippeddd..." >> $LOG
+
+    for i in `/usr/bin/ruby /opt/get-launch-params.rb`
+    do
+    echo "exporting to bashrc $i ... " >> $LOG
+        echo "export" ${i} >> /home/ubuntu/.bashrc
+    done
+    source /home/ubuntu/.bashrc
+
+fi
+
+
+echo ---------------------------- >> $LOG
+echo "getting public ip from metadata service" >> $LOG
+
+wget http://169.254.169.254/latest/meta-data/public-ipv4
+files="`cat public-ipv4`"
+if [[ -z ${files} ]]; then
+    echo "getting public ip" >> $LOG
+    for i in {1..30}
+    do
+      rm -f ./public-ipv4
+      wget http://169.254.169.254/latest/meta-data/public-ipv4
+      files="`cat public-ipv4`"
+      if [ -z $files ]; then
+          echo "Public ip is not yet assigned. Wait and continue for $i the time ..." >> $LOG
+          sleep $SLEEP_DURATION
+      else
+          echo "Public ip assigned" >> $LOG
+          break
+      fi
+    done
+
+    if [ -z $files ]; then
+      echo "Public ip is not yet assigned. So exit" >> $LOG
+      exit 0
+    fi
+    for x in $files
+    do
+        PUBLIC_IP="$x"
+    done
+
+
+else 
+   PUBLIC_IP="$files"
+fi
+
+
+for i in `/usr/bin/ruby /opt/get-launch-params.rb`
+do
+    export ${i}
+done
+
+
+cp -f ${instance_path}/payload/ssl-cert-snakeoil.pem /etc/ssl/certs/ssl-cert-snakeoil.pem
+cp -f ${instance_path}/payload/ssl-cert-snakeoil.key /etc/ssl/private/ssl-cert-snakeoil.key
+echo "Restarting apache..." >> $LOG
+
+/etc/init.d/apache2 restart
+
+echo "Apache restarted..." >> $LOG
+
+
+echo "Logging sys variables .. PUBLIC_IP:${PUBLIC_IP}, HOST_NAME:${HOST_NAME}, KEY:${KEY}, PORTS=${PORTS}, BAM:${BAM_IP}, GITREPO:${GIT_REPO}" >> $LOG
+
+mkdir -p  /etc/agent/conf
+
+echo "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:agen=\"http://service.agent.cartridge.stratos.apache.org\">
+  <soapenv:Header/>
+  <soapenv:Body>
+     <agen:register>
+        <registrant> 
+           <alarmingLowerRate>${ALARMING_LOWER_RATE}</alarmingLowerRate>
+           <alarmingUpperRate>${ALARMING_UPPER_RATE}</alarmingUpperRate>
+           <hostName>${HOST_NAME}</hostName>
+           <key>${KEY}</key>
+          <maxInstanceCount>${MAX}</maxInstanceCount>
+	  <maxRequestsPerSecond>${MAX_REQUESTS_PER_SEC}</maxRequestsPerSecond>
+          <minInstanceCount>${MIN}</minInstanceCount> " > /etc/agent/conf/request.xml
+
+IFS='|' read -ra PT <<< "${PORTS}"
+for i in "${PT[@]}"; do
+IFS=':' read -ra PP <<< "$i"
+echo "          <portMappings>
+                        <primaryPort>${PP[1]}</primaryPort>
+                        <proxyPort>${PP[2]}</proxyPort>
+                        <type>${PP[0]}</type>
+                </portMappings>">> /etc/agent/conf/request.xml
+done
+
+echo "          <remoteHost>${PUBLIC_IP}</remoteHost>
+           <service>${SERVICE}</service>
+	   <remoteHost>${PUBLIC_IP}</remoteHost>
+           <roundsToAverage>${ROUNDS_TO_AVERAGE}</roundsToAverage>
+           <scaleDownFactor>${SCALE_DOWN_FACTOR}</scaleDownFactor>
+           <tenantRange>${TENANT_RANGE}</tenantRange>
+        </registrant>
+     </agen:register>
+  </soapenv:Body>
+</soapenv:Envelope>
+" >> /etc/agent/conf/request.xml
+
+echo "Creating repoinfo request  " >> $LOG
+echo "TENANT_ID and SERVICE ${TENANT_ID} and ${SERVICE} " >> $LOG
+set -- "${HOST_NAME}" 
+IFS="."; declare -a Array=($*)
+ALIAS="${Array[0]}"
+echo "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsd=\"http://org.apache.axis2/xsd\">
+   <soapenv:Header/>
+   <soapenv:Body>
+      <xsd:getRepositoryCredentials>
+         <xsd:tenantId>${TENANT_ID}</xsd:tenantId>
+         <xsd:cartridgeType>${SERVICE}</xsd:cartridgeType>
+         <xsd:alias>${ALIAS}</xsd:alias>
+      </xsd:getRepositoryCredentials>
+   </soapenv:Body>
+</soapenv:Envelope>" > /opt/repoinforequest.xml
+
+echo "Repoinfo request created " >> $LOG
+
+
+echo "Git repo sync" >> $LOG
+
+# If repo is available do a git pull, else clone
+echo "#!/bin/bash
+if [ -d \"${APP_PATH}/.git\" ]; then
+    cd ${APP_PATH}
+
+    curl -X POST -H \"Content-Type: text/xml\" -H \"SOAPAction: urn:getRepositoryCredentials\" -d @/opt/repoinforequest.xml --silent  \"${REPO_INFO_EPR}\" --insecure > /tmp/git.xml
+   sed '1,5d' /tmp/git.xml > /tmp/git1.xml
+   sed '2d' /tmp/git1.xml > /tmp/git.xml
+   username=\`xml_grep 'ax29:userName' /tmp/git.xml --text_only\`
+   password=\`xml_grep 'ax29:password' /tmp/git.xml --text_only\`
+   repo=\`xml_grep 'ax29:url' /tmp/git.xml --text_only\`
+   rm /tmp/git1.xml
+   rm /tmp/git.xml
+   url=\`echo \$repo |sed 's/http.*\/\///g' |sed 's/\:.*//g' |sed 's/\/.*//g'\`
+   echo \"machine \${url} login \${username} password \${password}\" > ~/.netrc
+   sudo echo \"machine \${url} login \${username} password \${password}\" > /root/.netrc
+   chmod 600 ~/.netrc
+   sudo chmod 600 /root/.netrc
+   git config --global --bool --add http.sslVerify false
+   sudo git pull
+   rm ~/.netrc
+   sudo rm /root/.netrc
+
+    sudo chown -R www-data:www-data ${APP_PATH}/www
+    if [ -f \"${APP_PATH}/sql/alter.sql\" ]; then
+    	mysql -h ${MYSQL_HOST} -u ${MYSQL_USER} -p${MYSQL_PASSWORD} < ${APP_PATH}/sql/alter.sql
+    fi
+else
+    sudo rm -f ${APP_PATH}/index.html
+   curl -X POST -H \"Content-Type: text/xml\" -H \"SOAPAction: urn:getRepositoryCredentials\" -d @/opt/repoinforequest.xml --silent  \"${REPO_INFO_EPR}\" --insecure > /tmp/git.xml
+   sed '1,5d' /tmp/git.xml > /tmp/git1.xml
+   sed '2d' /tmp/git1.xml > /tmp/git.xml
+   username=\`xml_grep 'ax29:userName' /tmp/git.xml --text_only\`
+   password=\`xml_grep 'ax29:password' /tmp/git.xml --text_only\`
+   repo=\`xml_grep 'ax29:url' /tmp/git.xml --text_only\`
+   rm /tmp/git1.xml
+   rm /tmp/git.xml
+   url=\`echo \$repo |sed 's/http.*\/\///g' |sed 's/\:.*//g' |sed 's/\/.*//g'\`
+   echo \"machine \${url} login \${username} password \${password}\" > ~/.netrc
+   sudo echo \"machine \${url} login \${username} password \${password}\" > /root/.netrc
+   chmod 600 ~/.netrc
+   sudo chmod 600 /root/.netrc
+   git config --global --bool --add http.sslVerify false
+   sudo git clone \${repo} ${APP_PATH}
+   rm ~/.netrc
+   sudo rm /root/.netrc
+ 
+
+    if [ -f \"${APP_PATH}/sql/init.sql\" ]; then
+        mysql -h ${MYSQL_HOST} -u ${MYSQL_USER} -p${MYSQL_PASSWORD} < ${APP_PATH}/sql/init.sql
+    fi
+    echo \"SetEnv STRATOS_MYSQL_USER ${MYSQL_USER}
+    SetEnv STRATOS_MYSQL_HOST ${MYSQL_HOST}
+    SetEnv STRATOS_MYSQL_PASSWORD ${MYSQL_PASSWORD}
+    \" > /tmp/.htaccess
+    sudo mv /tmp/.htaccess ${APP_PATH}/
+    sudo chown -R www-data:www-data ${APP_PATH}/www
+    
+
+
+fi" > /opt/git.sh
+echo "File created.." >> $LOG
+chmod 755 /opt/git.sh
+
+
+
+while true
+do
+var=`nc -z localhost 80; echo $?`;
+if [ $var -eq 0 ]
+   then
+       echo "port 80 is available" >> $LOG
+       break
+   else
+       echo "port 80 is not available" >> $LOG
+   fi
+   sleep 1
+done
+
+
+while true
+do
+var=`nc -z localhost 443; echo $?`;
+if [ $var -eq 0 ]
+   then
+       echo "port 443 is available" >> $LOG
+       break
+   else
+       echo "port 443 is not available" >> $LOG
+   fi
+   sleep 1
+done
+
+
+
+echo "Sending register request to Cartridge agent service" >> $LOG
+
+curl -X POST -H "Content-Type: text/xml" -H "SOAPAction: urn:register" -d @/etc/agent/conf/request.xml -k --silent --output /dev/null "${CARTRIDGE_AGENT_EPR}"
+
+echo "Registered cartridge..." >> $LOG
+
+echo "running git clone........" >> $LOG
+su - ubuntu /opt/git.sh
+
+
+echo "setting up logging conf" >> $LOG
+
+
+echo "host:     ${BAM_IP}
+thriftPort:     ${BAM_PORT}
+
+#cartridge configs
+cartridgeAlias:  ${SERVICE}
+tenantName:      ${HOST_NAME}
+tenantId:      ${TENANT_ID}
+localIP:         ${PUBLIC_IP}" > /opt/cartridge_data_publisher_1.0.2/conf/data_publisher.conf
+
+
+echo "started loggin ........."
+cd /opt/cartridge_data_publisher_1.0.2/dist/Debug/GNU-Linux-x86/
+nohup ./cartridge_data_publisher_1.0.2 ${ACCESSLOG} ${ERRORLOG} 2>&1> /dev/null &
+
+echo "logging started........."
+
+# ========================== // End of script ===========================================================

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b60d2c7d/tools/cartridge-create/init-scripts/php/php
----------------------------------------------------------------------
diff --git a/tools/cartridge-create/init-scripts/php/php b/tools/cartridge-create/init-scripts/php/php
new file mode 100644
index 0000000..9fe5339
--- /dev/null
+++ b/tools/cartridge-create/init-scripts/php/php
@@ -0,0 +1,49 @@
+#!/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.
+#
+# ----------------------------------------------------------------------------
+
+INSTANCE=$1
+INSTANCE_USER=$2
+KEY=$3
+SOFTWARE=$4
+
+SCP="scp -i ./$KEY"
+SSH="ssh -i ./$KEY"
+
+$SCP ./openstack/wso2-cartridge-init.sh $INSTANCE_USER@$INSTANCE:
+$SCP ./php.ctrg $INSTANCE_USER@$INSTANCE:
+$SCP ./openstack/get-launch-params.rb $INSTANCE_USER@$INSTANCE:
+$SCP ./cc/ssl-cert-snakeoil.pem $INSTANCE_USER@$INSTANCE:
+$SCP ./cc/ssl-cert-snakeoil.key $INSTANCE_USER@$INSTANCE:
+$SCP ./ $INSTANCE_USER@$INSTANCE:
+$SCP ./thrift-0.8.0.tar.gz $INSTANCE_USER@$INSTANCE:
+$SCP ./default $INSTANCE_USER@$INSTANCE:
+$SCP ./default-ssl $INSTANCE_USER@$INSTANCE:
+
+# Copy additional software
+arr=$(echo $SOFTWARE | tr ":" "\n")
+for x in $arr
+do
+   $SCP $x $INSTANCE_USER@$INSTANCE:
+done
+
+# Execute the cartridge creation process in the remoter server
+$SSH $INSTANCE_USER@$INSTANCE "sudo chmod 755 ./php.ctrg;sudo ./php.ctrg"

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b60d2c7d/tools/cartridge-create/init-scripts/php/php.ctrg
----------------------------------------------------------------------
diff --git a/tools/cartridge-create/init-scripts/php/php.ctrg b/tools/cartridge-create/init-scripts/php/php.ctrg
new file mode 100644
index 0000000..cbaf639
--- /dev/null
+++ b/tools/cartridge-create/init-scripts/php/php.ctrg
@@ -0,0 +1,65 @@
+#!/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.
+#
+# ----------------------------------------------------------------------------
+
+    mv ./wso2-cartridge-init.sh /opt/
+    mv ./get-launch-params.rb /opt/
+    mv ./ssl-cert-snakeoil.pem /etc/ssl/certs/
+    mv ./ssl-cert-snakeoil.key /etc/ssl/private/
+    mv ./cartridge_data_publisher_1.0.2.zip /opt/
+    mv ./thrift-0.8.0.tar.gz /opt/
+    mv ./*.tar.gz /opt/
+    mv ./*.zip /opt/
+    cp -f ./default /etc/apache2/sites-available/
+    cp -f ./default-ssl /etc/apache2/sites-available/
+    rm ./default
+    rm ./default-ssl
+    
+
+	apt-get update
+	# Next, all the packages.
+	
+	apt-get install -y \
+	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-intl php5-sqlite php5-xmlrpc php5-xsl \
+	openssl ssl-cert ldap-utils php5-mcrypt mcrypt ufw fail2ban git libboost-all-dev ruby xml-twig-tools
+
+    # Install the thrift library
+    tar -zxf /opt/thrift-0.8.0.tar.gz -C/opt
+    cd /opt/thrift-0.8.0
+    ./configure --libdir=/usr/lib;make;make install
+    cd /opt
+    unzip cartridge_data_publisher_1.0.2.zip
+    cd /opt/cartridge_data_publisher_1.0.2
+    make
+
+
+	# Enable HTTPS:
+	a2enmod ssl
+	a2ensite default-ssl	
+
+    echo "#!/bin/bash -e
+chmod 755 /opt/wso2-cartridge-init.sh
+/opt/wso2-cartridge-init.sh > /var/log/wso2-cartridge-init.log
+exit 0
+    " > /etc/rc.local
+
+

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b60d2c7d/tools/cartridge-create/init-scripts/php/thrift-0.8.0.tar.gz
----------------------------------------------------------------------
diff --git a/tools/cartridge-create/init-scripts/php/thrift-0.8.0.tar.gz b/tools/cartridge-create/init-scripts/php/thrift-0.8.0.tar.gz
new file mode 100644
index 0000000..46a1a23
Binary files /dev/null and b/tools/cartridge-create/init-scripts/php/thrift-0.8.0.tar.gz differ

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b60d2c7d/tools/cartridge-create/init-scripts/php/wso2.pem
----------------------------------------------------------------------
diff --git a/tools/cartridge-create/init-scripts/php/wso2.pem b/tools/cartridge-create/init-scripts/php/wso2.pem
new file mode 100644
index 0000000..f4260f9
--- /dev/null
+++ b/tools/cartridge-create/init-scripts/php/wso2.pem
@@ -0,0 +1,16 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIICXQIBAAKBgQCp31ZRD9kPwKoxW3sh+4x2IfldCKEfHbo18LhvOnGPJcNzqHDy
+6WWxpxPAHNAMyvrAv+hUfX4fwSRctieTim0N+fTr+mRP0q4HHhEkvEmxoXs4Y7lz
+jrh5vhMBZBAXsSurHVp2Bpie1xyjW+ksuAziT2gw6KvipjJiGTjuLTnLmQIDAQAB
+AoGAMFvtNbx+PbbKfKyfXChBb2vykmKfg70xwqNZzghkRa0pfCaKqQx6r91xiPJq
+5Alw4yh+2nazThTs5hvRHnZ83tPFxKyekrOdFpFEwAdibmvM3ckfAmUqJErteFhp
+o524O37kWpzwBgk1rxwLHVxyoscVHF8vWSjk9jzvdor9XbUCQQDdPp+F/X5qQLZw
+xaYyHrWmLkRnFRaxxmiOQmvAxYKybMp0Ei8euy+wKHiNPBVPxn143hrag7a2GKIn
+hq6LwoiHAkEAxI7GYK47woZJHI6rjskjxT+DBNKjTmoDZVTa4KrWUVY1NfTC+/jI
+Ajm3cQ1QYnGEYyvlczgD3jvRdDtjJjGy3wJAV4JnkpX7pIdIIj7rR7PB4aM3Rxae
+TV7PCEXZXPxCf9RsF5EBtkQPzruTQznarB00j9Q6BuhGIqyHpt6st3cQjQJBAKtf
+oG7i+o+b7VrMuZ+Al4N+4Ijv7hqMK/HJjhycVsgL1dD5Wpe+TQRDtkEHTrLGLpsY
+xrEygYzdsr0YmlXOtxkCQQC46OoYuk/bZhp1gnFNtWXp73ZESphNOC/FovNKu5Os
+fbxKoqUbosXAi6wxuU1L+eojN0UNx98xyKjG/lyUog/m
+-----END RSA PRIVATE KEY-----
+

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b60d2c7d/tools/cartridge-create/init-scripts/php/x.sh
----------------------------------------------------------------------
diff --git a/tools/cartridge-create/init-scripts/php/x.sh b/tools/cartridge-create/init-scripts/php/x.sh
new file mode 100644
index 0000000..1f42589
--- /dev/null
+++ b/tools/cartridge-create/init-scripts/php/x.sh
@@ -0,0 +1,50 @@
+#!/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.
+#
+#
+LOG=/tmp/me.log
+CARTRIDGE_AGENT_EPR="http://localhost/me.html"
+echo "Sending register request to Cartridge agent service\n" > $LOG
+for i in {1..2}
+do
+    #curl --write-out "%{http_code}\n" --silent --output /dev/null $CARTRIDGE_AGENT_EPR
+    curl -X POST -H "Content-Type: text/xml" -d @/tmp/request.xml --silent --output /dev/null "$CARTRIDGE_AGENT_EPR"
+    ret=$?
+    echo "return value:$ret" > $LOG
+    if [[ $ret -eq 2  ]]; then
+        echo "[curl] Failed to initialize" >> $LOG
+    fi
+    if [[ $ret -eq 5 || $ret -eq 6 || $ret -eq 7  ]]; then
+        echo "[curl] Resolving host failed" >> $LOG
+    fi
+    if [[ $ret -eq 28 ]]; then
+        echo "[curl] Operation timeout" >> $LOG
+    fi
+    if [[ $ret -eq 55 || $ret -eq 56 ]]; then
+        echo "[curl] Failed sending/receiving network data" >> $LOG
+    fi
+    if [[ $ret -eq 28 ]]; then
+        echo "Operation timeout" >> $LOG
+    fi
+done
+if [[ $ret -gt 0 ]]; then
+    echo "Sending cluster join message failed. So shutdown instance and exit" >> $LOG
+    exit 0
+fi

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b60d2c7d/tools/cartridge-create/init-scripts/php/y.sh
----------------------------------------------------------------------
diff --git a/tools/cartridge-create/init-scripts/php/y.sh b/tools/cartridge-create/init-scripts/php/y.sh
new file mode 100644
index 0000000..a786460
--- /dev/null
+++ b/tools/cartridge-create/init-scripts/php/y.sh
@@ -0,0 +1,32 @@
+#!/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.
+#
+#
+LOG=/tmp/me.log
+CARTRIDGE_AGENT_EPR="http://localhost/me.html"
+echo "Sending register request to Cartridge agent service\n" > $LOG
+for i in {1..1}
+do
+    ret=`curl --write-out "%{http_code}\n" --silent --output /dev/null $CARTRIDGE_AGENT_EPR`
+    echo "return value:$ret" > $LOG
+    #if [[ $ret -eq 2  ]]; then
+    #    echo "[curl] Failed to initialize" >> $LOG
+    #fi
+done

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b60d2c7d/tools/cartridge-create/init-scripts/tomcat/get-launch-params.rb
----------------------------------------------------------------------
diff --git a/tools/cartridge-create/init-scripts/tomcat/get-launch-params.rb b/tools/cartridge-create/init-scripts/tomcat/get-launch-params.rb
new file mode 100644
index 0000000..0948d6a
--- /dev/null
+++ b/tools/cartridge-create/init-scripts/tomcat/get-launch-params.rb
@@ -0,0 +1,53 @@
+#! /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(
+  "/var/lib/cloud/instance/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/b60d2c7d/tools/cartridge-create/init-scripts/tomcat/openstack/get-launch-params.rb
----------------------------------------------------------------------
diff --git a/tools/cartridge-create/init-scripts/tomcat/openstack/get-launch-params.rb b/tools/cartridge-create/init-scripts/tomcat/openstack/get-launch-params.rb
new file mode 100644
index 0000000..c6368ca
--- /dev/null
+++ b/tools/cartridge-create/init-scripts/tomcat/openstack/get-launch-params.rb
@@ -0,0 +1,55 @@
+#! /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(
+  "/var/lib/cloud/instance/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/b60d2c7d/tools/cartridge-create/init-scripts/tomcat/openstack/healthcheck.sh
----------------------------------------------------------------------
diff --git a/tools/cartridge-create/init-scripts/tomcat/openstack/healthcheck.sh b/tools/cartridge-create/init-scripts/tomcat/openstack/healthcheck.sh
new file mode 100644
index 0000000..27ab926
--- /dev/null
+++ b/tools/cartridge-create/init-scripts/tomcat/openstack/healthcheck.sh
@@ -0,0 +1,30 @@
+#!/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 8080; echo $?`;
+if [ $var -eq 0 ]
+then
+    echo "port 8080 is available" > /dev/null 2>&1
+else
+    echo "port 8080 is not available" > /dev/null 2>&1
+    /etc/init.d/apache2 restart
+fi

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b60d2c7d/tools/cartridge-create/init-scripts/tomcat/openstack/stratos-init.sh
----------------------------------------------------------------------
diff --git a/tools/cartridge-create/init-scripts/tomcat/openstack/stratos-init.sh b/tools/cartridge-create/init-scripts/tomcat/openstack/stratos-init.sh
new file mode 100755
index 0000000..ba30b44
--- /dev/null
+++ b/tools/cartridge-create/init-scripts/tomcat/openstack/stratos-init.sh
@@ -0,0 +1,289 @@
+#!/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.
+
+export LOG=/var/log/stratos-cartridge.log
+instance_path=/var/lib/cloud/instance
+PUBLIC_IP=""
+KEY=`uuidgen`
+CRON_DURATION=1
+RETRY_COUNT=30
+SLEEP_DURATION=3
+
+if [ ! -d ${instance_path}/payload ]; then
+
+    echo "creating payload dir ... " >> $LOG
+    mkdir ${instance_path}/payload
+    echo "payload dir created ... " >> $LOG
+    cp ${instance_path}/user-data.txt ${instance_path}/payload/user-data.zip
+    echo "payload copied  ... "  >> $LOG
+    unzip -d ${instance_path}/payload ${instance_path}/payload/user-data.zip
+    echo "unzippeddd..." >> $LOG
+
+    for i in `/usr/bin/ruby /opt/get-launch-params.rb`
+    do
+    echo "exporting to bashrc $i ... " >> $LOG
+        echo "export" ${i} >> /home/ubuntu/.bashrc
+    done
+    source /home/ubuntu/.bashrc
+
+fi
+
+
+echo ---------------------------- >> $LOG
+echo "getting public ip from metadata service" >> $LOG
+
+wget http://169.254.169.254/latest/meta-data/public-ipv4
+files="`cat public-ipv4`"
+if [[ -z ${files} ]]; then
+    echo "getting public ip" >> $LOG
+    for i in {1..30}
+    do
+      rm -f ./public-ipv4
+      wget http://169.254.169.254/latest/meta-data/public-ipv4
+      files="`cat public-ipv4`"
+      if [ -z $files ]; then
+          echo "Public ip is not yet assigned. Wait and continue for $i the time ..." >> $LOG
+          sleep $SLEEP_DURATION
+      else
+          echo "Public ip assigned" >> $LOG
+          break
+      fi
+    done
+
+    if [ -z $files ]; then
+      echo "Public ip is not yet assigned. So exit" >> $LOG
+      exit 0
+    fi
+    for x in $files
+    do
+        PUBLIC_IP="$x"
+    done
+
+
+else 
+   PUBLIC_IP="$files"
+fi
+
+
+for i in `/usr/bin/ruby /opt/get-launch-params.rb`
+do
+    export ${i}
+done
+
+
+echo "Restarting apache..." >> $LOG
+
+/etc/init.d/apache2 restart
+
+echo "Apache restarted..." >> $LOG
+
+
+echo "Logging sys variables .. PUBLIC_IP:${PUBLIC_IP}, HOST_NAME:${HOST_NAME}, KEY:${KEY}, PORTS=${PORTS}, BAM:${BAM_IP}, GITREPO:${GIT_REPO}" >> $LOG
+
+mkdir -p  /etc/agent/conf
+
+echo "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:agen=\"http://service.agent.cartridge.stratos.apache.org\">
+  <soapenv:Header/>
+  <soapenv:Body>
+     <agen:register>
+        <registrant> 
+           <alarmingLowerRate>${ALARMING_LOWER_RATE}</alarmingLowerRate>
+           <alarmingUpperRate>${ALARMING_UPPER_RATE}</alarmingUpperRate>
+           <hostName>${HOST_NAME}</hostName>
+           <key>${KEY}</key>
+          <maxInstanceCount>${MAX}</maxInstanceCount>
+	  <maxRequestsPerSecond>${MAX_REQUESTS_PER_SEC}</maxRequestsPerSecond>
+          <minInstanceCount>${MIN}</minInstanceCount> " > /etc/agent/conf/request.xml
+
+IFS='|' read -ra PT <<< "${PORTS}"
+for i in "${PT[@]}"; do
+IFS=':' read -ra PP <<< "$i"
+echo "          <portMappings>
+                        <primaryPort>${PP[1]}</primaryPort>
+                        <proxyPort>${PP[2]}</proxyPort>
+                        <type>${PP[0]}</type>
+                </portMappings>">> /etc/agent/conf/request.xml
+done
+
+echo "          <remoteHost>${PUBLIC_IP}</remoteHost>
+           <service>${SERVICE}</service>
+	   <remoteHost>${PUBLIC_IP}</remoteHost>
+           <roundsToAverage>${ROUNDS_TO_AVERAGE}</roundsToAverage>
+           <scaleDownFactor>${SCALE_DOWN_FACTOR}</scaleDownFactor>
+           <tenantRange>${TENANT_RANGE}</tenantRange>
+        </registrant>
+     </agen:register>
+  </soapenv:Body>
+</soapenv:Envelope>
+" >> /etc/agent/conf/request.xml
+
+echo "Creating repoinfo request  " >> $LOG
+echo "TENANT_ID and SERVICE ${TENANT_ID} and ${SERVICE} " >> $LOG
+set -- "${HOST_NAME}" 
+IFS="."; declare -a Array=($*)
+ALIAS="${Array[0]}"
+echo "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsd=\"http://org.apache.axis2/xsd\">
+   <soapenv:Header/>
+   <soapenv:Body>
+      <xsd:getRepositoryCredentials>
+         <xsd:tenantId>${TENANT_ID}</xsd:tenantId>
+         <xsd:cartridgeType>${SERVICE}</xsd:cartridgeType>
+         <xsd:alias>${ALIAS}</xsd:alias>
+      </xsd:getRepositoryCredentials>
+   </soapenv:Body>
+</soapenv:Envelope>" > /opt/repoinforequest.xml
+
+echo "Repoinfo request created " >> $LOG
+
+echo "Private Key....Copying to .ssh  " >> $LOG
+
+cp ${instance_path}/payload/id_rsa /root/.ssh/id_rsa
+chmod 0600 /root/.ssh/id_rsa
+echo "StrictHostKeyChecking no" >> /root/.ssh/config
+
+
+
+
+#echo "Getting repo username password from repoInfoService" >> $LOG
+#curl -X POST -H "Content-Type: text/xml" -d @/etc/agent/conf/request.xml --silent --output /dev/null "${CARTRIDGE_AGENT_EPR}"
+
+echo "Git repo sync" >> $LOG
+
+# If repo is available do a git pull, else clone
+
+echo "#!/bin/bash
+if [ -d \"${APP_PATH}/.git\" ]; then
+    cd ${APP_PATH}
+
+    curl -X POST -H \"Content-Type: text/xml\" -H \"SOAPAction: urn:getRepositoryCredentials\" -d @/opt/repoinforequest.xml --silent  \"${REPO_INFO_EPR}\" --insecure > /tmp/git.xml
+   sed '1,5d' /tmp/git.xml > /tmp/git1.xml
+   sed '2d' /tmp/git1.xml > /tmp/git.xml
+   username=\`xml_grep 'ax29:userName' /tmp/git.xml --text_only\`
+   password=\`xml_grep 'ax29:password' /tmp/git.xml --text_only\`
+   repo=\`xml_grep 'ax29:url' /tmp/git.xml --text_only\`
+   rm /tmp/git1.xml
+   rm /tmp/git.xml
+   url=\`echo \$repo |sed 's/http.*\/\///g' |sed 's/\:.*//g' |sed 's/\/.*//g'\`
+   echo \"machine \${url} login \${username} password \${password}\" > ~/.netrc
+   sudo echo \"machine \${url} login \${username} password \${password}\" > /root/.netrc
+   chmod 600 ~/.netrc
+   sudo chmod 600 /root/.netrc
+   git config --global --bool --add http.sslVerify false
+   sudo git pull
+   rm ~/.netrc
+   sudo rm /root/.netrc
+
+else
+   curl -X POST -H \"Content-Type: text/xml\" -H \"SOAPAction: urn:getRepositoryCredentials\" -d @/opt/repoinforequest.xml --silent  \"${REPO_INFO_EPR}\" --insecure > /tmp/git.xml
+   sed '1,5d' /tmp/git.xml > /tmp/git1.xml
+   sed '2d' /tmp/git1.xml > /tmp/git.xml
+   username=\`xml_grep 'ax29:userName' /tmp/git.xml --text_only\`
+   password=\`xml_grep 'ax29:password' /tmp/git.xml --text_only\`
+   repo=\`xml_grep 'ax29:url' /tmp/git.xml --text_only\`
+   rm /tmp/git1.xml
+   rm /tmp/git.xml
+   url=\`echo \$repo |sed 's/http.*\/\///g' |sed 's/\:.*//g' |sed 's/\/.*//g'\`
+   echo \"machine \${url} login \${username} password \${password}\" > ~/.netrc
+   sudo echo \"machine \${url} login \${username} password \${password}\" > /root/.netrc
+   chmod 600 ~/.netrc
+   sudo chmod 600 /root/.netrc
+    git config --global --bool --add http.sslVerify false
+    cd ${APP_PATH}
+    sudo mv ROOT ../
+    sudo git clone \${repo} ${APP_PATH}
+    sudo mv ../ROOT .
+   rm ~/.netrc
+   sudo rm /root/.netrc
+ 
+
+fi" > /opt/git.sh
+echo "File created.." >> $LOG
+chmod 755 /opt/git.sh
+                       
+
+
+while true
+do
+var=`nc -z localhost 8080; echo $?`;
+if [ $var -eq 0 ]
+   then
+       echo "port 8080 is available" >> $LOG
+       break
+   else
+       echo "port 8080 is not available" >> $LOG
+   fi
+   sleep 1
+done
+
+
+while true
+do
+var=`nc -z localhost 8443; echo $?`;
+if [ $var -eq 0 ]
+   then
+       echo "port 8443 is available" >> $LOG
+       break
+   else
+       echo "port 8443 is not available" >> $LOG
+   fi
+   sleep 1
+done
+
+
+
+echo "Sending register request to Cartridge agent service" >> $LOG
+
+curl -X POST -H "Content-Type: text/xml" -H "SOAPAction: urn:register" -d @/etc/agent/conf/request.xml -k --silent --output /dev/null "${CARTRIDGE_AGENT_EPR}"
+
+echo "Registered cartridge..." >> $LOG
+
+echo "running git clone........" >> $LOG
+su - ubuntu /opt/git.sh
+
+
+echo "setting up logging conf" >> $LOG
+
+
+echo "host:     ${BAM_IP}
+thriftPort:     ${BAM_PORT}
+
+#cartridge configs
+cartridgeAlias:  ${CARTRIDGE_ALIAS}
+tenantName:      ${HOST_NAME}
+tenantId:        ${TENANT_ID}
+localIP:         ${PUBLIC_IP}" > /opt/cartridge_data_publisher_1.0.2/conf/data_publisher.conf
+
+
+
+echo "started loggin ........."
+cd /opt/cartridge_data_publisher_1.0.2/dist/Debug/GNU-Linux-x86/
+nohup ./cartridge_data_publisher_1.0.2 /var/lib/tomcat7/logs/catalina.out >> /var/log/stratos-data-publisher.log  &
+
+echo "logging started........."
+
+
+# ========================== // End of script ===========================================================
+

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b60d2c7d/tools/cartridge-create/init-scripts/tomcat/payload/README
----------------------------------------------------------------------
diff --git a/tools/cartridge-create/init-scripts/tomcat/payload/README b/tools/cartridge-create/init-scripts/tomcat/payload/README
new file mode 100644
index 0000000..0e6c864
--- /dev/null
+++ b/tools/cartridge-create/init-scripts/tomcat/payload/README
@@ -0,0 +1,21 @@
+This folder is a sample payload sent to a php instance when it is created.
+
+
+Replace the values in launch_params file with correct values of your environment.
+
+Now pack this payload as payload.zip and pass this when creating php instances.
+
+
+Following is the /etc/rc.local file of the php instance
+
+#!/bin/sh -e
+/opt/wso2-openstack-init.sh > /var/log/wso2-openstack-init.log
+exit 0
+
+By the time rc.local file is invokded in the newly created tomcat instance, the payload is already
+passed to the instance and reside in /var/lib/cloud/instance/payload
+
+You can see that rc.local invoke the wso2-openstack-init.sh script in the payload.
+
+
+

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b60d2c7d/tools/cartridge-create/init-scripts/tomcat/payload/launch-params
----------------------------------------------------------------------
diff --git a/tools/cartridge-create/init-scripts/tomcat/payload/launch-params b/tools/cartridge-create/init-scripts/tomcat/payload/launch-params
new file mode 100644
index 0000000..70eda77
--- /dev/null
+++ b/tools/cartridge-create/init-scripts/tomcat/payload/launch-params
@@ -0,0 +1,18 @@
+# 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.
+
+TENANT=1,SVNPASS=g,SVNURL=http://11.0.0.1:80/svn,APP=tomcat7

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b60d2c7d/tools/cartridge-create/init-scripts/tomcat/stratos-init.sh
----------------------------------------------------------------------
diff --git a/tools/cartridge-create/init-scripts/tomcat/stratos-init.sh b/tools/cartridge-create/init-scripts/tomcat/stratos-init.sh
new file mode 100644
index 0000000..0495b7b
--- /dev/null
+++ b/tools/cartridge-create/init-scripts/tomcat/stratos-init.sh
@@ -0,0 +1,274 @@
+#!/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 LOG=/var/log/stratos-init.log
+instance_path=/opt
+PUBLIC_IP=""
+KEY=`uuidgen`
+CRON_DURATION=1
+RETRY_COUNT=30
+SLEEP_DURATION=3
+
+if [ ! -d ${instance_path}/payload ]; then
+
+    echo "creating payload dir ... " >> $LOG
+    mkdir ${instance_path}/payload
+    echo "payload dir created ... " >> $LOG
+    wget http://169.254.169.254/latest/user-data -O ${instance_path}/payload/payload.zip    
+    echo "payload copied  ... "  >> $LOG
+    unzip -d ${instance_path}/payload ${instance_path}/payload/payload.zip
+    echo "unzippeddd..." >> $LOG
+
+    for i in `/usr/bin/ruby /opt/get-launch-params.rb`
+    do
+    echo "exporting to bashrc $i ... " >> $LOG
+        echo "export" ${i} >> /home/ubuntu/.bashrc
+    done
+    source /home/ubuntu/.bashrc
+
+fi
+
+
+echo ---------------------------- >> $LOG
+echo "getting public ip from metadata service" >> $LOG
+
+wget http://169.254.169.254/latest/meta-data/public-ipv4
+files="`cat public-ipv4`"
+if [[ -z ${files} ]]; then
+    echo "getting public ip" >> $LOG
+    for i in {1..30}
+    do
+      rm -f ./public-ipv4
+      wget http://169.254.169.254/latest/meta-data/public-ipv4
+      files="`cat public-ipv4`"
+      if [ -z $files ]; then
+          echo "Public ip is not yet assigned. Wait and continue for $i the time ..." >> $LOG
+          sleep $SLEEP_DURATION
+      else
+          echo "Public ip assigned" >> $LOG
+          break
+      fi
+    done
+
+    if [ -z $files ]; then
+      echo "Public ip is not yet assigned. So exit" >> $LOG
+      exit 0
+    fi
+    for x in $files
+    do
+        PUBLIC_IP="$x"
+    done
+
+
+else 
+   PUBLIC_IP="$files"
+fi
+
+
+for i in `/usr/bin/ruby /opt/get-launch-params.rb`
+do
+    export ${i}
+done
+
+
+echo "Restarting apache..." >> $LOG
+
+/etc/init.d/apache2 restart
+
+echo "Apache restarted..." >> $LOG
+
+
+echo "Logging sys variables .. PUBLIC_IP:${PUBLIC_IP}, HOST_NAME:${HOST_NAME}, KEY:${KEY}, PORTS=${PORTS}, BAM:${BAM_IP}, GITREPO:${GIT_REPO}" >> $LOG
+
+mkdir -p  /etc/agent/conf
+
+echo "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:agen=\"http://service.agent.cartridge.stratos.apache.org\">
+  <soapenv:Header/>
+  <soapenv:Body>
+     <agen:register>
+        <registrant> 
+           <alarmingLowerRate>${ALARMING_LOWER_RATE}</alarmingLowerRate>
+           <alarmingUpperRate>${ALARMING_UPPER_RATE}</alarmingUpperRate>
+           <hostName>${HOST_NAME}</hostName>
+           <key>${KEY}</key>
+          <maxInstanceCount>${MAX}</maxInstanceCount>
+	  <maxRequestsPerSecond>${MAX_REQUESTS_PER_SEC}</maxRequestsPerSecond>
+          <minInstanceCount>${MIN}</minInstanceCount> " > /etc/agent/conf/request.xml
+
+IFS='|' read -ra PT <<< "${PORTS}"
+for i in "${PT[@]}"; do
+IFS=':' read -ra PP <<< "$i"
+echo "          <portMappings>
+                        <primaryPort>${PP[1]}</primaryPort>
+                        <proxyPort>${PP[2]}</proxyPort>
+                        <type>${PP[0]}</type>
+                </portMappings>">> /etc/agent/conf/request.xml
+done
+
+echo "          <remoteHost>${PUBLIC_IP}</remoteHost>
+           <service>${SERVICE}</service>
+	   <remoteHost>${PUBLIC_IP}</remoteHost>
+           <roundsToAverage>${ROUNDS_TO_AVERAGE}</roundsToAverage>
+           <scaleDownFactor>${SCALE_DOWN_FACTOR}</scaleDownFactor>
+           <tenantRange>${TENANT_RANGE}</tenantRange>
+        </registrant>
+     </agen:register>
+  </soapenv:Body>
+</soapenv:Envelope>
+" >> /etc/agent/conf/request.xml
+
+echo "Creating repoinfo request  " >> $LOG
+echo "TENANT_ID and SERVICE ${TENANT_ID} and ${SERVICE} " >> $LOG
+set -- "${HOST_NAME}" 
+IFS="."; declare -a Array=($*)
+ALIAS="${Array[0]}"
+echo "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsd=\"http://org.apache.axis2/xsd\">
+   <soapenv:Header/>
+   <soapenv:Body>
+      <xsd:getRepositoryCredentials>
+         <xsd:tenantId>${TENANT_ID}</xsd:tenantId>
+         <xsd:cartridgeType>${SERVICE}</xsd:cartridgeType>
+         <xsd:alias>${ALIAS}</xsd:alias>
+      </xsd:getRepositoryCredentials>
+   </soapenv:Body>
+</soapenv:Envelope>" > /opt/repoinforequest.xml
+
+echo "Repoinfo request created " >> $LOG
+
+echo "Private Key....Copying to .ssh  " >> $LOG
+
+cp ${instance_path}/payload/id_rsa /root/.ssh/id_rsa
+chmod 0600 /root/.ssh/id_rsa
+echo "StrictHostKeyChecking no" >> /root/.ssh/config
+
+
+
+
+#echo "Getting repo username password from repoInfoService" >> $LOG
+#curl -X POST -H "Content-Type: text/xml" -d @/etc/agent/conf/request.xml --silent --output /dev/null "${CARTRIDGE_AGENT_EPR}"
+
+echo "Git repo sync" >> $LOG
+
+# If repo is available do a git pull, else clone
+
+echo "#!/bin/bash
+if [ -d \"${APP_PATH}/.git\" ]; then
+    cd ${APP_PATH}
+    
+    curl -X POST -H \"Content-Type: text/xml\" -H \"SOAPAction: urn:getRepositoryCredentials\" -d @/opt/repoinforequest.xml --silent  \"${REPO_INFO_EPR}\" --insecure > /tmp/git.xml
+   sed '1,5d' /tmp/git.xml > /tmp/git1.xml
+   sed '2d' /tmp/git1.xml > /tmp/git.xml
+   username=\`xml_grep 'ax29:userName' /tmp/git.xml --text_only\`
+   password=\`xml_grep 'ax29:password' /tmp/git.xml --text_only\`
+   repo=\`xml_grep 'ax29:url' /tmp/git.xml --text_only\`
+   rm /tmp/git1.xml
+   rm /tmp/git.xml
+   url=\`echo \$repo |sed 's/http.*\/\///g' |sed 's/\:.*//g' |sed 's/\/.*//g'\`
+   echo \"machine \${url} login \${username} password \${password}\" > ~/.netrc
+   sudo echo \"machine \${url} login \${username} password \${password}\" > /root/.netrc
+   chmod 600 ~/.netrc
+   sudo chmod 600 /root/.netrc
+   git config --global --bool --add http.sslVerify false
+   sudo git pull
+   rm ~/.netrc
+   sudo rm /root/.netrc
+
+else
+   curl -X POST -H \"Content-Type: text/xml\" -H \"SOAPAction: urn:getRepositoryCredentials\" -d @/opt/repoinforequest.xml --silent  \"${REPO_INFO_EPR}\" --insecure > /tmp/git.xml
+   sed '1,5d' /tmp/git.xml > /tmp/git1.xml
+   sed '2d' /tmp/git1.xml > /tmp/git.xml
+   username=\`xml_grep 'ax29:userName' /tmp/git.xml --text_only\`
+   password=\`xml_grep 'ax29:password' /tmp/git.xml --text_only\`
+   repo=\`xml_grep 'ax29:url' /tmp/git.xml --text_only\`
+   rm /tmp/git1.xml
+   rm /tmp/git.xml
+   url=\`echo \$repo |sed 's/http.*\/\///g' |sed 's/\:.*//g' |sed 's/\/.*//g'\`
+   echo \"machine \${url} login \${username} password \${password}\" > ~/.netrc
+   sudo echo \"machine \${url} login \${username} password \${password}\" > /root/.netrc
+   chmod 600 ~/.netrc
+   sudo chmod 600 /root/.netrc
+    git config --global --bool --add http.sslVerify false
+    cd ${APP_PATH}
+    sudo mv ROOT ../
+    sudo git clone \${repo} ${APP_PATH}
+    sudo mv ../ROOT .
+   rm ~/.netrc
+   sudo rm /root/.netrc
+ 
+
+fi" > /opt/git.sh
+echo "File created.." >> $LOG
+chmod 755 /opt/git.sh
+                       
+
+
+while true
+do
+var=`nc -z localhost 8080; echo $?`;
+if [ $var -eq 0 ]
+   then
+       echo "port 8080 is available" >> $LOG
+       break
+   else
+       echo "port 8080 is not available" >> $LOG
+   fi
+   sleep 1
+done
+
+
+
+
+
+echo "Sending register request to Cartridge agent service" >> $LOG
+
+curl -X POST -H "Content-Type: text/xml" -H "SOAPAction: urn:register" -d @/etc/agent/conf/request.xml -k --silent --output /dev/null "${CARTRIDGE_AGENT_EPR}"
+
+echo "Registered cartridge..." >> $LOG
+
+echo "running git clone........" >> $LOG
+su - ubuntu /opt/git.sh
+
+
+echo "setting up logging conf" >> $LOG
+
+
+echo "host:     ${BAM_IP}
+thriftPort:     ${BAM_PORT}
+
+#cartridge configs
+cartridgeAlias:  ${CARTRIDGE_ALIAS}
+tenantName:      ${HOST_NAME}
+tenantId:        ${TENANT_ID}
+localIP:         ${PUBLIC_IP}" > /opt/cartridge_data_publisher_1.0.2/conf/data_publisher.conf
+
+
+
+echo "started loggin ........."
+cd /opt/cartridge_data_publisher_1.0.2/dist/Debug/GNU-Linux-x86/
+nohup ./cartridge_data_publisher_1.0.2 /var/lib/tomcat7/logs/catalina.out >> /var/log/stratos-data-publisher.log  &
+
+
+
+
+
+# ========================== // End of script ===========================================================

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b60d2c7d/tools/cartridge-create/init-scripts/tomcat/stratos.pem
----------------------------------------------------------------------
diff --git a/tools/cartridge-create/init-scripts/tomcat/stratos.pem b/tools/cartridge-create/init-scripts/tomcat/stratos.pem
new file mode 100644
index 0000000..f4260f9
--- /dev/null
+++ b/tools/cartridge-create/init-scripts/tomcat/stratos.pem
@@ -0,0 +1,16 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIICXQIBAAKBgQCp31ZRD9kPwKoxW3sh+4x2IfldCKEfHbo18LhvOnGPJcNzqHDy
+6WWxpxPAHNAMyvrAv+hUfX4fwSRctieTim0N+fTr+mRP0q4HHhEkvEmxoXs4Y7lz
+jrh5vhMBZBAXsSurHVp2Bpie1xyjW+ksuAziT2gw6KvipjJiGTjuLTnLmQIDAQAB
+AoGAMFvtNbx+PbbKfKyfXChBb2vykmKfg70xwqNZzghkRa0pfCaKqQx6r91xiPJq
+5Alw4yh+2nazThTs5hvRHnZ83tPFxKyekrOdFpFEwAdibmvM3ckfAmUqJErteFhp
+o524O37kWpzwBgk1rxwLHVxyoscVHF8vWSjk9jzvdor9XbUCQQDdPp+F/X5qQLZw
+xaYyHrWmLkRnFRaxxmiOQmvAxYKybMp0Ei8euy+wKHiNPBVPxn143hrag7a2GKIn
+hq6LwoiHAkEAxI7GYK47woZJHI6rjskjxT+DBNKjTmoDZVTa4KrWUVY1NfTC+/jI
+Ajm3cQ1QYnGEYyvlczgD3jvRdDtjJjGy3wJAV4JnkpX7pIdIIj7rR7PB4aM3Rxae
+TV7PCEXZXPxCf9RsF5EBtkQPzruTQznarB00j9Q6BuhGIqyHpt6st3cQjQJBAKtf
+oG7i+o+b7VrMuZ+Al4N+4Ijv7hqMK/HJjhycVsgL1dD5Wpe+TQRDtkEHTrLGLpsY
+xrEygYzdsr0YmlXOtxkCQQC46OoYuk/bZhp1gnFNtWXp73ZESphNOC/FovNKu5Os
+fbxKoqUbosXAi6wxuU1L+eojN0UNx98xyKjG/lyUog/m
+-----END RSA PRIVATE KEY-----
+

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b60d2c7d/tools/cartridge-create/stratos-image
----------------------------------------------------------------------
diff --git a/tools/cartridge-create/stratos-image b/tools/cartridge-create/stratos-image
new file mode 100755
index 0000000..e11e5de
--- /dev/null
+++ b/tools/cartridge-create/stratos-image
@@ -0,0 +1,100 @@
+#!/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.
+# ----------------------------------------------------------------------------
+
+
+# Die on any error:
+set -e
+
+# This script will create an cartridge image from a running virtual machine instance in Openstack using a given cartridge template. Then it will be
+# uploaded into the Glance Server. This script should be executed after logging into the Openstack controller with a valid user account that can
+# upload images to the glance server.
+
+vm_instance_ip=""
+cartridge_template=""
+vm_instance_user=""
+vm_instance_private_key=""
+software=""
+function help {
+    echo ""
+    echo "    This script  will upload the cartridge template execution file into the remote virtual machine from"
+    echo "            which you need to create the image, and execute it. At the end of the execution, image is ready for"
+    echo "            upload"
+    echo "    Usage for action create:"
+    echo ""
+    echo "    stratos-image -s <software> create <ip/hostname of the virtual machine> <cartridge template> <vm instance user> <vm instance private key>"
+    echo ""
+    echo "    -s : Softwared to be copied to the new image, separated by colon(:). Default is none. These will be"
+    echo "         copied into the /opt folder of the instance"
+    echo "    <ip/hostname of the virtual machine> : ip or hostname of the virtual machine using which image will be created from"
+    echo "    <cartridge template> : Template for the new image"
+    echo "    <vm instance user> : User name of the instance from which you need to create the image"
+    echo "    <vm instance private key> : Name of the private key of the user for logging into the virtual machine instance."
+    echo "            Copy the private key to init_scripts/<cartridge template> (e.g., init_scripts/php) folder"
+    echo ""
+}
+
+function image_validate {
+
+if [[ -z $vm_instance_ip || -z $cartridge_template || -z $vm_instance_user || -z $vm_instance_private_key ]]; then
+    help
+    exit 1
+fi
+
+}
+
+while getopts s: opts
+do
+  case $opts in
+    s)
+        software=${OPTARG}
+        ;;
+    *)
+        help
+        exit 1
+        ;;
+  esac
+done
+shift $((OPTIND-1))
+
+vm_instance_ip=$1
+echo $vm_instance_ip
+cartridge_template=$2
+echo $cartridge_template
+vm_instance_user=$3
+vm_instance_private_key=$4
+
+image_validate
+
+echo "Install from cartridge_template $cartridge_template"
+pushd ./init_scripts/$cartridge_template
+chmod 755 ./$cartridge_template
+./$cartridge_template $vm_instance_ip $vm_instance_user $vm_instance_private_key $software
+popd
+echo "Installed from cartridge_template $cartridge_template"
+echo "Now upload the image by using Openstack nova command"
+echo "nova image-create <vm instance id> <image name>"
+echo "where"
+echo "<vm instance id> is the id of the virtual machine instance from which you need to create the image"
+echo "<image name> is the name you wish to give for your new cartridge image"
+
+
+echo "Done"
+

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b60d2c7d/tools/cartridge-create/stratos-image-local
----------------------------------------------------------------------
diff --git a/tools/cartridge-create/stratos-image-local b/tools/cartridge-create/stratos-image-local
new file mode 100755
index 0000000..816fd92
--- /dev/null
+++ b/tools/cartridge-create/stratos-image-local
@@ -0,0 +1,310 @@
+#!/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.
+# ----------------------------------------------------------------------------
+
+
+# Die on any error:
+set -e
+
+work_dir=""
+new_image=""
+image_root="/tmp"
+image_template="default"
+software=""
+new_image_size="" #In GB
+action=""
+original_image=""
+image_type="qcow2"
+
+function help {
+    echo "Usage: stratos-image-local [optional arguments] <action> <mandatory arguments>"
+    echo "    Action can be one of the following"
+    echo "        create : Mount the base image and customize it according to the given arguments"
+    echo "        pack : Archive the newly created image and unmount the base image"
+    echo ""
+    echo "    Mandatory and optional arguments depend on the action. Following is the list of usages for each action"
+    echo ""
+    echo "    Usage for action create:"
+    echo "        stratos-image-local -r <image root> -t <image template> -s <software> -n <new image size(just enter number without G suffix)> "
+    echo "                            create <path to original image>"
+    echo ""
+    echo "            -r : Image root - This is where the base image is mounted. Default is /tmp"
+    echo "            -t : Template for the new image. Default is no template"
+    echo "            -s : Softwared to be copied to the new image, separated by colon(:). Default is none"
+    echo "            -n : Image size of the new image in GB(just enter number without G suffix). Default is the size of the base image"
+    echo "            -v : Image type. This is one of qcow2 or row. Default is qcow2"
+    echo ""
+    echo "    Usage for action pack:"
+    echo "        stratos-image-local -r <image root> -t <image template> pack <new image archive name in tar.gz format>"
+    echo ""
+    echo "            -r : Image root - This is where the base image is mounted. Default is /tmp"
+    echo "            -t : Template for the new image. Default is no template"
+    echo "            -v : Image type. This is one of qcow2 or row. Default is qcow2"
+    echo ""
+    echo "    Usage for action mount:"
+    echo "        stratos-image-local -r <image root> -t <image template> -n <new image size(just enter number without G suffix)> mount <path to original image>"
+    echo ""
+    echo "            -r : Image root - This is where the base image is mounted. Default is /tmp"
+    echo "            -t : Template for the new image. Default is no template"
+    echo "            -n : Resize the image to this size in GB(just enter number wihout G suffix) before mounting. Default is the size of the base image"
+    echo "            -v : Image type. This is one of qcow2 or row. Default is qcow2"
+    echo ""
+    echo "    eg:sudo ./stratos-image-local -r /tmp/ -n 8 mount /opt/lxc/precise-server-carbon-cloudimg-amd64-disk1.img"
+    echo ""
+    echo "    Usage for action unmount:"
+    echo "        stratos-image-local -r <image root> -t <image template>  unmount"
+    echo ""
+    echo "            -r : Image root - This is where the base image is mounted. Default is /tmp"
+    echo "            -t : Template for the new image. Default is no template"
+    echo "            -v : Image type. This is one of qcow2 or row. Default is qcow2"
+    echo ""
+    echo "    eg:sudo ./stratos-image-local -r /tmp unmount"
+}
+
+function image_validate {
+
+if [[ ( -z $action || ( -n $action && $action == "help" ) ) ]]; then
+    help
+    exit 1
+fi
+
+if [[ ( -z $action || ( -n $action && !( $action == "create" || $action == "pack" || $action == "mount" || $action == "unmount" ) ) ) ]]; then
+        echo "Mandatory parameter action with value create or pack should be provided"
+        echo "    create : Mount the base image and customize it according to the given arguments"
+        echo "    pack : Archive the newly created image and unmount the base image"
+        echo ""
+        exit 1
+    fi
+
+if [[ ( -n $action && $action == "create" && -z $original_image ) ]]; then
+        echo "Usage:"
+        echo "    stratos-image-local -r <image root> -t <image template> -s <software> -n <new image size(just enter number without G suffix)> -v <image type> create <path to original image>"
+        echo ""
+        echo "        -r : Image root - This is where the base image is mounted. Default is /tmp"
+        echo "        -t : Template for the new image. Default is no template"
+        echo "        -s : Softwared to be copied to the new image, separated by colon(:). Default is none"
+        echo "        -n : Image size of the new image in GB. Default is the size of the base image"
+        echo "        -v : Image type. qcow2 or raw. Default is qcow2"
+        echo ""
+        exit 1
+fi
+
+if [[ ( -n $action && $action == "pack" && -z $new_image ) ]]; then
+        echo "Usage:"
+        echo "    stratos-image-local -r <image root> -t <image template> pack <new image archive name in tar.gz format>"
+        echo ""
+        echo "        -r : Image root - This is where the base image is mounted. Default is /tmp"
+        echo "        -t : Template for the new image. Default is no template"
+        echo "        -v : Image type. qcow2 or raw. Default is qcow2"
+        echo ""
+        exit 1
+fi
+
+if [[ ( -n $action && $action == "mount" && -z $original_image ) ]]; then
+        echo "Usage:"
+        echo "    stratos-image-local -r <image root> -t <image template> -n <new image size(just enter number without G suffix)> -v <image type> mount <path to original image>"
+        echo ""
+        echo "        -r : Image root - This is where the base image is mounted. Default is /tmp"
+        echo "        -t : Template for the new image. Default is no template"
+        echo "        -n : Resize the image to this size in GB(just enter number without G suffix) before mounting. Default is the size of the base image"
+        echo "        -v : Image type. qcow2 or raw. Default is qcow2"
+        echo ""
+        echo "    eg:sudo ./stratos-image-local -r /tmp/ -n 8 mount /opt/lxc/precise-server-carbon-cloudimg-amd64-disk1.img"
+        exit 1
+fi
+
+}
+
+# Make sure the user is running as root.
+if [ "$UID" -ne "0" ]; then
+	echo ; echo "  You must be root to run $0.  (Try running 'sudo bash' first.)" ; echo 
+	exit 69
+fi
+
+while getopts r:t:s:n:v: opts
+do
+  case $opts in
+    r)
+        image_root=${OPTARG}
+        ;;
+    t)
+        image_template=${OPTARG}
+        ;;
+    s)
+        software=${OPTARG}
+        ;;
+    n)
+        new_image_size=${OPTARG}
+        ;;
+    v)
+        image_type=${OPTARG}
+        ;;
+    *)
+        help
+        exit 1
+        ;;
+  esac
+done
+shift $((OPTIND-1))
+action=$1
+if [[ $action == "create" ]]; then
+    original_image=$2
+elif [[ $action == "pack" ]]; then
+    new_image=$2
+elif [[ $action == "mount" ]]; then
+    original_image=$2
+fi
+
+image_validate
+
+work_dir="$image_root/$image_template"
+img_dir="$work_dir/image"
+
+if [[ $action == "create" || $action == "mount" ]]; then
+    if [ $image_type = "qcow2" ]; then
+        let "new_image_size=$new_image_size*1024*1024*1024"
+        new_image_size=$new_image_size
+        echo "qcow2 new_image_size:$new_image_size"
+    else
+        new_image_size=$new_image_size"G"
+        echo "raw new_image_size:$new_image_size"
+    fi
+fi
+
+if [[ $action == "create" ]]; then
+
+    if [ -d ./$work_dir ]; then
+        rm -rf ./$work_dir
+    fi
+
+    mkdir -p $work_dir
+
+    if [ ! -d $img_dir ]; then
+        mkdir -p $img_dir
+    fi
+
+    pushd $img_dir
+    type=`echo $original_image|awk -F . '{print $NF}'`
+    if [[ $type == "zip" ]]; then
+        zip -rq $original_image
+    elif [[ $type == "gz" || $type == "tgz" ]]; then
+        tar -zxf $original_image
+    else
+        cp -f $original_image ./
+    fi
+    popd
+    echo $img_dir
+    image_image=`ls $img_dir/*.img`
+    echo $image_image
+    if [ -z $new_image_size ]; then
+        echo "Image will not be resized since new image size is not provided"
+    else
+        echo "Resizing the original image"
+        if [ $image_type = "qcow2" ]; then
+            qemu-img resize $image_image $new_image_size
+        else
+            fsck.ext3 -f $image_image
+            e2fsck -f $image_image
+            resize2fs $image_image $new_image_size
+        fi
+    fi
+
+    echo "Mount the original image"
+    ./image_action.sh action=mount image-template=$image_template image-root=$image_root image-image=$image_image image-type=$image_type
+    echo "Original image mounted"
+    read
+
+    if [[ !( $image_template == "default" ) ]]; then
+    	echo "Customizing the original image"
+    	./image_action.sh action=create image-template=$image_template image-root=$image_root software=$software image-type=$image_type
+    fi
+
+fi
+
+if [[ $action == "pack" ]]; then
+    echo "Archiving the new image"
+    pushd $work_dir/image
+    type=`echo $new_image|awk -F . '{print $NF}'`
+    if [[ $type == "zip" ]]; then
+        zip -rq $new_image ./*
+    elif [[ $type == "gz" || $type == "tgz" ]]; then
+        tar -zcf $new_image ./*
+    elif [[ $type == "img" ]]; then
+        mv *.img $new_image
+    fi
+
+    popd
+    echo "Unmounting"
+    ./image_action.sh action=unmount image-template=$image_template image-root=$image_root image-type=$image_type
+fi
+
+if [[ $action == "mount" ]]; then
+    if [ -d ./$work_dir ]; then
+        rm -rf ./$work_dir
+    fi
+
+    mkdir -p $work_dir
+
+    if [ ! -d $img_dir ]; then
+        mkdir -p $img_dir
+    fi
+
+    pushd $img_dir
+    type=`echo $original_image|awk -F . '{print $NF}'`
+    if [[ $type == "zip" ]]; then
+        zip -rq $original_image
+    elif [[ $type == "gz" || $type == "tgz" ]]; then
+        tar -zxf $original_image
+    else
+        cp -f $original_image ./
+    fi
+    popd
+    echo $img_dir
+    image_image=`ls $img_dir/*.img`
+    echo $image_image
+
+    if [ -z $new_image_size ]; then
+        echo "Image will not be resized since new image size is not provided"
+    else
+        echo "Resizing the original image"
+        if [ $image_type = "qcow2" ]; then
+            qemu-img resize $image_image $new_image_size
+        else
+            echo "image:"$image_image
+            fsck.ext3 -f $image_image
+            e2fsck -f $image_image
+            resize2fs $image_image $new_image_size
+        fi
+    fi
+
+    echo "Mount the image"
+    ./image_action.sh action=mount image-template=$image_template image-root=$image_root image-image=$image_image image-type=$image_type
+    echo "Mounted the image"
+fi
+
+if [[ $action == "unmount" ]]; then
+    echo "Unmount the image"
+
+    ./image_action.sh action=unmount image-template=$image_template image-root=$image_root image-type=$image_type
+    echo "Unmounted the image"
+fi
+
+echo "Done"
+

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b60d2c7d/tools/cartridge-create/uploadimg.sh
----------------------------------------------------------------------
diff --git a/tools/cartridge-create/uploadimg.sh b/tools/cartridge-create/uploadimg.sh
new file mode 100755
index 0000000..2afec21
--- /dev/null
+++ b/tools/cartridge-create/uploadimg.sh
@@ -0,0 +1,32 @@
+#!/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.
+# ----------------------------------------------------------------------------
+
+
+ip=$1
+imagename=$2
+userrc=$3
+mysqlpass=$4
+source ./$userrc
+ret=`mysql -u root -p$mysqlpass nova -e "select i.uuid from instances i, fixed_ips x, floating_ips f where i.id=x.instance_id and x.id=f.fixed_ip_id and f.address='$ip' and i.vm_state='ACTIVE'"`
+tok_str=(`echo $ret | tr '.' ' '`)
+id=${tok_str[1]}
+echo $id > /tmp/test
+nova image-create $id $imagename

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b60d2c7d/tools/cartridge_create/README
----------------------------------------------------------------------
diff --git a/tools/cartridge_create/README b/tools/cartridge_create/README
deleted file mode 100644
index 883fe48..0000000
--- a/tools/cartridge_create/README
+++ /dev/null
@@ -1,50 +0,0 @@
-This folder contain utilities to create customized images from the already running openstack instances.
-The main utility is a CLI tool called stratos-image.
-Pre-requisites:
-
-You need the private or public(floating)ip of the openstack instance from which you need to create the image. Also you need a username
-for that instance and a private key to access that instance. Copy the private key to init_scripts/<template> (e.g., init_scripts/php) folder.
-
-You need a file with the following information regarding the Openstack environment and copy that file into the current folder.
-When uploading the image you need the variables in the file exported to the environment. 
-Normally when you install the Openstack you get this file generated. Please refer to your Openstack installation documents 
-on how to get the information in this file.
-
-----------------------------------------------------------
-NOVA_API_HOST=192.168.16.20
-GLANCE_API_HOST=192.168.16.20
-KEYSTONE_API_HOST=192.168.16.20
-
-NOVA_REGION="nova"
-
-export NOVA_USERNAME=demo
-export NOVA_PROJECT_ID=demo
-export NOVA_PASSWORD=openstack
-export NOVA_API_KEY=openstack
-export NOVA_REGION_NAME=$NOVA_REGION
-export NOVA_URL="http://$NOVA_API_HOST:5000/v2.0/"
-export NOVA_VERSION="1.1"
-
-export OS_USERNAME=demo
-export OS_PASSWORD=openstack
-export OS_TENANT_ID=7434d33c18e04e60a6751922773fbe2d
-export OS_AUTH_URL="http://$KEYSTONE_API_HOST:5000/v2.0/"
-export OS_AUTH_STRATEGY="keystone"
-
-export EC2_URL="http://$NOVA_API_HOST:8773/services/Cloud"
-export EC2_ACCESS_KEY="8b742fee68c6464198517242828adb82"
-export EC2_SECRET_KEY="279a7f28c8a54d5db8e27524f648a7d3"
-export S3_URL="http://$GLANCE_API_HOST:3333"
-
-----------------------------------------------------------
-
-For help on how to execute stratos-image execute.
-./stratos-image help
-
-Following is an example of create and upload the image for php cartridge
-
-./stratos-image create 192.168.16.129 php ubuntu wso2.pem
-
-nova image-create <vm instance id> php-cloudimg-amd64
-
-


[2/4] Renamed folder cartridge_create to cartridge-create and init_scripts to init-scripts

Posted by im...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b60d2c7d/tools/cartridge_create/configure_software
----------------------------------------------------------------------
diff --git a/tools/cartridge_create/configure_software b/tools/cartridge_create/configure_software
deleted file mode 100755
index 251a1ac..0000000
--- a/tools/cartridge_create/configure_software
+++ /dev/null
@@ -1,383 +0,0 @@
-#!/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.
-# ----------------------------------------------------------------------------
-
-
-ROOTFS=$1
-TEMPLATE=$2
-
-#
-# Locale settings (en_GB for Redcoats, en_US for Yanks):
-#
-LANG="en_US.UTF-8" 
-LANGUAGE="en_US.UTF-8" 
-LC_ALL="en_US.UTF-8" 
-LC_CTYPE="C"
-
-#
-# Ubuntu mirror to use:
-#
-###DEBMIRROR="http://archive.ubuntu.com/ubuntu/"
-#DEBMIRROR="http://us.archive.ubuntu.com/ubuntu/"
-DEBMIRROR="http://lk.archive.ubuntu.com/ubuntu/"
-
-
-mysql() {
-
-	# MySQL still prompts.  Bug.
-	#DEBCONF_FRONTEND='noninteractive' 
-	
-	chroot $ROOTFS apt-get update
-	# Next, all the LAMP packages.  We must first pre-save the password
-	# for MySQL to use:
-	#chroot $ROOTFS echo "mysql-server mysql-server/root_password select ubuntu" | chroot $ROOTFS debconf-set-selections
-	#chroot $ROOTFS echo "mysql-server mysql-server/root_password_again select ubuntu" | chroot $ROOTFS debconf-set-selections
-	
-	chroot $ROOTFS apt-get install -y \
-	nano zip mysql-server git \
-	apache2-mpm-prefork apache2-utils apache2.2-bin apache2.2-common dbconfig-common fontconfig-config libapache2-mod-php5 \
-	libaprutil1-dbd-sqlite3 libaprutil1-ldap libcap2 libfontconfig1 libgd2-xpm libjpeg-turbo8 libjpeg8 libmcrypt4 \
-	libt1-5 libxpm4 php5-cli php5-common php5-gd php5-mcrypt php5-mysql phpmyadmin ssl-cert ttf-dejavu-core ruby
-
-	# Be sure to have a new SSL cert for this new LXC host:
-	rm -f $ROOTFS/etc/ssl/private/ssl-cert-snakeoil.key
-    cp -f ./init_scripts/mysql/cc/ssl-cert-snakeoil.pem $ROOTFS/etc/ssl/certs/
-    cp -f ./init_scripts/mysql/cc/ssl-cert-snakeoil.key $ROOTFS/etc/ssl/private/
-	#chroot $ROOTFS dpkg-reconfigure ssl-cert
-
-	# Enable HTTPS:
-	chroot $ROOTFS a2enmod ssl
-	chroot $ROOTFS a2ensite default-ssl	
-	# Desable HTTP
-	chroot $ROOTFS a2dissite default	
-
- 	# set mysql to listen to all network
-	chroot $ROOTFS cp /etc/mysql/my.cnf /etc/mysql/my.cnf.org
-	chroot $ROOTFS cat /etc/mysql/my.cnf.org | sed -e 's/127.0.0.1/0.0.0.0/' > $ROOTFS/etc/mysql/my.cnf	
-
-	# See http://blog.bodhizazen.net/linux/lxc-configure-ubuntu-lucid-containers/
-	# This requirement is confirmed on 10.04.1 LTS.  Within LXC, the
-	# upstart "startup" signal is sent, but not "network-interface", etc.
-	pushd $ROOTFS/etc/init/
-	cp -a ufw.conf ufw.conf-dist
-	sed '
-s/start on (starting network-interface/start on startup\n#start on (starting network-interface/
-s/          or starting network-manager/#          or starting network-manager/
-s/          or starting networking)/#          or starting network-manager/
-' < ufw.conf-dist > ufw.conf
-	
-	popd
-
-}
-
-php() {
-
-    cp -f ./init_scripts/php/wso2-openstack-init.sh $ROOTFS/opt/
-    cp -f ./init_scripts/php/get-launch-params.rb $ROOTFS/opt/
-    cp -f ./init_scripts/php/cc/ssl-cert-snakeoil.pem $ROOTFS/etc/ssl/certs/
-    cp -f ./init_scripts/php/cc/ssl-cert-snakeoil.key $ROOTFS/etc/ssl/private/
-    
-	chroot $ROOTFS apt-get update
-	# Next, all the packages. 
-	
-	chroot $ROOTFS apt-get install -y \
-    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-ldap \
-    openssl ssl-cert ldap-utils php5-mcrypt mcrypt ufw fail2ban git libboost-all-dev ruby
-
-    # Install the thrift library
-    tar -zxf ./init_scripts/php/thrift-0.8.0.tar.gz -C$ROOTFS/opt
-    chroot $ROOTFS cd /opt/thrift-0.8.0;./configure --libdir=/usr/lib;make;make install
-    tar -zxf ./init_scripts/php/cartridge_data_publisher_1.0.0.tar.gz -C$ROOTFS/opt
-    chroot $ROOTFS cd /opt/cartridge_data_publisher_1.0.0;make
-
-	# install gitpython 
-	# chroot $ROOTFS easy_install GitPython
-
-
-	# configure apache log write to syslog TODO : Need generic solution
-	chroot $ROOTFS cp /etc/apache2/apache2.conf /etc/apache2/apache2.conf.org
-    chroot $ROOTFS cat /etc/apache2/apache2.conf.org | sed -e 's/^ErrorLog.*/ErrorLog syslog:local2/' > $ROOTFS/etc/apache2/apache2.conf
-
-	# configure rsyslog TODO : Need generic solution
-	chroot $ROOTFS cp /etc/rsyslog.conf /etc/rsyslog.conf.org
-    chroot $ROOTFS cat /etc/rsyslog.conf.org | sed -e 's/^#$ModLoad\simtcp.*/$ModLoad imtcp/' |  sed -e 's/^\#\$ModLoad\simtcp.*/\$ModLoad imtcp/' | sed -e 's/^\#\$InputTCPServerRun\s514.*/\$InputTCPServerRun 514\nlocal2\.\*        \@\@localhost\:32000/' > $ROOTFS/etc/rsyslog.conf
-
-
-# adding simplesaml alias to apache
-chroot $ROOTFS cp /etc/apache2/sites-available/default /etc/apache2/sites-available/default-org
-chroot $ROOTFS cp /etc/apache2/sites-available/default-ssl /etc/apache2/sites-available/default-ssl-org
-chroot $ROOTFS cat /etc/apache2/sites-available/default-org | sed -e 's@DocumentRoot \/var\/www@DocumentRoot \/var\/www\/public\n\tAlias \/simplesaml \/var\/www\/simplesamlphp\/www@' > $ROOTFS/etc/apache2/sites-available/default
-chroot $ROOTFS cat /etc/apache2/sites-available/default-ssl-org | sed -e 's@DocumentRoot \/var\/www@DocumentRoot \/var\/www\/public\n\tAlias \/simplesaml \/var\/www\/simplesamlphp\/www@' > $ROOTFS/etc/apache2/sites-available/default-ssl
-	# Enable HTTPS:
-	chroot $ROOTFS a2enmod ssl
-	chroot $ROOTFS a2ensite default-ssl	
-
-
-	# See http://blog.bodhizazen.net/linux/lxc-configure-ubuntu-lucid-containers/
-	# This requirement is confirmed on 10.04.1 LTS.  Within LXC, the
-	# upstart "startup" signal is sent, but not "network-interface", etc.
-	pushd $ROOTFS/etc/init/
-	cp -a ufw.conf ufw.conf-dist
-	sed '
-s/start on (starting network-interface/start on startup\n#start on (starting network-interface/
-s/          or starting network-manager/#          or starting network-manager/
-s/          or starting networking)/#          or starting network-manager/
-' < ufw.conf-dist > ufw.conf
-	popd
-	
-    pushd $ROOTFS/etc
-    echo "#!/bin/bash -e
-mkdir -p /etc/agent/conf
-chmod 755 /opt/wso2-openstack-init.sh
-/opt/wso2-openstack-init.sh > /var/log/wso2-openstack-init.log
-exit 0
-    " > rc.local
-    popd
-
-}
-
-lamp() {
-
-    cp -f ./init_scripts/lamp/wso2-openstack-init.sh $ROOTFS/opt/
-    cp -f ./init_scripts/lamp/get-launch-params.rb $ROOTFS/opt/
-    cp -f ./init_scripts/lamp/server $ROOTFS/opt/
-    cp -f ./init_scripts/lamp/svn_client.sh $ROOTFS/opt/
-    cp -f ./init_scripts/lamp/svn_client_y.sh $ROOTFS/opt/
-    cp -f ./init_scripts/lamp/deployer.sh $ROOTFS/opt/
-
-    # Copy software
-    arr=$(echo $SOFTWARE | tr ":" "\n")
-    for x in $arr
-    do
-       cp -rf $x $ROOTFS/opt/
-    done
-
-
-	# MySQL still prompts.  Bug.
-	#DEBCONF_FRONTEND='noninteractive' 
-	
-	chroot $ROOTFS apt-get update
-	# Next, all the LAMP packages.  We must first pre-save the password
-	# for MySQL to use:
-	chroot $ROOTFS echo "mysql-server mysql-server/root_password select ubuntu" | chroot $ROOTFS debconf-set-selections
-	chroot $ROOTFS echo "mysql-server mysql-server/root_password_again select ubuntu" | chroot $ROOTFS debconf-set-selections
-	
-	chroot $ROOTFS apt-get install -y \
-	 nano zip mysql-server 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-ldap \
-	 openssl ssl-cert ldap-utils \
-	 php5-mcrypt mcrypt ufw fail2ban ruby subversion
-
-	# Be sure to have a new SSL cert for this new LXC host:
-	#rm -f $ROOTFS/etc/ssl/private/ssl-cert-snakeoil.key
-	#chroot $ROOTFS dpkg-reconfigure ssl-cert
-
-	# Enable HTTPS:
-	#chroot $ROOTFS a2enmod ssl
-	#chroot $ROOTFS a2ensite default-ssl	
-
-	# Turn on MySQL replication logs by default.  (Necessary for 
-	# incremental backups, even if you're not doing replication.)
-	pushd $ROOTFS/etc/mysql/conf.d
-	echo "[mysqld]
-log-bin=mysqld-bin
-server-id = 1
-
-# For an SSH Tunneled slave:
-# See also: /etc/rc.local for the SSH Tunnel that makes this work.
-#[mysqld]
-#master-host     = 127.0.0.1
-#master-user     = root
-#master-password = ubuntu
-#master-port     = 13306
-#server-id       = 2
-	" >> replication.cnf
-	popd
-
-pushd $ROOTFS/etc
-    echo "#!/bin/bash -e
-/opt/wso2-openstack-init.sh > /var/log/wso2-openstack-init.log
-exit 0
-    " > rc.local
-    popd
-
-	# Next, fix a couple of Debian gotchas:
-
-	# Comment out these two lines.  (Don't expire,
-	# and use the 1G default file size.
-	pushd $ROOTFS/etc/mysql
-	cp -a my.cnf my.cnf-dist
-	sed '
-s/expire_logs_days/#expire_logs_days/
-s/max_binlog_size/#max_binlog_size/
-' < my.cnf-dist > my.cnf
-	popd
-	
-	# See http://blog.bodhizazen.net/linux/lxc-configure-ubuntu-lucid-containers/
-	# This requirement is confirmed on 10.04.1 LTS.  Within LXC, the
-	# upstart "startup" signal is sent, but not "network-interface", etc.
-	pushd $ROOTFS/etc/init/
-	cp -a ufw.conf ufw.conf-dist
-	sed '
-s/start on (starting network-interface/start on startup\n#start on (starting network-interface/
-s/          or starting network-manager/#          or starting network-manager/
-s/          or starting networking)/#          or starting network-manager/
-' < ufw.conf-dist > ufw.conf
-	
-	cp -a mysql.conf mysql.conf-dist
-	sed --posix -e '
-s/start on (net-device-up/start on startup\n#start on (net-device-up/
-s/          and local-filesystems/#          and local-filesystems/
-s/\t  and runlevel \[2345\])/#\t  and runlevel \[2345\])/
-' < mysql.conf-dist > mysql.conf
-	popd
-	
-}
-
-wso2_carbon_server() {
-
-    cp -f ./init_scripts/carbon/wso2-openstack-init.sh $ROOTFS/opt/
-    cp -f ./init_scripts/carbon/get-launch-params.rb $ROOTFS/opt/
-    # Copy software
-    arr=$(echo $SOFTWARE | tr ":" "\n")
-    for x in $arr
-    do
-       cp -rf $x $ROOTFS/opt/
-    done
-
-	#chroot $ROOTFS apt-get update
-	
-	 chroot $ROOTFS apt-get install -y \
-	 nano zip \
-	 wget \
-	 openssl ssl-cert ldap-utils ruby git
-  
-     # TODO install puppet agent
-
-	# Be sure to have a new SSL cert for this new LXC host:
-	#rm -f $ROOTFS/etc/ssl/private/ssl-cert-snakeoil.key
-	#chroot $ROOTFS dpkg-reconfigure ssl-cert
-
-pushd $ROOTFS/etc
-    echo "#!/bin/bash -e
-/opt/wso2-openstack-init.sh > /var/log/wso2-openstack-init.log
-exit 0
-    " > rc.local
-    popd
-
-}
-
-jetty() {
-
-    cp -f ./init_scripts/jetty/wso2-openstack-init.sh $ROOTFS/opt/
-    cp -f ./init_scripts/jetty/get-launch-params.rb $ROOTFS/opt/
-    cp -f ./init_scripts/jetty/server $ROOTFS/opt/
-    cp -f ./init_scripts/jetty/svn_client.sh $ROOTFS/opt/
-    cp -f ./init_scripts/jetty/svn_client_y.sh $ROOTFS/opt/
-    cp -f ./init_scripts/jetty/deployer.sh $ROOTFS/opt/
-    # Copy software
-    arr=$(echo $SOFTWARE | tr ":" "\n")
-    for x in $arr
-    do
-       cp -rf $x $ROOTFS/opt/
-    done
-
-	#chroot $ROOTFS apt-get update
-	
-	chroot $ROOTFS apt-get install -y \
-	 nano zip \
-	 wget \
-	 openssl ssl-cert ldap-utils ruby subversion
-   
-pushd $ROOTFS/etc
-    echo "#!/bin/bash -e
-/opt/wso2-openstack-init.sh > /var/log/wso2-openstack-init.log
-exit 0
-    " > rc.local
-    popd
-
-}
-
-
-tomcat7() {
-
-    #chroot $ROOTFS echo "nameserver 8.8.8.8" >> $ROOTFS/etc/resolvconf/resolv.conf.d/base
-    echo "Please fix the resolve conf file"
-    read
-    #chroot $ROOTFS mkdir -p /run/resolveconf
-    #chroot $ROORFS touch /run/resolveconf/resolv.conf
-    #chroot echo "nameserver 8.8.8.8" > /run/resolveconf/resolv.conf
-    
-    echo "------------------------------------------"
-    chroot $ROOTFS cat /etc/resolv.conf
-    echo "------------------------------------------"
-
-
-    mount -o bind /dev $ROOTFS/dev
-
-
-    mount -t proc none $ROOTFS/proc
-
-
-    cp -f ./init_scripts/tomcat7/wso2-openstack-init.sh $ROOTFS/opt/
-    cp -f ./init_scripts/tomcat7/get-launch-params.rb $ROOTFS/opt/
-    
-    
-	chroot $ROOTFS apt-get update
-	# Next, all the packages. 
-	
-    chroot $ROOTFS apt-get install -y \
-    nano zip git\
-    ruby curl wget tomcat7
-     
-	# See http://blog.bodhizazen.net/linux/lxc-configure-ubuntu-lucid-containers/
-	# This requirement is confirmed on 10.04.1 LTS.  Within LXC, the
-	# upstart "startup" signal is sent, but not "network-interface", etc.
-	pushd $ROOTFS/etc/init/
-	cp -a ufw.conf ufw.conf-dist
-	sed '
-s/start on (starting network-interface/start on startup\n#start on (starting network-interface/
-s/          or starting network-manager/#          or starting network-manager/
-s/          or starting networking)/#          or starting network-manager/
-' < ufw.conf-dist > ufw.conf
-	popd
-	
-    pushd $ROOTFS/etc
-    echo "#!/bin/bash -e
-mkdir -p /etc/agent/conf
-chmod 755 /opt/wso2-openstack-init.sh
-/opt/wso2-openstack-init.sh > /var/log/wso2-openstack-init.log
-exit 0
-    " > rc.local
-    popd
-
-    umount $ROOTFS/dev
-    umount $ROOTFS/proc
-}
-
-
-# Don't prompt when running apt-get:
-export DEBCONF_FRONTEND='noninteractive' 
-
-# Run the config function with given $TEMPLATE name (if it exists):
-$TEMPLATE 
-

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b60d2c7d/tools/cartridge_create/create_kvm_image.sh
----------------------------------------------------------------------
diff --git a/tools/cartridge_create/create_kvm_image.sh b/tools/cartridge_create/create_kvm_image.sh
deleted file mode 100755
index 795f42c..0000000
--- a/tools/cartridge_create/create_kvm_image.sh
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/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.
-# ----------------------------------------------------------------------------
-
-
-./stratos-image create 192.168.16.131 mysql ubuntu stratos.pem
-#./stratos-image upload 192.168.16.131 precise-server-mysql-cloudimg-amd64

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b60d2c7d/tools/cartridge_create/image_action.sh
----------------------------------------------------------------------
diff --git a/tools/cartridge_create/image_action.sh b/tools/cartridge_create/image_action.sh
deleted file mode 100755
index a6c8261..0000000
--- a/tools/cartridge_create/image_action.sh
+++ /dev/null
@@ -1,165 +0,0 @@
-#!/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.
-# ----------------------------------------------------------------------------
-
-
-# Die on any error:
-set -e
-
-work_dir=""
-action=""
-image_template=""
-image_root=""
-software=""
-image_type=""
-loopdevice="/dev/loop1"
-nbddevice="/dev/nbd3"
-nbdmount="/dev/nbd3p1"
-
-function image_validate {
-    if [ -z $action ]; then
-        echo "usage: image_action.sh action=<mount|create|unmount> <options>"
-        exit 1
-    fi
-
-    if [[ !($action == "mount") && !($action == "create") && !($action == "unmount") ]]; then
-        echo "usage: image_action.sh action=<mount|create|unmount> <options>"
-        exit 1
-    fi
-
-    if [[ (-n $action) && ($action == "create") && ( -z $image_template || -z $image_root ) ]]; then
-        echo "usage: image_action.sh action=create template=<template> image-root=<image_root>"
-        exit 1
-    fi
-
-    if [[ (-n $action) && ($action == "unmount") && (-z $image_template || -z $image_root) ]]; then
-        echo "usage: image_action.sh action=unmount image-id=<image_template> image-root=<image_root>"
-        exit 1
-    fi
-    
-    if [[ (-n $action) && ($action == "mount") && (-z $image_template || -z $image_root || -z $image_image) ]]; then
-        echo "usage: image_action.sh action=mount image-template=<image_template> image-root=<image_root> image-image=<image_image>"
-        exit 1
-    fi
-    
-}
-
-for var in $@; do
-    set -- `echo $var | tr '=' ' '`
-    key=$1
-    value=$2
-
-    if [ $key = "action" ]; then
-        action="$value"
-        echo "action:" $action
-    fi
-
-    if [ $key = "image-root" ]; then
-        image_root="$value"
-        echo "image root:" $image_root
-    fi
-    
-    if [ $key = "image-template" ]; then
-        image_template="$value"
-        echo "template:" $image_template
-    fi
-    
-    if [ $key = "image-image" ]; then
-        image_image="$value"
-        echo "image-image:" $image_image
-    fi
-    
-    if [ $key = "software" ]; then
-        software="$value"
-        echo "software:" $software
-    fi
-    
-    if [ $key = "image-type" ]; then
-        image_type="$value"
-        echo "image_type:" $image_type
-    fi
-
-done
-
-image_validate
-
-work_dir="$image_root/$image_template"
-if [[ (-n $action) && ($action == "unmount") ]]; then
-    echo "# unmount $image_template"
-    if [ -d $work_dir/$image_template ]; then
-        if [ $image_type == "qcow2" ]; then
-            umount $work_dir/$image_template
-            qemu-nbd -d $nbddevice
-            rmmod nbd
-        else
-            echo 'this action unmount image!'
-            umount $work_dir/$image_template/dev
-            umount $work_dir/$image_template/proc
-            umount $work_dir/$image_template/sys
-            umount $work_dir/$image_template
-            if [ -d $work_dir/$image_template/dev ]; then
-                umount -l $work_dir/$image_template
-            fi
-            losetup -d $loopdevice
-        fi
-    fi
-    exit 0
-fi
-
-if [[ (-n $action) && ($action == "mount") ]]; then
-    echo "# mount $image_template "
-    if [ ! -d "$work_dir/$image_template" ]; then
-        mkdir -p $work_dir/$image_template
-    fi
-    #cp -f $image_image $work_dir/
-    if [ $image_type == "qcow2" ]; then
-        modprobe nbd max_part=8
-        qemu-nbd -c $nbddevice $image_image
-        mount $nbdmount $work_dir/$image_template
-    else
-        #loopdevice=`losetup -f`
-        echo "Available loop device is $loopdevice"
-        losetup $loopdevice $image_image
-        #kpartx -av $loopdevice
-        mount $loopdevice $work_dir/$image_template 
-        mount -o bind /dev $work_dir/$image_template/dev
-        mount -o bind /proc $work_dir/$image_template/proc
-        mount -o bind /sys $work_dir/$image_template/sys
-    fi
-    exit 0
-fi
-
-# Where to create newly-created LXC container rootfs filesystems, fstabs, and confs:
-export BASEDIR=$work_dir
-
-# This is a list of semi-colon separated files/directories that will be needed by templates.
-export SOFTWARE="$software"
-export ROOTFS=$work_dir/$image_template
-export TEMPLATE=$image_template
-
-if [ -z "$TEMPLATE" ]; then
-	TEMPLATE="default"
-fi
-
-./configure_software $ROOTFS $TEMPLATE
-echo
-
-exit
-

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b60d2c7d/tools/cartridge_create/init_scripts/default/default
----------------------------------------------------------------------
diff --git a/tools/cartridge_create/init_scripts/default/default b/tools/cartridge_create/init_scripts/default/default
deleted file mode 100644
index 7d5274b..0000000
--- a/tools/cartridge_create/init_scripts/default/default
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/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.
-#
-# ----------------------------------------------------------------------------
-
-INSTANCE=$1
-INSTANCE_USER=$2
-KEY=$3
-SOFTWARE=$4
-
-SCP="scp -i ./$KEY"
-SSH="ssh -i ./$KEY"
-
-$SCP ./wso2-openstack-init.sh $INSTANCE_USER@$INSTANCE:
-$SCP ./default.ctrg $INSTANCE_USER@$INSTANCE:
-$SCP ./get-launch-params.rb $INSTANCE_USER@$INSTANCE:
-
-# Copy additional software
-arr=$(echo $SOFTWARE | tr ":" "\n")
-for x in $arr
-do
-   $SCP $x $INSTANCE_USER@$INSTANCE:
-done
-
-# Execute the cartridge creation process in the remoter server
-$SSH $INSTANCE_USER@$INSTANCE "sudo chmod 755 ./default.ctrg;sudo ./default.ctrg"

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b60d2c7d/tools/cartridge_create/init_scripts/default/default.ctrg
----------------------------------------------------------------------
diff --git a/tools/cartridge_create/init_scripts/default/default.ctrg b/tools/cartridge_create/init_scripts/default/default.ctrg
deleted file mode 100644
index d9414f0..0000000
--- a/tools/cartridge_create/init_scripts/default/default.ctrg
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/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.
-#
-# ----------------------------------------------------------------------------
-
-    mv ./wso2-openstack-init.sh /opt/
-    mv ./default.ctrg 
-    mv ./get-launch-params.rb /opt/
-    mv ./*.tar.gz /opt/
-    mv ./*.zip /opt/
-
-	apt-get update
-	# Next, all th packages.
-	
-	# See http://blog.bodhizazen.net/linux/lxc-configure-ubuntu-lucid-containers/
-	# This requirement is confirmed on 10.04.1 LTS.  Within LXC, the
-	# upstart "startup" signal is sent, but not "network-interface", etc.
-	pushd /etc/init/
-	cp -a ufw.conf ufw.conf-dist
-	sed '
-s/start on (starting network-interface/start on startup\n#start on (starting network-interface/
-s/          or starting network-manager/#          or starting network-manager/
-s/          or starting networking)/#          or starting network-manager/
-' < ufw.conf-dist > ufw.conf
-	
-	popd
-    
-    pushd /etc
-    echo "#!/bin/bash -e
-chmod 755 /opt/wso2-openstack-init.sh
-/opt/wso2-openstack-init.sh > /var/log/wso2-openstack-init.log
-exit 0
-    " > rc.local
-    popd

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b60d2c7d/tools/cartridge_create/init_scripts/default/get-launch-params.rb
----------------------------------------------------------------------
diff --git a/tools/cartridge_create/init_scripts/default/get-launch-params.rb b/tools/cartridge_create/init_scripts/default/get-launch-params.rb
deleted file mode 100644
index c6368ca..0000000
--- a/tools/cartridge_create/init_scripts/default/get-launch-params.rb
+++ /dev/null
@@ -1,55 +0,0 @@
-#! /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(
-  "/var/lib/cloud/instance/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/b60d2c7d/tools/cartridge_create/init_scripts/default/stratos-openstack-init.sh
----------------------------------------------------------------------
diff --git a/tools/cartridge_create/init_scripts/default/stratos-openstack-init.sh b/tools/cartridge_create/init_scripts/default/stratos-openstack-init.sh
deleted file mode 100644
index 7e8430a..0000000
--- a/tools/cartridge_create/init_scripts/default/stratos-openstack-init.sh
+++ /dev/null
@@ -1,57 +0,0 @@
-#!/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 LOG=/var/log/wso2-openstack.log
-instance_path=/var/lib/cloud/instance
-
-if [ ! -d ${instance_path}/payload ]; then
-
-    echo "creating payload dir ... " >> $LOG
-    mkdir ${instance_path}/payload
-    echo "payload dir created ... " >> $LOG
-    cp ${instance_path}/user-data.txt ${instance_path}/payload/user-data.zip
-    echo "payload copied  ... "  >> $LOG
-    unzip -d ${instance_path}/payload ${instance_path}/payload/user-data.zip
-    echo "unzippeddd..." >> $LOG
-
-    for i in `/usr/bin/ruby /opt/get-launch-params.rb`
-    do
-    echo "exporting to bashrc $i ... " >> $LOG
-        echo "export" ${i} >> /home/ubuntu/.bashrc
-    done
-    source /home/ubuntu/.bashrc
-    # Write a cronjob to execute wso2-openstack-init.sh periodically until public ip is assigned
-    #crontab -l > ./mycron
-    #echo "*/${CRON_DURATION} * * * * /opt/wso2-openstack-init.sh > /var/log/wso2-openstack-init.log" >> ./mycron
-    #crontab ./mycron
-    #rm ./mycron
-
-fi
-
-
-
-for i in `/usr/bin/ruby /opt/get-launch-params.rb`
-do
-    export ${i}
-done
-
-echo "Done" >> $LOG
-# ========================== // End of script ===========================================================

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b60d2c7d/tools/cartridge_create/init_scripts/default/stratos.pem
----------------------------------------------------------------------
diff --git a/tools/cartridge_create/init_scripts/default/stratos.pem b/tools/cartridge_create/init_scripts/default/stratos.pem
deleted file mode 100644
index 7b2155e..0000000
--- a/tools/cartridge_create/init_scripts/default/stratos.pem
+++ /dev/null
@@ -1,16 +0,0 @@
------BEGIN RSA PRIVATE KEY-----
-MIICXQIBAAKBgQDUdNzv8oHkA8Zn28iQH2qyiV7ZJlBITqp4iw21ZbuyhFtDw2c0
-7euC/g4zbdLjAO4Wofn03C9LSA8KcWKYz4ubaKd+6xG/ywTW2QDRFdGDUY6Dwvkj
-3vnLlPWqvRBpF8ZclkeIjX6svydRvov3F6BSsbYY3trm9PlMtsZq/jtswwIDAQAB
-AoGAEJTqZYPc5WnyA0shFTaOgk68a2BVJb+WCIB52m2NP7qa0OggVv42wmuHujXZ
-HsSE0Jllw9mni02ddugwlNKmB5+z2yiJoGkuaFhFNwB4xFjjujRwMf7ZtoDpa8Yo
-SS1f94dswB31kT601HcUyCEwRBfD9pYBduysFZ1I3/ozVukCQQDs1Lm+LvmZQgLa
-BaWqU73MShDypiyMHVyKwnDUu/zaHu+9r15z/UHroU2nRIRteNv77nUmHsQVHKOc
-0QpmEsT3AkEA5acVolx+4mSCe4ZXh1R9hHZ+HdRrvC2yBiZhHe3bHbcyBN+oPMF4
-OcUE2JsE2+IIJomC5B/v6vjsf67yCFo/lQJAfm+jKjGR94wSUasqIqDKd0IjgifN
-KJCUU1AzRJ+IAjr56t6xImNWyiE3f9FIkdkwOHO5/zv1mv/LKXFAh/YFSQJBAMKE
-MWjiW366j2K9OWohAGewTcZKZC5xrfZTj7LgAtY6kx1Zq5A6dvDHlgE53HW6EBlE
-JB/BhV9LFFZaAhtdBbkCQQDrx9X5f/Lbe39kx5UMtvYrswpYjbKW+qRoQ38NryYA
-G7rRPsgmrjURSEeH4VUG//7gV8wGze7cl50luI2T8+Kg
------END RSA PRIVATE KEY-----
-

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b60d2c7d/tools/cartridge_create/init_scripts/mysql/ec2/get-launch-params.rb
----------------------------------------------------------------------
diff --git a/tools/cartridge_create/init_scripts/mysql/ec2/get-launch-params.rb b/tools/cartridge_create/init_scripts/mysql/ec2/get-launch-params.rb
deleted file mode 100644
index 8991b7b..0000000
--- a/tools/cartridge_create/init_scripts/mysql/ec2/get-launch-params.rb
+++ /dev/null
@@ -1,51 +0,0 @@
-#! /usr/bin/ruby
-# ----------------------------------------------------------------------------
-#  Copyright 2005-20012 WSO2, Inc. http://www.apache.org
-#
-#  Licensed 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/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/b60d2c7d/tools/cartridge_create/init_scripts/mysql/ec2/healthcheck.sh
----------------------------------------------------------------------
diff --git a/tools/cartridge_create/init_scripts/mysql/ec2/healthcheck.sh b/tools/cartridge_create/init_scripts/mysql/ec2/healthcheck.sh
deleted file mode 100644
index 706022b..0000000
--- a/tools/cartridge_create/init_scripts/mysql/ec2/healthcheck.sh
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/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/b60d2c7d/tools/cartridge_create/init_scripts/mysql/ec2/stratos-init.sh
----------------------------------------------------------------------
diff --git a/tools/cartridge_create/init_scripts/mysql/ec2/stratos-init.sh b/tools/cartridge_create/init_scripts/mysql/ec2/stratos-init.sh
deleted file mode 100644
index 3dc20a8..0000000
--- a/tools/cartridge_create/init_scripts/mysql/ec2/stratos-init.sh
+++ /dev/null
@@ -1,152 +0,0 @@
-#!/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 LOG=/var/log/stratos-cartridge.log
-instance_path=/opt
-PUBLIC_IP=""
-KEY=`uuidgen`
-CRON_DURATION=1
-SLEEP_DURATION=3
-
-if [ ! -d ${instance_path}/payload ]; then
-
-    echo "creating payload dir ... " >> $LOG
-    mkdir ${instance_path}/payload
-    echo "payload dir created ... " >> $LOG
-    wget http://169.254.169.254/latest/user-data -O ${instance_path}/payload/payload.zip
-    echo "payload copied  ... "  >> $LOG
-    unzip -d ${instance_path}/payload ${instance_path}/payload/payload.zip
-    echo "unzipped..." >> $LOG
-
-    for i in `/usr/bin/ruby /opt/get-launch-params.rb`
-    do
-    echo "exporting to bashrc $i ... " >> $LOG
-        echo "export" ${i} >> /home/ubuntu/.bashrc
-    done
-    source /home/ubuntu/.bashrc
-
-fi
-
-if [ -f public-ipv4 ]; then
-    echo "public-ipv4 already exists. Removing the public-ipv4 file" >> $LOG
-    rm public-ipv4
-fi
-
-echo ---------------------------- >> $LOG
-echo "getting public ip from metadata service" >> $LOG
-
-wget http://169.254.169.254/latest/meta-data/public-ipv4
-files="`cat public-ipv4`"
-if [[ -z ${files} ]]; then
-    echo "getting public ip" >> $LOG
-    for i in {1..30}
-    do
-      rm -f ./public-ipv4
-      wget http://169.254.169.254/latest/meta-data/public-ipv4
-      files="`cat public-ipv4`"
-      if [ -z $files ]; then
-          echo "Public ip is not yet assigned. Wait and continue for $i the time ..." >> $LOG
-          sleep $SLEEP_DURATION
-      else
-          echo "Public ip assigned" >> $LOG
-          #crontab -r
-          break
-      fi
-    done
-
-    if [ -z $files ]; then
-      echo "Public ip is not yet assigned. So exit" >> $LOG
-      exit 0
-    fi
-    for x in $files
-    do
-        PUBLIC_IP="$x"
-    done
-
-
-else 
-   PUBLIC_IP="$files"
-   #crontab -r
-fi
-
-
-for i in `/usr/bin/ruby /opt/get-launch-params.rb`
-do
-    export ${i}
-done
-
-echo "Setting MySQL root password" >> $LOG
-if [[ (-n ${MYSQL_PASSWORD} ) ]]; then
-	mysqladmin -u root password "${MYSQL_PASSWORD}"
-	mysql -uroot -p${MYSQL_PASSWORD} -e "GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'   IDENTIFIED BY '${MYSQL_PASSWORD}' WITH GRANT OPTION;flush privileges;"
-	echo "MySQL root password set" >> $LOG
-fi
-
-cp -f ${instance_path}/payload/ssl-cert-snakeoil.pem /etc/ssl/certs/ssl-cert-snakeoil.pem
-cp -f ${instance_path}/payload/ssl-cert-snakeoil.key /etc/ssl/private/ssl-cert-snakeoil.key
-/etc/init.d/apache2 restart
-
-echo "Logging sys variables .. PUBLIC_IP:${PUBLIC_IP}, HOST_NAME:${HOST_NAME}, KEY:${KEY}, PORTS=${PORTS} , BAM:${BAM_IP}, GITREPO:${GIT_REPO}" >> $LOG
-
-mkdir -p  /etc/agent/conf
-
-echo "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:agen=\"http://service.agent.cartridge.stratos.apache.org\">
-  <soapenv:Header/>
-  <soapenv:Body>
-     <agen:register>
-        <registrant> 
-           <alarmingLowerRate>${ALARMING_LOWER_RATE}</alarmingLowerRate>
-           <alarmingUpperRate>${ALARMING_UPPER_RATE}</alarmingUpperRate>
-           <hostName>${HOST_NAME}</hostName>
-           <key>${KEY}</key>
-          <maxInstanceCount>${MAX}</maxInstanceCount>
-          <maxRequestsPerSecond>${MAX_REQUESTS_PER_SEC}</maxRequestsPerSecond>
-          <minInstanceCount>${MIN}</minInstanceCount> " > /etc/agent/conf/request.xml
-
-IFS='|' read -ra PT <<< "${PORTS}"
-for i in "${PT[@]}"; do
-IFS=':' read -ra PP <<< "$i"
-echo "          <portMappings>
-                        <primaryPort>${PP[1]}</primaryPort>
-                        <proxyPort>${PP[2]}</proxyPort>
-                        <type>${PP[0]}</type>
-                </portMappings>">> /etc/agent/conf/request.xml
-done
-
-echo "
-           <service>${SERVICE}</service>
-           <remoteHost>${PUBLIC_IP}</remoteHost>
-           <roundsToAverage>${ROUNDS_TO_AVERAGE}</roundsToAverage>
-           <scaleDownFactor>${SCALE_DOWN_FACTOR}</scaleDownFactor>
-           <tenantRange>${TENANT_RANGE}</tenantRange>
-        </registrant>
-     </agen:register>
-  </soapenv:Body>
-</soapenv:Envelope>
-" >> /etc/agent/conf/request.xml
-
-sleep 3
-echo "Sending register request to Cartridge agent service" >> $LOG
-curl -X POST -H "Content-Type: text/xml" -H "SOAPAction: urn:register" -d @/etc/agent/conf/request.xml -k --silent --output /dev/null "${CARTRIDGE_AGENT_EPR}"
-
-
-# ========================== // End of script ===========================================================

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b60d2c7d/tools/cartridge_create/init_scripts/mysql/get-launch-params.rb
----------------------------------------------------------------------
diff --git a/tools/cartridge_create/init_scripts/mysql/get-launch-params.rb b/tools/cartridge_create/init_scripts/mysql/get-launch-params.rb
deleted file mode 100644
index c6368ca..0000000
--- a/tools/cartridge_create/init_scripts/mysql/get-launch-params.rb
+++ /dev/null
@@ -1,55 +0,0 @@
-#! /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(
-  "/var/lib/cloud/instance/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/b60d2c7d/tools/cartridge_create/init_scripts/mysql/mysql
----------------------------------------------------------------------
diff --git a/tools/cartridge_create/init_scripts/mysql/mysql b/tools/cartridge_create/init_scripts/mysql/mysql
deleted file mode 100644
index 063b14c..0000000
--- a/tools/cartridge_create/init_scripts/mysql/mysql
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/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.
-#
-# ----------------------------------------------------------------------------
-
-INSTANCE=$1
-INSTANCE_USER=$2
-KEY=$3
-SOFTWARE=$4
-
-SCP="scp -i ./$KEY"
-SSH="ssh -i ./$KEY"
-
-$SCP ./wso2-cartridge-init.sh $INSTANCE_USER@$INSTANCE:
-$SCP ./mysql.ctrg $INSTANCE_USER@$INSTANCE:
-$SCP ./get-launch-params.rb $INSTANCE_USER@$INSTANCE:
-$SCP ./cc/ssl-cert-snakeoil.pem $INSTANCE_USER@$INSTANCE:
-$SCP ./cc/ssl-cert-snakeoil.key $INSTANCE_USER@$INSTANCE:
-$SCP ./phpMyAdmin-3.5.6-english.tar.xz $INSTANCE_USER@$INSTANCE:
-
-# Copy additional software
-arr=$(echo $SOFTWARE | tr ":" "\n")
-for x in $arr
-do
-   $SCP $x $INSTANCE_USER@$INSTANCE:
-done
-
-# Execute the cartridge creation process in the remoter server
-$SSH $INSTANCE_USER@$INSTANCE "sudo chmod 755 ./mysql.ctrg;sudo ./mysql.ctrg"

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b60d2c7d/tools/cartridge_create/init_scripts/mysql/mysql.ctrg
----------------------------------------------------------------------
diff --git a/tools/cartridge_create/init_scripts/mysql/mysql.ctrg b/tools/cartridge_create/init_scripts/mysql/mysql.ctrg
deleted file mode 100644
index 0e9b9cf..0000000
--- a/tools/cartridge_create/init_scripts/mysql/mysql.ctrg
+++ /dev/null
@@ -1,58 +0,0 @@
-#!/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.
-#
-# ----------------------------------------------------------------------------
-
-    mv ./wso2-cartridge-init.sh /opt/
-    mv ./get-launch-params.rb /opt/
-    mv ./ssl-cert-snakeoil.pem /etc/ssl/certs/
-    mv ./ssl-cert-snakeoil.key /etc/ssl/private/
-    mv ./*.tar.gz /opt/
-    mv ./*.zip /opt/
-#    tar -xf phpMyAdmin-3.5.6-english.tar.xz
-	apt-get update
-	# Next, all th packages.
-	
-	apt-get install -y \
-	nano zip mysql-server git \
-	xml-twig-tools phpmyadmin ruby
-#	apache2-mpm-prefork apache2-utils apache2.2-bin apache2.2-common dbconfig-common fontconfig-config libapache2-mod-php5 \
-#	libaprutil1-dbd-sqlite3 libaprutil1-ldap libcap2 libfontconfig1 libgd2-xpm libjpeg-turbo8 libjpeg8 libmcrypt4 \
-#	libt1-5 libxpm4 php5-cli php5-common php5-gd php5-mcrypt php5-mysql ssl-cert ttf-dejavu-core libboost-all-dev ruby
-
-	# Enable HTTPS:
-	a2enmod ssl
-	a2ensite default-ssl	
-	# Desable HTTP
-#	a2dissite default	
-
- 	# set mysql to listen to all network
-	cp /etc/mysql/my.cnf /etc/mysql/my.cnf.org
-	cat /etc/mysql/my.cnf.org | sed -e 's/127.0.0.1/0.0.0.0/' > $ROOTFS/etc/mysql/my.cnf	
-
-	# See http://blog.bodhizazen.net/linux/lxc-configure-ubuntu-lucid-containers/
-	# This requirement is confirmed on 10.04.1 LTS.  Within LXC, the
-	# upstart "startup" signal is sent, but not "network-interface", etc.
-    echo "#!/bin/bash -e
-mkdir -p /etc/agent/conf
-chmod 755 /opt/wso2-cartridge-init.sh
-/opt/wso2-cartridge-init.sh > /var/log/wso2-cartridge-init.log
-exit 0
-    " > /etc/rc.local

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b60d2c7d/tools/cartridge_create/init_scripts/mysql/openstack/get-launch-params.rb
----------------------------------------------------------------------
diff --git a/tools/cartridge_create/init_scripts/mysql/openstack/get-launch-params.rb b/tools/cartridge_create/init_scripts/mysql/openstack/get-launch-params.rb
deleted file mode 100644
index c6368ca..0000000
--- a/tools/cartridge_create/init_scripts/mysql/openstack/get-launch-params.rb
+++ /dev/null
@@ -1,55 +0,0 @@
-#! /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(
-  "/var/lib/cloud/instance/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/b60d2c7d/tools/cartridge_create/init_scripts/mysql/openstack/healthcheck.sh
----------------------------------------------------------------------
diff --git a/tools/cartridge_create/init_scripts/mysql/openstack/healthcheck.sh b/tools/cartridge_create/init_scripts/mysql/openstack/healthcheck.sh
deleted file mode 100644
index 4194608..0000000
--- a/tools/cartridge_create/init_scripts/mysql/openstack/healthcheck.sh
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/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/b60d2c7d/tools/cartridge_create/init_scripts/mysql/openstack/stratos-init.sh
----------------------------------------------------------------------
diff --git a/tools/cartridge_create/init_scripts/mysql/openstack/stratos-init.sh b/tools/cartridge_create/init_scripts/mysql/openstack/stratos-init.sh
deleted file mode 100755
index 29ae6f6..0000000
--- a/tools/cartridge_create/init_scripts/mysql/openstack/stratos-init.sh
+++ /dev/null
@@ -1,165 +0,0 @@
-#!/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.
-
-export LOG=/var/log/stratos-cartridge.log
-instance_path=/var/lib/cloud/instance
-PUBLIC_IP=""
-KEY=`uuidgen`
-CRON_DURATION=1
-RETRY_COUNT=30
-SLEEP_DURATION=3
-
-if [ ! -d ${instance_path}/payload ]; then
-
-    echo "creating payload dir ... " >> $LOG
-    mkdir ${instance_path}/payload
-    echo "payload dir created ... " >> $LOG
-    cp ${instance_path}/user-data.txt ${instance_path}/payload/user-data.zip
-    echo "payload copied  ... "  >> $LOG
-    unzip -d ${instance_path}/payload ${instance_path}/payload/user-data.zip
-    echo "unzippeddd..." >> $LOG
-
-    for i in `/usr/bin/ruby /opt/get-launch-params.rb`
-    do
-    echo "exporting to bashrc $i ... " >> $LOG
-        echo "export" ${i} >> /home/ubuntu/.bashrc
-    done
-    source /home/ubuntu/.bashrc
-    # Write a cronjob to execute wso2-cartridge-init.sh periodically until public ip is assigned
-    #crontab -l > ./mycron
-    #echo "*/${CRON_DURATION} * * * * /opt/wso2-cartridge-init.sh > /var/log/wso2-cartridge-init.log" >> ./mycron
-    #crontab ./mycron
-    #rm ./mycron
-
-fi
-
-
-echo ---------------------------- >> $LOG
-echo "getting public ip from metadata service" >> $LOG
-
-wget http://169.254.169.254/latest/meta-data/public-ipv4
-files="`cat public-ipv4`"
-if [[ -z ${files} ]]; then
-    echo "getting public ip" >> $LOG
-    for i in {1..30}
-    do
-      rm -f ./public-ipv4
-      wget http://169.254.169.254/latest/meta-data/public-ipv4
-      files="`cat public-ipv4`"
-      if [ -z $files ]; then
-          echo "Public ip is not yet assigned. Wait and continue for $i the time ..." >> $LOG
-          sleep $SLEEP_DURATION
-      else
-          echo "Public ip assigned" >> $LOG
-          #crontab -r
-          break
-      fi
-    done
-
-    if [ -z $files ]; then
-      echo "Public ip is not yet assigned. So exit" >> $LOG
-      exit 0
-    fi
-    for x in $files
-    do
-        PUBLIC_IP="$x"
-    done
-
-
-else 
-   PUBLIC_IP="$files"
-   #crontab -r
-fi
-
-
-for i in `/usr/bin/ruby /opt/get-launch-params.rb`
-do
-    export ${i}
-done
-
-cp -f ${instance_path}/payload/ssl-cert-snakeoil.pem /etc/ssl/certs/ssl-cert-snakeoil.pem
-cp -f ${instance_path}/payload/ssl-cert-snakeoil.key /etc/ssl/private/ssl-cert-snakeoil.key
-
-echo "Setting MySQL root password" >> $LOG
-if [[ (-n ${MYSQL_PASSWORD} ) ]]; then
-       mysqladmin -u root password "${MYSQL_PASSWORD}"
-       mysql -uroot -p${MYSQL_PASSWORD} -e "GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'   IDENTIFIED BY '${MYSQL_PASSWORD}' WITH GRANT OPTION;flush privileges;"
-       echo "MySQL root password set" >> $LOG
-fi
-
-/etc/init.d/apache2 restart
-
-
-echo "Logging sys variables .. PUBLIC_IP:${PUBLIC_IP}, HOST_NAME:${HOST_NAME}, KEY:${KEY}, PORTS=${PORTS} , BAM:${BAM_IP}, GITREPO:${GIT_REPO}" >> $LOG
-
-
-mkdir -p  /etc/agent/conf
-
-echo "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:agen=\"http://service.agent.cartridge.stratos.apache.org\">
-  <soapenv:Header/>
-  <soapenv:Body>
-     <agen:register>
-        <registrant> 
-           <alarmingLowerRate>${ALARMING_LOWER_RATE}</alarmingLowerRate>
-           <alarmingUpperRate>${ALARMING_UPPER_RATE}</alarmingUpperRate>
-           <hostName>${HOST_NAME}</hostName>
-           <key>${KEY}</key>
-          <maxInstanceCount>${MAX}</maxInstanceCount>
-      <maxRequestsPerSecond>${MAX_REQUESTS_PER_SEC}</maxRequestsPerSecond>
-          <minInstanceCount>${MIN}</minInstanceCount> " > /etc/agent/conf/request.xml
-
-IFS='|' read -ra PT <<< "${PORTS}"
-for i in "${PT[@]}"; do
-IFS=':' read -ra PP <<< "$i"
-echo "          <portMappings>
-                        <primaryPort>${PP[1]}</primaryPort>
-                        <proxyPort>${PP[2]}</proxyPort>
-                        <type>${PP[0]}</type>
-                </portMappings>">> /etc/agent/conf/request.xml
-done
-
-echo "          <remoteHost>${PUBLIC_IP}</remoteHost>
-           <service>${SERVICE}</service>
-       <remoteHost>${PUBLIC_IP}</remoteHost>
-           <roundsToAverage>${ROUNDS_TO_AVERAGE}</roundsToAverage>
-           <scaleDownFactor>${SCALE_DOWN_FACTOR}</scaleDownFactor>
-           <tenantRange>${TENANT_RANGE}</tenantRange>
-        </registrant>
-     </agen:register>
-  </soapenv:Body>
-</soapenv:Envelope>
-" >> /etc/agent/conf/request.xml
-
-
-echo "Sending register request to Cartridge agent service" >> $LOG
-
-curl -X POST -H "Content-Type: text/xml" -H "SOAPAction: urn:register" -d @/etc/agent/conf/request.xml --silent --output /dev/null "$CARTRIDGE_AGENT_EPR" --insecure
-
-
-sleep 5
-
-/etc/init.d/apache2 restart
-# ========================== // End of script ===========================================================

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b60d2c7d/tools/cartridge_create/init_scripts/mysql/stratos.pem
----------------------------------------------------------------------
diff --git a/tools/cartridge_create/init_scripts/mysql/stratos.pem b/tools/cartridge_create/init_scripts/mysql/stratos.pem
deleted file mode 100644
index abd2985..0000000
--- a/tools/cartridge_create/init_scripts/mysql/stratos.pem
+++ /dev/null
@@ -1,16 +0,0 @@
------BEGIN RSA PRIVATE KEY-----
-MIICXQIBAAKBgQDUExvnBa8QbdRPsyZFppsuO9pVG4Ve6cuo7cf4oXUiqnt5aYtC
-2h+1NoGwpxTyeqnMTw1UvyrGme3r/gwYBhtEwiSsXFTcPVqyA30wq1Gp+ghnj5NR
-sGEl4dVQYGl/+KbRDQQFmx6K31LAXc+EUrvUjCtXjuH5LrhRGgdIW44EeQIDAQAB
-AoGAMsJYHVVo71+6P1E7ydP0tH4y5cfuhicjTc2L3WCXrrJrV0YBxQB8Ml1XcTas
-dtURKwuIv036KQrSvXdS4bUkdULiDAfkx8I4IRK1TnT0SCHtoO/lOu3NweKI3QeW
-9DX8sdRZ1xOdarmLydJkyk/kLE8v8VbfPaxgxM8KiIMtwtkCQQD2sWf8+/FEOcW7
-11omtKAqIJW+mnARfSMUJspJgvVo+dQbQwdYhgH5z93Y5bH7bUmHZWNsnFYqcPOw
-Ns24QGtjAkEA3BNaqrvba4DEaX1o8Hp8o2NAindAjiKF0WP61l7TNCtgFt8hOiJF
-vTl0MOtPxIOlXrn/pIf0GiQHRykrt7tNcwJBAOd4fL820yIWJz/iiDdrIiGFI5yN
-onv2c9SztPkXBRgz2l6eHSVl0DLLZTjgBYmJ+QUvEARYCM2X4D/GnG63G0sCQEDF
-7YSc3/rnHmgSAkXtNyv7tW5LpRNwc8RqUdSweic7sP9qUuRCXBZSh7EyQPsM6CpW
-QjjRzvW2rvGx220rUqMCQQCiFgDaJvTl7iB9/G/Mzj8xIpABzcwq4AmneR2gEBxf
-38YHLAADdUymlG1hbs2J+yT6Tb5YGFFhDHdOTQ4FOAjl
------END RSA PRIVATE KEY-----
-

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b60d2c7d/tools/cartridge_create/init_scripts/mysql/vcloud/stratos-init.sh
----------------------------------------------------------------------
diff --git a/tools/cartridge_create/init_scripts/mysql/vcloud/stratos-init.sh b/tools/cartridge_create/init_scripts/mysql/vcloud/stratos-init.sh
deleted file mode 100644
index 13649c2..0000000
--- a/tools/cartridge_create/init_scripts/mysql/vcloud/stratos-init.sh
+++ /dev/null
@@ -1,152 +0,0 @@
-#!/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 LOG=/var/log/apache-cartridge.log
-instance_path=/var/lib/cloud/instance
-PUBLIC_IP=""
-KEY=`uuidgen`
-CRON_DURATION=1
-RETRY_COUNT=30
-SLEEP_DURATION=30
-
-#if [ ! -d ${instance_path}/payload ]; then
-#
-#    echo "creating payload dir ... " >> $LOG
-#    mkdir ${instance_path}/payload
-#    echo "payload dir created ... " >> $LOG
-#    cp ${instance_path}/user-data.txt ${instance_path}/payload/user-data.zip
-#    echo "payload copied  ... "  >> $LOG
-#    unzip -d ${instance_path}/payload ${instance_path}/payload/user-data.zip
-#    echo "unzippeddd..." >> $LOG
-#
-#    for i in `/usr/bin/ruby /opt/get-launch-params.rb`
-#    do
-#    echo "exporting to bashrc $i ... " >> $LOG
-#        echo "export" ${i} >> /home/ubuntu/.bashrc
-#    done
-#    source /home/ubuntu/.bashrc
-    # Write a cronjob to execute apache-openstack-init.sh periodically until public ip is assigned
-    #crontab -l > ./mycron
-    #echo "*/${CRON_DURATION} * * * * /opt/apache-openstack-init.sh > /var/log/apache-openstack-init.log" >> ./mycron
-    #crontab ./mycron
-    #rm ./mycron
-
-#fi
-
-    for i in `/usr/bin/ruby /opt/get-launch-params.rb`
-    do
-    echo "exporting to bashrc $i ... " >> $LOG
-        echo "export" ${i} >> /root/.bashrc
-    done
-    source /root/.bashrc
-
-echo ---------------------------- >> $LOG
-echo "getting private IP" >> $LOG
-
-#wget http://169.254.169.254/latest/meta-data/public-ipv4
-#files="`cat public-ipv4`"
-#if [[ -z ${files} ]]; then
-#    echo "getting public ip" >> $LOG
-#    for i in {1..$RETRY_COUNT}
-#    do
-#      rm -f ./public-ipv4
-#      wget http://169.254.169.254/latest/meta-data/public-ipv4
-#      files="`cat public-ipv4`"
-#      if [ -z $files ]; then
-#          echo "Public ip is not yet assigned. Wait and continue for $i the time ..." >> $LOG
-#          sleep $SLEEP_DURATION
-#      else
-#          echo "Public ip assigned" >> $LOG
-          #crontab -r
-#          break
-#      fi
-#    done
-
-#    if [ -z $files ]; then
-#      echo "Public ip is not yet assigned. So shutdown the instance and exit" >> $LOG
-#      /sbin/poweroff
-#      exit 0
-#    fi
-#    for x in $files
-#    do
-#        PUBLIC_IP="$x"
-#    done
-
-
-#else 
-#   PUBLIC_IP="$files"
-   #crontab -r
-#fi
-PUBLIC_IP=`ifconfig | awk -F':' '/inet addr/&&!/127.0.0.1/{split($2,_," ");print _[1]}'`
-
-for i in `/usr/bin/ruby /opt/get-launch-params.rb`
-do
-    export ${i}
-done
-
-#PORTS=HTTP:8280:80|HTTPS:8243:443
-#MYSQL_HOST
-#MYSQL_USER
-#MYSQL_PASSWORD
-echo "Logging sys variables .. PUBLIC_IP:${PUBLIC_IP}, HOST_NAME:${HOST_NAME}, KEY:${KEY}, PORTS=${PORTS} , BAM:${BAM_IP}, GITREPO:${GIT_REPO}" >> $LOG
-
-
-echo "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:agen=\"http://agent.cartridge.stratos.apache.org\">
-  <soapenv:Header/>
-  <soapenv:Body>
-     <agen:register>
-        <registrant> 
-           <alarmingLowerRate>${ALARMING_LOWER_RATE}</alarmingLowerRate>
-           <alarmingUpperRate>${ALARMING_UPPER_RATE}</alarmingUpperRate>
-           <hostName>${HOST_NAME}</hostName>
-           <key>${KEY}</key>
-          <maxInstanceCount>${MAX}</maxInstanceCount>
-	  <maxRequestsPerSecond>${MAX_REQUESTS_PER_SEC}</maxRequestsPerSecond>
-          <minInstanceCount>${MIN}</minInstanceCount> " > /etc/agent/conf/request.xml
-
-IFS='|' read -ra PT <<< "${PORTS}"
-for i in "${PT[@]}"; do
-IFS=':' read -ra PP <<< "$i"
-echo "          <portMappings>
-                        <primaryPort>${PP[1]}</primaryPort>
-                        <proxyPort>${PP[2]}</proxyPort>
-                        <type>${PP[0]}</type>
-                </portMappings>">> /etc/agent/conf/request.xml
-done
-
-echo "          <remoteHost>${PUBLIC_IP}</remoteHost>
-           <service>${SERVICE}</service>
-	   <remoteHost>${PUBLIC_IP}</remoteHost>
-           <roundsToAverage>${ROUNDS_TO_AVERAGE}</roundsToAverage>
-           <scaleDownFactor>${SCALE_DOWN_FACTOR}</scaleDownFactor>
-           <tenantRange>${TENANT_RANGE}</tenantRange>
-        </registrant>
-     </agen:register>
-  </soapenv:Body>
-</soapenv:Envelope>
-" >> /etc/agent/conf/request.xml
-
-
-echo "Sending register request to Cartridge agent service" >> $LOG
-
-curl -X POST -H "Content-Type: text/xml" -d @/etc/agent/conf/request.xml --silent --output /dev/null "$CARTRIDGE_AGENT_EPR"
-
-# ========================== // End of script ===========================================================

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b60d2c7d/tools/cartridge_create/init_scripts/php/cartridge_data_publisher_1.0.2.zip
----------------------------------------------------------------------
diff --git a/tools/cartridge_create/init_scripts/php/cartridge_data_publisher_1.0.2.zip b/tools/cartridge_create/init_scripts/php/cartridge_data_publisher_1.0.2.zip
deleted file mode 100644
index 08d8b1d..0000000
Binary files a/tools/cartridge_create/init_scripts/php/cartridge_data_publisher_1.0.2.zip and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b60d2c7d/tools/cartridge_create/init_scripts/php/default
----------------------------------------------------------------------
diff --git a/tools/cartridge_create/init_scripts/php/default b/tools/cartridge_create/init_scripts/php/default
deleted file mode 100644
index cbb5406..0000000
--- a/tools/cartridge_create/init_scripts/php/default
+++ /dev/null
@@ -1,59 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#  http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-<VirtualHost *:80>
-	ServerAdmin webmaster@localhost
-
-	DocumentRoot /var/www/www
-	Alias /simplesaml /var/www/simplesamlphp/www
-	<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>

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b60d2c7d/tools/cartridge_create/init_scripts/php/default-ssl
----------------------------------------------------------------------
diff --git a/tools/cartridge_create/init_scripts/php/default-ssl b/tools/cartridge_create/init_scripts/php/default-ssl
deleted file mode 100644
index e48d3ea..0000000
--- a/tools/cartridge_create/init_scripts/php/default-ssl
+++ /dev/null
@@ -1,190 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#  http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-<IfModule mod_ssl.c>
-<VirtualHost _default_:443>
-	ServerAdmin webmaster@localhost
-
-	DocumentRoot /var/www/www
-	Alias /simplesaml /var/www/simplesamlphp/www
-	<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/b60d2c7d/tools/cartridge_create/init_scripts/php/ec2/get-launch-params.rb
----------------------------------------------------------------------
diff --git a/tools/cartridge_create/init_scripts/php/ec2/get-launch-params.rb b/tools/cartridge_create/init_scripts/php/ec2/get-launch-params.rb
deleted file mode 100644
index baab411..0000000
--- a/tools/cartridge_create/init_scripts/php/ec2/get-launch-params.rb
+++ /dev/null
@@ -1,54 +0,0 @@
-#! /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/b60d2c7d/tools/cartridge_create/init_scripts/php/ec2/healthcheck.sh
----------------------------------------------------------------------
diff --git a/tools/cartridge_create/init_scripts/php/ec2/healthcheck.sh b/tools/cartridge_create/init_scripts/php/ec2/healthcheck.sh
deleted file mode 100644
index eb06412..0000000
--- a/tools/cartridge_create/init_scripts/php/ec2/healthcheck.sh
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/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
-
-


[4/4] git commit: Renamed folder cartridge_create to cartridge-create and init_scripts to init-scripts

Posted by im...@apache.org.
Renamed folder cartridge_create to cartridge-create and init_scripts to init-scripts


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

Branch: refs/heads/master
Commit: b60d2c7d9b37d0949eca4729bec86066d903a029
Parents: 00569d4
Author: Imesh Gunaratne <im...@apache.org>
Authored: Tue Dec 3 22:14:16 2013 +0530
Committer: Imesh Gunaratne <im...@apache.org>
Committed: Tue Dec 3 22:14:16 2013 +0530

----------------------------------------------------------------------
 tools/cartridge-create/README                   |  50 +++
 tools/cartridge-create/configure_software       | 383 +++++++++++++++++++
 tools/cartridge-create/create_kvm_image.sh      |  24 ++
 tools/cartridge-create/image_action.sh          | 165 ++++++++
 .../init-scripts/default/default                |  43 +++
 .../init-scripts/default/default.ctrg           |  51 +++
 .../init-scripts/default/get-launch-params.rb   |  55 +++
 .../default/stratos-openstack-init.sh           |  57 +++
 .../init-scripts/default/stratos.pem            |  16 +
 .../init-scripts/mysql/ec2/get-launch-params.rb |  51 +++
 .../init-scripts/mysql/ec2/healthcheck.sh       |  32 ++
 .../init-scripts/mysql/ec2/stratos-init.sh      | 152 ++++++++
 .../init-scripts/mysql/get-launch-params.rb     |  55 +++
 tools/cartridge-create/init-scripts/mysql/mysql |  46 +++
 .../init-scripts/mysql/mysql.ctrg               |  58 +++
 .../mysql/openstack/get-launch-params.rb        |  55 +++
 .../init-scripts/mysql/openstack/healthcheck.sh |  30 ++
 .../mysql/openstack/stratos-init.sh             | 165 ++++++++
 .../init-scripts/mysql/stratos.pem              |  16 +
 .../init-scripts/mysql/vcloud/stratos-init.sh   | 152 ++++++++
 .../php/cartridge_data_publisher_1.0.2.zip      | Bin 0 -> 2832200 bytes
 tools/cartridge-create/init-scripts/php/default |  59 +++
 .../init-scripts/php/default-ssl                | 190 +++++++++
 .../init-scripts/php/ec2/get-launch-params.rb   |  54 +++
 .../init-scripts/php/ec2/healthcheck.sh         |  32 ++
 .../init-scripts/php/ec2/stratos-init.sh        | 304 +++++++++++++++
 .../init-scripts/php/get-launch-params.rb       |  55 +++
 .../php/openstack/get-launch-params.rb          |  55 +++
 .../init-scripts/php/openstack/healthcheck.sh   |  30 ++
 .../init-scripts/php/openstack/stratos-init.sh  | 293 ++++++++++++++
 tools/cartridge-create/init-scripts/php/php     |  49 +++
 .../cartridge-create/init-scripts/php/php.ctrg  |  65 ++++
 .../init-scripts/php/thrift-0.8.0.tar.gz        | Bin 0 -> 2379006 bytes
 .../cartridge-create/init-scripts/php/wso2.pem  |  16 +
 tools/cartridge-create/init-scripts/php/x.sh    |  50 +++
 tools/cartridge-create/init-scripts/php/y.sh    |  32 ++
 .../init-scripts/tomcat/get-launch-params.rb    |  53 +++
 .../tomcat/openstack/get-launch-params.rb       |  55 +++
 .../tomcat/openstack/healthcheck.sh             |  30 ++
 .../tomcat/openstack/stratos-init.sh            | 289 ++++++++++++++
 .../init-scripts/tomcat/payload/README          |  21 +
 .../init-scripts/tomcat/payload/launch-params   |  18 +
 .../init-scripts/tomcat/stratos-init.sh         | 274 +++++++++++++
 .../init-scripts/tomcat/stratos.pem             |  16 +
 tools/cartridge-create/stratos-image            | 100 +++++
 tools/cartridge-create/stratos-image-local      | 310 +++++++++++++++
 tools/cartridge-create/uploadimg.sh             |  32 ++
 tools/cartridge_create/README                   |  50 ---
 tools/cartridge_create/configure_software       | 383 -------------------
 tools/cartridge_create/create_kvm_image.sh      |  24 --
 tools/cartridge_create/image_action.sh          | 165 --------
 .../init_scripts/default/default                |  43 ---
 .../init_scripts/default/default.ctrg           |  51 ---
 .../init_scripts/default/get-launch-params.rb   |  55 ---
 .../default/stratos-openstack-init.sh           |  57 ---
 .../init_scripts/default/stratos.pem            |  16 -
 .../init_scripts/mysql/ec2/get-launch-params.rb |  51 ---
 .../init_scripts/mysql/ec2/healthcheck.sh       |  32 --
 .../init_scripts/mysql/ec2/stratos-init.sh      | 152 --------
 .../init_scripts/mysql/get-launch-params.rb     |  55 ---
 tools/cartridge_create/init_scripts/mysql/mysql |  46 ---
 .../init_scripts/mysql/mysql.ctrg               |  58 ---
 .../mysql/openstack/get-launch-params.rb        |  55 ---
 .../init_scripts/mysql/openstack/healthcheck.sh |  30 --
 .../mysql/openstack/stratos-init.sh             | 165 --------
 .../init_scripts/mysql/stratos.pem              |  16 -
 .../init_scripts/mysql/vcloud/stratos-init.sh   | 152 --------
 .../php/cartridge_data_publisher_1.0.2.zip      | Bin 2832200 -> 0 bytes
 tools/cartridge_create/init_scripts/php/default |  59 ---
 .../init_scripts/php/default-ssl                | 190 ---------
 .../init_scripts/php/ec2/get-launch-params.rb   |  54 ---
 .../init_scripts/php/ec2/healthcheck.sh         |  32 --
 .../init_scripts/php/ec2/stratos-init.sh        | 304 ---------------
 .../init_scripts/php/get-launch-params.rb       |  55 ---
 .../php/openstack/get-launch-params.rb          |  55 ---
 .../init_scripts/php/openstack/healthcheck.sh   |  30 --
 .../init_scripts/php/openstack/stratos-init.sh  | 293 --------------
 tools/cartridge_create/init_scripts/php/php     |  49 ---
 .../cartridge_create/init_scripts/php/php.ctrg  |  65 ----
 .../init_scripts/php/thrift-0.8.0.tar.gz        | Bin 2379006 -> 0 bytes
 .../cartridge_create/init_scripts/php/wso2.pem  |  16 -
 tools/cartridge_create/init_scripts/php/x.sh    |  50 ---
 tools/cartridge_create/init_scripts/php/y.sh    |  32 --
 .../init_scripts/tomcat/get-launch-params.rb    |  53 ---
 .../tomcat/openstack/get-launch-params.rb       |  55 ---
 .../tomcat/openstack/healthcheck.sh             |  30 --
 .../tomcat/openstack/stratos-init.sh            | 289 --------------
 .../init_scripts/tomcat/payload/README          |  21 -
 .../init_scripts/tomcat/payload/launch-params   |  18 -
 .../init_scripts/tomcat/stratos-init.sh         | 274 -------------
 .../init_scripts/tomcat/stratos.pem             |  16 -
 tools/cartridge_create/stratos-image            | 100 -----
 tools/cartridge_create/stratos-image-local      | 310 ---------------
 tools/cartridge_create/uploadimg.sh             |  32 --
 94 files changed, 4138 insertions(+), 4138 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b60d2c7d/tools/cartridge-create/README
----------------------------------------------------------------------
diff --git a/tools/cartridge-create/README b/tools/cartridge-create/README
new file mode 100644
index 0000000..883fe48
--- /dev/null
+++ b/tools/cartridge-create/README
@@ -0,0 +1,50 @@
+This folder contain utilities to create customized images from the already running openstack instances.
+The main utility is a CLI tool called stratos-image.
+Pre-requisites:
+
+You need the private or public(floating)ip of the openstack instance from which you need to create the image. Also you need a username
+for that instance and a private key to access that instance. Copy the private key to init_scripts/<template> (e.g., init_scripts/php) folder.
+
+You need a file with the following information regarding the Openstack environment and copy that file into the current folder.
+When uploading the image you need the variables in the file exported to the environment. 
+Normally when you install the Openstack you get this file generated. Please refer to your Openstack installation documents 
+on how to get the information in this file.
+
+----------------------------------------------------------
+NOVA_API_HOST=192.168.16.20
+GLANCE_API_HOST=192.168.16.20
+KEYSTONE_API_HOST=192.168.16.20
+
+NOVA_REGION="nova"
+
+export NOVA_USERNAME=demo
+export NOVA_PROJECT_ID=demo
+export NOVA_PASSWORD=openstack
+export NOVA_API_KEY=openstack
+export NOVA_REGION_NAME=$NOVA_REGION
+export NOVA_URL="http://$NOVA_API_HOST:5000/v2.0/"
+export NOVA_VERSION="1.1"
+
+export OS_USERNAME=demo
+export OS_PASSWORD=openstack
+export OS_TENANT_ID=7434d33c18e04e60a6751922773fbe2d
+export OS_AUTH_URL="http://$KEYSTONE_API_HOST:5000/v2.0/"
+export OS_AUTH_STRATEGY="keystone"
+
+export EC2_URL="http://$NOVA_API_HOST:8773/services/Cloud"
+export EC2_ACCESS_KEY="8b742fee68c6464198517242828adb82"
+export EC2_SECRET_KEY="279a7f28c8a54d5db8e27524f648a7d3"
+export S3_URL="http://$GLANCE_API_HOST:3333"
+
+----------------------------------------------------------
+
+For help on how to execute stratos-image execute.
+./stratos-image help
+
+Following is an example of create and upload the image for php cartridge
+
+./stratos-image create 192.168.16.129 php ubuntu wso2.pem
+
+nova image-create <vm instance id> php-cloudimg-amd64
+
+

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b60d2c7d/tools/cartridge-create/configure_software
----------------------------------------------------------------------
diff --git a/tools/cartridge-create/configure_software b/tools/cartridge-create/configure_software
new file mode 100755
index 0000000..251a1ac
--- /dev/null
+++ b/tools/cartridge-create/configure_software
@@ -0,0 +1,383 @@
+#!/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.
+# ----------------------------------------------------------------------------
+
+
+ROOTFS=$1
+TEMPLATE=$2
+
+#
+# Locale settings (en_GB for Redcoats, en_US for Yanks):
+#
+LANG="en_US.UTF-8" 
+LANGUAGE="en_US.UTF-8" 
+LC_ALL="en_US.UTF-8" 
+LC_CTYPE="C"
+
+#
+# Ubuntu mirror to use:
+#
+###DEBMIRROR="http://archive.ubuntu.com/ubuntu/"
+#DEBMIRROR="http://us.archive.ubuntu.com/ubuntu/"
+DEBMIRROR="http://lk.archive.ubuntu.com/ubuntu/"
+
+
+mysql() {
+
+	# MySQL still prompts.  Bug.
+	#DEBCONF_FRONTEND='noninteractive' 
+	
+	chroot $ROOTFS apt-get update
+	# Next, all the LAMP packages.  We must first pre-save the password
+	# for MySQL to use:
+	#chroot $ROOTFS echo "mysql-server mysql-server/root_password select ubuntu" | chroot $ROOTFS debconf-set-selections
+	#chroot $ROOTFS echo "mysql-server mysql-server/root_password_again select ubuntu" | chroot $ROOTFS debconf-set-selections
+	
+	chroot $ROOTFS apt-get install -y \
+	nano zip mysql-server git \
+	apache2-mpm-prefork apache2-utils apache2.2-bin apache2.2-common dbconfig-common fontconfig-config libapache2-mod-php5 \
+	libaprutil1-dbd-sqlite3 libaprutil1-ldap libcap2 libfontconfig1 libgd2-xpm libjpeg-turbo8 libjpeg8 libmcrypt4 \
+	libt1-5 libxpm4 php5-cli php5-common php5-gd php5-mcrypt php5-mysql phpmyadmin ssl-cert ttf-dejavu-core ruby
+
+	# Be sure to have a new SSL cert for this new LXC host:
+	rm -f $ROOTFS/etc/ssl/private/ssl-cert-snakeoil.key
+    cp -f ./init_scripts/mysql/cc/ssl-cert-snakeoil.pem $ROOTFS/etc/ssl/certs/
+    cp -f ./init_scripts/mysql/cc/ssl-cert-snakeoil.key $ROOTFS/etc/ssl/private/
+	#chroot $ROOTFS dpkg-reconfigure ssl-cert
+
+	# Enable HTTPS:
+	chroot $ROOTFS a2enmod ssl
+	chroot $ROOTFS a2ensite default-ssl	
+	# Desable HTTP
+	chroot $ROOTFS a2dissite default	
+
+ 	# set mysql to listen to all network
+	chroot $ROOTFS cp /etc/mysql/my.cnf /etc/mysql/my.cnf.org
+	chroot $ROOTFS cat /etc/mysql/my.cnf.org | sed -e 's/127.0.0.1/0.0.0.0/' > $ROOTFS/etc/mysql/my.cnf	
+
+	# See http://blog.bodhizazen.net/linux/lxc-configure-ubuntu-lucid-containers/
+	# This requirement is confirmed on 10.04.1 LTS.  Within LXC, the
+	# upstart "startup" signal is sent, but not "network-interface", etc.
+	pushd $ROOTFS/etc/init/
+	cp -a ufw.conf ufw.conf-dist
+	sed '
+s/start on (starting network-interface/start on startup\n#start on (starting network-interface/
+s/          or starting network-manager/#          or starting network-manager/
+s/          or starting networking)/#          or starting network-manager/
+' < ufw.conf-dist > ufw.conf
+	
+	popd
+
+}
+
+php() {
+
+    cp -f ./init_scripts/php/wso2-openstack-init.sh $ROOTFS/opt/
+    cp -f ./init_scripts/php/get-launch-params.rb $ROOTFS/opt/
+    cp -f ./init_scripts/php/cc/ssl-cert-snakeoil.pem $ROOTFS/etc/ssl/certs/
+    cp -f ./init_scripts/php/cc/ssl-cert-snakeoil.key $ROOTFS/etc/ssl/private/
+    
+	chroot $ROOTFS apt-get update
+	# Next, all the packages. 
+	
+	chroot $ROOTFS apt-get install -y \
+    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-ldap \
+    openssl ssl-cert ldap-utils php5-mcrypt mcrypt ufw fail2ban git libboost-all-dev ruby
+
+    # Install the thrift library
+    tar -zxf ./init_scripts/php/thrift-0.8.0.tar.gz -C$ROOTFS/opt
+    chroot $ROOTFS cd /opt/thrift-0.8.0;./configure --libdir=/usr/lib;make;make install
+    tar -zxf ./init_scripts/php/cartridge_data_publisher_1.0.0.tar.gz -C$ROOTFS/opt
+    chroot $ROOTFS cd /opt/cartridge_data_publisher_1.0.0;make
+
+	# install gitpython 
+	# chroot $ROOTFS easy_install GitPython
+
+
+	# configure apache log write to syslog TODO : Need generic solution
+	chroot $ROOTFS cp /etc/apache2/apache2.conf /etc/apache2/apache2.conf.org
+    chroot $ROOTFS cat /etc/apache2/apache2.conf.org | sed -e 's/^ErrorLog.*/ErrorLog syslog:local2/' > $ROOTFS/etc/apache2/apache2.conf
+
+	# configure rsyslog TODO : Need generic solution
+	chroot $ROOTFS cp /etc/rsyslog.conf /etc/rsyslog.conf.org
+    chroot $ROOTFS cat /etc/rsyslog.conf.org | sed -e 's/^#$ModLoad\simtcp.*/$ModLoad imtcp/' |  sed -e 's/^\#\$ModLoad\simtcp.*/\$ModLoad imtcp/' | sed -e 's/^\#\$InputTCPServerRun\s514.*/\$InputTCPServerRun 514\nlocal2\.\*        \@\@localhost\:32000/' > $ROOTFS/etc/rsyslog.conf
+
+
+# adding simplesaml alias to apache
+chroot $ROOTFS cp /etc/apache2/sites-available/default /etc/apache2/sites-available/default-org
+chroot $ROOTFS cp /etc/apache2/sites-available/default-ssl /etc/apache2/sites-available/default-ssl-org
+chroot $ROOTFS cat /etc/apache2/sites-available/default-org | sed -e 's@DocumentRoot \/var\/www@DocumentRoot \/var\/www\/public\n\tAlias \/simplesaml \/var\/www\/simplesamlphp\/www@' > $ROOTFS/etc/apache2/sites-available/default
+chroot $ROOTFS cat /etc/apache2/sites-available/default-ssl-org | sed -e 's@DocumentRoot \/var\/www@DocumentRoot \/var\/www\/public\n\tAlias \/simplesaml \/var\/www\/simplesamlphp\/www@' > $ROOTFS/etc/apache2/sites-available/default-ssl
+	# Enable HTTPS:
+	chroot $ROOTFS a2enmod ssl
+	chroot $ROOTFS a2ensite default-ssl	
+
+
+	# See http://blog.bodhizazen.net/linux/lxc-configure-ubuntu-lucid-containers/
+	# This requirement is confirmed on 10.04.1 LTS.  Within LXC, the
+	# upstart "startup" signal is sent, but not "network-interface", etc.
+	pushd $ROOTFS/etc/init/
+	cp -a ufw.conf ufw.conf-dist
+	sed '
+s/start on (starting network-interface/start on startup\n#start on (starting network-interface/
+s/          or starting network-manager/#          or starting network-manager/
+s/          or starting networking)/#          or starting network-manager/
+' < ufw.conf-dist > ufw.conf
+	popd
+	
+    pushd $ROOTFS/etc
+    echo "#!/bin/bash -e
+mkdir -p /etc/agent/conf
+chmod 755 /opt/wso2-openstack-init.sh
+/opt/wso2-openstack-init.sh > /var/log/wso2-openstack-init.log
+exit 0
+    " > rc.local
+    popd
+
+}
+
+lamp() {
+
+    cp -f ./init_scripts/lamp/wso2-openstack-init.sh $ROOTFS/opt/
+    cp -f ./init_scripts/lamp/get-launch-params.rb $ROOTFS/opt/
+    cp -f ./init_scripts/lamp/server $ROOTFS/opt/
+    cp -f ./init_scripts/lamp/svn_client.sh $ROOTFS/opt/
+    cp -f ./init_scripts/lamp/svn_client_y.sh $ROOTFS/opt/
+    cp -f ./init_scripts/lamp/deployer.sh $ROOTFS/opt/
+
+    # Copy software
+    arr=$(echo $SOFTWARE | tr ":" "\n")
+    for x in $arr
+    do
+       cp -rf $x $ROOTFS/opt/
+    done
+
+
+	# MySQL still prompts.  Bug.
+	#DEBCONF_FRONTEND='noninteractive' 
+	
+	chroot $ROOTFS apt-get update
+	# Next, all the LAMP packages.  We must first pre-save the password
+	# for MySQL to use:
+	chroot $ROOTFS echo "mysql-server mysql-server/root_password select ubuntu" | chroot $ROOTFS debconf-set-selections
+	chroot $ROOTFS echo "mysql-server mysql-server/root_password_again select ubuntu" | chroot $ROOTFS debconf-set-selections
+	
+	chroot $ROOTFS apt-get install -y \
+	 nano zip mysql-server 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-ldap \
+	 openssl ssl-cert ldap-utils \
+	 php5-mcrypt mcrypt ufw fail2ban ruby subversion
+
+	# Be sure to have a new SSL cert for this new LXC host:
+	#rm -f $ROOTFS/etc/ssl/private/ssl-cert-snakeoil.key
+	#chroot $ROOTFS dpkg-reconfigure ssl-cert
+
+	# Enable HTTPS:
+	#chroot $ROOTFS a2enmod ssl
+	#chroot $ROOTFS a2ensite default-ssl	
+
+	# Turn on MySQL replication logs by default.  (Necessary for 
+	# incremental backups, even if you're not doing replication.)
+	pushd $ROOTFS/etc/mysql/conf.d
+	echo "[mysqld]
+log-bin=mysqld-bin
+server-id = 1
+
+# For an SSH Tunneled slave:
+# See also: /etc/rc.local for the SSH Tunnel that makes this work.
+#[mysqld]
+#master-host     = 127.0.0.1
+#master-user     = root
+#master-password = ubuntu
+#master-port     = 13306
+#server-id       = 2
+	" >> replication.cnf
+	popd
+
+pushd $ROOTFS/etc
+    echo "#!/bin/bash -e
+/opt/wso2-openstack-init.sh > /var/log/wso2-openstack-init.log
+exit 0
+    " > rc.local
+    popd
+
+	# Next, fix a couple of Debian gotchas:
+
+	# Comment out these two lines.  (Don't expire,
+	# and use the 1G default file size.
+	pushd $ROOTFS/etc/mysql
+	cp -a my.cnf my.cnf-dist
+	sed '
+s/expire_logs_days/#expire_logs_days/
+s/max_binlog_size/#max_binlog_size/
+' < my.cnf-dist > my.cnf
+	popd
+	
+	# See http://blog.bodhizazen.net/linux/lxc-configure-ubuntu-lucid-containers/
+	# This requirement is confirmed on 10.04.1 LTS.  Within LXC, the
+	# upstart "startup" signal is sent, but not "network-interface", etc.
+	pushd $ROOTFS/etc/init/
+	cp -a ufw.conf ufw.conf-dist
+	sed '
+s/start on (starting network-interface/start on startup\n#start on (starting network-interface/
+s/          or starting network-manager/#          or starting network-manager/
+s/          or starting networking)/#          or starting network-manager/
+' < ufw.conf-dist > ufw.conf
+	
+	cp -a mysql.conf mysql.conf-dist
+	sed --posix -e '
+s/start on (net-device-up/start on startup\n#start on (net-device-up/
+s/          and local-filesystems/#          and local-filesystems/
+s/\t  and runlevel \[2345\])/#\t  and runlevel \[2345\])/
+' < mysql.conf-dist > mysql.conf
+	popd
+	
+}
+
+wso2_carbon_server() {
+
+    cp -f ./init_scripts/carbon/wso2-openstack-init.sh $ROOTFS/opt/
+    cp -f ./init_scripts/carbon/get-launch-params.rb $ROOTFS/opt/
+    # Copy software
+    arr=$(echo $SOFTWARE | tr ":" "\n")
+    for x in $arr
+    do
+       cp -rf $x $ROOTFS/opt/
+    done
+
+	#chroot $ROOTFS apt-get update
+	
+	 chroot $ROOTFS apt-get install -y \
+	 nano zip \
+	 wget \
+	 openssl ssl-cert ldap-utils ruby git
+  
+     # TODO install puppet agent
+
+	# Be sure to have a new SSL cert for this new LXC host:
+	#rm -f $ROOTFS/etc/ssl/private/ssl-cert-snakeoil.key
+	#chroot $ROOTFS dpkg-reconfigure ssl-cert
+
+pushd $ROOTFS/etc
+    echo "#!/bin/bash -e
+/opt/wso2-openstack-init.sh > /var/log/wso2-openstack-init.log
+exit 0
+    " > rc.local
+    popd
+
+}
+
+jetty() {
+
+    cp -f ./init_scripts/jetty/wso2-openstack-init.sh $ROOTFS/opt/
+    cp -f ./init_scripts/jetty/get-launch-params.rb $ROOTFS/opt/
+    cp -f ./init_scripts/jetty/server $ROOTFS/opt/
+    cp -f ./init_scripts/jetty/svn_client.sh $ROOTFS/opt/
+    cp -f ./init_scripts/jetty/svn_client_y.sh $ROOTFS/opt/
+    cp -f ./init_scripts/jetty/deployer.sh $ROOTFS/opt/
+    # Copy software
+    arr=$(echo $SOFTWARE | tr ":" "\n")
+    for x in $arr
+    do
+       cp -rf $x $ROOTFS/opt/
+    done
+
+	#chroot $ROOTFS apt-get update
+	
+	chroot $ROOTFS apt-get install -y \
+	 nano zip \
+	 wget \
+	 openssl ssl-cert ldap-utils ruby subversion
+   
+pushd $ROOTFS/etc
+    echo "#!/bin/bash -e
+/opt/wso2-openstack-init.sh > /var/log/wso2-openstack-init.log
+exit 0
+    " > rc.local
+    popd
+
+}
+
+
+tomcat7() {
+
+    #chroot $ROOTFS echo "nameserver 8.8.8.8" >> $ROOTFS/etc/resolvconf/resolv.conf.d/base
+    echo "Please fix the resolve conf file"
+    read
+    #chroot $ROOTFS mkdir -p /run/resolveconf
+    #chroot $ROORFS touch /run/resolveconf/resolv.conf
+    #chroot echo "nameserver 8.8.8.8" > /run/resolveconf/resolv.conf
+    
+    echo "------------------------------------------"
+    chroot $ROOTFS cat /etc/resolv.conf
+    echo "------------------------------------------"
+
+
+    mount -o bind /dev $ROOTFS/dev
+
+
+    mount -t proc none $ROOTFS/proc
+
+
+    cp -f ./init_scripts/tomcat7/wso2-openstack-init.sh $ROOTFS/opt/
+    cp -f ./init_scripts/tomcat7/get-launch-params.rb $ROOTFS/opt/
+    
+    
+	chroot $ROOTFS apt-get update
+	# Next, all the packages. 
+	
+    chroot $ROOTFS apt-get install -y \
+    nano zip git\
+    ruby curl wget tomcat7
+     
+	# See http://blog.bodhizazen.net/linux/lxc-configure-ubuntu-lucid-containers/
+	# This requirement is confirmed on 10.04.1 LTS.  Within LXC, the
+	# upstart "startup" signal is sent, but not "network-interface", etc.
+	pushd $ROOTFS/etc/init/
+	cp -a ufw.conf ufw.conf-dist
+	sed '
+s/start on (starting network-interface/start on startup\n#start on (starting network-interface/
+s/          or starting network-manager/#          or starting network-manager/
+s/          or starting networking)/#          or starting network-manager/
+' < ufw.conf-dist > ufw.conf
+	popd
+	
+    pushd $ROOTFS/etc
+    echo "#!/bin/bash -e
+mkdir -p /etc/agent/conf
+chmod 755 /opt/wso2-openstack-init.sh
+/opt/wso2-openstack-init.sh > /var/log/wso2-openstack-init.log
+exit 0
+    " > rc.local
+    popd
+
+    umount $ROOTFS/dev
+    umount $ROOTFS/proc
+}
+
+
+# Don't prompt when running apt-get:
+export DEBCONF_FRONTEND='noninteractive' 
+
+# Run the config function with given $TEMPLATE name (if it exists):
+$TEMPLATE 
+

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b60d2c7d/tools/cartridge-create/create_kvm_image.sh
----------------------------------------------------------------------
diff --git a/tools/cartridge-create/create_kvm_image.sh b/tools/cartridge-create/create_kvm_image.sh
new file mode 100755
index 0000000..795f42c
--- /dev/null
+++ b/tools/cartridge-create/create_kvm_image.sh
@@ -0,0 +1,24 @@
+#!/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.
+# ----------------------------------------------------------------------------
+
+
+./stratos-image create 192.168.16.131 mysql ubuntu stratos.pem
+#./stratos-image upload 192.168.16.131 precise-server-mysql-cloudimg-amd64

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b60d2c7d/tools/cartridge-create/image_action.sh
----------------------------------------------------------------------
diff --git a/tools/cartridge-create/image_action.sh b/tools/cartridge-create/image_action.sh
new file mode 100755
index 0000000..a6c8261
--- /dev/null
+++ b/tools/cartridge-create/image_action.sh
@@ -0,0 +1,165 @@
+#!/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.
+# ----------------------------------------------------------------------------
+
+
+# Die on any error:
+set -e
+
+work_dir=""
+action=""
+image_template=""
+image_root=""
+software=""
+image_type=""
+loopdevice="/dev/loop1"
+nbddevice="/dev/nbd3"
+nbdmount="/dev/nbd3p1"
+
+function image_validate {
+    if [ -z $action ]; then
+        echo "usage: image_action.sh action=<mount|create|unmount> <options>"
+        exit 1
+    fi
+
+    if [[ !($action == "mount") && !($action == "create") && !($action == "unmount") ]]; then
+        echo "usage: image_action.sh action=<mount|create|unmount> <options>"
+        exit 1
+    fi
+
+    if [[ (-n $action) && ($action == "create") && ( -z $image_template || -z $image_root ) ]]; then
+        echo "usage: image_action.sh action=create template=<template> image-root=<image_root>"
+        exit 1
+    fi
+
+    if [[ (-n $action) && ($action == "unmount") && (-z $image_template || -z $image_root) ]]; then
+        echo "usage: image_action.sh action=unmount image-id=<image_template> image-root=<image_root>"
+        exit 1
+    fi
+    
+    if [[ (-n $action) && ($action == "mount") && (-z $image_template || -z $image_root || -z $image_image) ]]; then
+        echo "usage: image_action.sh action=mount image-template=<image_template> image-root=<image_root> image-image=<image_image>"
+        exit 1
+    fi
+    
+}
+
+for var in $@; do
+    set -- `echo $var | tr '=' ' '`
+    key=$1
+    value=$2
+
+    if [ $key = "action" ]; then
+        action="$value"
+        echo "action:" $action
+    fi
+
+    if [ $key = "image-root" ]; then
+        image_root="$value"
+        echo "image root:" $image_root
+    fi
+    
+    if [ $key = "image-template" ]; then
+        image_template="$value"
+        echo "template:" $image_template
+    fi
+    
+    if [ $key = "image-image" ]; then
+        image_image="$value"
+        echo "image-image:" $image_image
+    fi
+    
+    if [ $key = "software" ]; then
+        software="$value"
+        echo "software:" $software
+    fi
+    
+    if [ $key = "image-type" ]; then
+        image_type="$value"
+        echo "image_type:" $image_type
+    fi
+
+done
+
+image_validate
+
+work_dir="$image_root/$image_template"
+if [[ (-n $action) && ($action == "unmount") ]]; then
+    echo "# unmount $image_template"
+    if [ -d $work_dir/$image_template ]; then
+        if [ $image_type == "qcow2" ]; then
+            umount $work_dir/$image_template
+            qemu-nbd -d $nbddevice
+            rmmod nbd
+        else
+            echo 'this action unmount image!'
+            umount $work_dir/$image_template/dev
+            umount $work_dir/$image_template/proc
+            umount $work_dir/$image_template/sys
+            umount $work_dir/$image_template
+            if [ -d $work_dir/$image_template/dev ]; then
+                umount -l $work_dir/$image_template
+            fi
+            losetup -d $loopdevice
+        fi
+    fi
+    exit 0
+fi
+
+if [[ (-n $action) && ($action == "mount") ]]; then
+    echo "# mount $image_template "
+    if [ ! -d "$work_dir/$image_template" ]; then
+        mkdir -p $work_dir/$image_template
+    fi
+    #cp -f $image_image $work_dir/
+    if [ $image_type == "qcow2" ]; then
+        modprobe nbd max_part=8
+        qemu-nbd -c $nbddevice $image_image
+        mount $nbdmount $work_dir/$image_template
+    else
+        #loopdevice=`losetup -f`
+        echo "Available loop device is $loopdevice"
+        losetup $loopdevice $image_image
+        #kpartx -av $loopdevice
+        mount $loopdevice $work_dir/$image_template 
+        mount -o bind /dev $work_dir/$image_template/dev
+        mount -o bind /proc $work_dir/$image_template/proc
+        mount -o bind /sys $work_dir/$image_template/sys
+    fi
+    exit 0
+fi
+
+# Where to create newly-created LXC container rootfs filesystems, fstabs, and confs:
+export BASEDIR=$work_dir
+
+# This is a list of semi-colon separated files/directories that will be needed by templates.
+export SOFTWARE="$software"
+export ROOTFS=$work_dir/$image_template
+export TEMPLATE=$image_template
+
+if [ -z "$TEMPLATE" ]; then
+	TEMPLATE="default"
+fi
+
+./configure_software $ROOTFS $TEMPLATE
+echo
+
+exit
+

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b60d2c7d/tools/cartridge-create/init-scripts/default/default
----------------------------------------------------------------------
diff --git a/tools/cartridge-create/init-scripts/default/default b/tools/cartridge-create/init-scripts/default/default
new file mode 100644
index 0000000..7d5274b
--- /dev/null
+++ b/tools/cartridge-create/init-scripts/default/default
@@ -0,0 +1,43 @@
+#!/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.
+#
+# ----------------------------------------------------------------------------
+
+INSTANCE=$1
+INSTANCE_USER=$2
+KEY=$3
+SOFTWARE=$4
+
+SCP="scp -i ./$KEY"
+SSH="ssh -i ./$KEY"
+
+$SCP ./wso2-openstack-init.sh $INSTANCE_USER@$INSTANCE:
+$SCP ./default.ctrg $INSTANCE_USER@$INSTANCE:
+$SCP ./get-launch-params.rb $INSTANCE_USER@$INSTANCE:
+
+# Copy additional software
+arr=$(echo $SOFTWARE | tr ":" "\n")
+for x in $arr
+do
+   $SCP $x $INSTANCE_USER@$INSTANCE:
+done
+
+# Execute the cartridge creation process in the remoter server
+$SSH $INSTANCE_USER@$INSTANCE "sudo chmod 755 ./default.ctrg;sudo ./default.ctrg"

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b60d2c7d/tools/cartridge-create/init-scripts/default/default.ctrg
----------------------------------------------------------------------
diff --git a/tools/cartridge-create/init-scripts/default/default.ctrg b/tools/cartridge-create/init-scripts/default/default.ctrg
new file mode 100644
index 0000000..d9414f0
--- /dev/null
+++ b/tools/cartridge-create/init-scripts/default/default.ctrg
@@ -0,0 +1,51 @@
+#!/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.
+#
+# ----------------------------------------------------------------------------
+
+    mv ./wso2-openstack-init.sh /opt/
+    mv ./default.ctrg 
+    mv ./get-launch-params.rb /opt/
+    mv ./*.tar.gz /opt/
+    mv ./*.zip /opt/
+
+	apt-get update
+	# Next, all th packages.
+	
+	# See http://blog.bodhizazen.net/linux/lxc-configure-ubuntu-lucid-containers/
+	# This requirement is confirmed on 10.04.1 LTS.  Within LXC, the
+	# upstart "startup" signal is sent, but not "network-interface", etc.
+	pushd /etc/init/
+	cp -a ufw.conf ufw.conf-dist
+	sed '
+s/start on (starting network-interface/start on startup\n#start on (starting network-interface/
+s/          or starting network-manager/#          or starting network-manager/
+s/          or starting networking)/#          or starting network-manager/
+' < ufw.conf-dist > ufw.conf
+	
+	popd
+    
+    pushd /etc
+    echo "#!/bin/bash -e
+chmod 755 /opt/wso2-openstack-init.sh
+/opt/wso2-openstack-init.sh > /var/log/wso2-openstack-init.log
+exit 0
+    " > rc.local
+    popd

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b60d2c7d/tools/cartridge-create/init-scripts/default/get-launch-params.rb
----------------------------------------------------------------------
diff --git a/tools/cartridge-create/init-scripts/default/get-launch-params.rb b/tools/cartridge-create/init-scripts/default/get-launch-params.rb
new file mode 100644
index 0000000..c6368ca
--- /dev/null
+++ b/tools/cartridge-create/init-scripts/default/get-launch-params.rb
@@ -0,0 +1,55 @@
+#! /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(
+  "/var/lib/cloud/instance/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/b60d2c7d/tools/cartridge-create/init-scripts/default/stratos-openstack-init.sh
----------------------------------------------------------------------
diff --git a/tools/cartridge-create/init-scripts/default/stratos-openstack-init.sh b/tools/cartridge-create/init-scripts/default/stratos-openstack-init.sh
new file mode 100644
index 0000000..7e8430a
--- /dev/null
+++ b/tools/cartridge-create/init-scripts/default/stratos-openstack-init.sh
@@ -0,0 +1,57 @@
+#!/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 LOG=/var/log/wso2-openstack.log
+instance_path=/var/lib/cloud/instance
+
+if [ ! -d ${instance_path}/payload ]; then
+
+    echo "creating payload dir ... " >> $LOG
+    mkdir ${instance_path}/payload
+    echo "payload dir created ... " >> $LOG
+    cp ${instance_path}/user-data.txt ${instance_path}/payload/user-data.zip
+    echo "payload copied  ... "  >> $LOG
+    unzip -d ${instance_path}/payload ${instance_path}/payload/user-data.zip
+    echo "unzippeddd..." >> $LOG
+
+    for i in `/usr/bin/ruby /opt/get-launch-params.rb`
+    do
+    echo "exporting to bashrc $i ... " >> $LOG
+        echo "export" ${i} >> /home/ubuntu/.bashrc
+    done
+    source /home/ubuntu/.bashrc
+    # Write a cronjob to execute wso2-openstack-init.sh periodically until public ip is assigned
+    #crontab -l > ./mycron
+    #echo "*/${CRON_DURATION} * * * * /opt/wso2-openstack-init.sh > /var/log/wso2-openstack-init.log" >> ./mycron
+    #crontab ./mycron
+    #rm ./mycron
+
+fi
+
+
+
+for i in `/usr/bin/ruby /opt/get-launch-params.rb`
+do
+    export ${i}
+done
+
+echo "Done" >> $LOG
+# ========================== // End of script ===========================================================

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b60d2c7d/tools/cartridge-create/init-scripts/default/stratos.pem
----------------------------------------------------------------------
diff --git a/tools/cartridge-create/init-scripts/default/stratos.pem b/tools/cartridge-create/init-scripts/default/stratos.pem
new file mode 100644
index 0000000..7b2155e
--- /dev/null
+++ b/tools/cartridge-create/init-scripts/default/stratos.pem
@@ -0,0 +1,16 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIICXQIBAAKBgQDUdNzv8oHkA8Zn28iQH2qyiV7ZJlBITqp4iw21ZbuyhFtDw2c0
+7euC/g4zbdLjAO4Wofn03C9LSA8KcWKYz4ubaKd+6xG/ywTW2QDRFdGDUY6Dwvkj
+3vnLlPWqvRBpF8ZclkeIjX6svydRvov3F6BSsbYY3trm9PlMtsZq/jtswwIDAQAB
+AoGAEJTqZYPc5WnyA0shFTaOgk68a2BVJb+WCIB52m2NP7qa0OggVv42wmuHujXZ
+HsSE0Jllw9mni02ddugwlNKmB5+z2yiJoGkuaFhFNwB4xFjjujRwMf7ZtoDpa8Yo
+SS1f94dswB31kT601HcUyCEwRBfD9pYBduysFZ1I3/ozVukCQQDs1Lm+LvmZQgLa
+BaWqU73MShDypiyMHVyKwnDUu/zaHu+9r15z/UHroU2nRIRteNv77nUmHsQVHKOc
+0QpmEsT3AkEA5acVolx+4mSCe4ZXh1R9hHZ+HdRrvC2yBiZhHe3bHbcyBN+oPMF4
+OcUE2JsE2+IIJomC5B/v6vjsf67yCFo/lQJAfm+jKjGR94wSUasqIqDKd0IjgifN
+KJCUU1AzRJ+IAjr56t6xImNWyiE3f9FIkdkwOHO5/zv1mv/LKXFAh/YFSQJBAMKE
+MWjiW366j2K9OWohAGewTcZKZC5xrfZTj7LgAtY6kx1Zq5A6dvDHlgE53HW6EBlE
+JB/BhV9LFFZaAhtdBbkCQQDrx9X5f/Lbe39kx5UMtvYrswpYjbKW+qRoQ38NryYA
+G7rRPsgmrjURSEeH4VUG//7gV8wGze7cl50luI2T8+Kg
+-----END RSA PRIVATE KEY-----
+

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b60d2c7d/tools/cartridge-create/init-scripts/mysql/ec2/get-launch-params.rb
----------------------------------------------------------------------
diff --git a/tools/cartridge-create/init-scripts/mysql/ec2/get-launch-params.rb b/tools/cartridge-create/init-scripts/mysql/ec2/get-launch-params.rb
new file mode 100644
index 0000000..8991b7b
--- /dev/null
+++ b/tools/cartridge-create/init-scripts/mysql/ec2/get-launch-params.rb
@@ -0,0 +1,51 @@
+#! /usr/bin/ruby
+# ----------------------------------------------------------------------------
+#  Copyright 2005-20012 WSO2, Inc. http://www.apache.org
+#
+#  Licensed 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/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/b60d2c7d/tools/cartridge-create/init-scripts/mysql/ec2/healthcheck.sh
----------------------------------------------------------------------
diff --git a/tools/cartridge-create/init-scripts/mysql/ec2/healthcheck.sh b/tools/cartridge-create/init-scripts/mysql/ec2/healthcheck.sh
new file mode 100644
index 0000000..706022b
--- /dev/null
+++ b/tools/cartridge-create/init-scripts/mysql/ec2/healthcheck.sh
@@ -0,0 +1,32 @@
+#!/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/b60d2c7d/tools/cartridge-create/init-scripts/mysql/ec2/stratos-init.sh
----------------------------------------------------------------------
diff --git a/tools/cartridge-create/init-scripts/mysql/ec2/stratos-init.sh b/tools/cartridge-create/init-scripts/mysql/ec2/stratos-init.sh
new file mode 100644
index 0000000..3dc20a8
--- /dev/null
+++ b/tools/cartridge-create/init-scripts/mysql/ec2/stratos-init.sh
@@ -0,0 +1,152 @@
+#!/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 LOG=/var/log/stratos-cartridge.log
+instance_path=/opt
+PUBLIC_IP=""
+KEY=`uuidgen`
+CRON_DURATION=1
+SLEEP_DURATION=3
+
+if [ ! -d ${instance_path}/payload ]; then
+
+    echo "creating payload dir ... " >> $LOG
+    mkdir ${instance_path}/payload
+    echo "payload dir created ... " >> $LOG
+    wget http://169.254.169.254/latest/user-data -O ${instance_path}/payload/payload.zip
+    echo "payload copied  ... "  >> $LOG
+    unzip -d ${instance_path}/payload ${instance_path}/payload/payload.zip
+    echo "unzipped..." >> $LOG
+
+    for i in `/usr/bin/ruby /opt/get-launch-params.rb`
+    do
+    echo "exporting to bashrc $i ... " >> $LOG
+        echo "export" ${i} >> /home/ubuntu/.bashrc
+    done
+    source /home/ubuntu/.bashrc
+
+fi
+
+if [ -f public-ipv4 ]; then
+    echo "public-ipv4 already exists. Removing the public-ipv4 file" >> $LOG
+    rm public-ipv4
+fi
+
+echo ---------------------------- >> $LOG
+echo "getting public ip from metadata service" >> $LOG
+
+wget http://169.254.169.254/latest/meta-data/public-ipv4
+files="`cat public-ipv4`"
+if [[ -z ${files} ]]; then
+    echo "getting public ip" >> $LOG
+    for i in {1..30}
+    do
+      rm -f ./public-ipv4
+      wget http://169.254.169.254/latest/meta-data/public-ipv4
+      files="`cat public-ipv4`"
+      if [ -z $files ]; then
+          echo "Public ip is not yet assigned. Wait and continue for $i the time ..." >> $LOG
+          sleep $SLEEP_DURATION
+      else
+          echo "Public ip assigned" >> $LOG
+          #crontab -r
+          break
+      fi
+    done
+
+    if [ -z $files ]; then
+      echo "Public ip is not yet assigned. So exit" >> $LOG
+      exit 0
+    fi
+    for x in $files
+    do
+        PUBLIC_IP="$x"
+    done
+
+
+else 
+   PUBLIC_IP="$files"
+   #crontab -r
+fi
+
+
+for i in `/usr/bin/ruby /opt/get-launch-params.rb`
+do
+    export ${i}
+done
+
+echo "Setting MySQL root password" >> $LOG
+if [[ (-n ${MYSQL_PASSWORD} ) ]]; then
+	mysqladmin -u root password "${MYSQL_PASSWORD}"
+	mysql -uroot -p${MYSQL_PASSWORD} -e "GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'   IDENTIFIED BY '${MYSQL_PASSWORD}' WITH GRANT OPTION;flush privileges;"
+	echo "MySQL root password set" >> $LOG
+fi
+
+cp -f ${instance_path}/payload/ssl-cert-snakeoil.pem /etc/ssl/certs/ssl-cert-snakeoil.pem
+cp -f ${instance_path}/payload/ssl-cert-snakeoil.key /etc/ssl/private/ssl-cert-snakeoil.key
+/etc/init.d/apache2 restart
+
+echo "Logging sys variables .. PUBLIC_IP:${PUBLIC_IP}, HOST_NAME:${HOST_NAME}, KEY:${KEY}, PORTS=${PORTS} , BAM:${BAM_IP}, GITREPO:${GIT_REPO}" >> $LOG
+
+mkdir -p  /etc/agent/conf
+
+echo "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:agen=\"http://service.agent.cartridge.stratos.apache.org\">
+  <soapenv:Header/>
+  <soapenv:Body>
+     <agen:register>
+        <registrant> 
+           <alarmingLowerRate>${ALARMING_LOWER_RATE}</alarmingLowerRate>
+           <alarmingUpperRate>${ALARMING_UPPER_RATE}</alarmingUpperRate>
+           <hostName>${HOST_NAME}</hostName>
+           <key>${KEY}</key>
+          <maxInstanceCount>${MAX}</maxInstanceCount>
+          <maxRequestsPerSecond>${MAX_REQUESTS_PER_SEC}</maxRequestsPerSecond>
+          <minInstanceCount>${MIN}</minInstanceCount> " > /etc/agent/conf/request.xml
+
+IFS='|' read -ra PT <<< "${PORTS}"
+for i in "${PT[@]}"; do
+IFS=':' read -ra PP <<< "$i"
+echo "          <portMappings>
+                        <primaryPort>${PP[1]}</primaryPort>
+                        <proxyPort>${PP[2]}</proxyPort>
+                        <type>${PP[0]}</type>
+                </portMappings>">> /etc/agent/conf/request.xml
+done
+
+echo "
+           <service>${SERVICE}</service>
+           <remoteHost>${PUBLIC_IP}</remoteHost>
+           <roundsToAverage>${ROUNDS_TO_AVERAGE}</roundsToAverage>
+           <scaleDownFactor>${SCALE_DOWN_FACTOR}</scaleDownFactor>
+           <tenantRange>${TENANT_RANGE}</tenantRange>
+        </registrant>
+     </agen:register>
+  </soapenv:Body>
+</soapenv:Envelope>
+" >> /etc/agent/conf/request.xml
+
+sleep 3
+echo "Sending register request to Cartridge agent service" >> $LOG
+curl -X POST -H "Content-Type: text/xml" -H "SOAPAction: urn:register" -d @/etc/agent/conf/request.xml -k --silent --output /dev/null "${CARTRIDGE_AGENT_EPR}"
+
+
+# ========================== // End of script ===========================================================

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b60d2c7d/tools/cartridge-create/init-scripts/mysql/get-launch-params.rb
----------------------------------------------------------------------
diff --git a/tools/cartridge-create/init-scripts/mysql/get-launch-params.rb b/tools/cartridge-create/init-scripts/mysql/get-launch-params.rb
new file mode 100644
index 0000000..c6368ca
--- /dev/null
+++ b/tools/cartridge-create/init-scripts/mysql/get-launch-params.rb
@@ -0,0 +1,55 @@
+#! /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(
+  "/var/lib/cloud/instance/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/b60d2c7d/tools/cartridge-create/init-scripts/mysql/mysql
----------------------------------------------------------------------
diff --git a/tools/cartridge-create/init-scripts/mysql/mysql b/tools/cartridge-create/init-scripts/mysql/mysql
new file mode 100644
index 0000000..063b14c
--- /dev/null
+++ b/tools/cartridge-create/init-scripts/mysql/mysql
@@ -0,0 +1,46 @@
+#!/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.
+#
+# ----------------------------------------------------------------------------
+
+INSTANCE=$1
+INSTANCE_USER=$2
+KEY=$3
+SOFTWARE=$4
+
+SCP="scp -i ./$KEY"
+SSH="ssh -i ./$KEY"
+
+$SCP ./wso2-cartridge-init.sh $INSTANCE_USER@$INSTANCE:
+$SCP ./mysql.ctrg $INSTANCE_USER@$INSTANCE:
+$SCP ./get-launch-params.rb $INSTANCE_USER@$INSTANCE:
+$SCP ./cc/ssl-cert-snakeoil.pem $INSTANCE_USER@$INSTANCE:
+$SCP ./cc/ssl-cert-snakeoil.key $INSTANCE_USER@$INSTANCE:
+$SCP ./phpMyAdmin-3.5.6-english.tar.xz $INSTANCE_USER@$INSTANCE:
+
+# Copy additional software
+arr=$(echo $SOFTWARE | tr ":" "\n")
+for x in $arr
+do
+   $SCP $x $INSTANCE_USER@$INSTANCE:
+done
+
+# Execute the cartridge creation process in the remoter server
+$SSH $INSTANCE_USER@$INSTANCE "sudo chmod 755 ./mysql.ctrg;sudo ./mysql.ctrg"

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b60d2c7d/tools/cartridge-create/init-scripts/mysql/mysql.ctrg
----------------------------------------------------------------------
diff --git a/tools/cartridge-create/init-scripts/mysql/mysql.ctrg b/tools/cartridge-create/init-scripts/mysql/mysql.ctrg
new file mode 100644
index 0000000..0e9b9cf
--- /dev/null
+++ b/tools/cartridge-create/init-scripts/mysql/mysql.ctrg
@@ -0,0 +1,58 @@
+#!/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.
+#
+# ----------------------------------------------------------------------------
+
+    mv ./wso2-cartridge-init.sh /opt/
+    mv ./get-launch-params.rb /opt/
+    mv ./ssl-cert-snakeoil.pem /etc/ssl/certs/
+    mv ./ssl-cert-snakeoil.key /etc/ssl/private/
+    mv ./*.tar.gz /opt/
+    mv ./*.zip /opt/
+#    tar -xf phpMyAdmin-3.5.6-english.tar.xz
+	apt-get update
+	# Next, all th packages.
+	
+	apt-get install -y \
+	nano zip mysql-server git \
+	xml-twig-tools phpmyadmin ruby
+#	apache2-mpm-prefork apache2-utils apache2.2-bin apache2.2-common dbconfig-common fontconfig-config libapache2-mod-php5 \
+#	libaprutil1-dbd-sqlite3 libaprutil1-ldap libcap2 libfontconfig1 libgd2-xpm libjpeg-turbo8 libjpeg8 libmcrypt4 \
+#	libt1-5 libxpm4 php5-cli php5-common php5-gd php5-mcrypt php5-mysql ssl-cert ttf-dejavu-core libboost-all-dev ruby
+
+	# Enable HTTPS:
+	a2enmod ssl
+	a2ensite default-ssl	
+	# Desable HTTP
+#	a2dissite default	
+
+ 	# set mysql to listen to all network
+	cp /etc/mysql/my.cnf /etc/mysql/my.cnf.org
+	cat /etc/mysql/my.cnf.org | sed -e 's/127.0.0.1/0.0.0.0/' > $ROOTFS/etc/mysql/my.cnf	
+
+	# See http://blog.bodhizazen.net/linux/lxc-configure-ubuntu-lucid-containers/
+	# This requirement is confirmed on 10.04.1 LTS.  Within LXC, the
+	# upstart "startup" signal is sent, but not "network-interface", etc.
+    echo "#!/bin/bash -e
+mkdir -p /etc/agent/conf
+chmod 755 /opt/wso2-cartridge-init.sh
+/opt/wso2-cartridge-init.sh > /var/log/wso2-cartridge-init.log
+exit 0
+    " > /etc/rc.local

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b60d2c7d/tools/cartridge-create/init-scripts/mysql/openstack/get-launch-params.rb
----------------------------------------------------------------------
diff --git a/tools/cartridge-create/init-scripts/mysql/openstack/get-launch-params.rb b/tools/cartridge-create/init-scripts/mysql/openstack/get-launch-params.rb
new file mode 100644
index 0000000..c6368ca
--- /dev/null
+++ b/tools/cartridge-create/init-scripts/mysql/openstack/get-launch-params.rb
@@ -0,0 +1,55 @@
+#! /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(
+  "/var/lib/cloud/instance/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/b60d2c7d/tools/cartridge-create/init-scripts/mysql/openstack/healthcheck.sh
----------------------------------------------------------------------
diff --git a/tools/cartridge-create/init-scripts/mysql/openstack/healthcheck.sh b/tools/cartridge-create/init-scripts/mysql/openstack/healthcheck.sh
new file mode 100644
index 0000000..4194608
--- /dev/null
+++ b/tools/cartridge-create/init-scripts/mysql/openstack/healthcheck.sh
@@ -0,0 +1,30 @@
+#!/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/b60d2c7d/tools/cartridge-create/init-scripts/mysql/openstack/stratos-init.sh
----------------------------------------------------------------------
diff --git a/tools/cartridge-create/init-scripts/mysql/openstack/stratos-init.sh b/tools/cartridge-create/init-scripts/mysql/openstack/stratos-init.sh
new file mode 100755
index 0000000..29ae6f6
--- /dev/null
+++ b/tools/cartridge-create/init-scripts/mysql/openstack/stratos-init.sh
@@ -0,0 +1,165 @@
+#!/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.
+
+export LOG=/var/log/stratos-cartridge.log
+instance_path=/var/lib/cloud/instance
+PUBLIC_IP=""
+KEY=`uuidgen`
+CRON_DURATION=1
+RETRY_COUNT=30
+SLEEP_DURATION=3
+
+if [ ! -d ${instance_path}/payload ]; then
+
+    echo "creating payload dir ... " >> $LOG
+    mkdir ${instance_path}/payload
+    echo "payload dir created ... " >> $LOG
+    cp ${instance_path}/user-data.txt ${instance_path}/payload/user-data.zip
+    echo "payload copied  ... "  >> $LOG
+    unzip -d ${instance_path}/payload ${instance_path}/payload/user-data.zip
+    echo "unzippeddd..." >> $LOG
+
+    for i in `/usr/bin/ruby /opt/get-launch-params.rb`
+    do
+    echo "exporting to bashrc $i ... " >> $LOG
+        echo "export" ${i} >> /home/ubuntu/.bashrc
+    done
+    source /home/ubuntu/.bashrc
+    # Write a cronjob to execute wso2-cartridge-init.sh periodically until public ip is assigned
+    #crontab -l > ./mycron
+    #echo "*/${CRON_DURATION} * * * * /opt/wso2-cartridge-init.sh > /var/log/wso2-cartridge-init.log" >> ./mycron
+    #crontab ./mycron
+    #rm ./mycron
+
+fi
+
+
+echo ---------------------------- >> $LOG
+echo "getting public ip from metadata service" >> $LOG
+
+wget http://169.254.169.254/latest/meta-data/public-ipv4
+files="`cat public-ipv4`"
+if [[ -z ${files} ]]; then
+    echo "getting public ip" >> $LOG
+    for i in {1..30}
+    do
+      rm -f ./public-ipv4
+      wget http://169.254.169.254/latest/meta-data/public-ipv4
+      files="`cat public-ipv4`"
+      if [ -z $files ]; then
+          echo "Public ip is not yet assigned. Wait and continue for $i the time ..." >> $LOG
+          sleep $SLEEP_DURATION
+      else
+          echo "Public ip assigned" >> $LOG
+          #crontab -r
+          break
+      fi
+    done
+
+    if [ -z $files ]; then
+      echo "Public ip is not yet assigned. So exit" >> $LOG
+      exit 0
+    fi
+    for x in $files
+    do
+        PUBLIC_IP="$x"
+    done
+
+
+else 
+   PUBLIC_IP="$files"
+   #crontab -r
+fi
+
+
+for i in `/usr/bin/ruby /opt/get-launch-params.rb`
+do
+    export ${i}
+done
+
+cp -f ${instance_path}/payload/ssl-cert-snakeoil.pem /etc/ssl/certs/ssl-cert-snakeoil.pem
+cp -f ${instance_path}/payload/ssl-cert-snakeoil.key /etc/ssl/private/ssl-cert-snakeoil.key
+
+echo "Setting MySQL root password" >> $LOG
+if [[ (-n ${MYSQL_PASSWORD} ) ]]; then
+       mysqladmin -u root password "${MYSQL_PASSWORD}"
+       mysql -uroot -p${MYSQL_PASSWORD} -e "GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'   IDENTIFIED BY '${MYSQL_PASSWORD}' WITH GRANT OPTION;flush privileges;"
+       echo "MySQL root password set" >> $LOG
+fi
+
+/etc/init.d/apache2 restart
+
+
+echo "Logging sys variables .. PUBLIC_IP:${PUBLIC_IP}, HOST_NAME:${HOST_NAME}, KEY:${KEY}, PORTS=${PORTS} , BAM:${BAM_IP}, GITREPO:${GIT_REPO}" >> $LOG
+
+
+mkdir -p  /etc/agent/conf
+
+echo "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:agen=\"http://service.agent.cartridge.stratos.apache.org\">
+  <soapenv:Header/>
+  <soapenv:Body>
+     <agen:register>
+        <registrant> 
+           <alarmingLowerRate>${ALARMING_LOWER_RATE}</alarmingLowerRate>
+           <alarmingUpperRate>${ALARMING_UPPER_RATE}</alarmingUpperRate>
+           <hostName>${HOST_NAME}</hostName>
+           <key>${KEY}</key>
+          <maxInstanceCount>${MAX}</maxInstanceCount>
+      <maxRequestsPerSecond>${MAX_REQUESTS_PER_SEC}</maxRequestsPerSecond>
+          <minInstanceCount>${MIN}</minInstanceCount> " > /etc/agent/conf/request.xml
+
+IFS='|' read -ra PT <<< "${PORTS}"
+for i in "${PT[@]}"; do
+IFS=':' read -ra PP <<< "$i"
+echo "          <portMappings>
+                        <primaryPort>${PP[1]}</primaryPort>
+                        <proxyPort>${PP[2]}</proxyPort>
+                        <type>${PP[0]}</type>
+                </portMappings>">> /etc/agent/conf/request.xml
+done
+
+echo "          <remoteHost>${PUBLIC_IP}</remoteHost>
+           <service>${SERVICE}</service>
+       <remoteHost>${PUBLIC_IP}</remoteHost>
+           <roundsToAverage>${ROUNDS_TO_AVERAGE}</roundsToAverage>
+           <scaleDownFactor>${SCALE_DOWN_FACTOR}</scaleDownFactor>
+           <tenantRange>${TENANT_RANGE}</tenantRange>
+        </registrant>
+     </agen:register>
+  </soapenv:Body>
+</soapenv:Envelope>
+" >> /etc/agent/conf/request.xml
+
+
+echo "Sending register request to Cartridge agent service" >> $LOG
+
+curl -X POST -H "Content-Type: text/xml" -H "SOAPAction: urn:register" -d @/etc/agent/conf/request.xml --silent --output /dev/null "$CARTRIDGE_AGENT_EPR" --insecure
+
+
+sleep 5
+
+/etc/init.d/apache2 restart
+# ========================== // End of script ===========================================================

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b60d2c7d/tools/cartridge-create/init-scripts/mysql/stratos.pem
----------------------------------------------------------------------
diff --git a/tools/cartridge-create/init-scripts/mysql/stratos.pem b/tools/cartridge-create/init-scripts/mysql/stratos.pem
new file mode 100644
index 0000000..abd2985
--- /dev/null
+++ b/tools/cartridge-create/init-scripts/mysql/stratos.pem
@@ -0,0 +1,16 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIICXQIBAAKBgQDUExvnBa8QbdRPsyZFppsuO9pVG4Ve6cuo7cf4oXUiqnt5aYtC
+2h+1NoGwpxTyeqnMTw1UvyrGme3r/gwYBhtEwiSsXFTcPVqyA30wq1Gp+ghnj5NR
+sGEl4dVQYGl/+KbRDQQFmx6K31LAXc+EUrvUjCtXjuH5LrhRGgdIW44EeQIDAQAB
+AoGAMsJYHVVo71+6P1E7ydP0tH4y5cfuhicjTc2L3WCXrrJrV0YBxQB8Ml1XcTas
+dtURKwuIv036KQrSvXdS4bUkdULiDAfkx8I4IRK1TnT0SCHtoO/lOu3NweKI3QeW
+9DX8sdRZ1xOdarmLydJkyk/kLE8v8VbfPaxgxM8KiIMtwtkCQQD2sWf8+/FEOcW7
+11omtKAqIJW+mnARfSMUJspJgvVo+dQbQwdYhgH5z93Y5bH7bUmHZWNsnFYqcPOw
+Ns24QGtjAkEA3BNaqrvba4DEaX1o8Hp8o2NAindAjiKF0WP61l7TNCtgFt8hOiJF
+vTl0MOtPxIOlXrn/pIf0GiQHRykrt7tNcwJBAOd4fL820yIWJz/iiDdrIiGFI5yN
+onv2c9SztPkXBRgz2l6eHSVl0DLLZTjgBYmJ+QUvEARYCM2X4D/GnG63G0sCQEDF
+7YSc3/rnHmgSAkXtNyv7tW5LpRNwc8RqUdSweic7sP9qUuRCXBZSh7EyQPsM6CpW
+QjjRzvW2rvGx220rUqMCQQCiFgDaJvTl7iB9/G/Mzj8xIpABzcwq4AmneR2gEBxf
+38YHLAADdUymlG1hbs2J+yT6Tb5YGFFhDHdOTQ4FOAjl
+-----END RSA PRIVATE KEY-----
+

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b60d2c7d/tools/cartridge-create/init-scripts/mysql/vcloud/stratos-init.sh
----------------------------------------------------------------------
diff --git a/tools/cartridge-create/init-scripts/mysql/vcloud/stratos-init.sh b/tools/cartridge-create/init-scripts/mysql/vcloud/stratos-init.sh
new file mode 100644
index 0000000..13649c2
--- /dev/null
+++ b/tools/cartridge-create/init-scripts/mysql/vcloud/stratos-init.sh
@@ -0,0 +1,152 @@
+#!/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 LOG=/var/log/apache-cartridge.log
+instance_path=/var/lib/cloud/instance
+PUBLIC_IP=""
+KEY=`uuidgen`
+CRON_DURATION=1
+RETRY_COUNT=30
+SLEEP_DURATION=30
+
+#if [ ! -d ${instance_path}/payload ]; then
+#
+#    echo "creating payload dir ... " >> $LOG
+#    mkdir ${instance_path}/payload
+#    echo "payload dir created ... " >> $LOG
+#    cp ${instance_path}/user-data.txt ${instance_path}/payload/user-data.zip
+#    echo "payload copied  ... "  >> $LOG
+#    unzip -d ${instance_path}/payload ${instance_path}/payload/user-data.zip
+#    echo "unzippeddd..." >> $LOG
+#
+#    for i in `/usr/bin/ruby /opt/get-launch-params.rb`
+#    do
+#    echo "exporting to bashrc $i ... " >> $LOG
+#        echo "export" ${i} >> /home/ubuntu/.bashrc
+#    done
+#    source /home/ubuntu/.bashrc
+    # Write a cronjob to execute apache-openstack-init.sh periodically until public ip is assigned
+    #crontab -l > ./mycron
+    #echo "*/${CRON_DURATION} * * * * /opt/apache-openstack-init.sh > /var/log/apache-openstack-init.log" >> ./mycron
+    #crontab ./mycron
+    #rm ./mycron
+
+#fi
+
+    for i in `/usr/bin/ruby /opt/get-launch-params.rb`
+    do
+    echo "exporting to bashrc $i ... " >> $LOG
+        echo "export" ${i} >> /root/.bashrc
+    done
+    source /root/.bashrc
+
+echo ---------------------------- >> $LOG
+echo "getting private IP" >> $LOG
+
+#wget http://169.254.169.254/latest/meta-data/public-ipv4
+#files="`cat public-ipv4`"
+#if [[ -z ${files} ]]; then
+#    echo "getting public ip" >> $LOG
+#    for i in {1..$RETRY_COUNT}
+#    do
+#      rm -f ./public-ipv4
+#      wget http://169.254.169.254/latest/meta-data/public-ipv4
+#      files="`cat public-ipv4`"
+#      if [ -z $files ]; then
+#          echo "Public ip is not yet assigned. Wait and continue for $i the time ..." >> $LOG
+#          sleep $SLEEP_DURATION
+#      else
+#          echo "Public ip assigned" >> $LOG
+          #crontab -r
+#          break
+#      fi
+#    done
+
+#    if [ -z $files ]; then
+#      echo "Public ip is not yet assigned. So shutdown the instance and exit" >> $LOG
+#      /sbin/poweroff
+#      exit 0
+#    fi
+#    for x in $files
+#    do
+#        PUBLIC_IP="$x"
+#    done
+
+
+#else 
+#   PUBLIC_IP="$files"
+   #crontab -r
+#fi
+PUBLIC_IP=`ifconfig | awk -F':' '/inet addr/&&!/127.0.0.1/{split($2,_," ");print _[1]}'`
+
+for i in `/usr/bin/ruby /opt/get-launch-params.rb`
+do
+    export ${i}
+done
+
+#PORTS=HTTP:8280:80|HTTPS:8243:443
+#MYSQL_HOST
+#MYSQL_USER
+#MYSQL_PASSWORD
+echo "Logging sys variables .. PUBLIC_IP:${PUBLIC_IP}, HOST_NAME:${HOST_NAME}, KEY:${KEY}, PORTS=${PORTS} , BAM:${BAM_IP}, GITREPO:${GIT_REPO}" >> $LOG
+
+
+echo "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:agen=\"http://agent.cartridge.stratos.apache.org\">
+  <soapenv:Header/>
+  <soapenv:Body>
+     <agen:register>
+        <registrant> 
+           <alarmingLowerRate>${ALARMING_LOWER_RATE}</alarmingLowerRate>
+           <alarmingUpperRate>${ALARMING_UPPER_RATE}</alarmingUpperRate>
+           <hostName>${HOST_NAME}</hostName>
+           <key>${KEY}</key>
+          <maxInstanceCount>${MAX}</maxInstanceCount>
+	  <maxRequestsPerSecond>${MAX_REQUESTS_PER_SEC}</maxRequestsPerSecond>
+          <minInstanceCount>${MIN}</minInstanceCount> " > /etc/agent/conf/request.xml
+
+IFS='|' read -ra PT <<< "${PORTS}"
+for i in "${PT[@]}"; do
+IFS=':' read -ra PP <<< "$i"
+echo "          <portMappings>
+                        <primaryPort>${PP[1]}</primaryPort>
+                        <proxyPort>${PP[2]}</proxyPort>
+                        <type>${PP[0]}</type>
+                </portMappings>">> /etc/agent/conf/request.xml
+done
+
+echo "          <remoteHost>${PUBLIC_IP}</remoteHost>
+           <service>${SERVICE}</service>
+	   <remoteHost>${PUBLIC_IP}</remoteHost>
+           <roundsToAverage>${ROUNDS_TO_AVERAGE}</roundsToAverage>
+           <scaleDownFactor>${SCALE_DOWN_FACTOR}</scaleDownFactor>
+           <tenantRange>${TENANT_RANGE}</tenantRange>
+        </registrant>
+     </agen:register>
+  </soapenv:Body>
+</soapenv:Envelope>
+" >> /etc/agent/conf/request.xml
+
+
+echo "Sending register request to Cartridge agent service" >> $LOG
+
+curl -X POST -H "Content-Type: text/xml" -d @/etc/agent/conf/request.xml --silent --output /dev/null "$CARTRIDGE_AGENT_EPR"
+
+# ========================== // End of script ===========================================================

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b60d2c7d/tools/cartridge-create/init-scripts/php/cartridge_data_publisher_1.0.2.zip
----------------------------------------------------------------------
diff --git a/tools/cartridge-create/init-scripts/php/cartridge_data_publisher_1.0.2.zip b/tools/cartridge-create/init-scripts/php/cartridge_data_publisher_1.0.2.zip
new file mode 100644
index 0000000..08d8b1d
Binary files /dev/null and b/tools/cartridge-create/init-scripts/php/cartridge_data_publisher_1.0.2.zip differ

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b60d2c7d/tools/cartridge-create/init-scripts/php/default
----------------------------------------------------------------------
diff --git a/tools/cartridge-create/init-scripts/php/default b/tools/cartridge-create/init-scripts/php/default
new file mode 100644
index 0000000..cbb5406
--- /dev/null
+++ b/tools/cartridge-create/init-scripts/php/default
@@ -0,0 +1,59 @@
+# 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 /var/www/www
+	Alias /simplesaml /var/www/simplesamlphp/www
+	<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>

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b60d2c7d/tools/cartridge-create/init-scripts/php/default-ssl
----------------------------------------------------------------------
diff --git a/tools/cartridge-create/init-scripts/php/default-ssl b/tools/cartridge-create/init-scripts/php/default-ssl
new file mode 100644
index 0000000..e48d3ea
--- /dev/null
+++ b/tools/cartridge-create/init-scripts/php/default-ssl
@@ -0,0 +1,190 @@
+# 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 /var/www/www
+	Alias /simplesaml /var/www/simplesamlphp/www
+	<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/b60d2c7d/tools/cartridge-create/init-scripts/php/ec2/get-launch-params.rb
----------------------------------------------------------------------
diff --git a/tools/cartridge-create/init-scripts/php/ec2/get-launch-params.rb b/tools/cartridge-create/init-scripts/php/ec2/get-launch-params.rb
new file mode 100644
index 0000000..baab411
--- /dev/null
+++ b/tools/cartridge-create/init-scripts/php/ec2/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