You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by im...@apache.org on 2013/12/20 05:09:53 UTC
[4/4] git commit: Refactoring cartridge agent product to package new
standalone cartridge agent component
Refactoring cartridge agent product to package new standalone cartridge agent component
Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/2f3d9021
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/2f3d9021
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/2f3d9021
Branch: refs/heads/master
Commit: 2f3d9021104f5062517c87fb0ee48eda2b7987d6
Parents: 908504d
Author: Imesh Gunaratne <im...@apache.org>
Authored: Fri Dec 20 09:38:46 2013 +0530
Committer: Imesh Gunaratne <im...@apache.org>
Committed: Fri Dec 20 09:38:46 2013 +0530
----------------------------------------------------------------------
.../executionplans/AverageHeathRequest.xml | 2 +-
.../src/main/bin/haproxy-extension.sh | 4 +-
.../ec2/load-balancer/cartridge-agent.sh | 89 ---
.../ec2/load-balancer/start-load-balancer.sh | 82 ---
.../templates/loadbalancer.conf.template | 136 ----
.../ec2/mysql/cartridge-agent.sh | 142 ----
.../modules/cartridge-agent/ec2/mysql/clean.sh | 33 -
.../ec2/mysql/get-launch-params.rb | 54 --
.../cartridge-agent/ec2/mysql/healthcheck.sh | 33 -
.../cartridge-agent/ec2/php/cartridge-agent.sh | 86 ---
.../modules/cartridge-agent/ec2/php/clean.sh | 39 --
.../ec2/php/get-launch-params.rb | 54 --
.../cartridge-agent/ec2/php/healthcheck.sh | 33 -
.../ec2/tomcat/cartridge-agent.sh | 227 ------
.../modules/cartridge-agent/ec2/tomcat/clean.sh | 39 --
.../ec2/tomcat/get-launch-params.rb | 54 --
.../cartridge-agent/ec2/tomcat/healthcheck.sh | 33 -
.../openstack/php/cartridge-agent.sh | 261 -------
.../cartridge-agent/openstack/php/clean.sh | 39 --
.../openstack/php/get-launch-params.rb | 54 --
.../openstack/php/healthcheck.sh | 33 -
.../modules/deployment-synchronizer/pom.xml | 81 ---
.../synchronizer/ArtifactRepository.java | 31 -
.../synchronizer/RepositoryInformation.java | 65 --
.../git/impl/GitBasedArtifactRepository.java | 699 -------------------
.../CustomJschConfigSessionFactory.java | 64 --
.../GitDeploymentSynchronizerConstants.java | 61 --
.../git/internal/RepositoryContext.java | 131 ----
.../GitDeploymentSyncronizerConfiguration.java | 29 -
.../synchronizer/git/util/Utilities.java | 73 --
.../modules/distribution/pom.xml | 95 +++
.../distribution/src/main/assembly/bin.xml | 79 +++
.../src/main/bin/cartridge-agent.sh | 39 ++
.../distribution/src/main/conf/jndi.properties | 23 +
.../distribution/src/main/conf/log4j.properties | 39 ++
.../conf/templates/jndi.properties.template | 28 +
.../src/main/resources/jndi.properties | 23 +
.../src/main/security/client-truststore.jks | Bin 0 -> 35240 bytes
.../modules/event-publisher/pom.xml | 120 ----
.../event-publisher/src/main/assembly/bin.xml | 63 --
.../src/main/bin/event-publisher.sh | 29 -
.../agent/event/publisher/EventPublisher.java | 108 ---
.../event/publisher/EventPublisherClient.java | 102 ---
.../cartridge/agent/event/publisher/Main.java | 67 --
.../src/main/resources/jndi.properties | 23 -
.../src/main/resources/log4j.properties | 37 -
.../member-activated-event.json.template | 1 -
.../member-started-event.json.template | 1 -
.../modules/event-subscriber/pom.xml | 125 ----
.../event-subscriber/src/main/assembly/bin.xml | 71 --
.../src/main/bin/event-subscriber.sh | 28 -
.../event/subscriber/ArtifactListener.java | 121 ----
.../subscriber/CartridgeAgentConstants.java | 41 --
.../agent/event/subscriber/EventSubscriber.java | 108 ---
.../event/subscriber/EventSubscriberClient.java | 103 ---
.../event/subscriber/LaunchParamsUtil.java | 58 --
.../cartridge/agent/event/subscriber/Main.java | 211 ------
.../subscriber/RepositoryFileListener.java | 38 -
.../src/main/resources/jndi.properties | 23 -
.../src/main/resources/log4j.properties | 37 -
.../member-activated-event.json.template | 1 -
.../member-started-event.json.template | 1 -
.../modules/health-stats/pom.xml | 145 ----
.../health-stats/src/main/assembly/bin.xml | 62 --
.../src/main/bin/health-publisher.sh | 34 -
.../agent/health/publisher/HealthPublisher.java | 139 ----
.../health/publisher/HealthPublisherClient.java | 92 ---
.../cartridge/agent/health/publisher/Main.java | 53 --
.../src/main/resources/jndi.properties | 23 -
.../src/main/resources/log4j.properties | 37 -
.../src/main/security/client-truststore.jks | Bin 35240 -> 0 bytes
.../ec2/load-balancer/cartridge-agent.sh | 89 +++
.../ec2/load-balancer/start-load-balancer.sh | 82 +++
.../templates/loadbalancer.conf.template | 136 ++++
.../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 +
.../scripts/openstack/php/cartridge-agent.sh | 261 +++++++
.../modules/scripts/openstack/php/clean.sh | 39 ++
.../scripts/openstack/php/get-launch-params.rb | 54 ++
.../scripts/openstack/php/healthcheck.sh | 33 +
products/cartridge-agent/pom.xml | 1 +
.../puppet/etc/puppet/files/event-subscriber.sh | 2 +-
92 files changed, 1852 insertions(+), 4861 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2f3d9021/extensions/cep/artifacts/executionplans/AverageHeathRequest.xml
----------------------------------------------------------------------
diff --git a/extensions/cep/artifacts/executionplans/AverageHeathRequest.xml b/extensions/cep/artifacts/executionplans/AverageHeathRequest.xml
index d3cf7ff..56c9545 100644
--- a/extensions/cep/artifacts/executionplans/AverageHeathRequest.xml
+++ b/extensions/cep/artifacts/executionplans/AverageHeathRequest.xml
@@ -9,7 +9,7 @@
<importedStreams>
<stream as="healthStats1" name="cartridge_agent_health_stats" version="1.0.0"/>
</importedStreams>
- <queryExpressions><![CDATA[from healthStats1 [health_description == 'port_not_open'] select cluster_id, network_partition_id, member_id, partition_id insert into fault_message;
+ <queryExpressions><![CDATA[from healthStats1 [health_description == 'ports_not_open'] select cluster_id, network_partition_id, member_id, partition_id insert into fault_message;
from healthStats1 [health_description == 'load_average'] #window.timeBatch(1 min) select cluster_id, network_partition_id, avg(value) as average_load_average group by cluster_id, network_partition_id insert into average_load_average_stats;
from healthStats1 [health_description == 'load_average'] #window.timeBatch(1 min) select member_id, cluster_id, network_partition_id, avg(value) as member_average_load_average group by member_id insert into member_average_load_average_stats;
from healthStats1 [health_description == 'memory_consumption'] #window.timeBatch(1 min) select member_id, cluster_id, network_partition_id, avg(value) as member_average_memory_consumption group by member_id insert into member_average_memory_consumption_stats;
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2f3d9021/extensions/load-balancer/haproxy-extension/src/main/bin/haproxy-extension.sh
----------------------------------------------------------------------
diff --git a/extensions/load-balancer/haproxy-extension/src/main/bin/haproxy-extension.sh b/extensions/load-balancer/haproxy-extension/src/main/bin/haproxy-extension.sh
index 741b269..2254f09 100755
--- a/extensions/load-balancer/haproxy-extension/src/main/bin/haproxy-extension.sh
+++ b/extensions/load-balancer/haproxy-extension/src/main/bin/haproxy-extension.sh
@@ -21,7 +21,7 @@
# --------------------------------------------------------------
echo "Starting haproxy extension..."
-script_path=$(cd `dirname "${BASH_SOURCE[0]}"` && pwd)`"`
+script_path="$( cd -P "$( dirname "$SOURCE" )" && pwd )/`dirname $0`"
lib_path=${script_path}/../lib/
class_path=`echo ${lib_path}/*.jar | tr ' ' ':'`
properties="-Djndi.properties.dir=${script_path}/../conf
@@ -43,4 +43,4 @@ properties="-Djndi.properties.dir=${script_path}/../conf
# Uncomment below line to enable remote debugging
#debug="-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005"
-java -cp "${class_path}" ${properties} ${debug} org.apache.stratos.haproxy.extension.Main -Dp1=sample_value $*
+java -cp "${class_path}" ${properties} ${debug} org.apache.stratos.haproxy.extension.Main $*
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2f3d9021/products/cartridge-agent/modules/cartridge-agent/ec2/load-balancer/cartridge-agent.sh
----------------------------------------------------------------------
diff --git a/products/cartridge-agent/modules/cartridge-agent/ec2/load-balancer/cartridge-agent.sh b/products/cartridge-agent/modules/cartridge-agent/ec2/load-balancer/cartridge-agent.sh
deleted file mode 100644
index e463a69..0000000
--- a/products/cartridge-agent/modules/cartridge-agent/ec2/load-balancer/cartridge-agent.sh
+++ /dev/null
@@ -1,89 +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
-# ---------------------------------------------
-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 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 &
-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
-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/2f3d9021/products/cartridge-agent/modules/cartridge-agent/ec2/load-balancer/start-load-balancer.sh
----------------------------------------------------------------------
diff --git a/products/cartridge-agent/modules/cartridge-agent/ec2/load-balancer/start-load-balancer.sh b/products/cartridge-agent/modules/cartridge-agent/ec2/load-balancer/start-load-balancer.sh
deleted file mode 100755
index 671a4a1..0000000
--- a/products/cartridge-agent/modules/cartridge-agent/ec2/load-balancer/start-load-balancer.sh
+++ /dev/null
@@ -1,82 +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.
-#
-# --------------------------------------------------------------
-
-# --------------------------------------------------------------
-# Load Balancer Start Script
-# --------------------------------------------------------------
-#
-# This script will update the load balancer configuration with
-# parameter values received via the payload and start the server.
-#
-
-set -e # Terminate on any error
-export LOG="/var/log/apache-stratos/start-load-balancer.log"
-export JAVA_HOME=/opt/jdk1.6.0_45
-
-script_home=/opt/apache-stratos-cartridge-agent/load-balancer
-lb_home=/opt/apache-stratos-load-balancer
-lb_conf_path=$lb_home/repository/conf
-
-echo "Generating loadbalancer.conf file..." | tee -a $LOG
-mb_ip=$1
-mb_port=$2
-cep_ip=$3
-cep_port=$4
-lb_cluster_id=$5
-network_partition_id=$6
-
-echo "mb-ip: $mb_ip" | tee -a $LOG
-echo "mb-port: $mb_port" | tee -a $LOG
-echo "cep-ip: $cep_ip" | tee -a $LOG
-echo "cep-port: $cep_port" | tee -a $LOG
-echo "lb-cluster-id: $lb_cluster_id" | tee -a $LOG
-echo "lb-network-partition-id: $network_partition_id" | tee -a $LOG
-
-cp -f $script_home/templates/loadbalancer.conf.template $script_home/loadbalancer.conf.orig
-cat $script_home/loadbalancer.conf.orig | sed -e "s@MB_IP@$mb_ip@g" > $script_home/loadbalancer.conf
-
-cp -f $script_home/loadbalancer.conf $script_home/loadbalancer.conf.orig
-cat $script_home/loadbalancer.conf.orig | sed -e "s@MB_PORT@$mb_port@g" > $script_home/loadbalancer.conf
-
-cp -f $script_home/loadbalancer.conf $script_home/loadbalancer.conf.orig
-cat $script_home/loadbalancer.conf.orig | sed -e "s@CEP_IP@$cep_ip@g" > $script_home/loadbalancer.conf
-
-cp -f $script_home/loadbalancer.conf $script_home/loadbalancer.conf.orig
-cat $script_home/loadbalancer.conf.orig | sed -e "s@CEP_PORT@$cep_port@g" > $script_home/loadbalancer.conf
-
-cp -f $script_home/loadbalancer.conf $script_home/loadbalancer.conf.orig
-cat $script_home/loadbalancer.conf.orig | sed -e "s@LB_CLUSTER_ID@$lb_cluster_id@g" > $script_home/loadbalancer.conf
-
-cp -f $script_home/loadbalancer.conf $script_home/loadbalancer.conf.orig
-cat $script_home/loadbalancer.conf.orig | sed -e "s@NETWORK_PARTITION_ID@$network_partition_id@g" > $script_home/loadbalancer.conf
-
-rm $script_home/loadbalancer.conf.orig
-
-echo "Moving generated loadbalancer.conf to $lb_conf_path" | tee -a $LOG
-mv -f $script_home/loadbalancer.conf $lb_conf_path
-
-echo "Starting load balancer..." | tee -a $LOG
-sh $lb_home/bin/stratos.sh start &
-
-echo "Load balancer started" | tee -a $LOG
-
-
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2f3d9021/products/cartridge-agent/modules/cartridge-agent/ec2/load-balancer/templates/loadbalancer.conf.template
----------------------------------------------------------------------
diff --git a/products/cartridge-agent/modules/cartridge-agent/ec2/load-balancer/templates/loadbalancer.conf.template b/products/cartridge-agent/modules/cartridge-agent/ec2/load-balancer/templates/loadbalancer.conf.template
deleted file mode 100755
index de7bee3..0000000
--- a/products/cartridge-agent/modules/cartridge-agent/ec2/load-balancer/templates/loadbalancer.conf.template
+++ /dev/null
@@ -1,136 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-loadbalancer {
-
- # Default load balancing algorithm
- # Refer algorithm name from algorithms section.
- algorithm: round-robin;
-
- # Enable/disable failover handling
- # If failover handling is enabled load balancer will retry requests on all members in a
- # given cluster if the selected member fails to respond.
- failover: true;
-
- # Enable/disable session affinity
- # If session affinity is enabled load balancer will track all outgoing sessions and delegate
- # incoming requests to members with same sessions.
- session-affinity: true;
-
- # Session timeout in milli-seconds
- session-timeout: 90000;
-
- # Enable/disable topology event listener
- # If this property is set to true, load balancer will listen to topology events and build
- # the topology configuration accordingly. If not static configuration given in the services
- # section will be used.
- topology-event-listener: true;
-
- # Message broker endpoint
- # Provide message broker ip address and port if topology-event-listener or multi-tenancy is set to true.
- mb-ip: MB_IP;
- mb-port: MB_PORT;
-
- # Topology service filter
- # Provide service names in a comma separated list to filter incoming topology events if
- # topology_event_listener_enabled is set to true. This functionality could be used for hosting
- # dedicated load balancers for services.
- # topology-service-filter: service-name=service-name1,service-name2;
-
- # Topology cluster filter
- # Provide cluster ids in a comma separated list to filter incoming topology events if
- # topology_event_listener_enabled is set to true. This functionality could be used for hosting
- # dedicated load balancers for subscriptions.
- # topology-cluster-filter: cluster-id=cluster-id1,cluster-id2;
-
- # Topology member filter
- # Provide load balancer cluster ids in a comma separated list to filter incoming topology events if
- # topology_event_listener_enabled is set to true. This functionality could be used for allowing members
- # to join a given load balancer cluster.
- topology-member-filter: lb-cluster-id=LB_CLUSTER_ID;
-
- # Enable/disable cep statistics publisher
- cep-stats-publisher: true;
-
- # Complex event processor endpoint
- # Provide CEP ip address and port if cep-stats-publisher is set to true.
- cep-ip: CEP_IP;
- cep-port: CEP_PORT;
-
- # Network partition id
- # Provide the network partition id if cep-stats-publisher is set to true.
- network-partition-id: NETWORK_PARTITION_ID;
-
- # Multi-tenancy
- # If this property is set to true, all incoming request URLs will be scanned using the given tenant-identifier-regex
- # and matching tenant identifier value will be used to delegate the requests to the relevant cluster.
- multi-tenancy: true;
- tenant-identifier: tenant-domain; # Tenant identifier could either be tenant-id or tenant-domain.
- tenant-identifier-regex: t/([^/]*)/; # Regular expression for extracting the tenant identifier value from the URL.
-
- # Load balancing algorithm class names
- algorithms {
- round-robin { # algorithm name
- class-name: org.apache.stratos.load.balancer.algorithm.RoundRobin;
- }
- }
-
- # Static topology configuration
- # Define a static topology configuration if topology-event-listener is set to false.
- # A sample configuration has been given below:
- #
- # services {
- # app-server { # service name, a unique identifier to identify a service
- # multi-tenant: true; # Set to true if the service is multi-tenant
- # clusters {
- # app-server-cluster1 { # cluster id, a unique identifier to identify a cluster
- # hosts: cluster1.appserver.foo.org, cluster1.org; # comma separated hostname list
- # tenant-range: 1-100; # Tenant range of the cluster
- # algorithm: round-robin; # algorithm name
- # members {
- # m1 { # member id, a unique identifier to identify a member
- # ip: 10.0.0.10; # member ip address
- # ports {
- # http {
- # value: 8080; # application port
- # proxy: 80; # proxy port exposed by load balancer transport, set this value in axis2.xml
- # }
- # https {
- # value: 8090;
- # proxy: 443;
- # }
- # }
- # }
- # m2 {
- # ip: 10.0.0.11;
- # ports {
- # http {
- # value: 8080;
- # proxy: 80;
- # }
- # https {
- # value: 8090;
- # proxy: 443;
- # }
- # }
- # }
- # }
- # }
- # }
- # }
- # }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2f3d9021/products/cartridge-agent/modules/cartridge-agent/ec2/mysql/cartridge-agent.sh
----------------------------------------------------------------------
diff --git a/products/cartridge-agent/modules/cartridge-agent/ec2/mysql/cartridge-agent.sh b/products/cartridge-agent/modules/cartridge-agent/ec2/mysql/cartridge-agent.sh
deleted file mode 100755
index 5a2f370..0000000
--- a/products/cartridge-agent/modules/cartridge-agent/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/2f3d9021/products/cartridge-agent/modules/cartridge-agent/ec2/mysql/clean.sh
----------------------------------------------------------------------
diff --git a/products/cartridge-agent/modules/cartridge-agent/ec2/mysql/clean.sh b/products/cartridge-agent/modules/cartridge-agent/ec2/mysql/clean.sh
deleted file mode 100755
index 4e5f96a..0000000
--- a/products/cartridge-agent/modules/cartridge-agent/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/2f3d9021/products/cartridge-agent/modules/cartridge-agent/ec2/mysql/get-launch-params.rb
----------------------------------------------------------------------
diff --git a/products/cartridge-agent/modules/cartridge-agent/ec2/mysql/get-launch-params.rb b/products/cartridge-agent/modules/cartridge-agent/ec2/mysql/get-launch-params.rb
deleted file mode 100644
index 0631b2b..0000000
--- a/products/cartridge-agent/modules/cartridge-agent/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/2f3d9021/products/cartridge-agent/modules/cartridge-agent/ec2/mysql/healthcheck.sh
----------------------------------------------------------------------
diff --git a/products/cartridge-agent/modules/cartridge-agent/ec2/mysql/healthcheck.sh b/products/cartridge-agent/modules/cartridge-agent/ec2/mysql/healthcheck.sh
deleted file mode 100644
index 04a96d1..0000000
--- a/products/cartridge-agent/modules/cartridge-agent/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/2f3d9021/products/cartridge-agent/modules/cartridge-agent/ec2/php/cartridge-agent.sh
----------------------------------------------------------------------
diff --git a/products/cartridge-agent/modules/cartridge-agent/ec2/php/cartridge-agent.sh b/products/cartridge-agent/modules/cartridge-agent/ec2/php/cartridge-agent.sh
deleted file mode 100755
index 7064af8..0000000
--- a/products/cartridge-agent/modules/cartridge-agent/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/2f3d9021/products/cartridge-agent/modules/cartridge-agent/ec2/php/clean.sh
----------------------------------------------------------------------
diff --git a/products/cartridge-agent/modules/cartridge-agent/ec2/php/clean.sh b/products/cartridge-agent/modules/cartridge-agent/ec2/php/clean.sh
deleted file mode 100755
index 9720568..0000000
--- a/products/cartridge-agent/modules/cartridge-agent/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/2f3d9021/products/cartridge-agent/modules/cartridge-agent/ec2/php/get-launch-params.rb
----------------------------------------------------------------------
diff --git a/products/cartridge-agent/modules/cartridge-agent/ec2/php/get-launch-params.rb b/products/cartridge-agent/modules/cartridge-agent/ec2/php/get-launch-params.rb
deleted file mode 100644
index 0631b2b..0000000
--- a/products/cartridge-agent/modules/cartridge-agent/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/2f3d9021/products/cartridge-agent/modules/cartridge-agent/ec2/php/healthcheck.sh
----------------------------------------------------------------------
diff --git a/products/cartridge-agent/modules/cartridge-agent/ec2/php/healthcheck.sh b/products/cartridge-agent/modules/cartridge-agent/ec2/php/healthcheck.sh
deleted file mode 100644
index 04a96d1..0000000
--- a/products/cartridge-agent/modules/cartridge-agent/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/2f3d9021/products/cartridge-agent/modules/cartridge-agent/ec2/tomcat/cartridge-agent.sh
----------------------------------------------------------------------
diff --git a/products/cartridge-agent/modules/cartridge-agent/ec2/tomcat/cartridge-agent.sh b/products/cartridge-agent/modules/cartridge-agent/ec2/tomcat/cartridge-agent.sh
deleted file mode 100755
index 4f640fd..0000000
--- a/products/cartridge-agent/modules/cartridge-agent/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/2f3d9021/products/cartridge-agent/modules/cartridge-agent/ec2/tomcat/clean.sh
----------------------------------------------------------------------
diff --git a/products/cartridge-agent/modules/cartridge-agent/ec2/tomcat/clean.sh b/products/cartridge-agent/modules/cartridge-agent/ec2/tomcat/clean.sh
deleted file mode 100755
index 9720568..0000000
--- a/products/cartridge-agent/modules/cartridge-agent/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/2f3d9021/products/cartridge-agent/modules/cartridge-agent/ec2/tomcat/get-launch-params.rb
----------------------------------------------------------------------
diff --git a/products/cartridge-agent/modules/cartridge-agent/ec2/tomcat/get-launch-params.rb b/products/cartridge-agent/modules/cartridge-agent/ec2/tomcat/get-launch-params.rb
deleted file mode 100644
index 0631b2b..0000000
--- a/products/cartridge-agent/modules/cartridge-agent/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/2f3d9021/products/cartridge-agent/modules/cartridge-agent/ec2/tomcat/healthcheck.sh
----------------------------------------------------------------------
diff --git a/products/cartridge-agent/modules/cartridge-agent/ec2/tomcat/healthcheck.sh b/products/cartridge-agent/modules/cartridge-agent/ec2/tomcat/healthcheck.sh
deleted file mode 100644
index d536e1c..0000000
--- a/products/cartridge-agent/modules/cartridge-agent/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
-
-
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2f3d9021/products/cartridge-agent/modules/cartridge-agent/openstack/php/cartridge-agent.sh
----------------------------------------------------------------------
diff --git a/products/cartridge-agent/modules/cartridge-agent/openstack/php/cartridge-agent.sh b/products/cartridge-agent/modules/cartridge-agent/openstack/php/cartridge-agent.sh
deleted file mode 100755
index 9064bf5..0000000
--- a/products/cartridge-agent/modules/cartridge-agent/openstack/php/cartridge-agent.sh
+++ /dev/null
@@ -1,261 +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
- cp /var/lib/cloud/instance/user-data.txt ${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
-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
-
- echo \"Changing owner of application path/www to www-data:www-data...\" | tee -a \$GIT_SH_LOG
- sudo chown -R www-data:www-data ${APP_PATH}/www
- if [ -f \"${APP_PATH}/sql/alter.sql\" ] && [ -n \"${MYSQL_HOST}\" ] && [ -n \"${MYSQL_USER}\" ] && [ -n \"${MYSQL_PASSWORD}\" ]; then
- mysql -h ${MYSQL_HOST} -u ${MYSQL_USER} -p${MYSQL_PASSWORD} < ${APP_PATH}/sql/alter.sql
- 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
- echo \"Moving content to /var/www\" | tee -a \$GIT_SH_LOG
- sudo mv ${instance_path}/temp_git/* /var/www
- sudo mv ${instance_path}/temp_git/.git /var/www
- 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
-
- if [ -n \"${MYSQL_HOST}\" ] && [ -n \"${MYSQL_USER}\" ] && [ -n \"${MYSQL_PASSWORD}\" ]; then
- if [ -f \"${APP_PATH}/sql/init.sql\" ]; then
- mysql -h ${MYSQL_HOST} -u ${MYSQL_USER} -p${MYSQL_PASSWORD} < ${APP_PATH}/sql/init.sql
- fi
- echo \"Generating .htaccess...\" | tee -a \$GIT_SH_LOG
- echo \"SetEnv STRATOS_MYSQL_USER ${MYSQL_USER}
- SetEnv STRATOS_MYSQL_HOST ${MYSQL_HOST}
- SetEnv STRATOS_MYSQL_PASSWORD ${MYSQL_PASSWORD}
- \" > /tmp/.htaccess
- echo \"Copying .htaccess to application path...\" | tee -a \$GIT_SH_LOG
- sudo mv /tmp/.htaccess ${APP_PATH}/
- fi
- echo \"Changing owner of application path/www to www-data:www-data...\" | tee -a \$GIT_SH_LOG
- sudo chown -R www-data:www-data ${APP_PATH}/www
-
-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 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
-
-while true
-do
-var=`nc -z localhost 443; echo $?`;
-if [ $var -eq 0 ]
- then
- echo "Port 443 is available" | tee -a $LOG
- break
- else
- echo "Port 443 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/2f3d9021/products/cartridge-agent/modules/cartridge-agent/openstack/php/clean.sh
----------------------------------------------------------------------
diff --git a/products/cartridge-agent/modules/cartridge-agent/openstack/php/clean.sh b/products/cartridge-agent/modules/cartridge-agent/openstack/php/clean.sh
deleted file mode 100755
index 9720568..0000000
--- a/products/cartridge-agent/modules/cartridge-agent/openstack/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/2f3d9021/products/cartridge-agent/modules/cartridge-agent/openstack/php/get-launch-params.rb
----------------------------------------------------------------------
diff --git a/products/cartridge-agent/modules/cartridge-agent/openstack/php/get-launch-params.rb b/products/cartridge-agent/modules/cartridge-agent/openstack/php/get-launch-params.rb
deleted file mode 100644
index 0631b2b..0000000
--- a/products/cartridge-agent/modules/cartridge-agent/openstack/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/2f3d9021/products/cartridge-agent/modules/cartridge-agent/openstack/php/healthcheck.sh
----------------------------------------------------------------------
diff --git a/products/cartridge-agent/modules/cartridge-agent/openstack/php/healthcheck.sh b/products/cartridge-agent/modules/cartridge-agent/openstack/php/healthcheck.sh
deleted file mode 100644
index 04a96d1..0000000
--- a/products/cartridge-agent/modules/cartridge-agent/openstack/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/2f3d9021/products/cartridge-agent/modules/deployment-synchronizer/pom.xml
----------------------------------------------------------------------
diff --git a/products/cartridge-agent/modules/deployment-synchronizer/pom.xml b/products/cartridge-agent/modules/deployment-synchronizer/pom.xml
deleted file mode 100644
index 11d43d9..0000000
--- a/products/cartridge-agent/modules/deployment-synchronizer/pom.xml
+++ /dev/null
@@ -1,81 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ 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.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
- <parent>
- <groupId>org.apache.stratos</groupId>
- <artifactId>cartidge-agent</artifactId>
- <version>4.0.0-SNAPSHOT</version>
- <relativePath>../../pom.xml</relativePath>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
- <artifactId>org.apache.stratos.deployment.synchronizer</artifactId>
- <name>Cartridge agent - Git Based Deployment Synchronizer</name>
-
- <build>
- <plugins>
-
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-scr-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
- <Bundle-Name>${project.artifactId}</Bundle-Name>
- <Export-Package>
- org.apache.stratos.deployment.synchronizer.git.*
- </Export-Package>
- <Import-Package>
- !org.apache.stratos.deployment.synchronizer.git.*,
- *;resolution:=optional
- </Import-Package>
- <DynamicImport-Package>*</DynamicImport-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
- <dependencies>
- <dependency>
- <groupId>org.eclipse.jgit</groupId>
- <artifactId>org.eclipse.jgit</artifactId>
- <version>2.1.0.wso2v1</version>
- </dependency>
- <dependency>
- <groupId>com.jcraft</groupId>
- <artifactId>jsch</artifactId>
- <version>0.1.49.wso2v1</version>
- </dependency>
- <dependency>
- <groupId>org.wso2.carbon</groupId>
- <artifactId>org.wso2.carbon.utils</artifactId>
- <version>4.1.0</version>
- </dependency>
- </dependencies>
-
-</project>
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2f3d9021/products/cartridge-agent/modules/deployment-synchronizer/src/main/java/org/apache/stratos/deployment/synchronizer/ArtifactRepository.java
----------------------------------------------------------------------
diff --git a/products/cartridge-agent/modules/deployment-synchronizer/src/main/java/org/apache/stratos/deployment/synchronizer/ArtifactRepository.java b/products/cartridge-agent/modules/deployment-synchronizer/src/main/java/org/apache/stratos/deployment/synchronizer/ArtifactRepository.java
deleted file mode 100644
index 189fab7..0000000
--- a/products/cartridge-agent/modules/deployment-synchronizer/src/main/java/org/apache/stratos/deployment/synchronizer/ArtifactRepository.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.stratos.deployment.synchronizer;
-
-
-/**
- * @author wso2
- *
- */
-public interface ArtifactRepository {
-
- public boolean checkout(RepositoryInformation repositoryInformation);
-
-}