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 2015/03/05 07:45:44 UTC

[7/9] stratos git commit: PCA - ExtensionExecutor improved Dockerfile - PHP and Tomcat dockerfiles updated and server start plugins included

PCA - ExtensionExecutor improved
Dockerfile - PHP and Tomcat dockerfiles updated and server start plugins included


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

Branch: refs/heads/master
Commit: 11613b29863634d540aac972f0c1ea657507efd1
Parents: 3289538
Author: Chamila de Alwis <ch...@wso2.com>
Authored: Thu Mar 5 01:55:32 2015 +0530
Committer: Imesh Gunaratne <im...@apache.org>
Committed: Thu Mar 5 12:15:30 2015 +0530

----------------------------------------------------------------------
 .../extensions/bash/ArtifactUpdatedEvent.sh     |  28 +++++
 .../extensions/bash/ArtifactsUpdatedEvent.sh    |  28 -----
 .../extensions/py/ExtensionExecutor.py          |  10 +-
 .../base-image/Dockerfile                       |   7 +-
 .../base-image/files/populate-user-data.sh      |  27 -----
 .../base-image/files/run                        | 114 ++++++++++---------
 .../packs/extensions/artifacts-copy.sh          |  28 -----
 .../packs/extensions/artifacts-updated.sh       |  28 -----
 .../base-image/packs/extensions/clean.sh        |  28 -----
 .../packs/extensions/complete-tenant.sh         |  28 -----
 .../packs/extensions/complete-topology.sh       |  28 -----
 .../packs/extensions/domain-mapping-added.sh    |  29 -----
 .../packs/extensions/domain-mapping-removed.sh  |  29 -----
 .../packs/extensions/instance-activated.sh      |  28 -----
 .../packs/extensions/instance-started.sh        |  27 -----
 .../packs/extensions/member-activated.sh        |  28 -----
 .../packs/extensions/member-started.sh          |  28 -----
 .../packs/extensions/member-suspended.sh        |  28 -----
 .../packs/extensions/member-terminated.sh       |  28 -----
 .../packs/extensions/mount-volumes.sh           |  87 --------------
 .../packs/extensions/start-servers.sh           |  27 -----
 .../service-images/php/Dockerfile               |   5 +
 .../php/packs/plugins/PhpServerStarterPlugin.py |  36 ++++++
 .../plugins/PhpServerStarterPlugin.yapsy-plugin |   9 ++
 .../service-images/tomcat-saml-sso/Dockerfile   |  28 ++++-
 .../service-images/tomcat/Dockerfile            |  58 +++++++---
 .../service-images/tomcat/files/env             |   5 +
 .../service-images/tomcat/files/run.sh          |   3 -
 .../packs/plugins/TomcatServerStarterPlugin.py  |  38 +++++++
 .../TomcatServerStarterPlugin.yapsy-plugin      |   9 ++
 .../service-images/wso2is-saml-sso/Dockerfile   |  23 +++-
 31 files changed, 289 insertions(+), 618 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/11613b29/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/extensions/bash/ArtifactUpdatedEvent.sh
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/extensions/bash/ArtifactUpdatedEvent.sh b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/extensions/bash/ArtifactUpdatedEvent.sh
new file mode 100755
index 0000000..15d5591
--- /dev/null
+++ b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/extensions/bash/ArtifactUpdatedEvent.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+# --------------------------------------------------------------
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# --------------------------------------------------------------
+# This extension script will be executed once the update artifacts
+# event is received and they are copied to the given path.
+# --------------------------------------------------------------
+#
+
+log=/var/log/apache-stratos/cartridge-agent-extensions.log
+echo `date`": Artifacts Updated Event" | tee -a $log

http://git-wip-us.apache.org/repos/asf/stratos/blob/11613b29/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/extensions/bash/ArtifactsUpdatedEvent.sh
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/extensions/bash/ArtifactsUpdatedEvent.sh b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/extensions/bash/ArtifactsUpdatedEvent.sh
deleted file mode 100755
index 15d5591..0000000
--- a/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/extensions/bash/ArtifactsUpdatedEvent.sh
+++ /dev/null
@@ -1,28 +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 extension script will be executed once the update artifacts
-# event is received and they are copied to the given path.
-# --------------------------------------------------------------
-#
-
-log=/var/log/apache-stratos/cartridge-agent-extensions.log
-echo `date`": Artifacts Updated Event" | tee -a $log

http://git-wip-us.apache.org/repos/asf/stratos/blob/11613b29/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/extensions/py/ExtensionExecutor.py
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/extensions/py/ExtensionExecutor.py b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/extensions/py/ExtensionExecutor.py
index d423764..fbd315b 100644
--- a/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/extensions/py/ExtensionExecutor.py
+++ b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/extensions/py/ExtensionExecutor.py
@@ -18,20 +18,22 @@
 from plugins.contracts import ICartridgeAgentPlugin
 import os
 import subprocess
+from modules.util.log import LogFactory
 
 
 class ExtensionExecutor(ICartridgeAgentPlugin):
 
-    def run_plugin(self, values, log):
+    def run_plugin(self, values):
+        log = LogFactory().get_log(__name__)
         event_name = values["EVENT"]
         log.debug("Running extension for %s" % event_name)
         extension_values = {}
         for key in values.keys():
             extension_values["STRATOS_" + key] = values[key]
-            log.debug("%s => %s" % ("STRATOS_" + key, extension_values["STRATOS_" + key]))
+            # log.debug("%s => %s" % ("STRATOS_" + key, extension_values["STRATOS_" + key]))
 
         try:
-            output, errors = ExtensionExecutor.execute_bash(event_name + ".sh")
+            output, errors = ExtensionExecutor.execute_script(event_name + ".sh")
         except OSError:
             raise RuntimeError("Could not find an extension file for event %s" % event_name)
 
@@ -41,7 +43,7 @@ class ExtensionExecutor(ICartridgeAgentPlugin):
         log.info("%s Extension executed. [output]: %s" % (event_name, output))
 
     @staticmethod
-    def execute_bash(bash_file):
+    def execute_script(bash_file):
         """ Execute the given bash files in the <PCA_HOME>/extensions/bash folder
         :param bash_file: name of the bash file to execute
         :return: tuple of (output, errors)

http://git-wip-us.apache.org/repos/asf/stratos/blob/11613b29/tools/docker-images/cartridge-docker-images/base-image/Dockerfile
----------------------------------------------------------------------
diff --git a/tools/docker-images/cartridge-docker-images/base-image/Dockerfile b/tools/docker-images/cartridge-docker-images/base-image/Dockerfile
index d8f7c9f..1d1dfb0 100644
--- a/tools/docker-images/cartridge-docker-images/base-image/Dockerfile
+++ b/tools/docker-images/cartridge-docker-images/base-image/Dockerfile
@@ -47,11 +47,14 @@ RUN pip install yapsy
 # Install cartridge agent 
 # -------------------------
 WORKDIR /mnt/
+
 ADD packs/apache-stratos-python-cartridge-agent-4.1.0-SNAPSHOT.zip /mnt/apache-stratos-python-cartridge-agent-4.1.0-SNAPSHOT.zip
 RUN unzip -q /mnt/apache-stratos-python-cartridge-agent-4.1.0-SNAPSHOT.zip -d /mnt/apache-stratos-python-cartridge-agent-4.1.0-SNAPSHOT/
 RUN rm /mnt/apache-stratos-python-cartridge-agent-4.1.0-SNAPSHOT.zip
+
 RUN mkdir -p /mnt/apache-stratos-python-cartridge-agent-4.1.0-SNAPSHOT/payload
-RUN chmod +x /mnt/apache-stratos-python-cartridge-agent-4.1.0-SNAPSHOT/extensions/*
+
+RUN chmod +x /mnt/apache-stratos-python-cartridge-agent-4.1.0-SNAPSHOT/extensions/bash/*
 RUN mkdir -p /var/log/apache-stratos/
 RUN touch /var/log/apache-stratos/cartridge-agent-extensions.log
 
@@ -60,5 +63,3 @@ RUN touch /var/log/apache-stratos/cartridge-agent-extensions.log
 # -----------------------
 ADD files/run /usr/local/bin/run
 RUN chmod +x /usr/local/bin/run
-ADD files/populate-user-data.sh /usr/local/bin/populate-user-data.sh
-RUN chmod +x /usr/local/bin/populate-user-data.sh

http://git-wip-us.apache.org/repos/asf/stratos/blob/11613b29/tools/docker-images/cartridge-docker-images/base-image/files/populate-user-data.sh
----------------------------------------------------------------------
diff --git a/tools/docker-images/cartridge-docker-images/base-image/files/populate-user-data.sh b/tools/docker-images/cartridge-docker-images/base-image/files/populate-user-data.sh
deleted file mode 100755
index 522b392..0000000
--- a/tools/docker-images/cartridge-docker-images/base-image/files/populate-user-data.sh
+++ /dev/null
@@ -1,27 +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.
-#
-# --------------------------------------------------------------
-
-# Persists the payload parameters by storing the environment variables in the launch-params file
-
-#echo "APPLICATION_ID=${APPLICATION_ID},APPLICATION_PATH=${APPLICATION_PATH},SERVICE_NAME=${SERVICE_NAME},HOST_NAME=${HOST_NAME},MULTITENANT=false,TENANT_ID=${TENANT_ID},TENANT_RANGE=*,CARTRIDGE_ALIAS=${CARTRIDGE_ALIAS},CLUSTER_ID=${CLUSTER_ID},CLUSTER_INSTANCE_ID=${CLUSTER_INSTANCE_ID},CARTRIDGE_KEY=${CARTRIDGE_KEY},DEPLOYMENT=${DEPLOYMENT},REPO_URL=${REPO_URL},PORTS=${PORTS},PUPPET_IP=${PUPPET_IP},PUPPET_HOSTNAME=${PUPPET_HOSTNAME},PUPPET_ENV=${PUPPET_ENV},MEMBER_ID=${MEMBER_ID},LB_CLUSTER_ID=${LB_CLUSTER_ID},NETWORK_PARTITION_ID=${NETWORK_PARTITION_ID},PARTITION_ID=${PARTITION_ID},MIN_COUNT=${MIN_COUNT},INTERNAL=${INTERNAL},CLUSTERING_PRIMARY_KEY=${CLUSTERING_PRIMARY_KEY}" >> /mnt/apache-stratos-python-cartridge-agent-4.1.0-SNAPSHOT/payload/launch-params
-
-set -o posix ; set | sed -e ':a;N;$!ba;s/\n/,/g' > /mnt/apache-stratos-python-cartridge-agent-4.1.0-SNAPSHOT/payload/launch-params
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/stratos/blob/11613b29/tools/docker-images/cartridge-docker-images/base-image/files/run
----------------------------------------------------------------------
diff --git a/tools/docker-images/cartridge-docker-images/base-image/files/run b/tools/docker-images/cartridge-docker-images/base-image/files/run
index 69f45b6..042856a 100755
--- a/tools/docker-images/cartridge-docker-images/base-image/files/run
+++ b/tools/docker-images/cartridge-docker-images/base-image/files/run
@@ -25,162 +25,168 @@
 
 
 source /root/.bashrc
-/usr/local/bin/populate-user-data.sh
+
+export STRATOS_VERSION="4.1.0-SNAPSHOT"
+export PCA_HOME="/mnt/apache-stratos-python-cartridge-agent-${STRATOS_VERSION}"
+
+set -o posix ; set | sed -e ':a;N;$!ba;s/\n/,/g' > ${PCA_HOME}/payload/launch-params
 
 #mandatory parameters
-sed -i "s/MB-IP/${MB_IP}/g" /mnt/apache-stratos-python-cartridge-agent-4.1.0-SNAPSHOT/agent.conf
-sed -i "s/MB-PORT/${MB_PORT}/g" /mnt/apache-stratos-python-cartridge-agent-4.1.0-SNAPSHOT/agent.conf
+sed -i "s/MB-IP/${MB_IP}/g" ${PCA_HOME}/agent.conf
+sed -i "s/MB-PORT/${MB_PORT}/g" ${PCA_HOME}/agent.conf
 
 
 #parameters that can be empty
 #default values have to be set
 
 if [ -z "${LISTEN_ADDR}" ]; then
-	sed -i "s/LISTEN_ADDR/localhost/g" /mnt/apache-stratos-python-cartridge-agent-4.1.0-SNAPSHOT/agent.conf
+	sed -i "s/LISTEN_ADDR/localhost/g" ${PCA_HOME}/agent.conf
 else
-	sed -i "s/LISTEN_ADDR/${LISTEN_ADDR}/g" /mnt/apache-stratos-python-cartridge-agent-4.1.0-SNAPSHOT/agent.conf
+	sed -i "s/LISTEN_ADDR/${LISTEN_ADDR}/g" ${PCA_HOME}/agent.conf
 fi
 
 
 # defaults to the message broker IP if not set
 if [ -z "${CEP_IP}" ]; then
-	sed -i "s/CEP-IP/${MB_IP}/g" /mnt/apache-stratos-python-cartridge-agent-4.1.0-SNAPSHOT/agent.conf
+	sed -i "s/CEP-IP/${MB_IP}/g" ${PCA_HOME}/agent.conf
 else
-	sed -i "s/CEP-IP/${CEP_IP}/g" /mnt/apache-stratos-python-cartridge-agent-4.1.0-SNAPSHOT/agent.conf
+	sed -i "s/CEP-IP/${CEP_IP}/g" ${PCA_HOME}/agent.conf
 fi
 
 
 if [ -z "${CEP_PORT}" ]; then
-	sed -i "s/CEP-PORT/7711/g" /mnt/apache-stratos-python-cartridge-agent-4.1.0-SNAPSHOT/agent.conf
+	sed -i "s/CEP-PORT/7711/g" ${PCA_HOME}/agent.conf
 else
-	sed -i "s/CEP-PORT/${CEP_PORT}/g" /mnt/apache-stratos-python-cartridge-agent-4.1.0-SNAPSHOT/agent.conf
+	sed -i "s/CEP-PORT/${CEP_PORT}/g" ${PCA_HOME}/agent.conf
 fi
 
 if [ -z "${CEP_USERNAME}" ]; then
-	sed -i "s/CEP-ADMIN-USERNAME/admin/g" /mnt/apache-stratos-python-cartridge-agent-4.1.0-SNAPSHOT/agent.conf
+	sed -i "s/CEP-ADMIN-USERNAME/admin/g" ${PCA_HOME}/agent.conf
 else
-	sed -i "s/CEP-ADMIN-USERNAME/${CEP_USERNAME}/g" /mnt/apache-stratos-python-cartridge-agent-4.1.0-SNAPSHOT/agent.conf
+	sed -i "s/CEP-ADMIN-USERNAME/${CEP_USERNAME}/g" ${PCA_HOME}/agent.conf
 fi
 
 if [ -z "${CEP_PASSWORD}" ]; then
-	sed -i "s/CEP-ADMIN-PASSWORD/admin/g" /mnt/apache-stratos-python-cartridge-agent-4.1.0-SNAPSHOT/agent.conf
+	sed -i "s/CEP-ADMIN-PASSWORD/admin/g" ${PCA_HOME}/agent.conf
 else
-	sed -i "s/CEP-ADMIN-PASSWORD/${CEP_PASSWORD}/g" /mnt/apache-stratos-python-cartridge-agent-4.1.0-SNAPSHOT/agent.conf
+	sed -i "s/CEP-ADMIN-PASSWORD/${CEP_PASSWORD}/g" ${PCA_HOME}/agent.conf
 fi
 
 if [ -z "${ENABLE_HEALTH_PUBLISHER}" ]; then
-	sed -i "s/ENABLE_HEALTH_PUBLISHER/true/g" /mnt/apache-stratos-python-cartridge-agent-4.1.0-SNAPSHOT/agent.conf
+	sed -i "s/ENABLE_HEALTH_PUBLISHER/true/g" ${PCA_HOME}/agent.conf
 else
-	sed -i "s/ENABLE_HEALTH_PUBLISHER/${ENABLE_HEALTH_PUBLISHER}/g" /mnt/apache-stratos-python-cartridge-agent-4.1.0-SNAPSHOT/agent.conf
+	sed -i "s/ENABLE_HEALTH_PUBLISHER/${ENABLE_HEALTH_PUBLISHER}/g" ${PCA_HOME}/agent.conf
 fi
 
 if [ -z "${LB_PRIVATE_IP}" ]; then
-	sed -i "s/LB_PRIVATE_IP/ /g" /mnt/apache-stratos-python-cartridge-agent-4.1.0-SNAPSHOT/agent.conf
+	sed -i "s/LB_PRIVATE_IP/ /g" ${PCA_HOME}/agent.conf
 else
-	sed -i "s/LB_PRIVATE_IP/${LB_PRIVATE_IP}/g" /mnt/apache-stratos-python-cartridge-agent-4.1.0-SNAPSHOT/agent.conf
+	sed -i "s/LB_PRIVATE_IP/${LB_PRIVATE_IP}/g" ${PCA_HOME}/agent.conf
 fi
 
 if [ -z "${LB_PUBLIC_IP}" ]; then
-	sed -i "s/LB_PUBLIC_IP/ /g" /mnt/apache-stratos-python-cartridge-agent-4.1.0-SNAPSHOT/agent.conf
+	sed -i "s/LB_PUBLIC_IP/ /g" ${PCA_HOME}/agent.conf
 else
-	sed -i "s/LB_PUBLIC_IP/${LB_PUBLIC_IP}/g" /mnt/apache-stratos-python-cartridge-agent-4.1.0-SNAPSHOT/agent.conf
+	sed -i "s/LB_PUBLIC_IP/${LB_PUBLIC_IP}/g" ${PCA_HOME}/agent.conf
 fi
 
 if [ -z "${ENABLE_ARTFCT_UPDATE}" ]; then
-	sed -i "s/ENABLE_ARTFCT_UPDATE/true/g" /mnt/apache-stratos-python-cartridge-agent-4.1.0-SNAPSHOT/agent.conf
+	sed -i "s/ENABLE_ARTFCT_UPDATE/true/g" ${PCA_HOME}/agent.conf
 else
-	sed -i "s/ENABLE_ARTFCT_UPDATE/${ENABLE_ARTFCT_UPDATE}/g" /mnt/apache-stratos-python-cartridge-agent-4.1.0-SNAPSHOT/agent.conf
+	sed -i "s/ENABLE_ARTFCT_UPDATE/${ENABLE_ARTFCT_UPDATE}/g" ${PCA_HOME}/agent.conf
 fi
 
 if [ -z "${COMMIT_ENABLED}" ]; then
-	sed -i "s/COMMIT_ENABLED/false/g" /mnt/apache-stratos-python-cartridge-agent-4.1.0-SNAPSHOT/agent.conf
+	sed -i "s/COMMIT_ENABLED/false/g" ${PCA_HOME}/agent.conf
 else
-	sed -i "s/COMMIT_ENABLED/${COMMIT_ENABLED}/g" /mnt/apache-stratos-python-cartridge-agent-4.1.0-SNAPSHOT/agent.conf
+	sed -i "s/COMMIT_ENABLED/${COMMIT_ENABLED}/g" ${PCA_HOME}/agent.conf
 fi
 
 if [ -z "${CHECKOUT_ENABLED}" ]; then
-	sed -i "s/CHECKOUT_ENABLED/true/g" /mnt/apache-stratos-python-cartridge-agent-4.1.0-SNAPSHOT/agent.conf
+	sed -i "s/CHECKOUT_ENABLED/true/g" ${PCA_HOME}/agent.conf
 else
-	sed -i "s/CHECKOUT_ENABLED/${CHECKOUT_ENABLED}/g" /mnt/apache-stratos-python-cartridge-agent-4.1.0-SNAPSHOT/agent.conf
+	sed -i "s/CHECKOUT_ENABLED/${CHECKOUT_ENABLED}/g" ${PCA_HOME}/agent.conf
 fi
 
 if [ -z "${ARTFCT_UPDATE_INT}" ]; then
-	sed -i "s/ARTFCT_UPDATE_INT/15/g" /mnt/apache-stratos-python-cartridge-agent-4.1.0-SNAPSHOT/agent.conf
+	sed -i "s/ARTFCT_UPDATE_INT/15/g" ${PCA_HOME}/agent.conf
 else
-	sed -i "s/ARTFCT_UPDATE_INT/${ARTFCT_UPDATE_INT}/g" /mnt/apache-stratos-python-cartridge-agent-4.1.0-SNAPSHOT/agent.conf
+	sed -i "s/ARTFCT_UPDATE_INT/${ARTFCT_UPDATE_INT}/g" ${PCA_HOME}/agent.conf
 fi
 
 if [ -z "${PORT_CHECK_TIMEOUT}" ]; then
-	sed -i "s/PORT_CHECK_TIMEOUT/600000/g" /mnt/apache-stratos-python-cartridge-agent-4.1.0-SNAPSHOT/agent.conf
+	sed -i "s/PORT_CHECK_TIMEOUT/600000/g" ${PCA_HOME}/agent.conf
 else
-	sed -i "s/PORT_CHECK_TIMEOUT/${PORT_CHECK_TIMEOUT}/g" /mnt/apache-stratos-python-cartridge-agent-4.1.0-SNAPSHOT/agent.conf
+	sed -i "s/PORT_CHECK_TIMEOUT/${PORT_CHECK_TIMEOUT}/g" ${PCA_HOME}/agent.conf
 fi
 
 if [ -z "${ENABLE_DATA_PUBLISHER}" ]; then
-	sed -i "s/ENABLE-DATA-PUBLISHER/false/g" /mnt/apache-stratos-python-cartridge-agent-4.1.0-SNAPSHOT/agent.conf
+	sed -i "s/ENABLE-DATA-PUBLISHER/false/g" ${PCA_HOME}/agent.conf
 else
-	sed -i "s/ENABLE-DATA-PUBLISHER/${ENABLE_DATA_PUBLISHER}/g" /mnt/apache-stratos-python-cartridge-agent-4.1.0-SNAPSHOT/agent.conf
+	sed -i "s/ENABLE-DATA-PUBLISHER/${ENABLE_DATA_PUBLISHER}/g" ${PCA_HOME}/agent.conf
 fi
 
 # defaults to the message broker IP if not set
 if [ -z "${MONITORING_SERVER_IP}" ]; then
-	sed -i "s/MONITORING-SERVER-IP/${MB_IP}/g" /mnt/apache-stratos-python-cartridge-agent-4.1.0-SNAPSHOT/agent.conf
+	sed -i "s/MONITORING-SERVER-IP/${MB_IP}/g" ${PCA_HOME}/agent.conf
 else
-	sed -i "s/MONITORING-SERVER-IP/${MONITORING_SERVER_IP}/g" /mnt/apache-stratos-python-cartridge-agent-4.1.0-SNAPSHOT/agent.conf
+	sed -i "s/MONITORING-SERVER-IP/${MONITORING_SERVER_IP}/g" ${PCA_HOME}/agent.conf
 fi
 
 if [ -z "${MONITORING_SERVER_PORT}" ]; then
-	sed -i "s/MONITORING-SERVER-PORT/7611/g" /mnt/apache-stratos-python-cartridge-agent-4.1.0-SNAPSHOT/agent.conf
+	sed -i "s/MONITORING-SERVER-PORT/7611/g" ${PCA_HOME}/agent.conf
 else
-	sed -i "s/MONITORING-SERVER-PORT/${MONITORING_SERVER_PORT}/g" /mnt/apache-stratos-python-cartridge-agent-4.1.0-SNAPSHOT/agent.conf
+	sed -i "s/MONITORING-SERVER-PORT/${MONITORING_SERVER_PORT}/g" ${PCA_HOME}/agent.conf
 fi
 
 if [ -z "${MONITORING_SERVER_SECURE_PORT}" ]; then
-	sed -i "s/MONITORING-SERVER-SECURE-PORT/7711/g" /mnt/apache-stratos-python-cartridge-agent-4.1.0-SNAPSHOT/agent.conf
+	sed -i "s/MONITORING-SERVER-SECURE-PORT/7711/g" ${PCA_HOME}/agent.conf
 else
-	sed -i "s/MONITORING-SERVER-SECURE-PORT/${MONITORING_SERVER_SECURE_PORT}/g" /mnt/apache-stratos-python-cartridge-agent-4.1.0-SNAPSHOT/agent.conf
+	sed -i "s/MONITORING-SERVER-SECURE-PORT/${MONITORING_SERVER_SECURE_PORT}/g" ${PCA_HOME}/agent.conf
 fi
 
 if [ -z "${MONITORING_SERVER_ADMIN_USERNAME}" ]; then
-	sed -i "s/MONITORING-SERVER-ADMIN-USERNAME/admin/g" /mnt/apache-stratos-python-cartridge-agent-4.1.0-SNAPSHOT/agent.conf
+	sed -i "s/MONITORING-SERVER-ADMIN-USERNAME/admin/g" ${PCA_HOME}/agent.conf
 else
-	sed -i "s/MONITORING-SERVER-ADMIN-USERNAME/${MONITORING_SERVER_ADMIN_USERNAME}/g" /mnt/apache-stratos-python-cartridge-agent-4.1.0-SNAPSHOT/agent.conf
+	sed -i "s/MONITORING-SERVER-ADMIN-USERNAME/${MONITORING_SERVER_ADMIN_USERNAME}/g" ${PCA_HOME}/agent.conf
 fi
 
 if [ -z "${MONITORING_SERVER_ADMIN_PASSWORD}" ]; then
-	sed -i "s/MONITORING-SERVER-ADMIN-PASSWORD/admin/g" /mnt/apache-stratos-python-cartridge-agent-4.1.0-SNAPSHOT/agent.conf
+	sed -i "s/MONITORING-SERVER-ADMIN-PASSWORD/admin/g" ${PCA_HOME}/agent.conf
 else
-	sed -i "s/MONITORING-SERVER-ADMIN-PASSWORD/${MONITORING_SERVER_ADMIN_PASSWORD}/g" /mnt/apache-stratos-python-cartridge-agent-4.1.0-SNAPSHOT/agent.conf
+	sed -i "s/MONITORING-SERVER-ADMIN-PASSWORD/${MONITORING_SERVER_ADMIN_PASSWORD}/g" ${PCA_HOME}/agent.conf
 fi
 
 if [ -z "${LOG_FILE_PATHS}" ]; then
-	sed -i "s/LOG_FILE_PATHS/ /g" /mnt/apache-stratos-python-cartridge-agent-4.1.0-SNAPSHOT/agent.conf
+	sed -i "s/LOG_FILE_PATHS/ /g" ${PCA_HOME}/agent.conf
 else
-	sed -i "s#LOG_FILE_PATHS#${LOG_FILE_PATHS}#g" /mnt/apache-stratos-python-cartridge-agent-4.1.0-SNAPSHOT/agent.conf
+	sed -i "s#LOG_FILE_PATHS#${LOG_FILE_PATHS}#g" ${PCA_HOME}/agent.conf
 fi
 
 if [ -z "${APPLICATION_PATH}" ]; then
-	sed -i "s/APPLICATION-PATH/ /g" /mnt/apache-stratos-python-cartridge-agent-4.1.0-SNAPSHOT/agent.conf
+	sed -i "s/APPLICATION-PATH/ /g" ${PCA_HOME}/agent.conf
 else
-	sed -i "s#APPLICATION-PATH#${APPLICATION_PATH}#g" /mnt/apache-stratos-python-cartridge-agent-4.1.0-SNAPSHOT/agent.conf
+	sed -i "s#APPLICATION-PATH#${APPLICATION_PATH}#g" ${PCA_HOME}/agent.conf
 fi
 
 if [ -z "${METADATA_SERVICE_URL}" ]; then
-	sed -i "s/METADATA-SERVICE-URL/ /g" /mnt/apache-stratos-python-cartridge-agent-4.1.0-SNAPSHOT/agent.conf
+	sed -i "s/METADATA-SERVICE-URL/ /g" ${PCA_HOME}/agent.conf
 else
-	sed -i "s#METADATA-SERVICE-URL#${METADATA_SERVICE_URL}#g" /mnt/apache-stratos-python-cartridge-agent-4.1.0-SNAPSHOT/agent.conf
+	sed -i "s#METADATA-SERVICE-URL#${METADATA_SERVICE_URL}#g" ${PCA_HOME}/agent.conf
 fi
 
 if [ -z "${LOG_LEVEL}" ]; then
-	sed -i "s/LOG_LEVEL/INFO/g" /mnt/apache-stratos-python-cartridge-agent-4.1.0-SNAPSHOT/logging.ini
+	sed -i "s/LOG_LEVEL/INFO/g" ${PCA_HOME}/logging.ini
 else
-	sed -i "s/LOG_LEVEL/${LOG_LEVEL}/g" /mnt/apache-stratos-python-cartridge-agent-4.1.0-SNAPSHOT/logging.ini
+	sed -i "s/LOG_LEVEL/${LOG_LEVEL}/g" ${PCA_HOME}/logging.ini
 fi
 
-# copy plugins to PCA
-cp -R /mnt/plugins /mnt/apache-stratos-python-cartridge-agent-4.1.0-SNAPSHOT/
+# copy custom plugins to PCA
+cp -R /mnt/plugins ${PCA_HOME}/
+
+# copy custom extensions to PCA
+cp -R /mnt/extensions ${PCA_HOME}/
 
 # Start cartridge agent
-cd /mnt/apache-stratos-python-cartridge-agent-4.1.0-SNAPSHOT
-python agent.py > /tmp/agent.screen.log 2>&1 &
-#/usr/sbin/apache2ctl -D FOREGROUND
+cd ${PCA_HOME}/
+python agent.py > /tmp/agent.screen.log 2>&1 &
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/stratos/blob/11613b29/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/artifacts-copy.sh
----------------------------------------------------------------------
diff --git a/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/artifacts-copy.sh b/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/artifacts-copy.sh
deleted file mode 100644
index f25182f..0000000
--- a/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/artifacts-copy.sh
+++ /dev/null
@@ -1,28 +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 extension script will be executed once the update artifacts
-# event is received and they are copied to the given path.
-# --------------------------------------------------------------
-#
-
-log=/var/log/apache-stratos/cartridge-agent-extensions.log
-echo `date`": Artifacts Copied: " | tee -a $log

http://git-wip-us.apache.org/repos/asf/stratos/blob/11613b29/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/artifacts-updated.sh
----------------------------------------------------------------------
diff --git a/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/artifacts-updated.sh b/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/artifacts-updated.sh
deleted file mode 100755
index 15d5591..0000000
--- a/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/artifacts-updated.sh
+++ /dev/null
@@ -1,28 +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 extension script will be executed once the update artifacts
-# event is received and they are copied to the given path.
-# --------------------------------------------------------------
-#
-
-log=/var/log/apache-stratos/cartridge-agent-extensions.log
-echo `date`": Artifacts Updated Event" | tee -a $log

http://git-wip-us.apache.org/repos/asf/stratos/blob/11613b29/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/clean.sh
----------------------------------------------------------------------
diff --git a/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/clean.sh b/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/clean.sh
deleted file mode 100755
index c62ad35..0000000
--- a/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/clean.sh
+++ /dev/null
@@ -1,28 +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 extension script will be executed when stratos manager requests
-# to clean up the instance before terminating it.
-# --------------------------------------------------------------
-#
-
-log=/var/log/apache-stratos/cartridge-agent-extensions.log
-echo `date`": Cleaning the cartridge" | tee -a $log

http://git-wip-us.apache.org/repos/asf/stratos/blob/11613b29/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/complete-tenant.sh
----------------------------------------------------------------------
diff --git a/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/complete-tenant.sh b/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/complete-tenant.sh
deleted file mode 100644
index 50e4506..0000000
--- a/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/complete-tenant.sh
+++ /dev/null
@@ -1,28 +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 extension script will be executed when complete tenant
-# event is received.
-# --------------------------------------------------------------
-#
-
-log=/var/log/apache-stratos/cartridge-agent-extensions.log
-echo `date`": Complete Tenant Event: " | tee -a $log

http://git-wip-us.apache.org/repos/asf/stratos/blob/11613b29/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/complete-topology.sh
----------------------------------------------------------------------
diff --git a/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/complete-topology.sh b/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/complete-topology.sh
deleted file mode 100644
index a3311ad..0000000
--- a/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/complete-topology.sh
+++ /dev/null
@@ -1,28 +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 extension script will be executed when complete topology 
-# event is received.
-# --------------------------------------------------------------
-#
-
-log=/var/log/apache-stratos/cartridge-agent-extensions.log
-echo `date`": Complete Topology Event: " | tee -a $log

http://git-wip-us.apache.org/repos/asf/stratos/blob/11613b29/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/domain-mapping-added.sh
----------------------------------------------------------------------
diff --git a/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/domain-mapping-added.sh b/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/domain-mapping-added.sh
deleted file mode 100644
index 759f6b4..0000000
--- a/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/domain-mapping-added.sh
+++ /dev/null
@@ -1,29 +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 extension script will be executed when subscription domain
-# added event is received.
-# --------------------------------------------------------------
-#
-
-log=/var/log/apache-stratos/cartridge-agent-extensions.log
-OUTPUT=`date`": Domain Mapping Added Event"
-echo $OUTPUT | tee -a $log

http://git-wip-us.apache.org/repos/asf/stratos/blob/11613b29/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/domain-mapping-removed.sh
----------------------------------------------------------------------
diff --git a/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/domain-mapping-removed.sh b/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/domain-mapping-removed.sh
deleted file mode 100644
index 3be259e..0000000
--- a/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/domain-mapping-removed.sh
+++ /dev/null
@@ -1,29 +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 extension script will be executed when subscription domain
-# removed event is received.
-# --------------------------------------------------------------
-#
-
-log=/var/log/apache-stratos/cartridge-agent-extensions.log
-OUTPUT=`date`": Domain Mapping Removed Event"
-echo $OUTPUT | tee -a $log

http://git-wip-us.apache.org/repos/asf/stratos/blob/11613b29/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/instance-activated.sh
----------------------------------------------------------------------
diff --git a/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/instance-activated.sh b/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/instance-activated.sh
deleted file mode 100755
index f5d60e8..0000000
--- a/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/instance-activated.sh
+++ /dev/null
@@ -1,28 +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 extension script will be executed once the instance is
-# activated and ready to serve incoming requests.
-# --------------------------------------------------------------
-#
-
-log=/var/log/apache-stratos/cartridge-agent-extensions.log
-echo `date`": Instance activated" | tee -a $log

http://git-wip-us.apache.org/repos/asf/stratos/blob/11613b29/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/instance-started.sh
----------------------------------------------------------------------
diff --git a/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/instance-started.sh b/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/instance-started.sh
deleted file mode 100755
index 7b5aa6a..0000000
--- a/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/instance-started.sh
+++ /dev/null
@@ -1,27 +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 extension script will be executed once the instance is started.
-# --------------------------------------------------------------
-#
-
-log=/var/log/apache-stratos/cartridge-agent-extensions.log
-echo `date`": Instance Started Event: " | tee -a $log

http://git-wip-us.apache.org/repos/asf/stratos/blob/11613b29/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/member-activated.sh
----------------------------------------------------------------------
diff --git a/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/member-activated.sh b/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/member-activated.sh
deleted file mode 100644
index f6e8201..0000000
--- a/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/member-activated.sh
+++ /dev/null
@@ -1,28 +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 extension script will be executed when member activated
-# event is received.
-# --------------------------------------------------------------
-#
-
-log=/var/log/apache-stratos/cartridge-agent-extensions.log
-OUTPUT=`date`": Member Activated Event: "

http://git-wip-us.apache.org/repos/asf/stratos/blob/11613b29/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/member-started.sh
----------------------------------------------------------------------
diff --git a/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/member-started.sh b/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/member-started.sh
deleted file mode 100644
index 0b558b6..0000000
--- a/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/member-started.sh
+++ /dev/null
@@ -1,28 +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 extension script will be executed when member suspended
-# event is received.
-# --------------------------------------------------------------
-#
-
-log=/var/log/apache-stratos/cartridge-agent-extensions.log
-echo `date`": Member Started Event: " | tee -a $log

http://git-wip-us.apache.org/repos/asf/stratos/blob/11613b29/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/member-suspended.sh
----------------------------------------------------------------------
diff --git a/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/member-suspended.sh b/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/member-suspended.sh
deleted file mode 100644
index acf44b9..0000000
--- a/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/member-suspended.sh
+++ /dev/null
@@ -1,28 +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 extension script will be executed when member suspended
-# event is received.
-# --------------------------------------------------------------
-#
-
-log=/var/log/apache-stratos/cartridge-agent-extensions.log
-echo `date`": Member Suspended Event:" | tee -a $log

http://git-wip-us.apache.org/repos/asf/stratos/blob/11613b29/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/member-terminated.sh
----------------------------------------------------------------------
diff --git a/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/member-terminated.sh b/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/member-terminated.sh
deleted file mode 100644
index 0e69629..0000000
--- a/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/member-terminated.sh
+++ /dev/null
@@ -1,28 +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 extension script will be executed when member terminated
-# event is received.
-# --------------------------------------------------------------
-#
-
-log=/var/log/apache-stratos/cartridge-agent-extensions.log
-OUTPUT=`date`": Member Terminated Event: "

http://git-wip-us.apache.org/repos/asf/stratos/blob/11613b29/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/mount-volumes.sh
----------------------------------------------------------------------
diff --git a/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/mount-volumes.sh b/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/mount-volumes.sh
deleted file mode 100755
index 2e649bd..0000000
--- a/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/mount-volumes.sh
+++ /dev/null
@@ -1,87 +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 extension script will be executed to mount volumes
-# to the instance.
-# --------------------------------------------------------------
-#
-
-
-log=/var/log/apache-stratos/cartridge-agent-extensions.log
-echo -e "Starting mounting volumes" 2>&1 | tee -a $log
-
-# $1  is passed from Cartridge Agent code.
-echo -e "launh param file location $1" | tee -a $log
-#source /opt/apache-stratos-cartridge-agent/launch.params
-PERSISTENCE_MAPPING=$1
-echo -e "Persistance mappings : $PERSISTENCE_MAPPING" 2>&1 | tee -a $log
-
-mount_volume(){
-
-        device=$1;
-        mount_point=$2;
-        echo "device $device"
-        echo "point  $mount_point"
-        # check if the volume has a file system
-        output=`sudo file -s $device`;
-        echo $output | tee -a $log
-
-        # this is the pattern of the output of file -s if the volume does not have a file system
-        # refer to http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-using-volumes.html
-        pattern="$device: data"
-
-        if [[ $output ==  $pattern ]]
-        then
-                echo -e "Volume is not formatted. So formating the device $device \n" | tee -a $log
-                sudo mkfs -t ext4 $device
-        fi
-
-        echo "Mounting  the device $device to the mount point $mount_point \n" | tee -a $log
-        device_mounted=$(mount | grep "$device")
-
-        if [ ! -d "$mount_point" ]
-        then
-              echo "creating the  mount point directory $mount_point since it does not exist." | tee -a $log
-              sudo mkdir $mount_point
-        fi
-
-        #mounting the device if it is not already mounted
-        if [ ! "$device_mounted" = "" ]
-        then
-              echo -e "Device $device is already mounted." | tee -a $log
-        else
-              sudo mount $device $mount_point
-        fi
-
-}
-
-IFS='|' read -ra ADDR <<< "${PERSISTENCE_MAPPING}"
-echo "${ADDR[@]}" | tee -a $log
-
-for i in "${!ADDR[@]}"; do
-        # expected PERSISTANCE_MAPPING format is device1|mountPoint1|device2|mountpoint2...
-        # so that even indexes are devices and odd indexes are mount points..
-        if (( $i  % 2 == 0 ))
-        then
-           mount_volume ${ADDR[$i]} ${ADDR[$i + 1]}
-        fi
-done
-

http://git-wip-us.apache.org/repos/asf/stratos/blob/11613b29/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/start-servers.sh
----------------------------------------------------------------------
diff --git a/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/start-servers.sh b/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/start-servers.sh
deleted file mode 100755
index bac3a57..0000000
--- a/tools/docker-images/cartridge-docker-images/base-image/packs/extensions/start-servers.sh
+++ /dev/null
@@ -1,27 +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 extension script will be executed to start the servers.
-# --------------------------------------------------------------
-#
-
-log=/var/log/apache-stratos/cartridge-agent-extensions.log
-echo `date`": Starting servers" | tee -a $log

http://git-wip-us.apache.org/repos/asf/stratos/blob/11613b29/tools/docker-images/cartridge-docker-images/service-images/php/Dockerfile
----------------------------------------------------------------------
diff --git a/tools/docker-images/cartridge-docker-images/service-images/php/Dockerfile b/tools/docker-images/cartridge-docker-images/service-images/php/Dockerfile
index 64bcf49..4ac9530 100644
--- a/tools/docker-images/cartridge-docker-images/service-images/php/Dockerfile
+++ b/tools/docker-images/cartridge-docker-images/service-images/php/Dockerfile
@@ -29,6 +29,11 @@ RUN apt-get install -y apache2 php5 zip stress
 RUN rm -f /etc/apache2/sites-enabled/000-default.conf
 ADD files/000-default.conf /etc/apache2/sites-enabled/000-default.conf
 
+#------------------------
+# Copy PHP related PCA plugins
+#-----------------------
+ADD packs/plugins /mnt/plugins
+
 EXPOSE 80
 
 # ----------------

http://git-wip-us.apache.org/repos/asf/stratos/blob/11613b29/tools/docker-images/cartridge-docker-images/service-images/php/packs/plugins/PhpServerStarterPlugin.py
----------------------------------------------------------------------
diff --git a/tools/docker-images/cartridge-docker-images/service-images/php/packs/plugins/PhpServerStarterPlugin.py b/tools/docker-images/cartridge-docker-images/service-images/php/packs/plugins/PhpServerStarterPlugin.py
new file mode 100644
index 0000000..13d165c
--- /dev/null
+++ b/tools/docker-images/cartridge-docker-images/service-images/php/packs/plugins/PhpServerStarterPlugin.py
@@ -0,0 +1,36 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+import mdsclient
+from plugins.contracts import ICartridgeAgentPlugin
+import time
+import zipfile
+import subprocess
+from modules.util.log import LogFactory
+import os
+
+
+class PhpServerStarterPlugin(ICartridgeAgentPlugin):
+
+    def run_plugin(self, values):
+        log = LogFactory().get_log(__name__)
+        # php_start_command = "/usr/sbin/apache2ctl -D FOREGROUND"
+        php_start_command = "/etc/init.d/apache2 restart"
+        p = subprocess.Popen(php_start_command, shell=True)
+        output, errors = p.communicate()
+        log.debug("Apache server started: [command] %s, [output] %s" % (php_start_command, output))
+

http://git-wip-us.apache.org/repos/asf/stratos/blob/11613b29/tools/docker-images/cartridge-docker-images/service-images/php/packs/plugins/PhpServerStarterPlugin.yapsy-plugin
----------------------------------------------------------------------
diff --git a/tools/docker-images/cartridge-docker-images/service-images/php/packs/plugins/PhpServerStarterPlugin.yapsy-plugin b/tools/docker-images/cartridge-docker-images/service-images/php/packs/plugins/PhpServerStarterPlugin.yapsy-plugin
new file mode 100644
index 0000000..221ffd5
--- /dev/null
+++ b/tools/docker-images/cartridge-docker-images/service-images/php/packs/plugins/PhpServerStarterPlugin.yapsy-plugin
@@ -0,0 +1,9 @@
+[Core]
+Name = PhpServerStarterPlugin to start Apache server with PHP
+Module = PhpServerStarterPlugin
+
+[Documentation]
+Description = ArtifactUpdatedEvent
+Author = Op1
+Version = 0.1
+Website = stratos.apache.org
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/stratos/blob/11613b29/tools/docker-images/cartridge-docker-images/service-images/tomcat-saml-sso/Dockerfile
----------------------------------------------------------------------
diff --git a/tools/docker-images/cartridge-docker-images/service-images/tomcat-saml-sso/Dockerfile b/tools/docker-images/cartridge-docker-images/service-images/tomcat-saml-sso/Dockerfile
index b5ada30..63ce7d3 100644
--- a/tools/docker-images/cartridge-docker-images/service-images/tomcat-saml-sso/Dockerfile
+++ b/tools/docker-images/cartridge-docker-images/service-images/tomcat-saml-sso/Dockerfile
@@ -1,4 +1,25 @@
-FROM chamilad/base-image:4.1.0-beta
+# --------------------------------------------------------------
+#
+# 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.
+#
+# --------------------------------------------------------------
+
+FROM stratos/base-image:4.1.0-beta
 MAINTAINER dev@stratos.apache.org
 
 ENV JDK_VERSION 1.7.0_60
@@ -8,15 +29,11 @@ ENV TOMCAT_VERSION 7.0.55
 # ----------------------
 # Install prerequisites
 # ----------------------
-# RUN apt-get update && \ apt-get install -yq --no-install-recommends openjdk-7-jre wget ca-certificates && \apt-get clean && \rm -rf /var/lib/apt/lists/*
 WORKDIR /opt
-# RUN wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/7u67-b01/jdk-7u60-linux-x64.tar.gz
 ADD packs/${JDK_TAR_FILENAME} /mnt/${JDK_TAR_FILENAME}
-# RUN tar zxvf /mnt/${JDK_TAR_FILENAME}
 RUN mv /mnt/${JDK_TAR_FILENAME}/jdk${JDK_VERSION} /opt/jdk${JDK_VERSION}
 ENV JAVA_HOME /opt/jdk${JDK_VERSION}
 
-
 ENV CATALINA_HOME /opt/tomcat
 
 # ----------------------
@@ -30,7 +47,6 @@ RUN mv /opt/apache-tomcat-${TOMCAT_VERSION}.tar.gz/apache-tomcat-${TOMCAT_VERSIO
 # Add shell scripts
 # -----------------------
 ADD files/create-admin-user.sh /opt/create-admin-user.sh
-# ADD files/run.sh /opt/run.sh
 RUN chmod +x /opt/create-admin-user.sh && \
     bash /opt/create-admin-user.sh
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/11613b29/tools/docker-images/cartridge-docker-images/service-images/tomcat/Dockerfile
----------------------------------------------------------------------
diff --git a/tools/docker-images/cartridge-docker-images/service-images/tomcat/Dockerfile b/tools/docker-images/cartridge-docker-images/service-images/tomcat/Dockerfile
index 1f8d1b3..7eb916b 100644
--- a/tools/docker-images/cartridge-docker-images/service-images/tomcat/Dockerfile
+++ b/tools/docker-images/cartridge-docker-images/service-images/tomcat/Dockerfile
@@ -1,37 +1,69 @@
+# --------------------------------------------------------------
+#
+# 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.
+#
+# --------------------------------------------------------------
+
 FROM stratos/base-image:4.1.0-beta
 MAINTAINER dev@stratos.apache.org
 
+ENV JDK_VERSION 1.7.0_67
+ENV JDK_TAR_FILENAME jdk-7u67-linux-x64.tar.gz
+ENV TOMCAT_VERSION 7.0.59
+
 # ----------------------
 # Install prerequisites
 # ----------------------
-RUN apt-get update && \
-    apt-get install -yq --no-install-recommends openjdk-7-jre wget ca-certificates && \
-    apt-get clean && \
-    rm -rf /var/lib/apt/lists/*
+WORKDIR /opt
+ADD packs/${JDK_TAR_FILENAME} /mnt/${JDK_TAR_FILENAME}
+RUN mv /mnt/${JDK_TAR_FILENAME}/jdk${JDK_VERSION} /opt/jdk${JDK_VERSION}
+ENV JAVA_HOME /opt/jdk${JDK_VERSION}
 
 ENV CATALINA_HOME /opt/tomcat
 
 # ----------------------
 # Install Tomcat
 # ----------------------
-RUN cd /opt/ && \
-    wget -q https://archive.apache.org/dist/tomcat/tomcat-7/v7.0.55/bin/apache-tomcat-7.0.55.tar.gz && \
-    wget -qO- https://archive.apache.org/dist/tomcat/tomcat-7/v7.0.55/bin/apache-tomcat-7.0.55.tar.gz.md5 | md5sum -c - && \
-    tar zxf apache-tomcat-7.0.55.tar.gz && \
-    rm apache-tomcat-7.0.55.tar.gz && \
-    mv apache-tomcat-7.0.55 tomcat
+ADD packs/apache-tomcat-${TOMCAT_VERSION}.tar.gz /opt/apache-tomcat-${TOMCAT_VERSION}.tar.gz
+RUN mv /opt/apache-tomcat-${TOMCAT_VERSION}.tar.gz/apache-tomcat-${TOMCAT_VERSION} /opt/tomcat && \
+    rm -rf /opt/apache-tomcat-${TOMCAT_VERSION}.tar.gz
 
 # -----------------------
 # Add shell scripts
 # -----------------------
 ADD files/create-admin-user.sh /opt/create-admin-user.sh
-ADD files/run.sh /opt/run.sh
-RUN chmod +x /opt/create-admin-user.sh /opt/run.sh && \
+RUN chmod +x /opt/create-admin-user.sh && \
     bash /opt/create-admin-user.sh
 
+ADD files/env /tmp/env
+RUN chmod +x /tmp/env && \
+    sleep 1 && \
+    /tmp/env ${JAVA_HOME} ${CATALINA_HOME}
+
+#------------------------
+# Copy Tomcat related PCA plugins
+#-----------------------
+ADD packs/plugins /mnt/plugins
+
+
 EXPOSE 8080
 
 # -----------------------
 # Define entry point
 # -----------------------
-ENTRYPOINT /usr/local/bin/run | /opt/run.sh | /usr/sbin/sshd -D
+ENTRYPOINT /usr/local/bin/run | /usr/sbin/sshd -D

http://git-wip-us.apache.org/repos/asf/stratos/blob/11613b29/tools/docker-images/cartridge-docker-images/service-images/tomcat/files/env
----------------------------------------------------------------------
diff --git a/tools/docker-images/cartridge-docker-images/service-images/tomcat/files/env b/tools/docker-images/cartridge-docker-images/service-images/tomcat/files/env
new file mode 100644
index 0000000..b9deae3
--- /dev/null
+++ b/tools/docker-images/cartridge-docker-images/service-images/tomcat/files/env
@@ -0,0 +1,5 @@
+JAVA_HOME=$1
+CATALINA_HOME=$2
+
+echo "JAVA_HOME=${JAVA_HOME}" >> /etc/environment
+echo "CATALINA_HOME=${CATALINA_HOME}" >> /etc/environment
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/stratos/blob/11613b29/tools/docker-images/cartridge-docker-images/service-images/tomcat/files/run.sh
----------------------------------------------------------------------
diff --git a/tools/docker-images/cartridge-docker-images/service-images/tomcat/files/run.sh b/tools/docker-images/cartridge-docker-images/service-images/tomcat/files/run.sh
deleted file mode 100644
index 2058dd9..0000000
--- a/tools/docker-images/cartridge-docker-images/service-images/tomcat/files/run.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/bash
-
-exec ${CATALINA_HOME}/bin/catalina.sh run

http://git-wip-us.apache.org/repos/asf/stratos/blob/11613b29/tools/docker-images/cartridge-docker-images/service-images/tomcat/packs/plugins/TomcatServerStarterPlugin.py
----------------------------------------------------------------------
diff --git a/tools/docker-images/cartridge-docker-images/service-images/tomcat/packs/plugins/TomcatServerStarterPlugin.py b/tools/docker-images/cartridge-docker-images/service-images/tomcat/packs/plugins/TomcatServerStarterPlugin.py
new file mode 100644
index 0000000..6509865
--- /dev/null
+++ b/tools/docker-images/cartridge-docker-images/service-images/tomcat/packs/plugins/TomcatServerStarterPlugin.py
@@ -0,0 +1,38 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+import mdsclient
+from plugins.contracts import ICartridgeAgentPlugin
+import time
+import zipfile
+import subprocess
+from modules.util.log import LogFactory
+import os
+
+
+class TomcatServerStarterPlugin(ICartridgeAgentPlugin):
+
+    def run_plugin(self, values):
+        log = LogFactory().get_log(__name__)
+        # start tomcat
+        tomcat_start_command = "exec ${CATALINA_HOME}/bin/startup.sh"
+        log.info("Starting Tomcat server: [command] %s" % tomcat_start_command)
+
+        p = subprocess.Popen(tomcat_start_command, shell=True)
+        output, errors = p.communicate()
+        log.debug("Tomcat server started: [command] %s, [output] %s" % (p.args, output))
+

http://git-wip-us.apache.org/repos/asf/stratos/blob/11613b29/tools/docker-images/cartridge-docker-images/service-images/tomcat/packs/plugins/TomcatServerStarterPlugin.yapsy-plugin
----------------------------------------------------------------------
diff --git a/tools/docker-images/cartridge-docker-images/service-images/tomcat/packs/plugins/TomcatServerStarterPlugin.yapsy-plugin b/tools/docker-images/cartridge-docker-images/service-images/tomcat/packs/plugins/TomcatServerStarterPlugin.yapsy-plugin
new file mode 100644
index 0000000..87e0de2
--- /dev/null
+++ b/tools/docker-images/cartridge-docker-images/service-images/tomcat/packs/plugins/TomcatServerStarterPlugin.yapsy-plugin
@@ -0,0 +1,9 @@
+[Core]
+Name = TomcatServerStarterPlugin to read SAML SSO related metadata needed to configure SAML SSO for apps and start tomcat
+Module = TomcatServerStarterPlugin
+
+[Documentation]
+Description = ArtifactUpdatedEvent
+Author = Op1
+Version = 0.1
+Website = stratos.apache.org
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/stratos/blob/11613b29/tools/docker-images/cartridge-docker-images/service-images/wso2is-saml-sso/Dockerfile
----------------------------------------------------------------------
diff --git a/tools/docker-images/cartridge-docker-images/service-images/wso2is-saml-sso/Dockerfile b/tools/docker-images/cartridge-docker-images/service-images/wso2is-saml-sso/Dockerfile
index bb612b7..09e1d5a 100644
--- a/tools/docker-images/cartridge-docker-images/service-images/wso2is-saml-sso/Dockerfile
+++ b/tools/docker-images/cartridge-docker-images/service-images/wso2is-saml-sso/Dockerfile
@@ -1,4 +1,25 @@
-FROM chamilad/base-image:4.1.0-beta
+# --------------------------------------------------------------
+#
+# 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.
+#
+# --------------------------------------------------------------
+
+FROM stratos/base-image:4.1.0-beta
 MAINTAINER dev@stratos.apache.org
 
 ENV DEBIAN_FRONTEND noninteractive