You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by ud...@apache.org on 2013/12/20 16:15:19 UTC
[04/19] git commit: Checking in new cartridge agent scripts
Checking in new cartridge agent 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/f4e605c9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/f4e605c9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/f4e605c9
Branch: refs/heads/master
Commit: f4e605c90a8cce4e4d2a12199e00303751748b56
Parents: 2011cd2
Author: Imesh Gunaratne <im...@apache.org>
Authored: Fri Dec 20 14:09:16 2013 +0530
Committer: Udara Liyanage <ud...@wso2.com>
Committed: Fri Dec 20 20:25:36 2013 -0500
----------------------------------------------------------------------
.../modules/scripts/ec2/cartridge-agent.sh | 75 ++++++
.../modules/scripts/ec2/clean.sh | 20 ++
.../modules/scripts/ec2/get-launch-params.rb | 54 +++++
.../ec2/load-balancer/cartridge-agent.sh | 51 ++---
.../scripts/ec2/mysql/cartridge-agent.sh | 142 ------------
.../modules/scripts/ec2/mysql/clean.sh | 33 ---
.../scripts/ec2/mysql/get-launch-params.rb | 54 -----
.../modules/scripts/ec2/mysql/healthcheck.sh | 33 ---
.../modules/scripts/ec2/php/cartridge-agent.sh | 86 -------
.../modules/scripts/ec2/php/clean.sh | 39 ----
.../scripts/ec2/php/get-launch-params.rb | 54 -----
.../modules/scripts/ec2/php/healthcheck.sh | 33 ---
.../scripts/ec2/tomcat/cartridge-agent.sh | 227 -------------------
.../modules/scripts/ec2/tomcat/clean.sh | 39 ----
.../scripts/ec2/tomcat/get-launch-params.rb | 54 -----
.../modules/scripts/ec2/tomcat/healthcheck.sh | 33 ---
16 files changed, 171 insertions(+), 856 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f4e605c9/products/cartridge-agent/modules/scripts/ec2/cartridge-agent.sh
----------------------------------------------------------------------
diff --git a/products/cartridge-agent/modules/scripts/ec2/cartridge-agent.sh b/products/cartridge-agent/modules/scripts/ec2/cartridge-agent.sh
new file mode 100755
index 0000000..5769f92
--- /dev/null
+++ b/products/cartridge-agent/modules/scripts/ec2/cartridge-agent.sh
@@ -0,0 +1,75 @@
+#!/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.
+
+set -e # Terminate on any error
+export LOG=/var/log/apache-stratos/cartridge-agent-sh.log
+instance_path=/opt/apache-stratos-cartridge-agent # Cartridge agent home
+ca_exec_path=${instance_path}/cartridge-agent # Cartridge agent executable home
+
+# ---------------------------------------------
+# Download payload
+# ---------------------------------------------
+if [ ! -d ${instance_path}/payload ]; then
+ echo "creating payload directory... " | tee -a $LOG
+ mkdir ${instance_path}/payload
+ echo "payload directory created" | tee -a $LOG
+ wget http://169.254.169.254/latest/user-data -O ${instance_path}/payload/payload.txt
+ echo "payload copied" | tee -a $LOG
+
+ for i in `/usr/bin/ruby ${instance_path}/get-launch-params.rb`
+ do
+ # Add double quotes on both sides of the value
+ value=`echo "${i}" | sed -e s@=@=\"@g`
+ value=${value}"\""
+ if [[ ${value} == PORTS* ]]; then
+ # Replace port separator | with ,
+ value=`echo ${value} | sed -e s@'|'@,@g`
+ fi
+ echo "writing to launch.params ${value}" | tee -a $LOG
+ echo "export" ${value} >> ${instance_path}/launch.params
+ done
+fi
+
+source ${instance_path}/launch.params
+
+#------------------------------------
+# Starting cartridge agent executable
+#------------------------------------
+pushd $ca_exec_path
+echo "Configuring cartridge agent executable..." | tee -a $LOG
+cp -f templates/cartridge-agent.sh.template bin/cartridge-agent.sh.tmp
+cat bin/cartridge-agent.sh.tmp | sed -e "s@MB-IP@$MB_IP@g" > bin/cartridge-agent.sh
+cp -f bin/cartridge-agent.sh bin/cartridge-agent.sh.tmp
+cat bin/cartridge-agent.sh.tmp | sed -e "s@MB-PORT@$MB_PORT@g" > bin/cartridge-agent.sh
+cp -f bin/cartridge-agent.sh bin/cartridge-agent.sh.tmp
+cat bin/cartridge-agent.sh.tmp | sed -e "s@CEP-IP@$CEP_IP@g" > bin/cartridge-agent.sh
+cp -f bin/cartridge-agent.sh bin/cartridge-agent.sh.tmp
+cat bin/cartridge-agent.sh.tmp | sed -e "s@CEP-PORT@$CEP_PORT@g" > bin/cartridge-agent.sh
+rm -f bin/cartridge-agent.sh.tmp
+echo "Starting cartridge agent..." | tee -a $LOG
+sh bin/cartridge-agent.sh
+popd
+
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f4e605c9/products/cartridge-agent/modules/scripts/ec2/clean.sh
----------------------------------------------------------------------
diff --git a/products/cartridge-agent/modules/scripts/ec2/clean.sh b/products/cartridge-agent/modules/scripts/ec2/clean.sh
new file mode 100755
index 0000000..b088281
--- /dev/null
+++ b/products/cartridge-agent/modules/scripts/ec2/clean.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+read -p "Please confirm that you want to clean this instance [y/n] " answer
+if [[ $answer != y ]] ; then
+ exit 1
+fi
+
+echo 'Stopping all java processes'
+killall java
+echo "Removing payload directory"
+rm -rf payload/
+echo "Removing launch.params"
+rm -f launch.params
+echo "Removing content copied to the web server"
+rm -rf /var/www/* /var/www/.git
+echo "Removing cartridge agent logs"
+rm -f /var/log/apache-stratos/*
+echo "Removing load balancer logs"
+rm load-balancer/nohup.out
+echo "Cleaning completed"
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f4e605c9/products/cartridge-agent/modules/scripts/ec2/get-launch-params.rb
----------------------------------------------------------------------
diff --git a/products/cartridge-agent/modules/scripts/ec2/get-launch-params.rb b/products/cartridge-agent/modules/scripts/ec2/get-launch-params.rb
new file mode 100644
index 0000000..8e62d35
--- /dev/null
+++ b/products/cartridge-agent/modules/scripts/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/payload.txt")
+
+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/f4e605c9/products/cartridge-agent/modules/scripts/ec2/load-balancer/cartridge-agent.sh
----------------------------------------------------------------------
diff --git a/products/cartridge-agent/modules/scripts/ec2/load-balancer/cartridge-agent.sh b/products/cartridge-agent/modules/scripts/ec2/load-balancer/cartridge-agent.sh
index e463a69..b65888f 100644
--- a/products/cartridge-agent/modules/scripts/ec2/load-balancer/cartridge-agent.sh
+++ b/products/cartridge-agent/modules/scripts/ec2/load-balancer/cartridge-agent.sh
@@ -21,15 +21,13 @@
# --------------------------------------------------------------
# This script will be called from /etc/rc.local when the cartridge
-# instance is spawned. It will initiate all the tasks that needs to
+# instance is spawned. It will initiate all the tasks that needs to
# be run to bring the cartridge instance to operational state.
set -e # Terminate on any error
-export LOG=/var/log/apache-stratos/cartridge-agent.log
+export LOG=/var/log/apache-stratos/cartridge-agent-sh.log
instance_path=/opt/apache-stratos-cartridge-agent # Cartridge agent home
-event_publisher_path=/opt/apache-stratos-cartridge-agent/event-publisher # Event publisher home
-event_subscriber_path=/opt/apache-stratos-cartridge-agent/event-subscriber # Event subscriber home
-health_publisher_path=/opt/apache-stratos-cartridge-agent/health-publisher # Health publisher home
+ca_exec_path=${instance_path}/cartridge-agent # Cartridge agent executable home
# ---------------------------------------------
# Download payload
@@ -38,7 +36,7 @@ if [ ! -d ${instance_path}/payload ]; then
echo "creating payload directory... " | tee -a $LOG
mkdir ${instance_path}/payload
echo "payload directory created" | tee -a $LOG
- wget http://169.254.169.254/latest/user-data -O ${instance_path}/payload/launch-params
+ wget http://169.254.169.254/latest/user-data -O ${instance_path}/payload/payload.txt
echo "payload copied" | tee -a $LOG
for i in `/usr/bin/ruby ${instance_path}/get-launch-params.rb`
@@ -52,7 +50,7 @@ if [ ! -d ${instance_path}/payload ]; then
fi
echo "writing to launch.params ${value}" | tee -a $LOG
echo "export" ${value} >> ${instance_path}/launch.params
- done
+ done
fi
source ${instance_path}/launch.params
@@ -61,29 +59,24 @@ source ${instance_path}/launch.params
# Starting load balancer
#---------------------------
pushd $instance_path/load-balancer/
-sh start-load-balancer.sh $MB_IP $MB_PORT $CEP_IP $CEP_PORT $LB_CLUSTER_ID $NETWORK_PARTITION_ID &
+sh "start-load-balancer.sh" $MB_IP $MB_PORT $CEP_IP $CEP_PORT $CLUSTER_ID $NETWORK_PARTITION_ID &
popd
-#---------------------------
-# Starting topic subscriber
-#---------------------------
-# change mb ip port in conf/jndi.properties
-pushd $event_subscriber_path
-cp -f templates/jndi.properties.template conf/jndi.properties.tmp
-cat conf/jndi.properties.tmp | sed -e "s@MB-IP@$MB_IP@g" > conf/jndi.properties
-cp -f conf/jndi.properties conf/jndi.properties.tmp
-cat conf/jndi.properties.tmp | sed -e "s@MB-PORT@$MB_PORT@g" > conf/jndi.properties
-rm -f conf/jndi.properties.tmp
+#------------------------------------
+# Starting cartridge agent executable
+#------------------------------------
+pushd $ca_exec_path
+echo "Configuring cartridge agent executable..." | tee -a $LOG
+cp -f templates/cartridge-agent.sh.template bin/cartridge-agent.sh.tmp
+cat bin/cartridge-agent.sh.tmp | sed -e "s@MB-IP@$MB_IP@g" > bin/cartridge-agent.sh
+cp -f bin/cartridge-agent.sh bin/cartridge-agent.sh.tmp
+cat bin/cartridge-agent.sh.tmp | sed -e "s@MB-PORT@$MB_PORT@g" > bin/cartridge-agent.sh
+cp -f bin/cartridge-agent.sh bin/cartridge-agent.sh.tmp
+cat bin/cartridge-agent.sh.tmp | sed -e "s@CEP-IP@$CEP_IP@g" > bin/cartridge-agent.sh
+cp -f bin/cartridge-agent.sh bin/cartridge-agent.sh.tmp
+cat bin/cartridge-agent.sh.tmp | sed -e "s@CEP-PORT@$CEP_PORT@g" > bin/cartridge-agent.sh
+rm -f bin/cartridge-agent.sh.tmp
+echo "Starting cartridge agent..." | tee -a $LOG
+sh bin/cartridge-agent.sh
popd
-pushd $event_subscriber_path/bin
-echo "Executing: event-subscriber.sh "
-sh event-subscriber.sh &
-echo "Event subscribed" | tee -a $LOG
-popd
-
-pushd $health_publisher_path/bin
-echo "Executing: health-publisher.sh"
-sh health-publisher.sh $MEMBER_ID $CEP_IP $CEP_PORT $PORTS $CLUSTER_ID $NETWORK_PARTITION_ID
-echo "Health stat published" | tee -a $LOG
-popd
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f4e605c9/products/cartridge-agent/modules/scripts/ec2/mysql/cartridge-agent.sh
----------------------------------------------------------------------
diff --git a/products/cartridge-agent/modules/scripts/ec2/mysql/cartridge-agent.sh b/products/cartridge-agent/modules/scripts/ec2/mysql/cartridge-agent.sh
deleted file mode 100755
index 5a2f370..0000000
--- a/products/cartridge-agent/modules/scripts/ec2/mysql/cartridge-agent.sh
+++ /dev/null
@@ -1,142 +0,0 @@
-#!/bin/bash
-# --------------------------------------------------------------
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-# --------------------------------------------------------------
-
-# This script will be called from /etc/rc.local when the cartridge
-# instance is spawned. It will initiate all the tasks that needs to
-# be run to bring the cartridge instance to operational state.
-
-set -e # Terminate on any error
-export LOG=/var/log/apache-stratos/cartridge-agent.log
-instance_path=/opt/apache-stratos-cartridge-agent # Cartridge agent home
-event_publisher_path=/opt/apache-stratos-cartridge-agent/event-publisher # Event publisher home
-
-# ---------------------------------------------
-# Download payload.zip
-# ---------------------------------------------
-if [ ! -d ${instance_path}/payload ]; then
- echo "creating payload directory... " | tee -a $LOG
- mkdir ${instance_path}/payload
- echo "payload directory created" | tee -a $LOG
- wget http://169.254.169.254/latest/user-data -O ${instance_path}/payload/payload.zip
- echo "payload copied" | tee -a $LOG
- unzip -d ${instance_path}/payload ${instance_path}/payload/payload.zip
- echo "unzipped" | tee -a $LOG
-
- for i in `/usr/bin/ruby ${instance_path}/get-launch-params.rb`
- do
- # Add double quotes on both sides of the value
- value=`echo "${i}" | sed -e s@=@=\"@g`
- value=${value}"\""
- if [[ ${value} == PORTS* ]]; then
- # Replace port separator | with ,
- value=`echo ${value} | sed -e s@'|'@,@g`
- fi
- echo "writing to launch.params ${value}" | tee -a $LOG
- echo "export" ${value} >> ${instance_path}/launch.params
- done
-fi
-
-source ${instance_path}/launch.params
-
-# ---------------------------------------------
-# Publish member-started-event
-# ---------------------------------------------
-echo "Generating member-started-event.json..." | tee -a $LOG
-cp -f $event_publisher_path/templates/member-started-event.json.template member-started-event.json.tmp
-cat member-started-event.json.tmp | sed -e "s@SERVICE_NAME@$SERVICE_NAME@g" > member-started-event.json
-cp -f member-started-event.json member-started-event.json.tmp
-cat member-started-event.json.tmp | sed -e "s@CLUSTER_ID@$CLUSTER_ID@g" > member-started-event.json
-cp -f member-started-event.json member-started-event.json.tmp
-cat member-started-event.json.tmp | sed -e "s@MEMBER_ID@$MEMBER_ID@g" > member-started-event.json
-rm -f member-started-event.json.tmp
-echo "member-started-event.json generated" | tee -a $LOG
-
-echo "Publishing member started event..." | tee -a $LOG
-event_class_name=org.apache.stratos.messaging.event.instance.status.MemberStartedEvent
-event_json_path=`pwd`/member-started-event.json
-
-pushd $event_publisher_path/bin
-echo "Executing: event-publisher.sh $MB_IP $MB_PORT $event_class_name $event_json_path"
-sh event-publisher.sh $MB_IP $MB_PORT $event_class_name $event_json_path
-popd
-echo "Event published" | tee -a $LOG
-
-
-# -----------------------------------------------------
-# Set MySQL root password
-# -----------------------------------------------------
-echo "Setting MySQL root password" >> $LOG
-if [[ (-n ${MYSQL_PASSWORD} ) ]]; then
- mysqladmin -uroot -pmysql 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
-
-
-# -----------------------------------------------------
-# Publish member-activated-event
-# -----------------------------------------------------
-while true
-do
-var=`nc -z localhost 3306; echo $?`;
-if [ $var -eq 0 ]
- then
- echo "port 3306 is available" | tee -a $LOG
- break
- else
- echo "port 3306 is not available" | tee -a $LOG
- fi
- sleep 1
-done
-
-while true
-do
-var=`nc -z localhost 80; echo $?`;
-if [ $var -eq 0 ]
- then
- echo "port 80 is available" | tee -a $LOG
- break
- else
- echo "port 80 is not available" | tee -a $LOG
- fi
- sleep 1
-done
-
-echo "Generating member-activated-event.json..." | tee -a $LOG
-cp -f $event_publisher_path/templates/member-activated-event.json.template member-activated-event.json.tmp
-cat member-activated-event.json.tmp | sed -e "s@SERVICE_NAME@$SERVICE_NAME@g" > member-activated-event.json
-cp -f member-activated-event.json member-activated-event.json.tmp
-cat member-activated-event.json.tmp | sed -e "s@CLUSTER_ID@$CLUSTER_ID@g" > member-activated-event.json
-cp -f member-activated-event.json member-activated-event.json.tmp
-cat member-activated-event.json.tmp | sed -e "s@MEMBER_ID@$MEMBER_ID@g" > member-activated-event.json
-rm -f member-activated-event.json.tmp
-echo "member-activated-event.json generated" | tee -a $LOG
-
-echo "Publishing member activated event..." | tee -a $LOG
-event_class_name=org.apache.stratos.messaging.event.instance.status.MemberActivatedEvent
-event_json_path=`pwd`/member-activated-event.json
-
-pushd $event_publisher_path/bin
-echo "Executing: event-publisher.sh $MB_IP $MB_PORT $event_class_name $event_json_path"
-sh event-publisher.sh $MB_IP $MB_PORT $event_class_name $event_json_path
-popd
-echo "Event published" | tee -a $LOG
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f4e605c9/products/cartridge-agent/modules/scripts/ec2/mysql/clean.sh
----------------------------------------------------------------------
diff --git a/products/cartridge-agent/modules/scripts/ec2/mysql/clean.sh b/products/cartridge-agent/modules/scripts/ec2/mysql/clean.sh
deleted file mode 100755
index 4e5f96a..0000000
--- a/products/cartridge-agent/modules/scripts/ec2/mysql/clean.sh
+++ /dev/null
@@ -1,33 +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.
-#
-# --------------------------------------------------------------
-
-echo "Removing json files created"
-rm -f *.json
-echo "Removing payload directory"
-rm -rf payload/
-echo "Removing repo info soap request"
-rm -f repoinforequest.xml
-echo "Removing launch.params"
-rm -f launch.params
-echo "Removing cartridge agent logs"
-rm -f /var/log/apache-stratos/*
-
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f4e605c9/products/cartridge-agent/modules/scripts/ec2/mysql/get-launch-params.rb
----------------------------------------------------------------------
diff --git a/products/cartridge-agent/modules/scripts/ec2/mysql/get-launch-params.rb b/products/cartridge-agent/modules/scripts/ec2/mysql/get-launch-params.rb
deleted file mode 100644
index 0631b2b..0000000
--- a/products/cartridge-agent/modules/scripts/ec2/mysql/get-launch-params.rb
+++ /dev/null
@@ -1,54 +0,0 @@
-#! /usr/bin/ruby
-# --------------------------------------------------------------
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-# --------------------------------------------------------------
-
-### get-launch-params.rb
-
-# The following script obtains the launch parameters from
-# the file /tmp/payload/launch-params, then parses out the
-# parameters for this instance by using the launch index
-# of this particular EC2 instance.
-#
-# Pass the command the -e flag to output the instance
-# parameters as exports of shell variables. Any other
-# arguments are ignored.
-
-def get_launch_params(launch_params_file)
- IO.readlines launch_params_file
-end
-
-export_stmt = ""
-
-launch_params = get_launch_params(
- "/opt/apache-stratos-cartridge-agent/payload/launch-params")
-
-if launch_params.length > 0
- instance_params_str = launch_params[0]
-
- instance_params = instance_params_str.split(',')
-
- export_stmt = "export " if ARGV.length > 0 && ARGV.include?("-e")
-
- instance_params.each { |param|
- puts export_stmt + param
- }
-
-end
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f4e605c9/products/cartridge-agent/modules/scripts/ec2/mysql/healthcheck.sh
----------------------------------------------------------------------
diff --git a/products/cartridge-agent/modules/scripts/ec2/mysql/healthcheck.sh b/products/cartridge-agent/modules/scripts/ec2/mysql/healthcheck.sh
deleted file mode 100644
index 04a96d1..0000000
--- a/products/cartridge-agent/modules/scripts/ec2/mysql/healthcheck.sh
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/bin/bash
-# --------------------------------------------------------------
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-# --------------------------------------------------------------
-
-
-var=`nc -z localhost 80; echo $?`;
-if [ $var -eq 0 ]
-then
- echo "port 80 is available" > /dev/null 2>&1
-else
- echo "port 80 is not available" > /dev/null 2>&1
- /etc/init.d/apache2 restart
-fi
-
-
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f4e605c9/products/cartridge-agent/modules/scripts/ec2/php/cartridge-agent.sh
----------------------------------------------------------------------
diff --git a/products/cartridge-agent/modules/scripts/ec2/php/cartridge-agent.sh b/products/cartridge-agent/modules/scripts/ec2/php/cartridge-agent.sh
deleted file mode 100755
index 7064af8..0000000
--- a/products/cartridge-agent/modules/scripts/ec2/php/cartridge-agent.sh
+++ /dev/null
@@ -1,86 +0,0 @@
-#!/bin/bash
-# --------------------------------------------------------------
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-# --------------------------------------------------------------
-
-# This script will be called from /etc/rc.local when the cartridge
-# instance is spawned. It will initiate all the tasks that needs to
-# be run to bring the cartridge instance to operational state.
-
-set -e # Terminate on any error
-export LOG=/var/log/apache-stratos/cartridge-agent.log
-instance_path=/opt/apache-stratos-cartridge-agent # Cartridge agent home
-event_publisher_path=/opt/apache-stratos-cartridge-agent/event-publisher # Event publisher home
-event_subscriber_path=/opt/apache-stratos-cartridge-agent/event-subscriber # Event subscriber home
-health_publisher_path=/opt/apache-stratos-cartridge-agent/health-publisher # Health publisher home
-
-# ---------------------------------------------
-# Download payload.zip
-# ---------------------------------------------
-if [ ! -d ${instance_path}/payload ]; then
- echo "creating payload directory... " | tee -a $LOG
- mkdir ${instance_path}/payload
- echo "payload directory created" | tee -a $LOG
- wget http://169.254.169.254/latest/user-data -O ${instance_path}/payload/launch-params
- echo "payload copied" | tee -a $LOG
-
- for i in `/usr/bin/ruby ${instance_path}/get-launch-params.rb`
- do
- # Add double quotes on both sides of the value
- value=`echo "${i}" | sed -e s@=@=\"@g`
- value=${value}"\""
- if [[ ${value} == PORTS* ]]; then
- # Replace port separator | with ,
- value=`echo ${value} | sed -e s@'|'@,@g`
- fi
- echo "writing to launch.params ${value}" | tee -a $LOG
- echo "export" ${value} >> ${instance_path}/launch.params
- done
-fi
-
-source ${instance_path}/launch.params
-
-
-
-#---------------------------
-# Starting Topic Subscriber
-#---------------------------
-# change mb ip port in conf/jndi.properties
-pushd $event_subscriber_path/conf
-cp -rf jndi.properties jndi.properties.tmp
-cat jndi.properties.tmp | sed -e "s@MB-PORT@$MB_PORT@g" > jndi.properties
-cp -rf jndi.properties jndi.properties.tmp
-cat jndi.properties.tmp | sed -e "s@MB-IP-ADDRESS@$MB_IP@g" > jndi.properties
-rm -f jndi.properties.tmp
-popd
-
-pushd $event_subscriber_path/bin
-echo "Executing: event-subscriber.sh "
-sh event-subscriber.sh &
-echo "Event subscribed" | tee -a $LOG
-popd
-
-#Health publisher is started inside event subscriber
-#pushd $health_publisher_path/bin
-#echo "Executing: health-publisher.sh"
-#sh health-publisher.sh $MEMBER_ID $CEP_IP $CEP_PORT $PORTS $CLUSTER_ID $NETWORK_PARTITION_ID
-#echo "Health stat published" | tee -a $LOG
-#popd
-
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f4e605c9/products/cartridge-agent/modules/scripts/ec2/php/clean.sh
----------------------------------------------------------------------
diff --git a/products/cartridge-agent/modules/scripts/ec2/php/clean.sh b/products/cartridge-agent/modules/scripts/ec2/php/clean.sh
deleted file mode 100755
index 9720568..0000000
--- a/products/cartridge-agent/modules/scripts/ec2/php/clean.sh
+++ /dev/null
@@ -1,39 +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.
-#
-# --------------------------------------------------------------
-
-echo "Removing json files created"
-rm -f *.json
-echo "Removing payload directory"
-rm -rf payload/
-echo "Removing repo info soap request"
-rm -f repoinforequest.xml
-echo "Removing launch.params"
-rm -f launch.params
-echo "Removing git.sh"
-rm -f git.sh
-echo "Removing temporary git directory"
-rm -rf /opt/temp_git
-echo "Removing content copied to the web server"
-rm -rf /var/www/* /var/www/.git
-echo "Removing cartridge agent logs"
-rm -f /var/log/apache-stratos/*
-
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f4e605c9/products/cartridge-agent/modules/scripts/ec2/php/get-launch-params.rb
----------------------------------------------------------------------
diff --git a/products/cartridge-agent/modules/scripts/ec2/php/get-launch-params.rb b/products/cartridge-agent/modules/scripts/ec2/php/get-launch-params.rb
deleted file mode 100644
index 0631b2b..0000000
--- a/products/cartridge-agent/modules/scripts/ec2/php/get-launch-params.rb
+++ /dev/null
@@ -1,54 +0,0 @@
-#! /usr/bin/ruby
-# --------------------------------------------------------------
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-# --------------------------------------------------------------
-
-### get-launch-params.rb
-
-# The following script obtains the launch parameters from
-# the file /tmp/payload/launch-params, then parses out the
-# parameters for this instance by using the launch index
-# of this particular EC2 instance.
-#
-# Pass the command the -e flag to output the instance
-# parameters as exports of shell variables. Any other
-# arguments are ignored.
-
-def get_launch_params(launch_params_file)
- IO.readlines launch_params_file
-end
-
-export_stmt = ""
-
-launch_params = get_launch_params(
- "/opt/apache-stratos-cartridge-agent/payload/launch-params")
-
-if launch_params.length > 0
- instance_params_str = launch_params[0]
-
- instance_params = instance_params_str.split(',')
-
- export_stmt = "export " if ARGV.length > 0 && ARGV.include?("-e")
-
- instance_params.each { |param|
- puts export_stmt + param
- }
-
-end
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f4e605c9/products/cartridge-agent/modules/scripts/ec2/php/healthcheck.sh
----------------------------------------------------------------------
diff --git a/products/cartridge-agent/modules/scripts/ec2/php/healthcheck.sh b/products/cartridge-agent/modules/scripts/ec2/php/healthcheck.sh
deleted file mode 100644
index 04a96d1..0000000
--- a/products/cartridge-agent/modules/scripts/ec2/php/healthcheck.sh
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/bin/bash
-# --------------------------------------------------------------
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-# --------------------------------------------------------------
-
-
-var=`nc -z localhost 80; echo $?`;
-if [ $var -eq 0 ]
-then
- echo "port 80 is available" > /dev/null 2>&1
-else
- echo "port 80 is not available" > /dev/null 2>&1
- /etc/init.d/apache2 restart
-fi
-
-
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f4e605c9/products/cartridge-agent/modules/scripts/ec2/tomcat/cartridge-agent.sh
----------------------------------------------------------------------
diff --git a/products/cartridge-agent/modules/scripts/ec2/tomcat/cartridge-agent.sh b/products/cartridge-agent/modules/scripts/ec2/tomcat/cartridge-agent.sh
deleted file mode 100755
index 4f640fd..0000000
--- a/products/cartridge-agent/modules/scripts/ec2/tomcat/cartridge-agent.sh
+++ /dev/null
@@ -1,227 +0,0 @@
-#!/bin/bash
-# --------------------------------------------------------------
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-# --------------------------------------------------------------
-
-# This script will be called from /etc/rc.local when the cartridge
-# instance is spawned. It will initiate all the tasks that needs to
-# be run to bring the cartridge instance to operational state.
-
-set -e # Terminate on any error
-export LOG=/var/log/apache-stratos/cartridge-agent.log
-instance_path=/opt/apache-stratos-cartridge-agent # Cartridge agent home
-event_publisher_path=/opt/apache-stratos-cartridge-agent/event-publisher # Event publisher home
-
-# ---------------------------------------------
-# Download payload.zip
-# ---------------------------------------------
-if [ ! -d ${instance_path}/payload ]; then
- echo "creating payload directory... " | tee -a $LOG
- mkdir ${instance_path}/payload
- echo "payload directory created" | tee -a $LOG
- wget http://169.254.169.254/latest/user-data -O ${instance_path}/payload/launch-params
- echo "payload copied" | tee -a $LOG
-
- for i in `/usr/bin/ruby ${instance_path}/get-launch-params.rb`
- do
- # Add double quotes on both sides of the value
- value=`echo "${i}" | sed -e s@=@=\"@g`
- value=${value}"\""
- if [[ ${value} == PORTS* ]]; then
- # Replace port separator | with ,
- value=`echo ${value} | sed -e s@'|'@,@g`
- fi
- echo "writing to launch.params ${value}" | tee -a $LOG
- echo "export" ${value} >> ${instance_path}/launch.params
- done
-fi
-
-source ${instance_path}/launch.params
-
-# ---------------------------------------------
-# Publish member-started-event
-# ---------------------------------------------
-echo "Generating member-started-event.json..." | tee -a $LOG
-cp -f $event_publisher_path/templates/member-started-event.json.template member-started-event.json.tmp
-cat member-started-event.json.tmp | sed -e "s@SERVICE_NAME@$SERVICE_NAME@g" > member-started-event.json
-cp -f member-started-event.json member-started-event.json.tmp
-cat member-started-event.json.tmp | sed -e "s@CLUSTER_ID@$CLUSTER_ID@g" > member-started-event.json
-cp -f member-started-event.json member-started-event.json.tmp
-cat member-started-event.json.tmp | sed -e "s@MEMBER_ID@$MEMBER_ID@g" > member-started-event.json
-rm -f member-started-event.json.tmp
-echo "member-started-event.json generated" | tee -a $LOG
-
-echo "Publishing member started event..." | tee -a $LOG
-event_class_name=org.apache.stratos.messaging.event.instance.status.MemberStartedEvent
-event_json_path=`pwd`/member-started-event.json
-
-pushd $event_publisher_path/bin
-echo "Executing: event-publisher.sh $MB_IP $MB_PORT $event_class_name $event_json_path"
-sh event-publisher.sh $MB_IP $MB_PORT $event_class_name $event_json_path
-echo "Event published" | tee -a $LOG
-popd
-
-
-# -----------------------------------------------------
-# Generate git.sh
-# -----------------------------------------------------
-echo "Creating repoinfo request " | tee -a $LOG
-echo "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsd=\"http://org.apache.axis2/xsd\">
- <soapenv:Header/>
- <soapenv:Body>
- <xsd:getRepositoryCredentials>
- <xsd:tenantId>${TENANT_ID}</xsd:tenantId>
- <xsd:cartridgeType>${SERVICE_NAME}</xsd:cartridgeType>
- <xsd:alias>${CARTRIDGE_ALIAS}</xsd:alias>
- </xsd:getRepositoryCredentials>
- </soapenv:Body>
-</soapenv:Envelope>" > ${instance_path}/repoinforequest.xml
-
-echo "Repoinfo request created " | tee -a $LOG
-
-
-echo "Generating git.sh..." | tee -a $LOG
-# If repo is available do a git pull, else clone
-echo "#!/bin/bash
-set -e
-GIT_SH_LOG=/var/log/apache-stratos/git-sh.log
-if [ -d \"${APP_PATH}/.git\" ]; then
- cd ${APP_PATH}
- echo \"Invoking repo info service...\" | tee -a \$GIT_SH_LOG
- curl -X POST -H \"Content-Type: text/xml\" -H \"SOAPAction: urn:getRepositoryCredentials\" -d @${instance_path}/repoinforequest.xml --silent \"${REPO_INFO_EPR}\" --insecure > /tmp/git.xml
- echo \"Processing repo info service response...\" | tee -a \$GIT_SH_LOG
- sed '1,5d' /tmp/git.xml > /tmp/git1.xml
- sed '2d' /tmp/git1.xml > /tmp/git.xml
- username=\`xml_grep 'ax29:userName' /tmp/git.xml --text_only\`
- password=\`xml_grep 'ax29:password' /tmp/git.xml --text_only\`
- repo=\`xml_grep 'ax29:url' /tmp/git.xml --text_only\`
- echo \"username=\$username repo=\${repo}\" | tee -a \$GIT_SH_LOG
- rm /tmp/git1.xml
- rm /tmp/git.xml
- echo \"Preparing .netrc...\" | tee -a \$GIT_SH_LOG
- url=\`echo \$repo |sed 's/http.*\/\///g' |sed 's/\:.*//g' |sed 's/\/.*//g'\`
- echo \"machine \${url} login \${username} password \${password}\" > ~/.netrc
- sudo echo \"machine \${url} login \${username} password \${password}\" > /root/.netrc
- chmod 600 ~/.netrc
- sudo chmod 600 /root/.netrc
- echo \"Setting git http.sslVerify false\" | tee -a \$GIT_SH_LOG
- git config --global --bool --add http.sslVerify false
- echo \"Running git pull...\" | tee -a \$GIT_SH_LOG
- sudo git pull
- if [ -f ~/.netrc ]; then
- echo \"Removing ~/.netrc...\" | tee -a \$GIT_SH_LOG
- rm ~/.netrc
- fi
- if [ -f /root/.netrc ]; then
- echo \"Removing /root/.netrc...\" | tee -a \$GIT_SH_LOG
- sudo rm /root/.netrc
- fi
-
-else
- echo \"Removing index.html from application path...\" | tee -a \$GIT_SH_LOG
- sudo rm -f ${APP_PATH}/index.html
- echo \"Invoking repo info service...\" | tee -a \$GIT_SH_LOG
- curl -X POST -H \"Content-Type: text/xml\" -H \"SOAPAction: urn:getRepositoryCredentials\" -d @${instance_path}/repoinforequest.xml --silent \"${REPO_INFO_EPR}\" --insecure > /tmp/git.xml
- echo \"Processing repo info service response...\" | tee -a \$GIT_SH_LOG
- sed '1,5d' /tmp/git.xml > /tmp/git1.xml
- sed '2d' /tmp/git1.xml > /tmp/git.xml
- username=\`xml_grep 'ax29:userName' /tmp/git.xml --text_only\`
- password=\`xml_grep 'ax29:password' /tmp/git.xml --text_only\`
- repo=\`xml_grep 'ax29:url' /tmp/git.xml --text_only\`
- echo \"username=\$username repo=\${repo}\" | tee -a \$GIT_SH_LOG
- rm /tmp/git1.xml
- rm /tmp/git.xml
- echo \"Preparing .netrc...\" | tee -a \$GIT_SH_LOG
- url=\`echo \$repo |sed 's/http.*\/\///g' |sed 's/\:.*//g' |sed 's/\/.*//g'\`
- echo \"machine \${url} login \${username} password \${password}\" > ~/.netrc
- sudo echo \"machine \${url} login \${username} password \${password}\" > /root/.netrc
- chmod 600 ~/.netrc
- sudo chmod 600 /root/.netrc
- echo \"Setting git http.sslVerify false\" | tee -a \$GIT_SH_LOG
- git config --global --bool --add http.sslVerify false
- echo \"Creating temporary git folder...\" | tee -a \$GIT_SH_LOG
- sudo mkdir ${instance_path}/temp_git
- echo \"Running git clone...\" | tee -a \$GIT_SH_LOG
- git clone \${repo} ${instance_path}/temp_git
- sudo cp -r ${instance_path}/temp_git/* $APP_PATH/
- sudo cp -r ${instance_path}/temp_git/.git $APP_PATH/
- sudo rm -rf ${instance_path}/temp_git
-
- if [ -f ~/.netrc ]; then
- echo \"Removing ~/.netrc...\" | tee -a \$GIT_SH_LOG
- rm ~/.netrc
- fi
- if [ -f /root/.netrc ]; then
- echo \"Removing /root/.netrc...\" | tee -a \$GIT_SH_LOG
- sudo rm /root/.netrc
- fi
-
-
-fi
-echo \"git.sh done\" | tee -a \$LOG" > ${instance_path}/git.sh
-echo "git.sh generated" | tee -a $LOG
-chmod 755 ${instance_path}/git.sh
-
-
-# -----------------------------------------------------
-# Git clone
-# -----------------------------------------------------
-pushd ${instance_path}
-echo "Running git.sh..." | tee -a $LOG
-sudo sh ${instance_path}/git.sh
-echo "Git clone done" | tee -a $LOG
-
-
-# -----------------------------------------------------
-# Publish member-activated-event
-# -----------------------------------------------------
-while true
-do
-var=`nc -z localhost 8080; echo $?`;
-if [ $var -eq 0 ]
- then
- echo "Port 8080 is available" | tee -a $LOG
- break
- else
- echo "Port 8080 is not available" | tee -a $LOG
- fi
- sleep 1
-done
-
-echo "Generating member-activated-event.json..." | tee -a $LOG
-cp -f $event_publisher_path/templates/member-activated-event.json.template member-activated-event.json.tmp
-cat member-activated-event.json.tmp | sed -e "s@SERVICE_NAME@$SERVICE_NAME@g" > member-activated-event.json
-cp -f member-activated-event.json member-activated-event.json.tmp
-cat member-activated-event.json.tmp | sed -e "s@CLUSTER_ID@$CLUSTER_ID@g" > member-activated-event.json
-cp -f member-activated-event.json member-activated-event.json.tmp
-cat member-activated-event.json.tmp | sed -e "s@MEMBER_ID@$MEMBER_ID@g" > member-activated-event.json
-rm -f member-activated-event.json.tmp
-echo "member-activated-event.json generated" | tee -a $LOG
-
-echo "Publishing member activated event..." | tee -a $LOG
-event_class_name=org.apache.stratos.messaging.event.instance.status.MemberActivatedEvent
-event_json_path=`pwd`/member-activated-event.json
-
-pushd $event_publisher_path/bin
-echo "Executing: event-publisher.sh $MB_IP $MB_PORT $event_class_name $event_json_path"
-sh event-publisher.sh $MB_IP $MB_PORT $event_class_name $event_json_path
-echo "Event published" | tee -a $LOG
-popd
-
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f4e605c9/products/cartridge-agent/modules/scripts/ec2/tomcat/clean.sh
----------------------------------------------------------------------
diff --git a/products/cartridge-agent/modules/scripts/ec2/tomcat/clean.sh b/products/cartridge-agent/modules/scripts/ec2/tomcat/clean.sh
deleted file mode 100755
index 9720568..0000000
--- a/products/cartridge-agent/modules/scripts/ec2/tomcat/clean.sh
+++ /dev/null
@@ -1,39 +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.
-#
-# --------------------------------------------------------------
-
-echo "Removing json files created"
-rm -f *.json
-echo "Removing payload directory"
-rm -rf payload/
-echo "Removing repo info soap request"
-rm -f repoinforequest.xml
-echo "Removing launch.params"
-rm -f launch.params
-echo "Removing git.sh"
-rm -f git.sh
-echo "Removing temporary git directory"
-rm -rf /opt/temp_git
-echo "Removing content copied to the web server"
-rm -rf /var/www/* /var/www/.git
-echo "Removing cartridge agent logs"
-rm -f /var/log/apache-stratos/*
-
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f4e605c9/products/cartridge-agent/modules/scripts/ec2/tomcat/get-launch-params.rb
----------------------------------------------------------------------
diff --git a/products/cartridge-agent/modules/scripts/ec2/tomcat/get-launch-params.rb b/products/cartridge-agent/modules/scripts/ec2/tomcat/get-launch-params.rb
deleted file mode 100644
index 0631b2b..0000000
--- a/products/cartridge-agent/modules/scripts/ec2/tomcat/get-launch-params.rb
+++ /dev/null
@@ -1,54 +0,0 @@
-#! /usr/bin/ruby
-# --------------------------------------------------------------
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-# --------------------------------------------------------------
-
-### get-launch-params.rb
-
-# The following script obtains the launch parameters from
-# the file /tmp/payload/launch-params, then parses out the
-# parameters for this instance by using the launch index
-# of this particular EC2 instance.
-#
-# Pass the command the -e flag to output the instance
-# parameters as exports of shell variables. Any other
-# arguments are ignored.
-
-def get_launch_params(launch_params_file)
- IO.readlines launch_params_file
-end
-
-export_stmt = ""
-
-launch_params = get_launch_params(
- "/opt/apache-stratos-cartridge-agent/payload/launch-params")
-
-if launch_params.length > 0
- instance_params_str = launch_params[0]
-
- instance_params = instance_params_str.split(',')
-
- export_stmt = "export " if ARGV.length > 0 && ARGV.include?("-e")
-
- instance_params.each { |param|
- puts export_stmt + param
- }
-
-end
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f4e605c9/products/cartridge-agent/modules/scripts/ec2/tomcat/healthcheck.sh
----------------------------------------------------------------------
diff --git a/products/cartridge-agent/modules/scripts/ec2/tomcat/healthcheck.sh b/products/cartridge-agent/modules/scripts/ec2/tomcat/healthcheck.sh
deleted file mode 100644
index d536e1c..0000000
--- a/products/cartridge-agent/modules/scripts/ec2/tomcat/healthcheck.sh
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/bin/bash
-# --------------------------------------------------------------
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-# --------------------------------------------------------------
-
-
-var=`nc -z localhost 80; echo $?`;
-if [ $var -eq 0 ]
-then
- echo "port 8080 is available" > /dev/null 2>&1
-else
- echo "port 8080 is not available" > /dev/null 2>&1
- /etc/init.d/apache2 restart
-fi
-
-