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:33 UTC

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

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