You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by is...@apache.org on 2014/04/04 03:36:40 UTC

[1/3] Stratos Installer changes to use single product

Repository: incubator-stratos
Updated Branches:
  refs/heads/master 32f7c802d -> f11d283cd


http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7e4b3aee/tools/stratos-installer/stratos-setup.sh
----------------------------------------------------------------------
diff --git a/tools/stratos-installer/stratos-setup.sh b/tools/stratos-installer/stratos-setup.sh
deleted file mode 100755
index ace9540..0000000
--- a/tools/stratos-installer/stratos-setup.sh
+++ /dev/null
@@ -1,596 +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.
-#
-# ----------------------------------------------------------------------------
-#
-#  Server configuration script for Apache Stratos
-# ----------------------------------------------------------------------------
-
-# Die on any error:
-set -e
-
-source "./conf/stratos-setup.conf"
-export LOG=$log_path/stratos-setup.log
-
-profile="default"
-config_mb="true"
-activemq_client_libs=(activemq-broker-5.8.0.jar  activemq-client-5.8.0.jar  geronimo-j2ee-management_1.1_spec-1.0.1.jar  geronimo-jms_1.1_spec-1.1.1.jar  hawtbuf-1.2.jar)
-auto_start_servers="false"
-
-function help {
-    echo ""
-    echo "Usage:"
-    echo "setup.sh -p \"<profile>\" [-s]"
-    echo "product list : [default, cc, as, sm]"
-    echo "Example:"
-    echo "sudo ./setup.sh -p \"default\""
-    echo "sudo ./setup.sh -p \"cc\""
-    echo ""
-    echo "-p: <profile> Apache Stratos products to be installed on this node. Provide one name of a profile."
-    echo "    The available profiles are cc, as, sm or default. 'default' means you need to setup all servers in this machine. Default is 'default' profile"
-    echo "-s: Silent mode - Start servers after installation."
-    echo ""
-}
-
-# Check validity of IP
-function valid_ip()
-{
-    local  ip=$1
-    local  stat=1
-
-    if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
-        OIFS=$IFS
-        IFS='.'
-        ip=($ip)
-        IFS=$OIFS
-        [[ ${ip[0]} -le 255 && ${ip[1]} -le 255 \
-            && ${ip[2]} -le 255 && ${ip[3]} -le 255 ]]
-        stat=$?
-    fi
-    return $stat
-}
-
-# General functions
-# -------------------------------------------------------------------
-function general_conf_validate() {
-    if [[ ! -d $setup_path ]]; then
-        echo "Please specify the setup_path folder which contains stratos setup"
-        exit 1
-    fi
-    if [[ ! -d $stratos_packs ]]; then
-        echo "Please specify the stratos_packs folder which contains stratos packages"
-        exit 1
-    fi
-    if [[ ! -d $stratos_path ]]; then
-        echo "Please specify the stratos_path folder which stratos will be installed"
-        exit 1
-    fi
-    if [[ ! -d $JAVA_HOME ]]; then
-        echo "Please set the JAVA_HOME environment variable for the running user"
-        exit 1
-    fi
-    export JAVA_HOME=$JAVA_HOME
-
-    if [[ -z $stratos_domain ]]; then
-        echo "Please specify the stratos domain"
-        exit 1
-    fi
-    if [[ ! -f $stratos_pack_zip ]]; then
-        echo "Please copy the startos zip to the stratos pack folder"
-        exit 1
-    fi
-    if [[ -z $mb_port ]]; then
-        echo "Please specify the port of MB"
-        exit 1
-    fi
-
-    if [[ $auto_start_servers != "true" ]]; then
-    	if [[ $profile = "default" ]]; then
-            read -p "Do you want to configure ActiveMQ [y/n]: " answer
-            if [[ $answer = y ]] ; then
-            	mb_ip=$host_ip
-            else
-            	echo "Provided mb_ip in conf/stratos-setup.conf will be used"
-            	config_mb="false"
-            fi
-    	fi
-    fi
-}
-
-# Setup General
-function general_setup() {
-
-    cp -f ./config/all/repository/conf/activemq/jndi.properties $stratos_extract_path/repository/conf/
-
-    pushd $stratos_extract_path
-    echo "In repository/conf/carbon.xml"
-    sed -i "s@<Offset>0</Offset>@<Offset>${offset}</Offset>@g" repository/conf/carbon.xml
-
-    echo "In repository/conf/jndi.properties"
-    sed -i "s@MB_HOSTNAME:MB_LISTEN_PORT@$mb_ip:$mb_port@g" repository/conf/jndi.properties
-    popd
-
-    for activemq_client_lib in "${activemq_client_libs[@]}" 
-    do
-    	cp -f $stratos_packs/$activemq_client_lib $stratos_extract_path/repository/components/lib/
-    done
-}
-
-function activemq_validate() {
-    if [[ ! -f $activemq_pack ]]; then
-        echo "Please copy the activemq zip to the stratos pack folder and update the JAR name in conf/stratos-setup.conf file"
-        exit 1
-    fi
-}
-
-
-# CC related functions
-# -------------------------------------------------------------------
-function cc_related_popup() {
-    while read -p "Please provide cloud controller ip:" cc_ip
-    do
-	if !(valid_ip $cc_ip); then
-	    echo "Please provide valid ips for CC"	 
-	else 
-            export cc_ip
-	    break 
-	fi
-    done 
-
-    while read -p "Please provide cloud controller hostname:" cc_hostname
-    do
-	if [[ -z $cc_hostname ]]; then
-	    echo "Please specify valid hostname for CC"	 
-	else 
-            export cc_hostname
-	    break 
-	fi
-    done
-
-    while read -p "Please provide cloud controller port offset:" cc_port_offset
-    do
-	if [[ -z $cc_port_offset ]]; then
-	    echo "Please specify the port offset of CC"	 
-	else 
-            export cc_port_offset
-	    break 
-	fi
-    done
-}
-
-function cc_conf_validate() {
-    if [[ $ec2_provider_enabled = "false" && $openstack_provider_enabled = "false" && $vcloud_provider_enabled = "false" ]]; then
-        echo "Please enable at least one of the IaaS providers in conf/stratos-setup.conf file"
-        exit 1
-    fi
-    if [[ $openstack_provider_enabled = "true" ]]; then
-        if [[ ( -z $openstack_identity || -z $openstack_credential || -z $openstack_jclouds_endpoint ) ]]; then
-            echo "Please set openstack configuration information in conf/stratos-setup.conf file"
-            exit 1
-        fi
-    fi
-    if [[ $ec2_provider_enabled = "true" ]]; then
-        if [[ ( -z $ec2_identity || -z $ec2_credential || -z $ec2_keypair_name ) ]]; then
-            echo "Please set ec2 configuration information in conf/stratos-setup.conf file"
-            exit 1
-        fi
-    fi
-    if [[ $vcloud_provider_enabled = "true" ]]; then
-        if [[ ( -z $vcloud_identity || -z $vcloud_credential || -z $vcloud_jclouds_endpoint ) ]]; then
-            echo "Please set vcloud configuration information in conf/stratos-setup.conf file"
-            exit 1
-        fi
-    fi
-}
-
-# Setup cc
-function cc_setup() {
-    echo "Setup CC" >> $LOG
-    echo "Configuring the Cloud Controller"
-
-    cp -f ./config/all/repository/conf/cloud-controller.xml $stratos_extract_path/repository/conf/ 
-
-    export cc_path=$stratos_extract_path
-    echo "In repository/conf/cloud-controller.xml"
-    if [[ $ec2_provider_enabled = true ]]; then
-        ./stratos-ec2.sh
-    fi
-    if [[ $openstack_provider_enabled = true ]]; then
-        ./stratos-openstack.sh
-    fi
-    if [[ $vcloud_provider_enabled = true ]]; then
-        ./stratos-vcloud.sh
-    fi
-
-    pushd $stratos_extract_path
-    
-    popd 
-    echo "End configuring the Cloud Controller"
-}
-
-
-# AS related functions
-# -------------------------------------------------------------------
-function as_related_popup() {
-    while read -p "Please provide Auto Scalar ip:" as_ip
-    do
-	if !(valid_ip $as_ip); then
-	    echo "Please provide valid ips for AS"	 
-	else 
-            export as_ip
-	    break 
-	fi
-    done 
-
-    while read -p "Please provide Auto Scala hostname:" as_hostname
-    do
-	if [[ -z $as_hostname ]]; then
-	    echo "Please specify valid hostname for AS"	 
-	else 
-            export as_hostname
-	    break 
-	fi
-    done
-
-    while read -p "Please provide Auto Scala port offset:" as_port_offset
-    do
-	if [[ -z $as_port_offset ]]; then
-	    echo "Please specify the port offset of AS"	 
-	else 
-            export as_port_offset
-	    break 
-	fi
-    done
-}
-
-function as_conf_validate() {
-    if [[ !($profile = "default") ]]; then
-	cc_related_popup
-	sm_related_popup
-	export as_cc_https_port=$((9443 + $cc_port_offset))
-	export as_sm_https_port=$((9443 + $sm_port_offset))
-    else
-        cc_hostname=$stratos_domain
-        sm_hostname=$stratos_domain
-	export as_cc_https_port=$((9443 + $offset))
-	export as_sm_https_port=$((9443 + $offset))
-    fi
-}
-
-# Setup AS 
-function as_setup() {
-    echo "Setup AS" >> $LOG
-    echo "Configuring the Auto Scalar"
-
-    cp -f ./config/all/repository/conf/autoscaler.xml $stratos_extract_path/repository/conf/
-
-    pushd $stratos_extract_path
-
-    echo "In repository/conf/autoscaler.xml"
-    sed -i "s@CC_HOSTNAME@$cc_hostname@g" repository/conf/autoscaler.xml
-    sed -i "s@CC_LISTEN_PORT@$as_cc_https_port@g" repository/conf/autoscaler.xml
-    sed -i "s@SM_HOSTNAME@$sm_hostname@g" repository/conf/autoscaler.xml
-    sed -i "s@SM_LISTEN_PORT@$as_sm_https_port@g" repository/conf/autoscaler.xml
-
-    popd
-    echo "End configuring the Auto scalar"
-}
-
-
-# SM related functions
-# -------------------------------------------------------------------
-function sm_related_popup() {
-    while read -p "Please provide Stratos Manager ip:" sm_ip
-    do
-	if !(valid_ip $sm_ip); then
-	    echo "Please provide valid ips for SM"	 
-	else 
-            export sm_ip
-	    break 
-	fi
-    done 
-
-    while read -p "Please provide Stratos Manager hostname:" sm_hostname
-    do
-	if [[ -z $sm_hostname ]]; then
-	    echo "Please specify valid hostname for SM"	 
-	else 
-            export sm_hostname
-	    break 
-	fi
-    done
-
-    while read -p "Please provide Stratos Manager port offset:" sm_port_offset
-    do
-	if [[ -z $sm_port_offset ]]; then
-	    echo "Please specify the port offset of SM"	 
-	else 
-            export sm_port_offset
-	    break 
-	fi
-    done
-}
-
-function sm_conf_validate() {
-    if [[ -z $puppet_ip ]]; then
-        echo "Please specify the ip of puppet master"
-        exit 1
-    elif !(valid_ip $puppet_ip); then
-        echo "Please provide valid ip for puppet master"
-        exit 1
-    fi
-    if [[ -z $puppet_hostname ]]; then
-        echo "Please specify the puppet master's hostname"
-        exit 1
-    fi
-    if [[ -z $puppet_environment ]]; then
-        echo "Please specify the relevant puppet environment"
-        exit 1
-    fi
-    if [[ ! -f $mysql_connector_jar ]]; then
-        echo "Please copy the mysql connector jar to the stratos release pack folder and update the JAR name in conf/stratos-setup.conf file"
-        exit 1
-    fi
-
-    if [[ !($profile = "default") ]]; then
-	cc_related_popup
-	as_related_popup
-	export sm_cc_https_port=$((9443 + $cc_port_offset))
-	export sm_as_https_port=$((9443 + $as_port_offset))
-    else
-        export cc_hostname=$stratos_domain
-        export as_hostname=$stratos_domain
-	export sm_cc_https_port=$((9443 + $offset))
-	export sm_as_https_port=$((9443 + $offset))
-    fi
-    export sm_https_port=$((9443 + $offset))
-}
-
-# Setup SM
-function sm_setup() {
-    echo "Setup SM" >> $LOG
-    echo "Configuring Stratos Manager"
-
-    cp -f ./config/all/repository/conf/cartridge-config.properties $stratos_extract_path/repository/conf/
-    cp -f ./config/all/repository/conf/datasources/master-datasources.xml $stratos_extract_path/repository/conf/datasources/
-    cp -f $mysql_connector_jar $stratos_extract_path/repository/components/lib/
-
-    pushd $stratos_extract_path
-
-    echo "In repository/conf/cartridge-config.properties"
-    sed -i "s@CC_HOSTNAME:CC_HTTPS_PORT@$cc_hostname:$sm_cc_https_port@g" repository/conf/cartridge-config.properties
-    sed -i "s@AS_HOSTNAME:AS_HTTPS_PORT@$as_hostname:$sm_as_https_port@g" repository/conf/cartridge-config.properties
-    sed -i "s@PUPPET_IP@$puppet_ip@g" repository/conf/cartridge-config.properties
-    sed -i "s@PUPPET_HOSTNAME@$puppet_hostname@g" repository/conf/cartridge-config.properties
-    sed -i "s@PUPPET_ENV@$puppet_environment@g" repository/conf/cartridge-config.properties
-
-    echo "In repository/conf/datasources/master-datasources.xml"
-    sed -i "s@USERSTORE_DB_HOSTNAME@$userstore_db_hostname@g" repository/conf/datasources/master-datasources.xml
-    sed -i "s@USERSTORE_DB_PORT@$userstore_db_port@g" repository/conf/datasources/master-datasources.xml
-    sed -i "s@USERSTORE_DB_SCHEMA@$userstore_db_schema@g" repository/conf/datasources/master-datasources.xml
-    sed -i "s@USERSTORE_DB_USER@$userstore_db_user@g" repository/conf/datasources/master-datasources.xml
-    sed -i "s@USERSTORE_DB_PASS@$userstore_db_pass@g" repository/conf/datasources/master-datasources.xml
-
-    popd
-
-    # Database Configuration
-    # -----------------------------------------------
-    echo "Create and configure MySql Databases" >> $LOG 
-    echo "Creating userstore database"
-
-    pushd $resource_path
-    sed -i "s@USERSTORE_DB_SCHEMA@$userstore_db_schema@g" mysql.sql
-
-    popd
-
-    mysql -u$userstore_db_user -p$userstore_db_pass < $resource_path/mysql.sql
-    echo "End configuring the SM"
-}
-
-
-# Setup CEP
-function cep_setup() {
-    echo "Setup CEP" >> $LOG
-    echo "Configuring the Complex Event Processor"
-
-    pushd $stratos_extract_path
-
-    echo "In outputeventadaptors"
-
-    sed -i "s@CEP_HOME@$stratos_extract_path@g" repository/deployment/server/outputeventadaptors/JMSOutputAdaptor.xml
-    sed -i "s@MB_HOSTNAME:MB_LISTEN_PORT@$mb_ip:$mb_port@g" repository/deployment/server/outputeventadaptors/JMSOutputAdaptor.xml
-
-    echo "End configuring the Complex Event Processor"
-    popd
-}
-
-
-# ------------------------------------------------
-# Execution 
-# ------------------------------------------------
-
-while getopts p:s opts
-do
-  case $opts in
-    p)
-        profile_list=${OPTARG}
-        ;;
-    s)
-        auto_start_servers="true"
-        ;;
-    \?)
-        help
-        exit 1
-        ;;
-  esac
-done
-
-profile_list=`echo $profile_list | sed 's/^ *//g' | sed 's/ *$//g'`
-if [[ !(-z $profile_list || $profile_list = "") ]]; then
-    arr=$(echo $profile_list | tr " " "\n")
-echo $arr
-    for x in $arr
-    do
-    	if [[ $x = "default" ]]; then
-            profile="default"
-    	elif [[ $x = "cc" ]]; then
-            profile="cc"
-        elif [[ $x = "as" ]]; then
-            profile="as"
-        elif [[ $x = "sm" ]]; then
-            profile="sm"
-        else
-            echo "Invalid profile."
-            exit 1
-    	fi
-    done
-    echo "You have selected the profile : $profile"
-else 
-    echo "You have not provided a profile : default profile will be selected."
-fi
-
-
-if [[ $host_user == "" ]]; then
-    echo "user provided in conf/stratos-setup.conf is null. Please provide a user"
-    exit 1
-fi
-
-echo "user provided in conf/stratos-setup.conf is $host_user. If you want to provide some other user name please specify it at the prompt."
-echo "If you want to continue with $host_user just press enter to continue"
-read username
-if [[ $username != "" ]]; then
-    host_user=$username
-fi
-user=`id $host_user`
-if [[ $? = 1 ]]; then
-    echo "User $host_user does not exist. The system will create it."
-    adduser --home /home/$host_user $host_user
-fi
-
-export $host_user
-
-# Make sure the user is running as root.
-if [ "$UID" -ne "0" ]; then
-	echo ; echo "  You must be root to run $0.  (Try running 'sudo bash' first.)" ; echo 
-	exit 69
-fi
-
-general_conf_validate
-if [[ $profile = "cc" ]]; then
-    cc_conf_validate
-elif [[ $profile = "as" ]]; then
-    as_conf_validate
-elif [[ $profile = "sm" ]]; then
-    sm_conf_validate
-else
-    echo "In default profile CEP will be configured."
-    activemq_validate
-    cc_conf_validate
-    as_conf_validate
-    sm_conf_validate 
-fi
-
-if [[ ! -d $log_path ]]; then
-    mkdir -p $log_path
-fi
-
-
-echo ""
-echo "For all the questions asked while during executing the script please just press the enter button"
-echo ""
-
-
-# Extract stratos zip file
-if [[ !(-d $stratos_extract_path) ]]; then
-    echo "Extracting Apache Stratos"
-    unzip -q $stratos_pack_zip -d $stratos_path
-    mv -f $stratos_path/apache-stratos-4.0.0-SNAPSHOT $stratos_extract_path
-fi
-
-if [[ ($profile = "default" && $config_mb = "true") ]]; then
-    echo "Extracting ActiveMQ"
-    tar -xzf $activemq_pack -C $stratos_path
-fi
-
-general_setup
-if [[ $profile = "cc" ]]; then
-    cc_setup
-elif [[ $profile = "as" ]]; then
-    as_setup
-elif [[ $profile = "sm" ]]; then
-    sm_setup
-else
-    cc_setup
-    as_setup
-    sm_setup
-    cep_setup   
-fi
-
-# ------------------------------------------------
-# Mapping domain/host names 
-# ------------------------------------------------
-
-cp -f /etc/hosts hosts.tmp
-
-echo "$host_ip $sm_hostname	# stratos domain"	>> hosts.tmp
- 
-if [[ $profile = "sm" || $profile = "as" ]]; then
-    echo "$sm_ip $sm_hostname	# stratos domain"	>> hosts.tmp
-    echo "$cc_ip $cc_hostname	# cloud controller hostname"	>> hosts.tmp
-fi
-
-if [[ $profile = "sm" ]]; then
-    echo "$as_ip $as_hostname	# auto scalar hostname"	>> hosts.tmp
-fi
-
-mv -f ./hosts.tmp /etc/hosts
-
-
-# ------------------------------------------------
-# Starting the servers
-# ------------------------------------------------
-echo 'Changing owner of '$stratos_path' to '$host_user:$host_user
-chown $host_user:$host_user $stratos_path -R
-
-echo "Apache Stratos setup has successfully completed"
-
-if [[ $auto_start_servers != "true" ]]; then
-    read -p "Do you want to start the servers [y/n]? " answer
-    if [[ $answer != y ]] ; then
-        exit 1
-    fi
-fi
-
-echo "Starting the servers" >> $LOG
-
-echo "Starting up servers. This may take time. Look at $LOG file for server startup details"
-
-chown -R $host_user.$host_user $log_path
-chmod -R 777 $log_path
-
-export setup_dir=$PWD
-su - $host_user -c "source $setup_path/conf/stratos-setup.conf;$setup_path/stratos-start-servers.sh -p\"$profile\" >> $LOG"
-
-echo "Servers started. Please look at $LOG file for server startup details"
-if [[ $profile == "default" || $profile == "sm" ]]; then
-    echo "**************************************************************"
-    echo "Management Console : https://$stratos_domain:$sm_https_port/console"
-    echo "**************************************************************"
-fi

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7e4b3aee/tools/stratos-installer/stratos-start-servers.sh
----------------------------------------------------------------------
diff --git a/tools/stratos-installer/stratos-start-servers.sh b/tools/stratos-installer/stratos-start-servers.sh
deleted file mode 100755
index f3d03c7..0000000
--- a/tools/stratos-installer/stratos-start-servers.sh
+++ /dev/null
@@ -1,96 +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 is for starting Apache Stratos servers.
-# ----------------------------------------------------------------------------
-
-# Die on any error:
-set -e
-product_list=$1
-export LOG=$log_path/stratos.log
-SLEEP=40
-
-profile="default"
-
-if [[ -f ./conf/stratos-setup.conf ]]; then
-    source "./conf/stratos-setup.conf"
-    echo "source it"
-fi
-
-
-function help {
-    echo ""
-    echo "Give one or more of the servers to start on this machine. The available servers are"
-    echo "cc, as, sm, default. 'default' means you need to start all servers."
-    echo "usage:"
-    echo "stratos-start-servers.sh -p\"<profile>\""
-    echo "eg."
-    echo "stratos-start-servers.sh -p\"cc\""
-    echo ""
-}
-
-while getopts p: opts
-do
-  case $opts in
-    p)
-        profile_list=${OPTARG}
-        ;;
-    \?)
-        help
-        exit 1
-        ;;
-  esac
-done
-
-
-arr=$(echo $profile_list | tr " " "\n")
-
-for x in $arr
-do
-    if [[ $x = "cc" ]]; then
-        profile="cc"
-    elif [[ $x = "as" ]]; then
-        profile="as"
-    elif [[ $x = "sm" ]]; then
-        profile="sm"
-    else
-        echo "Inavlid profile : 'default' profile will be selected."
-        profile="default"
-    fi
-done
-
-if [[ $profile = "default" ]]; then
-    echo "Starting ActiveMQ server ..." >> $LOG
-    $activemq_path/bin/activemq start
-    echo "ActiveMQ server started" >> $LOG
-    sleep $SLEEP
-    sleep $SLEEP
-fi
-
-echo "Starting Stratos server ..." >> $LOG
-echo "$stratos_extract_path/bin/stratos.sh -Dprofile=$profile start"
-$stratos_extract_path/bin/stratos.sh -Dprofile=$profile start
-echo "Stratos server started" >> $LOG
-sleep $SLEEP
-sleep $SLEEP
-
-

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7e4b3aee/tools/stratos-installer/stratos-vcloud.sh
----------------------------------------------------------------------
diff --git a/tools/stratos-installer/stratos-vcloud.sh b/tools/stratos-installer/stratos-vcloud.sh
deleted file mode 100755
index 9bc7fa8..0000000
--- a/tools/stratos-installer/stratos-vcloud.sh
+++ /dev/null
@@ -1,52 +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 is invoked by setup.sh for configuring OpenStack IaaS information.
-# ----------------------------------------------------------------------------
-
-# Die on any error:
-set -e
-
-SLEEP=60
-export LOG=$log_path/stratos-vcloud.log
-
-source "./conf/stratos-setup.conf"
-
-if [[ ! -d $log_path ]]; then
-    mkdir -p $log_path
-fi
-
-pushd $stratos_extract_path
-
-echo "Set vCloud provider specific info in repository/conf/cloud-controller.xml" >> $LOG
-
-sed -i "s@VCLOUD_PROVIDER_START@@g" repository/conf/cloud-controller.xml
-sed -i "s/VCLOUD_IDENTITY/$vcloud_identity/g" repository/conf/cloud-controller.xml
-sed -i "s/VCLOUD_CREDENTIAL/$vcloud_credential/g" repository/conf/cloud-controller.xml
-sed -i "s@VCLOUD_ENDPOINT@$vcloud_jclouds_endpoint@g" repository/conf/cloud-controller.xml
-sed -i "s@VCLOUD_PROVIDER_END@@g" repository/conf/cloud-controller.xml
-sed -i "s@EC2_PROVIDER_START@!--@g" repository/conf/cloud-controller.xml
-sed -i "s@EC2_PROVIDER_END@--@g" repository/conf/cloud-controller.xml
-sed -i "s@OPENSTACK_PROVIDER_START@!--@g" repository/conf/cloud-controller.xml
-sed -i "s@OPENSTACK_PROVIDER_END@--@g" repository/conf/cloud-controller.xml
-
-popd

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7e4b3aee/tools/stratos-installer/vcloud.sh
----------------------------------------------------------------------
diff --git a/tools/stratos-installer/vcloud.sh b/tools/stratos-installer/vcloud.sh
index 6c594c0..02a2e0e 100755
--- a/tools/stratos-installer/vcloud.sh
+++ b/tools/stratos-installer/vcloud.sh
@@ -35,35 +35,18 @@ if [[ ! -d $log_path ]]; then
     mkdir -p $log_path
 fi
 
-pushd $cc_path
+pushd $stratos_extract_path
 
 echo "Set vCloud provider specific info in repository/conf/cloud-controller.xml" >> $LOG
 
-cp -f repository/conf/cloud-controller.xml repository/conf/cloud-controller.xml.orig
-cat repository/conf/cloud-controller.xml.orig | sed -e "s@VCLOUD_PROVIDER_START@@g" > repository/conf/cloud-controller.xml
-
-cp -f repository/conf/cloud-controller.xml repository/conf/cloud-controller.xml.orig
-cat repository/conf/cloud-controller.xml.orig | sed -e "s/VCLOUD_IDENTITY/$vcloud_identity/g" > repository/conf/cloud-controller.xml
-
-cp -f repository/conf/cloud-controller.xml repository/conf/cloud-controller.xml.orig
-cat repository/conf/cloud-controller.xml.orig | sed -e "s/VCLOUD_CREDENTIAL/$vcloud_credential/g" > repository/conf/cloud-controller.xml
-
-cp -f repository/conf/cloud-controller.xml repository/conf/cloud-controller.xml.orig
-cat repository/conf/cloud-controller.xml.orig | sed -e "s@VCLOUD_ENDPOINT@$vcloud_jclouds_endpoint@g" > repository/conf/cloud-controller.xml
-
-cp -f repository/conf/cloud-controller.xml repository/conf/cloud-controller.xml.orig
-cat repository/conf/cloud-controller.xml.orig | sed -e "s@VCLOUD_PROVIDER_END@@g" > repository/conf/cloud-controller.xml
-
-cp -f repository/conf/cloud-controller.xml repository/conf/cloud-controller.xml.orig
-cat repository/conf/cloud-controller.xml.orig | sed -e "s@EC2_PROVIDER_START@!--@g" > repository/conf/cloud-controller.xml
-
-cp -f repository/conf/cloud-controller.xml repository/conf/cloud-controller.xml.orig
-cat repository/conf/cloud-controller.xml.orig | sed -e "s@EC2_PROVIDER_END@--@g" > repository/conf/cloud-controller.xml
-
-cp -f repository/conf/cloud-controller.xml repository/conf/cloud-controller.xml.orig
-cat repository/conf/cloud-controller.xml.orig | sed -e "s@OPENSTACK_PROVIDER_START@!--@g" > repository/conf/cloud-controller.xml
-
-cp -f repository/conf/cloud-controller.xml repository/conf/cloud-controller.xml.orig
-cat repository/conf/cloud-controller.xml.orig | sed -e "s@OPENSTACK_PROVIDER_END@--@g" > repository/conf/cloud-controller.xml
+sed -i "s@VCLOUD_PROVIDER_START@@g" repository/conf/cloud-controller.xml
+sed -i "s/VCLOUD_IDENTITY/$vcloud_identity/g" repository/conf/cloud-controller.xml
+sed -i "s/VCLOUD_CREDENTIAL/$vcloud_credential/g" repository/conf/cloud-controller.xml
+sed -i "s@VCLOUD_ENDPOINT@$vcloud_jclouds_endpoint@g" repository/conf/cloud-controller.xml
+sed -i "s@VCLOUD_PROVIDER_END@@g" repository/conf/cloud-controller.xml
+sed -i "s@EC2_PROVIDER_START@!--@g" repository/conf/cloud-controller.xml
+sed -i "s@EC2_PROVIDER_END@--@g" repository/conf/cloud-controller.xml
+sed -i "s@OPENSTACK_PROVIDER_START@!--@g" repository/conf/cloud-controller.xml
+sed -i "s@OPENSTACK_PROVIDER_END@--@g" repository/conf/cloud-controller.xml
 
 popd


[3/3] git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incubator-stratos

Posted by is...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incubator-stratos


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

Branch: refs/heads/master
Commit: f11d283cdf814596af552fea685fab487b435e94
Parents: 7e4b3ae 32f7c80
Author: M. Isuru Tharanga Chrishantha Perera <is...@apache.org>
Authored: Fri Apr 4 07:06:23 2014 +0530
Committer: M. Isuru Tharanga Chrishantha Perera <is...@apache.org>
Committed: Fri Apr 4 07:06:23 2014 +0530

----------------------------------------------------------------------
 .../console/controllers/cartridgeSubscribeSubmit.jag     |  8 ++++++++
 .../console/themes/theme1/partials/mycartridges.hbs      |  4 ++--
 .../themes/theme1/partials/subscribe_cartridge.hbs       | 11 +++++------
 .../console/themes/theme1/ui/css/main.css                |  3 +++
 4 files changed, 18 insertions(+), 8 deletions(-)
----------------------------------------------------------------------



Re: Fwd: [2/3] git commit: Stratos Installer changes to use single product

Posted by Isuru Perera <is...@wso2.com>.
Okay great. I'll avoid the same mistake next time.

Thanks!

--
Sent from my mobile
On Apr 4, 2014 8:55 AM, "Nirmal Fernando" <ni...@gmail.com> wrote:

> No worries, now :-)
>
>
> On Fri, Apr 4, 2014 at 7:36 AM, Isuru Perera <is...@wso2.com> wrote:
>
>> Well, yeah! :) I haven't done this kind of work in a single commit.
>>
>> Perhaps I should have done the work in different commits.
>>
>> I'm just worried that the commit has overwritten the efforts of other
>> people including you!
>>
>> Is there a way to fix this?
>>
>> On Fri, Apr 4, 2014 at 7:22 AM, Nirmal Fernando <ni...@gmail.com>wrote:
>>
>>> Well, it's bit suprising that you weren't aware about the consequences
>>> of git rm :-)
>>>  On Apr 4, 2014 7:16 AM, "Isuru Perera" <is...@wso2.com> wrote:
>>>
>>>> Hi Devs,
>>>>
>>>> I pushed the Stratos installer changes.
>>>>
>>>> What I did was to 'git rm' old files and 'git mv' to rename.
>>>>
>>>> Looks like the commit went as file changes. Sorry for the mistake! :-/
>>>>
>>>> ---------- Forwarded message ----------
>>>> From: <is...@apache.org>
>>>> Date: Fri, Apr 4, 2014 at 7:06 AM
>>>> Subject: [2/3] git commit: Stratos Installer changes to use single
>>>> product
>>>> To: commits@stratos.incubator.apache.org
>>>>
>>>>
>>>> Stratos Installer changes to use single product
>>>>
>>>>
>>>> Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
>>>> Commit:
>>>> http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/7e4b3aee
>>>> Tree:
>>>> http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/7e4b3aee
>>>> Diff:
>>>> http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/7e4b3aee
>>>>
>>>> Branch: refs/heads/master
>>>> Commit: 7e4b3aee15be72f1fa2771c623af920a4d5e9688
>>>> Parents: 0955f29
>>>> Author: M. Isuru Tharanga Chrishantha Perera <is...@apache.org>
>>>> Authored: Thu Apr 3 17:25:36 2014 +0530
>>>> Committer: M. Isuru Tharanga Chrishantha Perera <is...@apache.org>
>>>> Committed: Thu Apr 3 17:25:36 2014 +0530
>>>>
>>>> ----------------------------------------------------------------------
>>>>  tools/stratos-installer/clean.sh                |  39 +-
>>>>  tools/stratos-installer/conf/setup.conf         |  95 +--
>>>>  tools/stratos-installer/conf/stratos-setup.conf | 103 ---
>>>>  tools/stratos-installer/ec2.sh                  |  49 +-
>>>>  tools/stratos-installer/openstack.sh            |  37 +-
>>>>  tools/stratos-installer/setup.sh                | 825
>>>> +++++++++----------
>>>>  tools/stratos-installer/start-servers.sh        | 107 +--
>>>>  tools/stratos-installer/stratos-clean.sh        | 104 ---
>>>>  tools/stratos-installer/stratos-db-clean.sh     |  24 -
>>>>  tools/stratos-installer/stratos-ec2.sh          |  56 --
>>>>  tools/stratos-installer/stratos-openstack.sh    |  52 --
>>>>  tools/stratos-installer/stratos-setup.sh        | 596 --------------
>>>>  .../stratos-installer/stratos-start-servers.sh  |  96 ---
>>>>  tools/stratos-installer/stratos-vcloud.sh       |  52 --
>>>>  tools/stratos-installer/vcloud.sh               |  37 +-
>>>>  15 files changed, 453 insertions(+), 1819 deletions(-)
>>>> ----------------------------------------------------------------------
>>>>
>>>>
>>>>
>>>> http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7e4b3aee/tools/stratos-installer/clean.sh
>>>> ----------------------------------------------------------------------
>>>> diff --git a/tools/stratos-installer/clean.sh
>>>> b/tools/stratos-installer/clean.sh
>>>> index 5692739..b74879d 100755
>>>> --- a/tools/stratos-installer/clean.sh
>>>> +++ b/tools/stratos-installer/clean.sh
>>>> @@ -63,10 +63,6 @@ function helpclean {
>>>>  }
>>>>
>>>>  function clean_validate {
>>>> -#    if [[ ( -z $mysql_user || -z $mysql_pass ) ]]; then
>>>> - #       helpclean
>>>> -  #      exit 1
>>>> -   # fi
>>>>      if [ -z $stratos_path ]; then
>>>>          echo "stratos_path is not set"
>>>>          exit 1
>>>> @@ -90,13 +86,8 @@ echo 'Waiting for applications to exit'
>>>>  sleep 15
>>>>
>>>>  if [[ ( -n $mysql_user && -n $mysql_pass ) ]]; then
>>>> -
>>>> -       echo 'Removing stratos_foundation database'
>>>> -       mysql -u $mysql_user -p$mysql_pass -e "DROP DATABASE IF EXISTS
>>>> stratos_foundation;"
>>>> -
>>>> -       echo 'Removing userstore database'
>>>> -       mysql -u $mysql_user -p$mysql_pass -e "DROP DATABASE IF EXISTS
>>>> userstore;"
>>>> -
>>>> +   echo 'Removing userstore database'
>>>> +   mysql -u $mysql_user -p$mysql_pass -e "DROP DATABASE IF EXISTS
>>>> $userstore_db_schema;"
>>>>  fi
>>>>
>>>>  if [[ -d $stratos_path/scripts ]]; then
>>>> @@ -104,29 +95,9 @@ if [[ -d $stratos_path/scripts ]]; then
>>>>     rm -rf $stratos_path/scripts
>>>>  fi
>>>>
>>>> -if [[ -d $mb_path ]]; then
>>>> -   echo 'Removing MB'
>>>> -   rm -rf $mb_path
>>>> -fi
>>>> -
>>>> -if [[ -d $cep_path ]]; then
>>>> -   echo 'Removing CEP'
>>>> -   rm -rf $cep_path
>>>> -fi
>>>> -
>>>> -if [[ -d $cc_path ]]; then
>>>> -   echo 'Removing CC'
>>>> -   rm -rf $cc_path
>>>> -fi
>>>> -
>>>> -if [[ -d $as_path ]]; then
>>>> -   echo 'Removing AS'
>>>> -   rm -rf $as_path
>>>> -fi
>>>> -
>>>> -if [[ -d $sm_path ]]; then
>>>> -   echo 'Removing SM'
>>>> -   rm -rf $sm_path
>>>> +if [[ -d $stratos_path ]]; then
>>>> +   echo 'Removing Stratos'
>>>> +   rm -rf $stratos_path/*
>>>>  fi
>>>>
>>>>  echo 'Removing logs'
>>>>
>>>>
>>>> http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7e4b3aee/tools/stratos-installer/conf/setup.conf
>>>> ----------------------------------------------------------------------
>>>> diff --git a/tools/stratos-installer/conf/setup.conf
>>>> b/tools/stratos-installer/conf/setup.conf
>>>> index 10b4163..2abcb3e 100644
>>>> --- a/tools/stratos-installer/conf/setup.conf
>>>> +++ b/tools/stratos-installer/conf/setup.conf
>>>> @@ -24,8 +24,7 @@
>>>>  #
>>>> ----------------------------------------------------------------------------
>>>>  #
>>>>  #  Configure below parameters to install Apache Stratos using
>>>> ../setup.sh.
>>>> -#  General configuration parameters are mandatory and other sections
>>>> are optional. Configure each section on each node where
>>>> -#  Stratos product is installed.
>>>> +#  General configuration parameters are mandatory and other sections
>>>> are optional.
>>>>  #
>>>>  #
>>>> ----------------------------------------------------------------------------
>>>>
>>>> @@ -34,7 +33,7 @@
>>>>  # General configuration
>>>>  #
>>>> ----------------------------------------------------------------------------
>>>>  export setup_path= #Folder path containing stratos_setup
>>>> -export stratos_pack_path= #Folder path containing stratos packages
>>>> +export stratos_packs= #Folder path containing stratos package and
>>>> other third party packs and jars
>>>>  export stratos_path= #Folder which stratos will be installed
>>>>
>>>>  export JAVA_HOME= #Java home path
>>>> @@ -45,62 +44,25 @@ export host_user="" #A host user account for the
>>>> machine which run Stratos compo
>>>>
>>>>  export stratos_domain="stratos.apache.org"
>>>>
>>>> -export mb_ip="mb-ip"   # Machine ip on which mb run
>>>> -export cep_ip="cep-ip" # Machine ip on which cep run
>>>> -export cc_ip="cc-ip"   # Machine ip on which cc run
>>>> -export as_ip="as-ip"   # Machine ip on which auto scalar run
>>>> -export sm_ip="sc-ip"   # Machine ip on which sc run
>>>> -export puppet_ip="puppet-ip"   # Machine ip on which puppet master run
>>>> +export host_ip="127.0.0.1" # Machine ip on host machine
>>>> +export offset=0
>>>> +
>>>> +export puppet_ip="127.0.0.1"   # Machine ip on which puppet master run
>>>>  export puppet_hostname="puppet-hostname" # Host name given to identify
>>>> the puppet master
>>>>  export puppet_environment="puppet_environment" # Name of puppet
>>>> environment
>>>>
>>>> -export cc_port_offset=1
>>>> -export sm_port_offset=2
>>>> -export as_port_offset=3
>>>> -export cep_port_offset=4
>>>> -export mb_port_offset=5
>>>> -
>>>> -export mb_port=5672 #default port which the message broker service runs
>>>> +export mb_ip="127.0.0.1" # Machine ip on which mb run
>>>> +export mb_port=61616 #default port which the message broker service
>>>> runs
>>>> +
>>>> +export stratos_extract_path=$stratos_path/"apache-stratos"
>>>> +export
>>>> stratos_pack_zip=$stratos_packs/"apache-stratos-4.0.0-SNAPSHOT.zip"
>>>>
>>>> -export mb_hostname="mb.$stratos_domain"
>>>> -export cep_hostname="cep.$stratos_domain"
>>>> -export sm_hostname="$stratos_domain"
>>>> -export cc_hostname="cc.$stratos_domain"
>>>> -export as_hostname="as.$stratos_domain"
>>>> +export activemq_pack=$stratos_packs/"apache-activemq-5.8.0-bin.tar.gz"
>>>> +export activemq_path=$stratos_path/"apache-activemq-5.8.0"
>>>>
>>>>  export resource_path=$setup_path/resources
>>>>
>>>>
>>>> -#
>>>> ----------------------------------------------------------------------------
>>>> -# MB configuration
>>>> -#
>>>> ----------------------------------------------------------------------------
>>>> -export mb_path=$stratos_path/"wso2mb-2.1.0"
>>>> -export mb_pack_path=$stratos_pack_path/"wso2mb-2.1.0.zip"
>>>> -
>>>> -
>>>> -#
>>>> ----------------------------------------------------------------------------
>>>> -# CEP configuration
>>>> -#
>>>> ----------------------------------------------------------------------------
>>>> -export cep_artifacts_path= #Folder path containing cep artifacts files
>>>> -export
>>>> cep_extension_jar=$stratos_pack_path/"org.apache.stratos.cep.extension-1.0.0-SNAPSHOT.jar"
>>>> # cep extensions jar file name
>>>> -export
>>>> andes_client_jar=$stratos_pack_path/"andes-client-0.13.wso2v8.jar" # andes
>>>> client jar file name
>>>> -
>>>> -export cep_path=$stratos_path/"wso2cep-3.0.0"
>>>> -export cep_pack_path=$stratos_pack_path/"wso2cep-3.0.0.zip"
>>>> -
>>>> -export cep_mb_ip=$mb_ip
>>>> -export cep_mb_listen_port=$(($mb_port + $mb_port_offset))
>>>> -
>>>> -
>>>> -#
>>>> ----------------------------------------------------------------------------
>>>> -# CC configuration
>>>> -#
>>>> ----------------------------------------------------------------------------
>>>> -export cc_path=$stratos_path/"apache-stratos-cc-4.0.0-SNAPSHOT"
>>>> -export
>>>> cc_pack_path=$stratos_pack_path/"apache-stratos-cc-4.0.0-SNAPSHOT.zip"
>>>> -
>>>> -export cc_mb_listen_port=$(($mb_port + $mb_port_offset))
>>>> -export cc_https_port=$((9443 + $cc_port_offset))
>>>> -
>>>>  # IaaS Providers
>>>>  #
>>>> ----------------------------------------------------------------------------
>>>>  # Set <iaas-name>_provider_enabled parameter to true to enable desired
>>>> IaaS. A hybrid cloud could be
>>>> @@ -121,7 +83,7 @@ export openstack_identity="stratos:stratos" #
>>>> Openstack project name:Openstack l
>>>>  export openstack_credential="password" # Openstack login password
>>>>  export openstack_jclouds_endpoint="http://hostname:5000/v2.0"
>>>>  export openstack_keypair_name=""
>>>> -export openstack_security_groups="security-groups"
>>>> +export openstack_security_groups=""
>>>>
>>>>  # vCloud
>>>>  export vcloud_provider_enabled=false
>>>> @@ -129,36 +91,13 @@ export vcloud_identity="stratos" # vCloud login
>>>> user
>>>>  export vcloud_credential="password" # vCloud login password
>>>>  export vcloud_jclouds_endpoint="https://vcloud/api"
>>>>
>>>> -#
>>>> ----------------------------------------------------------------------------
>>>> -# Auto Scalar configuration
>>>> -#
>>>> ----------------------------------------------------------------------------
>>>> -export as_path=$stratos_path/"apache-stratos-autoscaler-4.0.0-SNAPSHOT"
>>>> -export
>>>> as_pack_path=$stratos_pack_path/"apache-stratos-autoscaler-4.0.0-SNAPSHOT.zip"
>>>>
>>>> -export as_mb_listen_port=$(($mb_port + $mb_port_offset))
>>>> -export as_cc_https_port=$((9443 + $cc_port_offset))
>>>> -export as_sm_https_port=$((9443 + $sm_port_offset))
>>>> -
>>>> -
>>>> -#
>>>> ----------------------------------------------------------------------------
>>>> -# SM configuration
>>>> +# Database configuration
>>>>  #
>>>> ----------------------------------------------------------------------------
>>>> -export sm_path=$stratos_path/"apache-stratos-manager-4.0.0-SNAPSHOT"
>>>> -export
>>>> sm_pack_path=$stratos_pack_path/"apache-stratos-manager-4.0.0-SNAPSHOT.zip"
>>>> -export
>>>> mysql_connector_jar=$stratos_pack_path/"mysql-connector-java-5.1.25.jar"
>>>> #mysql connector jar file name
>>>> +export
>>>> mysql_connector_jar=$stratos_packs/"mysql-connector-java-5.1.29-bin.jar"
>>>> #mysql connector jar file name
>>>>
>>>>  export userstore_db_hostname="localhost"
>>>>  export userstore_db_schema="userstore"
>>>>  export userstore_db_port="3306"
>>>>  export userstore_db_user="root"
>>>> -export userstore_db_pass="mysql"
>>>> -
>>>> -export sm_puppet_ip=$puppet_ip
>>>> -export sm_puppet_hostname=$puppet_hostname
>>>> -export sm_puppet_environment=$puppet_environment
>>>> -export sm_mb_listen_port=$(($mb_port + $mb_port_offset))
>>>> -export sm_cc_https_port=$((9443 + $cc_port_offset))
>>>> -export sm_as_https_port=$((9443 + $as_port_offset))
>>>> -export sm_https_port=$((9443 + $sm_port_offset))
>>>> -export sm_http_port=$((9763 + $sm_port_offset))
>>>> -
>>>> +export userstore_db_pass="root"
>>>>
>>>>
>>>> http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7e4b3aee/tools/stratos-installer/conf/stratos-setup.conf
>>>> ----------------------------------------------------------------------
>>>> diff --git a/tools/stratos-installer/conf/stratos-setup.conf
>>>> b/tools/stratos-installer/conf/stratos-setup.conf
>>>> deleted file mode 100644
>>>> index 2abcb3e..0000000
>>>> --- a/tools/stratos-installer/conf/stratos-setup.conf
>>>> +++ /dev/null
>>>> @@ -1,103 +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.
>>>> -#
>>>> -#
>>>> ----------------------------------------------------------------------------
>>>> -#
>>>> -#  Server configuration script for Apache Stratos
>>>> -#
>>>> ----------------------------------------------------------------------------
>>>> -#
>>>> -#  Configure below parameters to install Apache Stratos using
>>>> ../setup.sh.
>>>> -#  General configuration parameters are mandatory and other sections
>>>> are optional.
>>>> -#
>>>> -#
>>>> ----------------------------------------------------------------------------
>>>> -
>>>> -
>>>> -#
>>>> ----------------------------------------------------------------------------
>>>> -# General configuration
>>>> -#
>>>> ----------------------------------------------------------------------------
>>>> -export setup_path= #Folder path containing stratos_setup
>>>> -export stratos_packs= #Folder path containing stratos package and
>>>> other third party packs and jars
>>>> -export stratos_path= #Folder which stratos will be installed
>>>> -
>>>> -export JAVA_HOME= #Java home path
>>>> -
>>>> -export log_path=/var/log/apache-stratos
>>>> -
>>>> -export host_user="" #A host user account for the machine which run
>>>> Stratos component(s)
>>>> -
>>>> -export stratos_domain="stratos.apache.org"
>>>> -
>>>> -export host_ip="127.0.0.1" # Machine ip on host machine
>>>> -export offset=0
>>>> -
>>>> -export puppet_ip="127.0.0.1"   # Machine ip on which puppet master run
>>>> -export puppet_hostname="puppet-hostname" # Host name given to identify
>>>> the puppet master
>>>> -export puppet_environment="puppet_environment" # Name of puppet
>>>> environment
>>>> -
>>>> -export mb_ip="127.0.0.1" # Machine ip on which mb run
>>>> -export mb_port=61616 #default port which the message broker service
>>>> runs
>>>> -
>>>> -export stratos_extract_path=$stratos_path/"apache-stratos"
>>>> -export
>>>> stratos_pack_zip=$stratos_packs/"apache-stratos-4.0.0-SNAPSHOT.zip"
>>>> -
>>>> -export activemq_pack=$stratos_packs/"apache-activemq-5.8.0-bin.tar.gz"
>>>> -export activemq_path=$stratos_path/"apache-activemq-5.8.0"
>>>> -
>>>> -export resource_path=$setup_path/resources
>>>> -
>>>> -
>>>> -# IaaS Providers
>>>> -#
>>>> ----------------------------------------------------------------------------
>>>> -# Set <iaas-name>_provider_enabled parameter to true to enable desired
>>>> IaaS. A hybrid cloud could be
>>>> -# created using multiple IaaSs.
>>>> -
>>>> -# EC2
>>>> -export ec2_provider_enabled=true
>>>> -export ec2_identity="<ec2_identity>"
>>>> -export ec2_credential="<ec2_credential>"
>>>> -export ec2_keypair_name="<ec2_keypair_name>"
>>>> -export ec2_owner_id="<ec2_owner_id>"
>>>> -export ec2_availability_zone="<ec2_availability_zone>"
>>>> -export ec2_security_groups="<ec2_security_groups>"
>>>> -
>>>> -# Openstack
>>>> -export openstack_provider_enabled=false
>>>> -export openstack_identity="stratos:stratos" # Openstack project
>>>> name:Openstack login user
>>>> -export openstack_credential="password" # Openstack login password
>>>> -export openstack_jclouds_endpoint="http://hostname:5000/v2.0"
>>>> -export openstack_keypair_name=""
>>>> -export openstack_security_groups=""
>>>> -
>>>> -# vCloud
>>>> -export vcloud_provider_enabled=false
>>>> -export vcloud_identity="stratos" # vCloud login user
>>>> -export vcloud_credential="password" # vCloud login password
>>>> -export vcloud_jclouds_endpoint="https://vcloud/api"
>>>> -
>>>> -
>>>> -# Database configuration
>>>> -#
>>>> ----------------------------------------------------------------------------
>>>> -export
>>>> mysql_connector_jar=$stratos_packs/"mysql-connector-java-5.1.29-bin.jar"
>>>> #mysql connector jar file name
>>>> -
>>>> -export userstore_db_hostname="localhost"
>>>> -export userstore_db_schema="userstore"
>>>> -export userstore_db_port="3306"
>>>> -export userstore_db_user="root"
>>>> -export userstore_db_pass="root"
>>>>
>>>>
>>>> http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7e4b3aee/tools/stratos-installer/ec2.sh
>>>> ----------------------------------------------------------------------
>>>> diff --git a/tools/stratos-installer/ec2.sh
>>>> b/tools/stratos-installer/ec2.sh
>>>> index 12aae8e..21d47a3 100755
>>>> --- a/tools/stratos-installer/ec2.sh
>>>> +++ b/tools/stratos-installer/ec2.sh
>>>> @@ -35,45 +35,22 @@ if [[ ! -d $log_path ]]; then
>>>>      mkdir -p $log_path
>>>>  fi
>>>>
>>>> -pushd $cc_path
>>>> +pushd $stratos_extract_path
>>>>
>>>>  echo "Set EC2 provider specific info in
>>>> repository/conf/cloud-controller.xml" >> $LOG
>>>>
>>>> -cp -f repository/conf/cloud-controller.xml
>>>> repository/conf/cloud-controller.xml.orig
>>>> -cat repository/conf/cloud-controller.xml.orig | sed -e
>>>> "s@EC2_PROVIDER_START@@g" > repository/conf/cloud-controller.xml
>>>> -
>>>> -cp -f repository/conf/cloud-controller.xml
>>>> repository/conf/cloud-controller.xml.orig
>>>> -cat repository/conf/cloud-controller.xml.orig | sed -e "s@EC2_IDENTITY
>>>> @$ec2_identity@g" > repository/conf/cloud-controller.xml
>>>> -
>>>> -cp -f repository/conf/cloud-controller.xml
>>>> repository/conf/cloud-controller.xml.orig
>>>> -cat repository/conf/cloud-controller.xml.orig | sed -e
>>>> "s@EC2_CREDENTIAL@$ec2_credential@g" >
>>>> repository/conf/cloud-controller.xml
>>>> -
>>>> -cp -f repository/conf/cloud-controller.xml
>>>> repository/conf/cloud-controller.xml.orig
>>>> -cat repository/conf/cloud-controller.xml.orig | sed -e "s@EC2_OWNER_ID
>>>> @$ec2_owner_id@g" > repository/conf/cloud-controller.xml
>>>> -
>>>> -cp -f repository/conf/cloud-controller.xml
>>>> repository/conf/cloud-controller.xml.orig
>>>> -cat repository/conf/cloud-controller.xml.orig | sed -e
>>>> "s@EC2_AVAILABILITY_ZONE@$ec2_availability_zone@g" >
>>>> repository/conf/cloud-controller.xml
>>>> -
>>>> -cp -f repository/conf/cloud-controller.xml
>>>> repository/conf/cloud-controller.xml.orig
>>>> -cat repository/conf/cloud-controller.xml.orig | sed -e
>>>> "s@EC2_SECURITY_GROUPS@$ec2_security_groups@g" >
>>>> repository/conf/cloud-controller.xml
>>>> -
>>>> -cp -f repository/conf/cloud-controller.xml
>>>> repository/conf/cloud-controller.xml.orig
>>>> -cat repository/conf/cloud-controller.xml.orig | sed -e "s@EC2_KEYPAIR
>>>> @$ec2_keypair_name@g" > repository/conf/cloud-controller.xml
>>>> -
>>>> -cp -f repository/conf/cloud-controller.xml
>>>> repository/conf/cloud-controller.xml.orig
>>>> -cat repository/conf/cloud-controller.xml.orig | sed -e
>>>> "s@EC2_PROVIDER_END@@g" > repository/conf/cloud-controller.xml
>>>> -
>>>> -cp -f repository/conf/cloud-controller.xml
>>>> repository/conf/cloud-controller.xml.orig
>>>> -cat repository/conf/cloud-controller.xml.orig | sed -e
>>>> "s@OPENSTACK_PROVIDER_START@!--@g" >
>>>> repository/conf/cloud-controller.xml
>>>> -
>>>> -cp -f repository/conf/cloud-controller.xml
>>>> repository/conf/cloud-controller.xml.orig
>>>> -cat repository/conf/cloud-controller.xml.orig | sed -e
>>>> "s@OPENSTACK_PROVIDER_END@--@g" > repository/conf/cloud-controller.xml
>>>> -
>>>> -cp -f repository/conf/cloud-controller.xml
>>>> repository/conf/cloud-controller.xml.orig
>>>> -cat repository/conf/cloud-controller.xml.orig | sed -e
>>>> "s@VCLOUD_PROVIDER_START@!--@g" > repository/conf/cloud-controller.xml
>>>> -
>>>> -cp -f repository/conf/cloud-controller.xml
>>>> repository/conf/cloud-controller.xml.orig
>>>> -cat repository/conf/cloud-controller.xml.orig | sed -e
>>>> "s@VCLOUD_PROVIDER_END@--@g" > repository/conf/cloud-controller.xml
>>>> +sed -i "s@EC2_PROVIDER_START@@g"  repository/conf/cloud-controller.xml
>>>> +sed -i "s@EC2_IDENTITY@$ec2_identity@g"
>>>> repository/conf/cloud-controller.xml
>>>> +sed -i "s@EC2_CREDENTIAL@$ec2_credential@g"
>>>> repository/conf/cloud-controller.xml
>>>> +sed -i "s@EC2_OWNER_ID@$ec2_owner_id@g"
>>>> repository/conf/cloud-controller.xml
>>>> +sed -i "s@EC2_AVAILABILITY_ZONE@$ec2_availability_zone@g"
>>>> repository/conf/cloud-controller.xml
>>>> +sed -i "s@EC2_SECURITY_GROUPS@$ec2_security_groups@g"
>>>> repository/conf/cloud-controller.xml
>>>> +sed -i "s@EC2_KEYPAIR@$ec2_keypair_name@g"
>>>> repository/conf/cloud-controller.xml
>>>> +sed -i "s@EC2_PROVIDER_END@@g" repository/conf/cloud-controller.xml
>>>> +sed -i "s@OPENSTACK_PROVIDER_START@!--@g"
>>>> repository/conf/cloud-controller.xml
>>>> +sed -i "s@OPENSTACK_PROVIDER_END@--@g"
>>>> repository/conf/cloud-controller.xml
>>>> +sed -i "s@VCLOUD_PROVIDER_START@!--@g"
>>>> repository/conf/cloud-controller.xml
>>>> +sed -i "s@VCLOUD_PROVIDER_END@--@g"
>>>> repository/conf/cloud-controller.xml
>>>>
>>>>  popd
>>>>
>>>>
>>>>
>>>> http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7e4b3aee/tools/stratos-installer/openstack.sh
>>>> ----------------------------------------------------------------------
>>>> diff --git a/tools/stratos-installer/openstack.sh
>>>> b/tools/stratos-installer/openstack.sh
>>>> index dd893da..e774468 100755
>>>> --- a/tools/stratos-installer/openstack.sh
>>>> +++ b/tools/stratos-installer/openstack.sh
>>>> @@ -35,35 +35,18 @@ if [[ ! -d $log_path ]]; then
>>>>      mkdir -p $log_path
>>>>  fi
>>>>
>>>> -pushd $cc_path
>>>> +pushd $stratos_extract_path
>>>>
>>>>  echo "Set OpenStack provider specific info in
>>>> repository/conf/cloud-controller.xml" >> $LOG
>>>>
>>>> -cp -f repository/conf/cloud-controller.xml
>>>> repository/conf/cloud-controller.xml.orig
>>>> -cat repository/conf/cloud-controller.xml.orig | sed -e
>>>> "s@OPENSTACK_PROVIDER_START@@g" > repository/conf/cloud-controller.xml
>>>> -
>>>> -cp -f repository/conf/cloud-controller.xml
>>>> repository/conf/cloud-controller.xml.orig
>>>> -cat repository/conf/cloud-controller.xml.orig | sed -e
>>>> "s@OPENSTACK_IDENTITY@$openstack_identity@g" >
>>>> repository/conf/cloud-controller.xml
>>>> -
>>>> -cp -f repository/conf/cloud-controller.xml
>>>> repository/conf/cloud-controller.xml.orig
>>>> -cat repository/conf/cloud-controller.xml.orig | sed -e
>>>> "s@OPENSTACK_CREDENTIAL@$openstack_credential@g" >
>>>> repository/conf/cloud-controller.xml
>>>> -
>>>> -cp -f repository/conf/cloud-controller.xml
>>>> repository/conf/cloud-controller.xml.orig
>>>> -cat repository/conf/cloud-controller.xml.orig | sed -e
>>>> "s@OPENSTACK_ENDPOINT@$openstack_jclouds_endpoint@g" >
>>>> repository/conf/cloud-controller.xml
>>>> -
>>>> -cp -f repository/conf/cloud-controller.xml
>>>> repository/conf/cloud-controller.xml.orig
>>>> -cat repository/conf/cloud-controller.xml.orig | sed -e
>>>> "s@OPENSTACK_PROVIDER_END@@g" > repository/conf/cloud-controller.xml
>>>> -
>>>> -cp -f repository/conf/cloud-controller.xml
>>>> repository/conf/cloud-controller.xml.orig
>>>> -cat repository/conf/cloud-controller.xml.orig | sed -e
>>>> "s@EC2_PROVIDER_START@!--@g" > repository/conf/cloud-controller.xml
>>>> -
>>>> -cp -f repository/conf/cloud-controller.xml
>>>> repository/conf/cloud-controller.xml.orig
>>>> -cat repository/conf/cloud-controller.xml.orig | sed -e
>>>> "s@EC2_PROVIDER_END@--@g" > repository/conf/cloud-controller.xml
>>>> -
>>>> -cp -f repository/conf/cloud-controller.xml
>>>> repository/conf/cloud-controller.xml.orig
>>>> -cat repository/conf/cloud-controller.xml.orig | sed -e
>>>> "s@VCLOUD_PROVIDER_START@!--@g" > repository/conf/cloud-controller.xml
>>>> -
>>>> -cp -f repository/conf/cloud-controller.xml
>>>> repository/conf/cloud-controller.xml.orig
>>>> -cat repository/conf/cloud-controller.xml.orig | sed -e
>>>> "s@VCLOUD_PROVIDER_END@--@g" > repository/conf/cloud-controller.xml
>>>> +sed -i "s@OPENSTACK_PROVIDER_START@@g"
>>>> repository/conf/cloud-controller.xml
>>>> +sed -i "s@OPENSTACK_IDENTITY@$openstack_identity@g"
>>>>  repository/conf/cloud-controller.xml
>>>> +sed -i "s@OPENSTACK_CREDENTIAL@$openstack_credential@g"
>>>>  repository/conf/cloud-controller.xml
>>>> +sed -i "s@OPENSTACK_ENDPOINT@$openstack_jclouds_endpoint@g"
>>>>  repository/conf/cloud-controller.xml
>>>> +sed -i "s@OPENSTACK_PROVIDER_END@@g"
>>>>  repository/conf/cloud-controller.xml
>>>> +sed -i "s@EC2_PROVIDER_START@!--@g"
>>>>  repository/conf/cloud-controller.xml
>>>> +sed -i "s@EC2_PROVIDER_END@--@g"  repository/conf/cloud-controller.xml
>>>> +sed -i "s@VCLOUD_PROVIDER_START@!--@g"
>>>>  repository/conf/cloud-controller.xml
>>>> +sed -i "s@VCLOUD_PROVIDER_END@--@g"
>>>>  repository/conf/cloud-controller.xml
>>>>
>>>>  popd
>>>>
>>>>
>>>> http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7e4b3aee/tools/stratos-installer/setup.sh
>>>> ----------------------------------------------------------------------
>>>> diff --git a/tools/stratos-installer/setup.sh
>>>> b/tools/stratos-installer/setup.sh
>>>> index e15617d..589ab79 100755
>>>> --- a/tools/stratos-installer/setup.sh
>>>> +++ b/tools/stratos-installer/setup.sh
>>>> @@ -26,105 +26,29 @@
>>>>  # Die on any error:
>>>>  set -e
>>>>
>>>> -SLEEP=60
>>>> -
>>>>  source "./conf/setup.conf"
>>>>  export LOG=$log_path/stratos-setup.log
>>>>
>>>> -mb="false"
>>>> -cc="false"
>>>> -as="false"
>>>> -sm="false"
>>>> -cep="false"
>>>> -product_list="mb;cc;cep;as;sm"
>>>> -enable_internal_git=false
>>>> +profile="default"
>>>> +config_mb="true"
>>>> +activemq_client_libs=(activemq-broker-5.8.0.jar
>>>>  activemq-client-5.8.0.jar  geronimo-j2ee-management_1.1_spec-1.0.1.jar
>>>>  geronimo-jms_1.1_spec-1.1.1.jar  hawtbuf-1.2.jar)
>>>> +auto_start_servers="false"
>>>>
>>>>  function help {
>>>>      echo ""
>>>>      echo "Usage:"
>>>> -    echo "setup.sh -u <host username> -p \"<product list>\""
>>>> -    echo "product list : [mb, cc, as, sm, cep]"
>>>> +    echo "setup.sh -p \"<profile>\" [-s]"
>>>> +    echo "product list : [default, cc, as, sm]"
>>>>      echo "Example:"
>>>> +    echo "sudo ./setup.sh -p \"default\""
>>>>      echo "sudo ./setup.sh -p \"cc\""
>>>> -    echo "sudo ./setup.sh -p \"all\""
>>>>      echo ""
>>>> -    echo "-u: <host username> The login user of the host."
>>>> -    echo "-p: <product list> Apache Stratos products to be installed
>>>> on this node. Provide one or more names of the servers."
>>>> -    echo "    The available servers are cc, as, sm or all. 'all' means
>>>> you need to setup all servers in this machine. Default is all"
>>>> -    echo "-g: <enable_internal_git> true|false Whether enable internal
>>>> git repo for Stratos2. Default is false"
>>>> +    echo "-p: <profile> Apache Stratos products to be installed on
>>>> this node. Provide one name of a profile."
>>>> +    echo "    The available profiles are cc, as, sm or default.
>>>> 'default' means you need to setup all servers in this machine. Default is
>>>> 'default' profile"
>>>> +    echo "-s: Silent mode - Start servers after installation."
>>>>      echo ""
>>>>  }
>>>>
>>>> -while getopts u:p:g: opts
>>>> -do
>>>> -  case $opts in
>>>> -    p)
>>>> -        product_list=${OPTARG}
>>>> -        ;;
>>>> -    g)
>>>> -        enable_internal_git=${OPTARG}
>>>> -        ;;
>>>> -    \?)
>>>> -        help
>>>> -        exit 1
>>>> -        ;;
>>>> -  esac
>>>> -done
>>>> -
>>>> -
>>>> -arr=$(echo $product_list | tr " " "\n")
>>>> -
>>>> -for x in $arr
>>>> -do
>>>> -    if [[ $x = "mb" ]]; then
>>>> -        mb="true"
>>>> -    fi
>>>> -    if [[ $x = "cc" ]]; then
>>>> -        cc="true"
>>>> -    fi
>>>> -    if [[ $x = "cep" ]]; then
>>>> -        cep="true"
>>>> -    fi
>>>> -    if [[ $x = "as" ]]; then
>>>> -        as="true"
>>>> -    fi
>>>> -    if [[ $x = "sm" ]]; then
>>>> -        sm="true"
>>>> -    fi
>>>> -    if [[ $x = "all" ]]; then
>>>> -        mb="true"
>>>> -        cep="true"
>>>> -        cc="true"
>>>> -        as="true"
>>>> -        sm="true"
>>>> -    fi
>>>> -done
>>>> -
>>>> -product_list=`echo $product_list | sed 's/^ *//g' | sed 's/ *$//g'`
>>>> -if [[ -z $product_list || $product_list = "" ]]; then
>>>> -    help
>>>> -    exit 1
>>>> -fi
>>>> -
>>>> -if [[ $host_user == "" ]]; then
>>>> -    echo "user provided in conf/setup.conf is null. Please provide a
>>>> user"
>>>> -    exit 1
>>>> -fi
>>>> -
>>>> -echo "user provided in conf/setup.conf is $host_user. If you want to
>>>> provide some other user name please specify it at the prompt."
>>>> -echo "If you want to continue with $host_user just press enter to
>>>> continue"
>>>> -read username
>>>> -if [[ $username != "" ]]; then
>>>> -    host_user=$username
>>>> -fi
>>>> -user=`id $host_user`
>>>> -if [[ $? = 1 ]]; then
>>>> -    echo "User $host_user does not exist. The system will create it."
>>>> -    adduser --home /home/$host_user $host_user
>>>> -fi
>>>> -
>>>> -export $host_user
>>>> -
>>>>  # Check validity of IP
>>>>  function valid_ip()
>>>>  {
>>>> @@ -143,19 +67,15 @@ function valid_ip()
>>>>      return $stat
>>>>  }
>>>>
>>>> -function helpsetup {
>>>> -    echo ""
>>>> -    echo "Please set up the $1 related environment variables correctly
>>>> in conf/setup.conf"
>>>> -    echo ""
>>>> -}
>>>> -
>>>> -function general_conf_validate {
>>>> +# General functions
>>>> +# -------------------------------------------------------------------
>>>> +function general_conf_validate() {
>>>>      if [[ ! -d $setup_path ]]; then
>>>>          echo "Please specify the setup_path folder which contains
>>>> stratos setup"
>>>>          exit 1
>>>>      fi
>>>> -    if [[ ! -d $stratos_pack_path ]]; then
>>>> -        echo "Please specify the stratos_pack_path folder which
>>>> contains stratos packages"
>>>> +    if [[ ! -d $stratos_packs ]]; then
>>>> +        echo "Please specify the stratos_packs folder which contains
>>>> stratos packages"
>>>>          exit 1
>>>>      fi
>>>>      if [[ ! -d $stratos_path ]]; then
>>>> @@ -172,72 +92,106 @@ function general_conf_validate {
>>>>          echo "Please specify the stratos domain"
>>>>          exit 1
>>>>      fi
>>>> -    if [[ (-z $mb_port_offset || -z $mb_ip || -z $mb_hostname) ]]; then
>>>> -        echo "Please specify the ip, the port offset and the hostname
>>>> of MB"
>>>> +    if [[ ! -f $stratos_pack_zip ]]; then
>>>> +        echo "Please copy the startos zip to the stratos pack folder"
>>>>          exit 1
>>>>      fi
>>>> -    if !(valid_ip $mb_ip); then
>>>> -        echo "Please provide valid ip for MB's ip"
>>>> +    if [[ -z $mb_port ]]; then
>>>> +        echo "Please specify the port of MB"
>>>>          exit 1
>>>>      fi
>>>> -}
>>>>
>>>> -function andes_jar_validate {
>>>> -    if [[ ($cep = "true" || $cc = "true" || $as = "true" || $sm =
>>>> "true") ]]; then
>>>> -        if [[ ! -f $andes_client_jar ]]; then
>>>> -            echo "Please copy the andes client jar into the same
>>>> folder as this command(stratos release pack folder) and update
>>>> conf/setup.conf file"
>>>> -            exit 1
>>>> -        fi
>>>> +    if [[ $auto_start_servers != "true" ]]; then
>>>> +       if [[ $profile = "default" ]]; then
>>>> +            read -p "Do you want to configure ActiveMQ [y/n]: " answer
>>>> +            if [[ $answer = y ]] ; then
>>>> +               mb_ip=$host_ip
>>>> +            else
>>>> +               echo "Provided mb_ip in conf/setup.conf will be used"
>>>> +               config_mb="false"
>>>> +            fi
>>>> +       fi
>>>>      fi
>>>>  }
>>>>
>>>> -function mb_conf_validate {
>>>> -    if [[ -z $mb_path ]]; then
>>>> -       helpsetup MB
>>>> -       exit 1
>>>> -    fi
>>>> +# Setup General
>>>> +function general_setup() {
>>>> +
>>>> +    cp -f ./config/all/repository/conf/activemq/jndi.properties
>>>> $stratos_extract_path/repository/conf/
>>>> +
>>>> +    pushd $stratos_extract_path
>>>> +    echo "In repository/conf/carbon.xml"
>>>> +    sed -i "s@<Offset>0</Offset>@<Offset>${offset}</Offset>@g"
>>>> repository/conf/carbon.xml
>>>> +
>>>> +    echo "In repository/conf/jndi.properties"
>>>> +    sed -i "s@MB_HOSTNAME:MB_LISTEN_PORT@$mb_ip:$mb_port@g"
>>>> repository/conf/jndi.properties
>>>> +    popd
>>>> +
>>>> +    for activemq_client_lib in "${activemq_client_libs[@]}"
>>>> +    do
>>>> +       cp -f $stratos_packs/$activemq_client_lib
>>>> $stratos_extract_path/repository/components/lib/
>>>> +    done
>>>>  }
>>>>
>>>> -function cep_conf_validate {
>>>> -    if [[ (-z $cep_path || -z $cep_port_offset) ]]; then
>>>> -       helpsetup CEP
>>>> -       exit 1
>>>> -    fi
>>>> -    if [[ ! -d $cep_artifacts_path ]]; then
>>>> -        echo "Please specify the cep_artifacts_path folder which
>>>> contains cep artifacts files"
>>>> -        exit 1
>>>> -    fi
>>>> -    if [[ ! -f $cep_extension_jar ]]; then
>>>> -        echo "Please copy the cep extension jar into the same folder
>>>> as this command(stratos release pack folder) and update conf/setup.conf
>>>> file"
>>>> +function activemq_validate() {
>>>> +    if [[ ! -f $activemq_pack ]]; then
>>>> +        echo "Please copy the activemq zip to the stratos pack folder
>>>> and update the JAR name in conf/setup.conf file"
>>>>          exit 1
>>>>      fi
>>>>  }
>>>>
>>>> -function cc_conf_validate {
>>>> -    if [[ (-z $cc_path || -z $cc_port_offset) ]]; then
>>>> -       helpsetup CC
>>>> -       exit 1
>>>> -    fi
>>>>
>>>> +# CC related functions
>>>> +# -------------------------------------------------------------------
>>>> +function cc_related_popup() {
>>>> +    while read -p "Please provide cloud controller ip:" cc_ip
>>>> +    do
>>>> +       if !(valid_ip $cc_ip); then
>>>> +           echo "Please provide valid ips for CC"
>>>> +       else
>>>> +            export cc_ip
>>>> +           break
>>>> +       fi
>>>> +    done
>>>> +
>>>> +    while read -p "Please provide cloud controller hostname:"
>>>> cc_hostname
>>>> +    do
>>>> +       if [[ -z $cc_hostname ]]; then
>>>> +           echo "Please specify valid hostname for CC"
>>>> +       else
>>>> +            export cc_hostname
>>>> +           break
>>>> +       fi
>>>> +    done
>>>> +
>>>> +    while read -p "Please provide cloud controller port offset:"
>>>> cc_port_offset
>>>> +    do
>>>> +       if [[ -z $cc_port_offset ]]; then
>>>> +           echo "Please specify the port offset of CC"
>>>> +       else
>>>> +            export cc_port_offset
>>>> +           break
>>>> +       fi
>>>> +    done
>>>> +}
>>>> +
>>>> +function cc_conf_validate() {
>>>>      if [[ $ec2_provider_enabled = "false" &&
>>>> $openstack_provider_enabled = "false" && $vcloud_provider_enabled = "false"
>>>> ]]; then
>>>>          echo "Please enable at least one of the IaaS providers in
>>>> conf/setup.conf file"
>>>>          exit 1
>>>>      fi
>>>> -
>>>>      if [[ $openstack_provider_enabled = "true" ]]; then
>>>>          if [[ ( -z $openstack_identity || -z $openstack_credential ||
>>>> -z $openstack_jclouds_endpoint ) ]]; then
>>>>              echo "Please set openstack configuration information in
>>>> conf/setup.conf file"
>>>>              exit 1
>>>>          fi
>>>>      fi
>>>> -
>>>>      if [[ $ec2_provider_enabled = "true" ]]; then
>>>>          if [[ ( -z $ec2_identity || -z $ec2_credential || -z
>>>> $ec2_keypair_name ) ]]; then
>>>>              echo "Please set ec2 configuration information in
>>>> conf/setup.conf file"
>>>>              exit 1
>>>>          fi
>>>>      fi
>>>> -
>>>>      if [[ $vcloud_provider_enabled = "true" ]]; then
>>>>          if [[ ( -z $vcloud_identity || -z $vcloud_credential || -z
>>>> $vcloud_jclouds_endpoint ) ]]; then
>>>>              echo "Please set vcloud configuration information in
>>>> conf/setup.conf file"
>>>> @@ -246,48 +200,135 @@ function cc_conf_validate {
>>>>      fi
>>>>  }
>>>>
>>>> -function as_conf_validate {
>>>> -    if [[ (-z $as_path || -z $as_port_offset) ]]; then
>>>> -       helpsetup AS
>>>> -       exit 1
>>>> -    fi
>>>> -    if [[ -z $cc_port_offset || -z $sm_port_offset ]]; then
>>>> -        echo "Please specify the port offset of SM and/or CC"
>>>> -        exit 1
>>>> +# Setup cc
>>>> +function cc_setup() {
>>>> +    echo "Setup CC" >> $LOG
>>>> +    echo "Configuring the Cloud Controller"
>>>> +
>>>> +    cp -f ./config/all/repository/conf/cloud-controller.xml
>>>> $stratos_extract_path/repository/conf/
>>>> +
>>>> +    export cc_path=$stratos_extract_path
>>>> +    echo "In repository/conf/cloud-controller.xml"
>>>> +    if [[ $ec2_provider_enabled = true ]]; then
>>>> +        ./ec2.sh
>>>>      fi
>>>> -    if [[ -z $sm_ip || -z $cc_ip ]]; then
>>>> -        echo "Please specify the ips of SM and/or CC"
>>>> -        exit 1
>>>> -    elif !(valid_ip $sm_ip && valid_ip $cc_ip ); then
>>>> -        echo "Please provide valid ips for SM and/or CC"
>>>> -        exit 1
>>>> +    if [[ $openstack_provider_enabled = true ]]; then
>>>> +        ./openstack.sh
>>>>      fi
>>>> -    if [[ -z $cc_hostname || -z $sm_hostname ]]; then
>>>> -       echo "Please specify valid hostname for SM and/or CC"
>>>> -       exit 1
>>>> +    if [[ $vcloud_provider_enabled = true ]]; then
>>>> +        ./vcloud.sh
>>>>      fi
>>>> +
>>>> +    pushd $stratos_extract_path
>>>> +
>>>> +    popd
>>>> +    echo "End configuring the Cloud Controller"
>>>>  }
>>>>
>>>> -function sm_conf_validate {
>>>> -    if [[ (-z $sm_path || -z $sm_port_offset) ]]; then
>>>> -       helpsetup SM
>>>> -       exit 1
>>>> -    fi
>>>> -    if [[ ! -f $mysql_connector_jar ]]; then
>>>> -        echo "Please copy the mysql connector jar to the stratos
>>>> release pack folder and update the JAR name in conf/setup.conf file"
>>>> -        exit 1
>>>> -    fi
>>>> -    if [[ -z $cc_port_offset || -z $as_port_offset ]]; then
>>>> -        echo "Please specify the port offset of AS and/or CC"
>>>> -        exit 1
>>>> -    fi
>>>> -    if [[ -z $sm_ip || -z $as_ip || -z $cc_ip ]]; then
>>>> -        echo "Please specify the ips of SM and/or AS and/or CC"
>>>> -        exit 1
>>>> -    elif !(valid_ip $sm_ip && valid_ip $cc_ip && valid_ip $as_ip); then
>>>> -        echo "Please provide valid ips for SM and/or AS and/or CC"
>>>> -        exit 1
>>>> +
>>>> +# AS related functions
>>>> +# -------------------------------------------------------------------
>>>> +function as_related_popup() {
>>>> +    while read -p "Please provide Auto Scalar ip:" as_ip
>>>> +    do
>>>> +       if !(valid_ip $as_ip); then
>>>> +           echo "Please provide valid ips for AS"
>>>> +       else
>>>> +            export as_ip
>>>> +           break
>>>> +       fi
>>>> +    done
>>>> +
>>>> +    while read -p "Please provide Auto Scala hostname:" as_hostname
>>>> +    do
>>>> +       if [[ -z $as_hostname ]]; then
>>>> +           echo "Please specify valid hostname for AS"
>>>> +       else
>>>> +            export as_hostname
>>>> +           break
>>>> +       fi
>>>> +    done
>>>> +
>>>> +    while read -p "Please provide Auto Scala port offset:"
>>>> as_port_offset
>>>> +    do
>>>> +       if [[ -z $as_port_offset ]]; then
>>>> +           echo "Please specify the port offset of AS"
>>>> +       else
>>>> +            export as_port_offset
>>>> +           break
>>>> +       fi
>>>> +    done
>>>> +}
>>>> +
>>>> +function as_conf_validate() {
>>>> +    if [[ !($profile = "default") ]]; then
>>>> +       cc_related_popup
>>>> +       sm_related_popup
>>>> +       export as_cc_https_port=$((9443 + $cc_port_offset))
>>>> +       export as_sm_https_port=$((9443 + $sm_port_offset))
>>>> +    else
>>>> +        cc_hostname=$stratos_domain
>>>> +        sm_hostname=$stratos_domain
>>>> +       export as_cc_https_port=$((9443 + $offset))
>>>> +       export as_sm_https_port=$((9443 + $offset))
>>>>      fi
>>>> +}
>>>> +
>>>> +# Setup AS
>>>> +function as_setup() {
>>>> +    echo "Setup AS" >> $LOG
>>>> +    echo "Configuring the Auto Scalar"
>>>> +
>>>> +    cp -f ./config/all/repository/conf/autoscaler.xml
>>>> $stratos_extract_path/repository/conf/
>>>> +
>>>> +    pushd $stratos_extract_path
>>>> +
>>>> +    echo "In repository/conf/autoscaler.xml"
>>>> +    sed -i "s@CC_HOSTNAME@$cc_hostname@g"
>>>> repository/conf/autoscaler.xml
>>>> +    sed -i "s@CC_LISTEN_PORT@$as_cc_https_port@g"
>>>> repository/conf/autoscaler.xml
>>>> +    sed -i "s@SM_HOSTNAME@$sm_hostname@g"
>>>> repository/conf/autoscaler.xml
>>>> +    sed -i "s@SM_LISTEN_PORT@$as_sm_https_port@g"
>>>> repository/conf/autoscaler.xml
>>>> +
>>>> +    popd
>>>> +    echo "End configuring the Auto scalar"
>>>> +}
>>>> +
>>>> +
>>>> +# SM related functions
>>>> +# -------------------------------------------------------------------
>>>> +function sm_related_popup() {
>>>> +    while read -p "Please provide Stratos Manager ip:" sm_ip
>>>> +    do
>>>> +       if !(valid_ip $sm_ip); then
>>>> +           echo "Please provide valid ips for SM"
>>>> +       else
>>>> +            export sm_ip
>>>> +           break
>>>> +       fi
>>>> +    done
>>>> +
>>>> +    while read -p "Please provide Stratos Manager hostname:"
>>>> sm_hostname
>>>> +    do
>>>> +       if [[ -z $sm_hostname ]]; then
>>>> +           echo "Please specify valid hostname for SM"
>>>> +       else
>>>> +            export sm_hostname
>>>> +           break
>>>> +       fi
>>>> +    done
>>>> +
>>>> +    while read -p "Please provide Stratos Manager port offset:"
>>>> sm_port_offset
>>>> +    do
>>>> +       if [[ -z $sm_port_offset ]]; then
>>>> +           echo "Please specify the port offset of SM"
>>>> +       else
>>>> +            export sm_port_offset
>>>> +           break
>>>> +       fi
>>>> +    done
>>>> +}
>>>> +
>>>> +function sm_conf_validate() {
>>>>      if [[ -z $puppet_ip ]]; then
>>>>          echo "Please specify the ip of puppet master"
>>>>          exit 1
>>>> @@ -303,348 +344,219 @@ function sm_conf_validate {
>>>>          echo "Please specify the relevant puppet environment"
>>>>          exit 1
>>>>      fi
>>>> -    if [[ -z $cc_hostname || -z $as_hostname ]]; then
>>>> -       echo "Please specify valid hostname for AS and/or CC"
>>>> -       exit 1
>>>> +    if [[ ! -f $mysql_connector_jar ]]; then
>>>> +        echo "Please copy the mysql connector jar to the stratos
>>>> release pack folder and update the JAR name in conf/setup.conf file"
>>>> +        exit 1
>>>>      fi
>>>> -}
>>>> -
>>>>
>>>> -general_conf_validate
>>>> -andes_jar_validate
>>>> -if [[ $mb = "true" ]]; then
>>>> -    mb_conf_validate
>>>> -fi
>>>> -if [[ $cep = "true" ]]; then
>>>> -    cep_conf_validate
>>>> -fi
>>>> -if [[ $cc = "true" ]]; then
>>>> -    cc_conf_validate
>>>> -fi
>>>> -if [[ $as = "true" ]]; then
>>>> -    as_conf_validate
>>>> -fi
>>>> -if [[ $sm = "true" ]]; then
>>>> -    sm_conf_validate
>>>> -fi
>>>> -
>>>> -
>>>> -# Make sure the user is running as root.
>>>> -if [ "$UID" -ne "0" ]; then
>>>> -       echo ; echo "  You must be root to run $0.  (Try running 'sudo
>>>> bash' first.)" ; echo
>>>> -       exit 69
>>>> -fi
>>>> +    if [[ !($profile = "default") ]]; then
>>>> +       cc_related_popup
>>>> +       as_related_popup
>>>> +       export sm_cc_https_port=$((9443 + $cc_port_offset))
>>>> +       export sm_as_https_port=$((9443 + $as_port_offset))
>>>> +    else
>>>> +        export cc_hostname=$stratos_domain
>>>> +        export as_hostname=$stratos_domain
>>>> +       export sm_cc_https_port=$((9443 + $offset))
>>>> +       export sm_as_https_port=$((9443 + $offset))
>>>> +    fi
>>>> +    export sm_https_port=$((9443 + $offset))
>>>> +}
>>>>
>>>> -if [[ ! -d $log_path ]]; then
>>>> -    mkdir -p $log_path
>>>> -fi
>>>> +# Setup SM
>>>> +function sm_setup() {
>>>> +    echo "Setup SM" >> $LOG
>>>> +    echo "Configuring Stratos Manager"
>>>>
>>>> +    cp -f ./config/all/repository/conf/cartridge-config.properties
>>>> $stratos_extract_path/repository/conf/
>>>> +    cp -f
>>>> ./config/all/repository/conf/datasources/master-datasources.xml
>>>> $stratos_extract_path/repository/conf/datasources/
>>>> +    cp -f $mysql_connector_jar
>>>> $stratos_extract_path/repository/components/lib/
>>>>
>>>> -echo ""
>>>> -echo "For all the questions asked while during executing the script
>>>> please just press the enter button"
>>>> -echo ""
>>>> +    pushd $stratos_extract_path
>>>>
>>>> -if [[ $mb = "true" ]]; then
>>>> -    if [[ ! -d $mb_path ]]; then
>>>> -        echo "Extracting Message Broker"
>>>> -        unzip -q $mb_pack_path -d $stratos_path
>>>> -    fi
>>>> -fi
>>>> -if [[ $cep = "true" ]]; then
>>>> -    if [[ ! -d $cep_path ]]; then
>>>> -        echo "Extracting Complex Event Processor"
>>>> -        unzip -q $cep_pack_path -d $stratos_path
>>>> -    fi
>>>> -fi
>>>> -if [[ $cc = "true" ]]; then
>>>> -    if [[ ! -d $cc_path ]]; then
>>>> -        echo "Extracting Cloud Controller"
>>>> -        unzip -q $cc_pack_path -d $stratos_path
>>>> -    fi
>>>> -fi
>>>> -if [[ $as = "true" ]]; then
>>>> -    if [[ ! -d $as_path ]]; then
>>>> -        echo "Extracting Autoscaler"
>>>> -        unzip -q $as_pack_path -d $stratos_path
>>>> -    fi
>>>> -fi
>>>> -if [[ $sm = "true" ]]; then
>>>> -    if [[ ! -d $resource_path ]]; then
>>>> -        cp -rf ./resources $stratos_path
>>>> -    fi
>>>> -    if [[ ! -d $sm_path ]]; then
>>>> -        echo "Extracting Stratos Manager"
>>>> -        unzip -q $sm_pack_path -d $stratos_path
>>>> -    fi
>>>> -fi
>>>> +    echo "In repository/conf/cartridge-config.properties"
>>>> +    sed -i "s@CC_HOSTNAME:CC_HTTPS_PORT@
>>>> $cc_hostname:$sm_cc_https_port@g"
>>>> repository/conf/cartridge-config.properties
>>>> +    sed -i "s@AS_HOSTNAME:AS_HTTPS_PORT@
>>>> $as_hostname:$sm_as_https_port@g"
>>>> repository/conf/cartridge-config.properties
>>>> +    sed -i "s@PUPPET_IP@$puppet_ip@g"
>>>> repository/conf/cartridge-config.properties
>>>> +    sed -i "s@PUPPET_HOSTNAME@$puppet_hostname@g"
>>>> repository/conf/cartridge-config.properties
>>>> +    sed -i "s@PUPPET_ENV@$puppet_environment@g"
>>>> repository/conf/cartridge-config.properties
>>>>
>>>> +    echo "In repository/conf/datasources/master-datasources.xml"
>>>> +    sed -i "s@USERSTORE_DB_HOSTNAME@$userstore_db_hostname@g"
>>>> repository/conf/datasources/master-datasources.xml
>>>> +    sed -i "s@USERSTORE_DB_PORT@$userstore_db_port@g"
>>>> repository/conf/datasources/master-datasources.xml
>>>> +    sed -i "s@USERSTORE_DB_SCHEMA@$userstore_db_schema@g"
>>>> repository/conf/datasources/master-datasources.xml
>>>> +    sed -i "s@USERSTORE_DB_USER@$userstore_db_user@g"
>>>> repository/conf/datasources/master-datasources.xml
>>>> +    sed -i "s@USERSTORE_DB_PASS@$userstore_db_pass@g"
>>>> repository/conf/datasources/master-datasources.xml
>>>>
>>>> +    popd
>>>>
>>>> -# ------------------------------------------------
>>>> -# Setup MB
>>>> -# ------------------------------------------------
>>>> -function mb_setup {
>>>> -    echo "Setup MB" >> $LOG
>>>> -    echo "Configuring the Message Broker"
>>>> +    # Database Configuration
>>>> +    # -----------------------------------------------
>>>> +    echo "Create and configure MySql Databases" >> $LOG
>>>> +    echo "Creating userstore database"
>>>>
>>>> -    pushd $mb_path
>>>> +    pushd $resource_path
>>>> +    sed -i "s@USERSTORE_DB_SCHEMA@$userstore_db_schema@g" mysql.sql
>>>>
>>>> -    echo "In repository/conf/carbon.xml"
>>>> -    cp -f repository/conf/carbon.xml repository/conf/carbon.xml.orig
>>>> -    cat repository/conf/carbon.xml.orig | sed -e "s@<Offset>0</Offset>@<Offset>${mb_port_offset}</Offset>@g"
>>>> > repository/conf/carbon.xml
>>>> +    popd
>>>>
>>>> -    echo "End configuring the Message Broker"
>>>> -    popd #mb_path
>>>> +    mysql -u$userstore_db_user -p$userstore_db_pass <
>>>> $resource_path/mysql.sql
>>>> +    echo "End configuring the SM"
>>>>  }
>>>>
>>>> -if [[ $mb = "true" ]]; then
>>>> -    mb_setup
>>>> -fi
>>>>
>>>> -# ------------------------------------------------
>>>>  # Setup CEP
>>>> -# ------------------------------------------------
>>>> -function cep_setup {
>>>> +function cep_setup() {
>>>>      echo "Setup CEP" >> $LOG
>>>>      echo "Configuring the Complex Event Processor"
>>>>
>>>> -    cp -f ./config/cep/repository/conf/jndi.properties
>>>> $cep_path/repository/conf/
>>>> -    cp -f $cep_extension_jar $cep_path/repository/components/lib/
>>>> -    cp -f $andes_client_jar $cep_path/repository/components/dropins/
>>>> -    cp -f $cep_artifacts_path/eventbuilders/*.xml
>>>> $cep_path/repository/deployment/server/eventbuilders/
>>>> -    cp -f $cep_artifacts_path/inputeventadaptors/*.xml
>>>> $cep_path/repository/deployment/server/inputeventadaptors/
>>>> -    cp -f $cep_artifacts_path/outputeventadaptors/*.xml
>>>> $cep_path/repository/deployment/server/outputeventadaptors/
>>>> -    cp -f $cep_artifacts_path/executionplans/*.xml
>>>> $cep_path/repository/deployment/server/executionplans/
>>>> -    cp -f $cep_artifacts_path/eventformatters/*.xml
>>>> $cep_path/repository/deployment/server/eventformatters/
>>>> -    cp -f $cep_artifacts_path/streamdefinitions/*.xml
>>>> $cep_path/repository/conf/
>>>> -
>>>> -    pushd $cep_path
>>>> -
>>>> -    echo "In repository/conf/carbon.xml"
>>>> -    cp -f repository/conf/carbon.xml repository/conf/carbon.xml.orig
>>>> -    cat repository/conf/carbon.xml.orig | sed -e "s@<Offset>0</Offset>@<Offset>${cep_port_offset}</Offset>@g"
>>>> > repository/conf/carbon.xml
>>>> -
>>>> -    echo "In repository/conf/jndi.properties"
>>>> -    cp -f repository/conf/jndi.properties
>>>> repository/conf/jndi.properties.orig
>>>> -    cat repository/conf/jndi.properties.orig | sed -e "s@MB_HOSTNAME
>>>> :MB_LISTEN_PORT@$mb_hostname:$cep_mb_listen_port@g" >
>>>> repository/conf/jndi.properties
>>>> +    pushd $stratos_extract_path
>>>>
>>>>      echo "In outputeventadaptors"
>>>> -    cp -f
>>>> repository/deployment/server/outputeventadaptors/JMSOutputAdaptor.xml
>>>> repository/deployment/server/outputeventadaptors/JMSOutputAdaptor.xml.orig
>>>> -    cat
>>>> repository/deployment/server/outputeventadaptors/JMSOutputAdaptor.xml.orig
>>>> | sed -e "s@CEP_HOME@$cep_path@g" >
>>>> repository/deployment/server/outputeventadaptors/JMSOutputAdaptor.xml
>>>>
>>>> -    echo "In repository/conf/siddhi/siddhi.extension"
>>>> -    cp -f repository/conf/siddhi/siddhi.extension
>>>> repository/conf/siddhi/siddhi.extension.orig
>>>> -    echo
>>>> "org.apache.stratos.cep.extension.GradientFinderWindowProcessor" >>
>>>> repository/conf/siddhi/siddhi.extension.orig
>>>> -    echo
>>>> "org.apache.stratos.cep.extension.SecondDerivativeFinderWindowProcessor" >>
>>>> repository/conf/siddhi/siddhi.extension.orig
>>>> -    echo
>>>> "org.apache.stratos.cep.extension.FaultHandlingWindowProcessor" >>
>>>> repository/conf/siddhi/siddhi.extension.orig
>>>> -    mv -f repository/conf/siddhi/siddhi.extension.orig
>>>> repository/conf/siddhi/siddhi.extension
>>>> +    sed -i "s@CEP_HOME@$stratos_extract_path@g"
>>>> repository/deployment/server/outputeventadaptors/JMSOutputAdaptor.xml
>>>> +    sed -i "s@MB_HOSTNAME:MB_LISTEN_PORT@$mb_ip:$mb_port@g"
>>>> repository/deployment/server/outputeventadaptors/JMSOutputAdaptor.xml
>>>>
>>>>      echo "End configuring the Complex Event Processor"
>>>> -    popd #cep_path
>>>> +    popd
>>>>  }
>>>> -if [[ $cep = "true" ]]; then
>>>> -    cep_setup
>>>> -fi
>>>>
>>>>
>>>>  # ------------------------------------------------
>>>> -# Setup CC
>>>> +# Execution
>>>>  # ------------------------------------------------
>>>> -function cc_setup {
>>>> -    echo "Setup CC" >> $LOG
>>>> -    echo "Configuring the Cloud Controller"
>>>> -
>>>> -    echo "Creating payload directory ... " >> $LOG
>>>> -    if [[ ! -d $cc_path/repository/resources/payload ]]; then
>>>> -        mkdir -p $cc_path/repository/resources/payload
>>>> -    fi
>>>> -
>>>> -    cp -f ./config/cc/repository/conf/cloud-controller.xml
>>>> $cc_path/repository/conf/
>>>> -    cp -f ./config/cc/repository/conf/carbon.xml
>>>> $cc_path/repository/conf/
>>>> -    cp -f ./config/cc/repository/conf/jndi.properties
>>>> $cc_path/repository/conf/
>>>> -    cp -f $andes_client_jar $cc_path/repository/components/dropins/
>>>> -
>>>> -    echo "In repository/conf/cloud-controller.xml"
>>>> -    if [[ $ec2_provider_enabled = true ]]; then
>>>> -        ./ec2.sh
>>>> -    fi
>>>> -    if [[ $openstack_provider_enabled = true ]]; then
>>>> -        ./openstack.sh
>>>> -    fi
>>>> -    if [[ $vcloud_provider_enabled = true ]]; then
>>>> -        ./vcloud.sh
>>>> -    fi
>>>> -
>>>> -    pushd $cc_path
>>>> -
>>>> -    cp -f repository/conf/cloud-controller.xml
>>>> repository/conf/cloud-controller.xml.orig
>>>> -    cat repository/conf/cloud-controller.xml.orig | sed -e
>>>> "s@MB_HOSTNAME:MB_LISTEN_PORT@$mb_hostname:$cc_mb_listen_port@g" >
>>>> repository/conf/cloud-controller.xml
>>>>
>>>> -    echo "In repository/conf/carbon.xml"
>>>> -    cp -f repository/conf/carbon.xml repository/conf/carbon.xml.orig
>>>> -    cat repository/conf/carbon.xml.orig | sed -e "s@CC_PORT_OFFSET
>>>> @$cc_port_offset@g" > repository/conf/carbon.xml
>>>> -
>>>> -    echo "In repository/conf/jndi.properties"
>>>> -    cp -f repository/conf/jndi.properties
>>>> repository/conf/jndi.properties.orig
>>>> -    cat repository/conf/jndi.properties.orig | sed -e "s@MB_HOSTNAME
>>>> :MB_LISTEN_PORT@$mb_hostname:$cc_mb_listen_port@g" >
>>>> repository/conf/jndi.properties
>>>> -
>>>> -    popd #cc_path
>>>> -    echo "End configuring the Cloud Controller"
>>>> -}
>>>> +while getopts p:s opts
>>>> +do
>>>> +  case $opts in
>>>> +    p)
>>>> +        profile_list=${OPTARG}
>>>> +        ;;
>>>> +    s)
>>>> +        auto_start_servers="true"
>>>> +        ;;
>>>> +    \?)
>>>> +        help
>>>> +        exit 1
>>>> +        ;;
>>>> +  esac
>>>> +done
>>>>
>>>> -if [[ $cc = "true" ]]; then
>>>> -   cc_setup
>>>> +profile_list=`echo $profile_list | sed 's/^ *//g' | sed 's/ *$//g'`
>>>> +if [[ !(-z $profile_list || $profile_list = "") ]]; then
>>>> +    arr=$(echo $profile_list | tr " " "\n")
>>>> +echo $arr
>>>> +    for x in $arr
>>>> +    do
>>>> +       if [[ $x = "default" ]]; then
>>>> +            profile="default"
>>>> +       elif [[ $x = "cc" ]]; then
>>>> +            profile="cc"
>>>> +        elif [[ $x = "as" ]]; then
>>>> +            profile="as"
>>>> +        elif [[ $x = "sm" ]]; then
>>>> +            profile="sm"
>>>> +        else
>>>> +            echo "Invalid profile."
>>>> +            exit 1
>>>> +       fi
>>>> +    done
>>>> +    echo "You have selected the profile : $profile"
>>>> +else
>>>> +    echo "You have not provided a profile : default profile will be
>>>> selected."
>>>>  fi
>>>>
>>>> -# ------------------------------------------------
>>>> -# Setup AS
>>>> -# ------------------------------------------------
>>>> -function as_setup {
>>>> -    echo "Setup AS" >> $LOG
>>>> -    echo "Configuring the Auto Scalar"
>>>> -
>>>> -    cp -f ./config/as/repository/conf/carbon.xml
>>>> $as_path/repository/conf/
>>>> -    cp -f ./config/as/repository/conf/jndi.properties
>>>> $as_path/repository/conf/
>>>> -    cp -f ./config/as/repository/conf/autoscaler.xml
>>>> $as_path/repository/conf/
>>>> -    cp -f $andes_client_jar $as_path/repository/components/dropins/
>>>> -
>>>> -    pushd $as_path
>>>> -
>>>> -    echo "In repository/conf/carbon.xml"
>>>> -    cp -f repository/conf/carbon.xml repository/conf/carbon.xml.orig
>>>> -    cat repository/conf/carbon.xml.orig | sed -e "s@AS_PORT_OFFSET
>>>> @$as_port_offset@g" > repository/conf/carbon.xml
>>>> -
>>>> -    echo "In repository/conf/jndi.properties"
>>>> -    cp -f repository/conf/jndi.properties
>>>> repository/conf/jndi.properties.orig
>>>> -    cat repository/conf/jndi.properties.orig | sed -e "s@MB_HOSTNAME
>>>> :MB_LISTEN_PORT@$mb_hostname:$as_mb_listen_port@g" >
>>>> repository/conf/jndi.properties
>>>> -
>>>> -    echo "In repository/conf/autoscaler.xml"
>>>> -    cp -f repository/conf/autoscaler.xml
>>>> repository/conf/autoscaler.xml.orig
>>>> -    cat repository/conf/autoscaler.xml.orig | sed -e "s@CC_HOSTNAME
>>>> @$cc_hostname@g" > repository/conf/autoscaler.xml
>>>>
>>>> -    cp -f repository/conf/autoscaler.xml
>>>> repository/conf/autoscaler.xml.orig
>>>> -    cat repository/conf/autoscaler.xml.orig | sed -e "s@CC_LISTEN_PORT
>>>> @$as_cc_https_port@g" > repository/conf/autoscaler.xml
>>>> -
>>>> -    cp -f repository/conf/autoscaler.xml
>>>> repository/conf/autoscaler.xml.orig
>>>> -    cat repository/conf/autoscaler.xml.orig | sed -e "s@SM_HOSTNAME
>>>> @$sm_hostname@g" > repository/conf/autoscaler.xml
>>>> -
>>>> -    cp -f repository/conf/autoscaler.xml
>>>> repository/conf/autoscaler.xml.orig
>>>> -    cat repository/conf/autoscaler.xml.orig | sed -e "s@SM_LISTEN_PORT
>>>> @$as_sm_https_port@g" > repository/conf/autoscaler.xml
>>>> -
>>>> -    popd #as_path
>>>> -    echo "End configuring the Auto smalar"
>>>> -}
>>>> -
>>>> -if [[ $as = "true" ]]; then
>>>> -    as_setup
>>>> +if [[ $host_user == "" ]]; then
>>>> +    echo "user provided in conf/setup.conf is null. Please provide a
>>>> user"
>>>> +    exit 1
>>>>  fi
>>>>
>>>> +echo "user provided in conf/setup.conf is $host_user. If you want to
>>>> provide some other user name please specify it at the prompt."
>>>> +echo "If you want to continue with $host_user just press enter to
>>>> continue"
>>>> +read username
>>>> +if [[ $username != "" ]]; then
>>>> +    host_user=$username
>>>> +fi
>>>> +user=`id $host_user`
>>>> +if [[ $? = 1 ]]; then
>>>> +    echo "User $host_user does not exist. The system will create it."
>>>> +    adduser --home /home/$host_user $host_user
>>>> +fi
>>>>
>>>> +export $host_user
>>>>
>>>> -# ------------------------------------------------
>>>> -# Setup SM
>>>> -# ------------------------------------------------
>>>> -function sm_setup {
>>>> -    echo "Setup SM" >> $LOG
>>>> -    echo "Configuring Stratos Manager"
>>>> -
>>>> -    cp -f ./config/sm/repository/conf/carbon.xml
>>>> $sm_path/repository/conf/
>>>> -    cp -f ./config/sm/repository/conf/jndi.properties
>>>> $sm_path/repository/conf/
>>>> -    cp -f ./config/sm/repository/conf/cartridge-config.properties
>>>> $sm_path/repository/conf/
>>>> -    cp -f
>>>> ./config/sm/repository/conf/datasources/master-datasources.xml
>>>> $sm_path/repository/conf/datasources/
>>>> -    cp -f $mysql_connector_jar $sm_path/repository/components/lib/
>>>> -    cp -f $andes_client_jar $sm_path/repository/components/dropins/
>>>> -
>>>> -    pushd $sm_path
>>>> -
>>>> -    echo "In repository/conf/carbon.xml"
>>>> -    cp -f repository/conf/carbon.xml repository/conf/carbon.xml.orig
>>>> -    cat repository/conf/carbon.xml.orig | sed -e "s@SC_PORT_OFFSET
>>>> @$sm_port_offset@g" > repository/conf/carbon.xml
>>>> -
>>>> -    echo "In repository/conf/jndi.properties"
>>>> -    cp -f repository/conf/jndi.properties
>>>> repository/conf/jndi.properties.orig
>>>> -    cat repository/conf/jndi.properties.orig | sed -e "s@MB_HOSTNAME
>>>> :MB_LISTEN_PORT@$mb_hostname:$sm_mb_listen_port@g" >
>>>> repository/conf/jndi.properties
>>>> -
>>>> -    echo "In repository/conf/cartridge-config.properties" >> $LOG
>>>> -    cp -f repository/conf/cartridge-config.properties
>>>> repository/conf/cartridge-config.properties.orig
>>>> -    cat repository/conf/cartridge-config.properties.orig | sed -e
>>>> "s@CC_HOSTNAME:CC_HTTPS_PORT@$cc_hostname:$sm_cc_https_port@g" >
>>>> repository/conf/cartridge-config.properties
>>>> -
>>>> -    cp -f repository/conf/cartridge-config.properties
>>>> repository/conf/cartridge-config.properties.orig
>>>> -    cat repository/conf/cartridge-config.properties.orig | sed -e
>>>> "s@AS_HOSTNAME:AS_HTTPS_PORT@$as_hostname:$sm_as_https_port@g" >
>>>> repository/conf/cartridge-config.properties
>>>> -
>>>> -    cp -f repository/conf/cartridge-config.properties
>>>> repository/conf/cartridge-config.properties.orig
>>>> -    cat repository/conf/cartridge-config.properties.orig | sed -e
>>>> "s@PUPPET_IP@$sm_puppet_ip@g" >
>>>> repository/conf/cartridge-config.properties
>>>> -
>>>> -    cp -f repository/conf/cartridge-config.properties
>>>> repository/conf/cartridge-config.properties.orig
>>>> -    cat repository/conf/cartridge-config.properties.orig | sed -e
>>>> "s@PUPPET_HOSTNAME@$sm_puppet_hostname@g" >
>>>> repository/conf/cartridge-config.properties
>>>> -
>>>> -    cp -f repository/conf/cartridge-config.properties
>>>> repository/conf/cartridge-config.properties.orig
>>>> -    cat repository/conf/cartridge-config.properties.orig | sed -e
>>>> "s@PUPPET_ENV@$sm_puppet_environment@g" >
>>>> repository/conf/cartridge-config.properties
>>>> -
>>>> -    echo "In repository/conf/datasources/master-datasources.xml" >>
>>>> $LOG
>>>> -    cp -f repository/conf/datasources/master-datasources.xml
>>>> repository/conf/datasources/master-datasources.xml.orig
>>>> -    cat repository/conf/datasources/master-datasources.xml.orig | sed
>>>> -e "s@USERSTORE_DB_HOSTNAME@$userstore_db_hostname@g" >
>>>> repository/conf/datasources/master-datasources.xml
>>>> -
>>>> -    cp -f repository/conf/datasources/master-datasources.xml
>>>> repository/conf/datasources/master-datasources.xml.orig
>>>> -    cat repository/conf/datasources/master-datasources.xml.orig | sed
>>>> -e "s@USERSTORE_DB_PORT@$userstore_db_port@g" >
>>>> repository/conf/datasources/master-datasources.xml
>>>> -
>>>> -    cp -f repository/conf/datasources/master-datasources.xml
>>>> repository/conf/datasources/master-datasources.xml.orig
>>>> -    cat repository/conf/datasources/master-datasources.xml.orig | sed
>>>> -e "s@USERSTORE_DB_SCHEMA@$userstore_db_schema@g" >
>>>> repository/conf/datasources/master-datasources.xml
>>>> -
>>>> -    cp -f repository/conf/datasources/master-datasources.xml
>>>> repository/conf/datasources/master-datasources.xml.orig
>>>> -    cat repository/conf/datasources/master-datasources.xml.orig | sed
>>>> -e "s@USERSTORE_DB_USER@$userstore_db_user@g" >
>>>> repository/conf/datasources/master-datasources.xml
>>>> -
>>>> -    cp -f repository/conf/datasources/master-datasources.xml
>>>> repository/conf/datasources/master-datasources.xml.orig
>>>> -    cat repository/conf/datasources/master-datasources.xml.orig | sed
>>>> -e "s@USERSTORE_DB_PASS@$userstore_db_pass@g" >
>>>> repository/conf/datasources/master-datasources.xml
>>>> -
>>>> -    popd # sm_path
>>>> -
>>>> +# Make sure the user is running as root.
>>>> +if [ "$UID" -ne "0" ]; then
>>>> +       echo ; echo "  You must be root to run $0.  (Try running 'sudo
>>>> bash' first.)" ; echo
>>>> +       exit 69
>>>> +fi
>>>>
>>>> -    # Database Configuration
>>>> -    # -----------------------------------------------
>>>> -    echo "Create and configure MySql Databases" >> $LOG
>>>> +general_conf_validate
>>>> +if [[ $profile = "cc" ]]; then
>>>> +    cc_conf_validate
>>>> +elif [[ $profile = "as" ]]; then
>>>> +    as_conf_validate
>>>> +elif [[ $profile = "sm" ]]; then
>>>> +    sm_conf_validate
>>>> +else
>>>> +    echo "In default profile CEP will be configured."
>>>> +    activemq_validate
>>>> +    cc_conf_validate
>>>> +    as_conf_validate
>>>> +    sm_conf_validate
>>>> +fi
>>>>
>>>> -    echo "Creating userstore database"
>>>> +if [[ ! -d $log_path ]]; then
>>>> +    mkdir -p $log_path
>>>> +fi
>>>>
>>>> -    pushd $resource_path
>>>> -    cp -f mysql.sql mysql.sql.orig
>>>> -    cat mysql.sql.orig | sed -e "s@USERSTORE_DB_SCHEMA
>>>> @$userstore_db_schema@g" > mysql.sql
>>>>
>>>> -    popd # resource_path
>>>> +echo ""
>>>> +echo "For all the questions asked while during executing the script
>>>> please just press the enter button"
>>>> +echo ""
>>>>
>>>> -    mysql -u$userstore_db_user -p$userstore_db_pass <
>>>> $resource_path/mysql.sql
>>>> -
>>>> -    #Copy
>>>> https://svn.wso2.org/repos/wso2/scratch/hosting/build/tropos/resources/append_zone_file.shinto /opt/scripts folder
>>>> -    if [[ ! -d $stratos_path/scripts ]]; then
>>>> -        mkdir -p $stratos_path/scripts
>>>> -    fi
>>>> -    cp -f ./scripts/add_entry_zone_file.sh
>>>> $stratos_path/scripts/add_entry_zone_file.sh
>>>> -    cp -f ./scripts/remove_entry_zone_file.sh
>>>> $stratos_path/scripts/remove_entry_zone_file.sh
>>>>
>>>> +# Extract stratos zip file
>>>> +if [[ !(-d $stratos_extract_path) ]]; then
>>>> +    echo "Extracting Apache Stratos"
>>>> +    unzip -q $stratos_pack_zip -d $stratos_path
>>>> +    mv -f $stratos_path/apache-stratos-4.0.0-SNAPSHOT
>>>> $stratos_extract_path
>>>> +fi
>>>>
>>>> -    echo "End configuring the SM"
>>>> -}
>>>> +if [[ ($profile = "default" && $config_mb = "true") ]]; then
>>>> +    echo "Extracting ActiveMQ"
>>>> +    tar -xzf $activemq_pack -C $stratos_path
>>>> +fi
>>>>
>>>> -if [[ $sm = "true" ]]; then
>>>> +general_setup
>>>> +if [[ $profile = "cc" ]]; then
>>>> +    cc_setup
>>>> +elif [[ $profile = "as" ]]; then
>>>> +    as_setup
>>>> +elif [[ $profile = "sm" ]]; then
>>>> +    sm_setup
>>>> +else
>>>> +    cc_setup
>>>> +    as_setup
>>>>      sm_setup
>>>> +    cep_setup
>>>>  fi
>>>>
>>>> -
>>>>  # ------------------------------------------------
>>>>  # Mapping domain/host names
>>>>  # ------------------------------------------------
>>>>
>>>>  cp -f /etc/hosts hosts.tmp
>>>>
>>>> -
>>>> -echo "$mb_ip $mb_hostname      # message broker hostname"      >>
>>>> hosts.tmp
>>>> -
>>>> -if [[ $sm = "true" || $as = "true" ]]; then
>>>> +echo "$host_ip $sm_hostname    # stratos domain"       >> hosts.tmp
>>>> +
>>>> +if [[ $profile = "sm" || $profile = "as" ]]; then
>>>>      echo "$sm_ip $sm_hostname  # stratos domain"       >> hosts.tmp
>>>>      echo "$cc_ip $cc_hostname  # cloud controller hostname"    >>
>>>> hosts.tmp
>>>>  fi
>>>>
>>>> -if [[ $sm = "true" ]]; then
>>>> +if [[ $profile = "sm" ]]; then
>>>>      echo "$as_ip $as_hostname  # auto scalar hostname" >> hosts.tmp
>>>>  fi
>>>>
>>>> @@ -659,9 +571,11 @@ chown $host_user:$host_user $stratos_path -R
>>>>
>>>>  echo "Apache Stratos setup has successfully completed"
>>>>
>>>> -read -p "Do you want to start the servers [y/n]? " answer
>>>> -if [[ $answer != y ]] ; then
>>>> -   exit 1
>>>> +if [[ $auto_start_servers != "true" ]]; then
>>>> +    read -p "Do you want to start the servers [y/n]? " answer
>>>> +    if [[ $answer != y ]] ; then
>>>> +        exit 1
>>>> +    fi
>>>>  fi
>>>>
>>>>  echo "Starting the servers" >> $LOG
>>>> @@ -672,14 +586,11 @@ chown -R $host_user.$host_user $log_path
>>>>  chmod -R 777 $log_path
>>>>
>>>>  export setup_dir=$PWD
>>>> -su - $host_user -c "source
>>>> $setup_dir/conf/setup.conf;$setup_dir/start-servers.sh -p\"$product_list\"
>>>> >> $LOG"
>>>> +su - $host_user -c "source
>>>> $setup_path/conf/setup.conf;$setup_path/start-servers.sh -p\"$profile\" >>
>>>> $LOG"
>>>>
>>>>  echo "Servers started. Please look at $LOG file for server startup
>>>> details"
>>>> -if [[ $sm == "true" ]]; then
>>>> +if [[ $profile == "default" || $profile == "sm" ]]; then
>>>>      echo
>>>> "**************************************************************"
>>>>      echo "Management Console : https://
>>>> $stratos_domain:$sm_https_port/console"
>>>>      echo
>>>> "**************************************************************"
>>>>  fi
>>>> -
>>>> -
>>>> -
>>>>
>>>>
>>>> http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7e4b3aee/tools/stratos-installer/start-servers.sh
>>>> ----------------------------------------------------------------------
>>>> diff --git a/tools/stratos-installer/start-servers.sh
>>>> b/tools/stratos-installer/start-servers.sh
>>>> index c22eeea..78edf65 100755
>>>> --- a/tools/stratos-installer/start-servers.sh
>>>> +++ b/tools/stratos-installer/start-servers.sh
>>>> @@ -29,18 +29,22 @@ product_list=$1
>>>>  export LOG=$log_path/stratos.log
>>>>  SLEEP=40
>>>>
>>>> +profile="default"
>>>> +
>>>>  if [[ -f ./conf/setup.conf ]]; then
>>>>      source "./conf/setup.conf"
>>>> +    echo "source it"
>>>>  fi
>>>>
>>>> +
>>>>  function help {
>>>>      echo ""
>>>>      echo "Give one or more of the servers to start on this machine.
>>>> The available servers are"
>>>> -    echo "mb, cc, as, sm, cep, all. 'all' means you need to start all
>>>> servers."
>>>> +    echo "cc, as, sm, default. 'default' means you need to start all
>>>> servers."
>>>>      echo "usage:"
>>>> -    echo "start-servers.sh -p\"<product list>\""
>>>> +    echo "start-servers.sh -p\"<profile>\""
>>>>      echo "eg."
>>>> -    echo "start-servers.sh -p\"cc sm\""
>>>> +    echo "start-servers.sh -p\"cc\""
>>>>      echo ""
>>>>  }
>>>>
>>>> @@ -48,96 +52,45 @@ while getopts p: opts
>>>>  do
>>>>    case $opts in
>>>>      p)
>>>> -        product_list=${OPTARG}
>>>> -        echo $product_list
>>>> +        profile_list=${OPTARG}
>>>>          ;;
>>>> -    *)
>>>> +    \?)
>>>>          help
>>>>          exit 1
>>>>          ;;
>>>>    esac
>>>>  done
>>>> -arr=$(echo $product_list | tr ";" "\n")
>>>> +
>>>> +
>>>> +arr=$(echo $profile_list | tr " " "\n")
>>>>
>>>>  for x in $arr
>>>>  do
>>>> -    if [[ $x = "mb" ]]; then
>>>> -        mb="true"
>>>> -    fi
>>>> -    if [[ $x = "cep" ]]; then
>>>> -        cep="true"
>>>> -    fi
>>>>      if [[ $x = "cc" ]]; then
>>>> -        cc="true"
>>>> -    fi
>>>> -    if [[ $x = "as" ]]; then
>>>> -        as="true"
>>>> -    fi
>>>> -    if [[ $x = "sm" ]]; then
>>>> -        sm="true"
>>>> -    fi
>>>> -    if [[ $x = "all" ]]; then
>>>> -       mb="true"
>>>> -        cc="true"
>>>> -        as="true"
>>>> -        sm="true"
>>>> -        cep="true"
>>>> +        profile="cc"
>>>> +    elif [[ $x = "as" ]]; then
>>>> +        profile="as"
>>>> +    elif [[ $x = "sm" ]]; then
>>>> +        profile="sm"
>>>> +    else
>>>> +        echo "Inavlid profile : 'default' profile will be selected."
>>>> +        profile="default"
>>>>      fi
>>>>  done
>>>> -product_list=`echo $product_list | sed 's/^ *//g' | sed 's/ *$//g'`
>>>> -if [[ -z $product_list || $product_list = "" ]]; then
>>>> -    help
>>>> -    exit 1
>>>> -fi
>>>> -
>>>> -if [[ $mb = "true" ]]; then
>>>> -    echo ${mb_path}
>>>> -
>>>> -    echo "Starting MB server ..." >> $LOG
>>>> -    nohup ${mb_path}/bin/wso2server.sh &
>>>> -    echo "MB server started" >> $LOG
>>>> -    sleep $SLEEP
>>>> -    sleep $SLEEP
>>>> -fi
>>>>
>>>> -if [[ $cep = "true" ]]; then
>>>> -    echo ${cep_path}
>>>> -
>>>> -    echo "Starting CEP server ..." >> $LOG
>>>> -    nohup ${cep_path}/bin/wso2server.sh &
>>>> -    echo "CEP server started" >> $LOG
>>>> -    sleep $SLEEP
>>>> -    sleep $SLEEP
>>>> -fi
>>>> -
>>>> -if [[ $cc = "true" ]]; then
>>>> -    echo ${cc_path}
>>>> -
>>>> -    echo "Starting CC server ..." >> $LOG
>>>> -    nohup ${cc_path}/bin/stratos.sh &
>>>> -    echo "CC server started" >> $LOG
>>>> +if [[ $profile = "default" ]]; then
>>>> +    echo "Starting ActiveMQ server ..." >> $LOG
>>>> +    $activemq_path/bin/activemq start
>>>> +    echo "ActiveMQ server started" >> $LOG
>>>>      sleep $SLEEP
>>>>      sleep $SLEEP
>>>>  fi
>>>>
>>>> -if [[ $as = "true" ]]; then
>>>> -    echo ${as_path}
>>>> -
>>>> -    echo "Starting Auto Scalar server ..." >> $LOG
>>>> -    nohup ${as_path}/bin/stratos.sh &
>>>> -    echo "Auto Scalar server started" >> $LOG
>>>> -    sleep $SLEEP
>>>> -fi
>>>> -
>>>> -
>>>> -if [[ $sm = "true" ]]; then
>>>> -    echo ${sm_path}
>>>> -
>>>> -    echo "Starting SM server ..." >> $LOG
>>>> -    nohup ${sm_path}/bin/stratos.sh &
>>>> -    echo "SM server started" >> $LOG
>>>> -    sleep $SLEEP
>>>> -
>>>> -fi
>>>> +echo "Starting Stratos server ..." >> $LOG
>>>> +echo "$stratos_extract_path/bin/stratos.sh -Dprofile=$profile start"
>>>> +$stratos_extract_path/bin/stratos.sh -Dprofile=$profile start
>>>> +echo "Stratos server started" >> $LOG
>>>> +sleep $SLEEP
>>>> +sleep $SLEEP
>>>>
>>>>
>>>>
>>>>
>>>> http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7e4b3aee/tools/stratos-installer/stratos-clean.sh
>>>> ----------------------------------------------------------------------
>>>> diff --git a/tools/stratos-installer/stratos-clean.sh
>>>> b/tools/stratos-installer/stratos-clean.sh
>>>> deleted file mode 100755
>>>> index 261dee7..0000000
>>>> --- a/tools/stratos-installer/stratos-clean.sh
>>>> +++ /dev/null
>>>> @@ -1,104 +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 is for cleaning the host machine where one or more of
>>>> the Stratos servers are run.
>>>> -#
>>>> ----------------------------------------------------------------------------
>>>> -
>>>> -source "./conf/stratos-setup.conf"
>>>> -
>>>> -if [ "$UID" -ne "0" ]; then
>>>> -       echo ; echo "  You must be root to run $0.  (Try running 'sudo
>>>> bash' first.)" ; echo
>>>> -       exit 69
>>>> -fi
>>>> -
>>>> -function help {
>>>> -    echo ""
>>>> -    echo "Clean the host machine where one or more of the Stratos2
>>>> servers are run."
>>>> -    echo "usage:"
>>>> -    echo "stratos-clean.sh -u <mysql username> -p <mysql password>"
>>>> -    echo ""
>>>> -}
>>>> -
>>>> -while getopts u:p: opts
>>>> -do
>>>> -  case $opts in
>>>> -    u)
>>>> -        mysql_user=${OPTARG}
>>>> -        ;;
>>>> -    p)
>>>> -        mysql_pass=${OPTARG}
>>>> -        ;;
>>>> -    *)
>>>> -        help
>>>> -        #exit 1
>>>> -        ;;
>>>> -  esac
>>>> -done
>>>> -
>>>> -function helpclean {
>>>> -    echo ""
>>>> -    echo "Enter DB credentials if you need to clear Stratos DB"
>>>> -    echo "usage:"
>>>> -    echo "clean.sh -u <mysql username> -p <mysql password>"
>>>> -    echo ""
>>>> -}
>>>> -
>>>> -function clean_validate {
>>>> -    if [ -z $stratos_path ]; then
>>>> -        echo "stratos_path is not set"
>>>> -        exit 1
>>>> -    fi
>>>> -    if [ -z $log_path ]; then
>>>> -        echo "log_path is not set"
>>>> -        exit 1
>>>> -    fi
>>>> -}
>>>> -
>>>> -clean_validate
>>>> -if [[ ( -n $mysql_user && -n $mysql_pass ) ]]; then
>>>> -       read -p "Please confirm that you want to remove stratos
>>>> databases, servers and logs [y/n] " answer
>>>> -       if [[ $answer != y ]] ; then
>>>> -               exit 1
>>>> -       fi
>>>> -fi
>>>> -echo 'Stopping all java processes'
>>>> -killall java
>>>> -echo 'Waiting for applications to exit'
>>>> -sleep 15
>>>> -
>>>> -if [[ ( -n $mysql_user && -n $mysql_pass ) ]]; then
>>>> -   echo 'Removing userstore database'
>>>> -   mysql -u $mysql_user -p$mysql_pass -e "DROP DATABASE IF EXISTS
>>>> $userstore_db_schema;"
>>>> -fi
>>>> -
>>>> -if [[ -d $stratos_path/scripts ]]; then
>>>> -   echo 'Removing scripts'
>>>> -   rm -rf $stratos_path/scripts
>>>> -fi
>>>> -
>>>> -if [[ -d $stratos_path ]]; then
>>>> -   echo 'Removing Stratos'
>>>> -   rm -rf $stratos_path/*
>>>> -fi
>>>> -
>>>> -echo 'Removing logs'
>>>> -rm -rf $log_path/*
>>>>
>>>>
>>>> http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7e4b3aee/tools/stratos-installer/stratos-db-clean.sh
>>>> ----------------------------------------------------------------------
>>>> diff --git a/tools/stratos-installer/stratos-db-clean.sh
>>>> b/tools/stratos-installer/stratos-db-clean.sh
>>>> deleted file mode 100755
>>>> index 74fec29..0000000
>>>> --- a/tools/stratos-installer/stratos-db-clean.sh
>>>> +++ /dev/null
>>>> @@ -1,24 +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.
>>>> -#
>>>> -#
>>>> -# cleans up databases
>>>> -mysql -uroot -proot -e "DROP DATABASE IF EXISTS stratos_foundation;"
>>>> -mysql -uroot -proot -e "DROP DATABASE IF EXISTS userstore;"
>>>> -
>>>>
>>>>
>>>> http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7e4b3aee/tools/stratos-installer/stratos-ec2.sh
>>>> ----------------------------------------------------------------------
>>>> diff --git a/tools/stratos-installer/stratos-ec2.sh
>>>> b/tools/stratos-installer/stratos-ec2.sh
>>>> deleted file mode 100755
>>>> index 7e39a80..0000000
>>>> --- a/tools/stratos-installer/stratos-ec2.sh
>>>> +++ /dev/null
>>>> @@ -1,56 +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 is invoked by setup.sh for configuring Amazon EC2 IaaS
>>>> information.
>>>> -#
>>>> ----------------------------------------------------------------------------
>>>> -
>>>> -# Die on any error:
>>>> -set -e
>>>> -
>>>> -SLEEP=60
>>>> -export LOG=$log_path/stratos-ec2.log
>>>> -
>>>> -source "./conf/stratos-setup.conf"
>>>> -
>>>> -if [[ ! -d $log_path ]]; then
>>>> -    mkdir -p $log_path
>>>> -fi
>>>> -
>>>> -pushd $stratos_extract_path
>>>> -
>>>> -echo "Set EC2 provider specific info in
>>>> repository/conf/cloud-controller.xml" >> $LOG
>>>> -
>>>> -sed -i "s@EC2_PROVIDER_START@@g"  repository/conf/cloud-controller.xml
>>>> -sed -i "s@EC2_IDENTITY@$ec2_identity@g"
>>>> repository/conf/cloud-controller.xml
>>>> -sed -i "s@EC2_CREDENTIAL@$ec2_credential@g"
>>>> repository/conf/cloud-controller.xml
>>>> -sed -i "s@EC2_OWNER_ID@$ec2_owner_id@g"
>>>> repository/conf/cloud-controller.xml
>>>> -sed -i "s@EC2_AVAILABILITY_ZONE@$ec2_availability_zone@g"
>>>> repository/conf/cloud-controller.xml
>>>> -sed -i "s@EC2_SECURITY_GROUPS@$ec2_security_groups@g"
>>>> repository/conf/cloud-controller.xml
>>>> -sed -i "s@EC2_KEYPAIR@$ec2_keypair_name@g"
>>>> repository/conf/cloud-controller.xml
>>>> -sed -i "s@EC2_PROVIDER_END@@g" repository/conf/cloud-controller.xml
>>>> -sed -i "s@OPENSTACK_PROVIDER_START@!--@g"
>>>> repository/conf/cloud-controller.xml
>>>> -sed -i "s@OPENSTACK_PROVIDER_END@--@g"
>>>> repository/conf/cloud-controller.xml
>>>> -sed -i "s@VCLOUD_PROVIDER_START@!--@g"
>>>> repository/conf/cloud-controller.xml
>>>> -sed -i "s@VCLOUD_PROVIDER_END@--@g"
>>>> repository/conf/cloud-controller.xml
>>>> -
>>>> -popd
>>>> -
>>>>
>>>>
>>>> http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7e4b3aee/tools/stratos-installer/stratos-openstack.sh
>>>> ----------------------------------------------------------------------
>>>> diff --git a/tools/stratos-installer/stratos-openstack.sh
>>>> b/tools/stratos-installer/stratos-openstack.sh
>>>> deleted file mode 100755
>>>> index 925333c..0000000
>>>> --- a/tools/stratos-installer/stratos-openstack.sh
>>>> +++ /dev/null
>>>> @@ -1,52 +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 is invoked by setup.sh for configuring OpenStack IaaS
>>>> information.
>>>> -#
>>>> ----------------------------------------------------------------------------
>>>> -
>>>> -# Die on any error:
>>>> -set -e
>>>> -
>>>> -SLEEP=60
>>>> -export LOG=$log_path/stratos-openstack.log
>>>> -
>>>> -source "./conf/stratos-setup.conf"
>>>> -
>>>> -if [[ ! -d $log_path ]]; then
>>>> -    mkdir -p $log_path
>>>> -fi
>>>> -
>>>> -pushd $stratos_extract_path
>>>> -
>>>> -echo "Set OpenStack provider specific info in
>>>> repository/conf/cloud-controller.xml" >> $LOG
>>>> -
>>>> -sed -i "s@OPENSTACK_PROVIDER_START@@g"
>>>> repository/conf/cloud-controller.xml
>>>> -sed -i "s@OPENSTACK_IDENTITY@$openstack_identity@g"
>>>>  repository/conf/cloud-controller.xml
>>>> -sed -i "s@OPENSTACK_CREDENTIAL@$openstack_credential@g"
>>>>  repository/conf/cloud-controller.xml
>>>> -sed -i "s@OPENSTACK_ENDPOINT@$openstack_jclouds_endpoint@g"
>>>>  repository/conf/cloud-controller.xml
>>>> -sed -i "s@OPENSTACK_PROVIDER_END@@g"
>>>>  repository/conf/cloud-controller.xml
>>>> -sed -i "s@EC2_PROVIDER_START@!--@g"
>>>>  repository/conf/cloud-controller.xml
>>>> -sed -i "s@EC2_PROVIDER_END@--@g"  repository/conf/cloud-controller.xml
>>>> -sed -i "s@VCLOUD_PROVIDER_START@!--@g"
>>>>  repository/conf/cloud-controller.xml
>>>> -sed -i "s@VCLOUD_PROVIDER_END@--@g"
>>>>  repository/conf/cloud-controller.xml
>>>> -
>>>> -popd
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Isuru Perera
>>>> Senior Software Engineer | WSO2, Inc. | http://wso2.com/
>>>> Lean . Enterprise . Middleware
>>>>
>>>> about.me/chrishantha
>>>>
>>>
>>
>>
>> --
>> Isuru Perera
>> Senior Software Engineer | WSO2, Inc. | http://wso2.com/
>> Lean . Enterprise . Middleware
>>
>> about.me/chrishantha
>>
>
>
>
> --
> Best Regards,
> Nirmal
>
> Nirmal Fernando.
> PPMC Member & Committer of Apache Stratos,
> Senior Software Engineer, WSO2 Inc.
>
> Blog: http://nirmalfdo.blogspot.com/
>

Re: Fwd: [2/3] git commit: Stratos Installer changes to use single product

Posted by Nirmal Fernando <ni...@gmail.com>.
No worries, now :-)


On Fri, Apr 4, 2014 at 7:36 AM, Isuru Perera <is...@wso2.com> wrote:

> Well, yeah! :) I haven't done this kind of work in a single commit.
>
> Perhaps I should have done the work in different commits.
>
> I'm just worried that the commit has overwritten the efforts of other
> people including you!
>
> Is there a way to fix this?
>
> On Fri, Apr 4, 2014 at 7:22 AM, Nirmal Fernando <ni...@gmail.com>wrote:
>
>> Well, it's bit suprising that you weren't aware about the consequences of
>> git rm :-)
>>  On Apr 4, 2014 7:16 AM, "Isuru Perera" <is...@wso2.com> wrote:
>>
>>> Hi Devs,
>>>
>>> I pushed the Stratos installer changes.
>>>
>>> What I did was to 'git rm' old files and 'git mv' to rename.
>>>
>>> Looks like the commit went as file changes. Sorry for the mistake! :-/
>>>
>>> ---------- Forwarded message ----------
>>> From: <is...@apache.org>
>>> Date: Fri, Apr 4, 2014 at 7:06 AM
>>> Subject: [2/3] git commit: Stratos Installer changes to use single
>>> product
>>> To: commits@stratos.incubator.apache.org
>>>
>>>
>>> Stratos Installer changes to use single product
>>>
>>>
>>> Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
>>> Commit:
>>> http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/7e4b3aee
>>> Tree:
>>> http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/7e4b3aee
>>> Diff:
>>> http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/7e4b3aee
>>>
>>> Branch: refs/heads/master
>>> Commit: 7e4b3aee15be72f1fa2771c623af920a4d5e9688
>>> Parents: 0955f29
>>> Author: M. Isuru Tharanga Chrishantha Perera <is...@apache.org>
>>> Authored: Thu Apr 3 17:25:36 2014 +0530
>>> Committer: M. Isuru Tharanga Chrishantha Perera <is...@apache.org>
>>> Committed: Thu Apr 3 17:25:36 2014 +0530
>>>
>>> ----------------------------------------------------------------------
>>>  tools/stratos-installer/clean.sh                |  39 +-
>>>  tools/stratos-installer/conf/setup.conf         |  95 +--
>>>  tools/stratos-installer/conf/stratos-setup.conf | 103 ---
>>>  tools/stratos-installer/ec2.sh                  |  49 +-
>>>  tools/stratos-installer/openstack.sh            |  37 +-
>>>  tools/stratos-installer/setup.sh                | 825
>>> +++++++++----------
>>>  tools/stratos-installer/start-servers.sh        | 107 +--
>>>  tools/stratos-installer/stratos-clean.sh        | 104 ---
>>>  tools/stratos-installer/stratos-db-clean.sh     |  24 -
>>>  tools/stratos-installer/stratos-ec2.sh          |  56 --
>>>  tools/stratos-installer/stratos-openstack.sh    |  52 --
>>>  tools/stratos-installer/stratos-setup.sh        | 596 --------------
>>>  .../stratos-installer/stratos-start-servers.sh  |  96 ---
>>>  tools/stratos-installer/stratos-vcloud.sh       |  52 --
>>>  tools/stratos-installer/vcloud.sh               |  37 +-
>>>  15 files changed, 453 insertions(+), 1819 deletions(-)
>>> ----------------------------------------------------------------------
>>>
>>>
>>>
>>> http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7e4b3aee/tools/stratos-installer/clean.sh
>>> ----------------------------------------------------------------------
>>> diff --git a/tools/stratos-installer/clean.sh
>>> b/tools/stratos-installer/clean.sh
>>> index 5692739..b74879d 100755
>>> --- a/tools/stratos-installer/clean.sh
>>> +++ b/tools/stratos-installer/clean.sh
>>> @@ -63,10 +63,6 @@ function helpclean {
>>>  }
>>>
>>>  function clean_validate {
>>> -#    if [[ ( -z $mysql_user || -z $mysql_pass ) ]]; then
>>> - #       helpclean
>>> -  #      exit 1
>>> -   # fi
>>>      if [ -z $stratos_path ]; then
>>>          echo "stratos_path is not set"
>>>          exit 1
>>> @@ -90,13 +86,8 @@ echo 'Waiting for applications to exit'
>>>  sleep 15
>>>
>>>  if [[ ( -n $mysql_user && -n $mysql_pass ) ]]; then
>>> -
>>> -       echo 'Removing stratos_foundation database'
>>> -       mysql -u $mysql_user -p$mysql_pass -e "DROP DATABASE IF EXISTS
>>> stratos_foundation;"
>>> -
>>> -       echo 'Removing userstore database'
>>> -       mysql -u $mysql_user -p$mysql_pass -e "DROP DATABASE IF EXISTS
>>> userstore;"
>>> -
>>> +   echo 'Removing userstore database'
>>> +   mysql -u $mysql_user -p$mysql_pass -e "DROP DATABASE IF EXISTS
>>> $userstore_db_schema;"
>>>  fi
>>>
>>>  if [[ -d $stratos_path/scripts ]]; then
>>> @@ -104,29 +95,9 @@ if [[ -d $stratos_path/scripts ]]; then
>>>     rm -rf $stratos_path/scripts
>>>  fi
>>>
>>> -if [[ -d $mb_path ]]; then
>>> -   echo 'Removing MB'
>>> -   rm -rf $mb_path
>>> -fi
>>> -
>>> -if [[ -d $cep_path ]]; then
>>> -   echo 'Removing CEP'
>>> -   rm -rf $cep_path
>>> -fi
>>> -
>>> -if [[ -d $cc_path ]]; then
>>> -   echo 'Removing CC'
>>> -   rm -rf $cc_path
>>> -fi
>>> -
>>> -if [[ -d $as_path ]]; then
>>> -   echo 'Removing AS'
>>> -   rm -rf $as_path
>>> -fi
>>> -
>>> -if [[ -d $sm_path ]]; then
>>> -   echo 'Removing SM'
>>> -   rm -rf $sm_path
>>> +if [[ -d $stratos_path ]]; then
>>> +   echo 'Removing Stratos'
>>> +   rm -rf $stratos_path/*
>>>  fi
>>>
>>>  echo 'Removing logs'
>>>
>>>
>>> http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7e4b3aee/tools/stratos-installer/conf/setup.conf
>>> ----------------------------------------------------------------------
>>> diff --git a/tools/stratos-installer/conf/setup.conf
>>> b/tools/stratos-installer/conf/setup.conf
>>> index 10b4163..2abcb3e 100644
>>> --- a/tools/stratos-installer/conf/setup.conf
>>> +++ b/tools/stratos-installer/conf/setup.conf
>>> @@ -24,8 +24,7 @@
>>>  #
>>> ----------------------------------------------------------------------------
>>>  #
>>>  #  Configure below parameters to install Apache Stratos using
>>> ../setup.sh.
>>> -#  General configuration parameters are mandatory and other sections
>>> are optional. Configure each section on each node where
>>> -#  Stratos product is installed.
>>> +#  General configuration parameters are mandatory and other sections
>>> are optional.
>>>  #
>>>  #
>>> ----------------------------------------------------------------------------
>>>
>>> @@ -34,7 +33,7 @@
>>>  # General configuration
>>>  #
>>> ----------------------------------------------------------------------------
>>>  export setup_path= #Folder path containing stratos_setup
>>> -export stratos_pack_path= #Folder path containing stratos packages
>>> +export stratos_packs= #Folder path containing stratos package and other
>>> third party packs and jars
>>>  export stratos_path= #Folder which stratos will be installed
>>>
>>>  export JAVA_HOME= #Java home path
>>> @@ -45,62 +44,25 @@ export host_user="" #A host user account for the
>>> machine which run Stratos compo
>>>
>>>  export stratos_domain="stratos.apache.org"
>>>
>>> -export mb_ip="mb-ip"   # Machine ip on which mb run
>>> -export cep_ip="cep-ip" # Machine ip on which cep run
>>> -export cc_ip="cc-ip"   # Machine ip on which cc run
>>> -export as_ip="as-ip"   # Machine ip on which auto scalar run
>>> -export sm_ip="sc-ip"   # Machine ip on which sc run
>>> -export puppet_ip="puppet-ip"   # Machine ip on which puppet master run
>>> +export host_ip="127.0.0.1" # Machine ip on host machine
>>> +export offset=0
>>> +
>>> +export puppet_ip="127.0.0.1"   # Machine ip on which puppet master run
>>>  export puppet_hostname="puppet-hostname" # Host name given to identify
>>> the puppet master
>>>  export puppet_environment="puppet_environment" # Name of puppet
>>> environment
>>>
>>> -export cc_port_offset=1
>>> -export sm_port_offset=2
>>> -export as_port_offset=3
>>> -export cep_port_offset=4
>>> -export mb_port_offset=5
>>> -
>>> -export mb_port=5672 #default port which the message broker service runs
>>> +export mb_ip="127.0.0.1" # Machine ip on which mb run
>>> +export mb_port=61616 #default port which the message broker service runs
>>> +
>>> +export stratos_extract_path=$stratos_path/"apache-stratos"
>>> +export
>>> stratos_pack_zip=$stratos_packs/"apache-stratos-4.0.0-SNAPSHOT.zip"
>>>
>>> -export mb_hostname="mb.$stratos_domain"
>>> -export cep_hostname="cep.$stratos_domain"
>>> -export sm_hostname="$stratos_domain"
>>> -export cc_hostname="cc.$stratos_domain"
>>> -export as_hostname="as.$stratos_domain"
>>> +export activemq_pack=$stratos_packs/"apache-activemq-5.8.0-bin.tar.gz"
>>> +export activemq_path=$stratos_path/"apache-activemq-5.8.0"
>>>
>>>  export resource_path=$setup_path/resources
>>>
>>>
>>> -#
>>> ----------------------------------------------------------------------------
>>> -# MB configuration
>>> -#
>>> ----------------------------------------------------------------------------
>>> -export mb_path=$stratos_path/"wso2mb-2.1.0"
>>> -export mb_pack_path=$stratos_pack_path/"wso2mb-2.1.0.zip"
>>> -
>>> -
>>> -#
>>> ----------------------------------------------------------------------------
>>> -# CEP configuration
>>> -#
>>> ----------------------------------------------------------------------------
>>> -export cep_artifacts_path= #Folder path containing cep artifacts files
>>> -export
>>> cep_extension_jar=$stratos_pack_path/"org.apache.stratos.cep.extension-1.0.0-SNAPSHOT.jar"
>>> # cep extensions jar file name
>>> -export
>>> andes_client_jar=$stratos_pack_path/"andes-client-0.13.wso2v8.jar" # andes
>>> client jar file name
>>> -
>>> -export cep_path=$stratos_path/"wso2cep-3.0.0"
>>> -export cep_pack_path=$stratos_pack_path/"wso2cep-3.0.0.zip"
>>> -
>>> -export cep_mb_ip=$mb_ip
>>> -export cep_mb_listen_port=$(($mb_port + $mb_port_offset))
>>> -
>>> -
>>> -#
>>> ----------------------------------------------------------------------------
>>> -# CC configuration
>>> -#
>>> ----------------------------------------------------------------------------
>>> -export cc_path=$stratos_path/"apache-stratos-cc-4.0.0-SNAPSHOT"
>>> -export
>>> cc_pack_path=$stratos_pack_path/"apache-stratos-cc-4.0.0-SNAPSHOT.zip"
>>> -
>>> -export cc_mb_listen_port=$(($mb_port + $mb_port_offset))
>>> -export cc_https_port=$((9443 + $cc_port_offset))
>>> -
>>>  # IaaS Providers
>>>  #
>>> ----------------------------------------------------------------------------
>>>  # Set <iaas-name>_provider_enabled parameter to true to enable desired
>>> IaaS. A hybrid cloud could be
>>> @@ -121,7 +83,7 @@ export openstack_identity="stratos:stratos" #
>>> Openstack project name:Openstack l
>>>  export openstack_credential="password" # Openstack login password
>>>  export openstack_jclouds_endpoint="http://hostname:5000/v2.0"
>>>  export openstack_keypair_name=""
>>> -export openstack_security_groups="security-groups"
>>> +export openstack_security_groups=""
>>>
>>>  # vCloud
>>>  export vcloud_provider_enabled=false
>>> @@ -129,36 +91,13 @@ export vcloud_identity="stratos" # vCloud login user
>>>  export vcloud_credential="password" # vCloud login password
>>>  export vcloud_jclouds_endpoint="https://vcloud/api"
>>>
>>> -#
>>> ----------------------------------------------------------------------------
>>> -# Auto Scalar configuration
>>> -#
>>> ----------------------------------------------------------------------------
>>> -export as_path=$stratos_path/"apache-stratos-autoscaler-4.0.0-SNAPSHOT"
>>> -export
>>> as_pack_path=$stratos_pack_path/"apache-stratos-autoscaler-4.0.0-SNAPSHOT.zip"
>>>
>>> -export as_mb_listen_port=$(($mb_port + $mb_port_offset))
>>> -export as_cc_https_port=$((9443 + $cc_port_offset))
>>> -export as_sm_https_port=$((9443 + $sm_port_offset))
>>> -
>>> -
>>> -#
>>> ----------------------------------------------------------------------------
>>> -# SM configuration
>>> +# Database configuration
>>>  #
>>> ----------------------------------------------------------------------------
>>> -export sm_path=$stratos_path/"apache-stratos-manager-4.0.0-SNAPSHOT"
>>> -export
>>> sm_pack_path=$stratos_pack_path/"apache-stratos-manager-4.0.0-SNAPSHOT.zip"
>>> -export
>>> mysql_connector_jar=$stratos_pack_path/"mysql-connector-java-5.1.25.jar"
>>> #mysql connector jar file name
>>> +export
>>> mysql_connector_jar=$stratos_packs/"mysql-connector-java-5.1.29-bin.jar"
>>> #mysql connector jar file name
>>>
>>>  export userstore_db_hostname="localhost"
>>>  export userstore_db_schema="userstore"
>>>  export userstore_db_port="3306"
>>>  export userstore_db_user="root"
>>> -export userstore_db_pass="mysql"
>>> -
>>> -export sm_puppet_ip=$puppet_ip
>>> -export sm_puppet_hostname=$puppet_hostname
>>> -export sm_puppet_environment=$puppet_environment
>>> -export sm_mb_listen_port=$(($mb_port + $mb_port_offset))
>>> -export sm_cc_https_port=$((9443 + $cc_port_offset))
>>> -export sm_as_https_port=$((9443 + $as_port_offset))
>>> -export sm_https_port=$((9443 + $sm_port_offset))
>>> -export sm_http_port=$((9763 + $sm_port_offset))
>>> -
>>> +export userstore_db_pass="root"
>>>
>>>
>>> http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7e4b3aee/tools/stratos-installer/conf/stratos-setup.conf
>>> ----------------------------------------------------------------------
>>> diff --git a/tools/stratos-installer/conf/stratos-setup.conf
>>> b/tools/stratos-installer/conf/stratos-setup.conf
>>> deleted file mode 100644
>>> index 2abcb3e..0000000
>>> --- a/tools/stratos-installer/conf/stratos-setup.conf
>>> +++ /dev/null
>>> @@ -1,103 +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.
>>> -#
>>> -#
>>> ----------------------------------------------------------------------------
>>> -#
>>> -#  Server configuration script for Apache Stratos
>>> -#
>>> ----------------------------------------------------------------------------
>>> -#
>>> -#  Configure below parameters to install Apache Stratos using
>>> ../setup.sh.
>>> -#  General configuration parameters are mandatory and other sections
>>> are optional.
>>> -#
>>> -#
>>> ----------------------------------------------------------------------------
>>> -
>>> -
>>> -#
>>> ----------------------------------------------------------------------------
>>> -# General configuration
>>> -#
>>> ----------------------------------------------------------------------------
>>> -export setup_path= #Folder path containing stratos_setup
>>> -export stratos_packs= #Folder path containing stratos package and other
>>> third party packs and jars
>>> -export stratos_path= #Folder which stratos will be installed
>>> -
>>> -export JAVA_HOME= #Java home path
>>> -
>>> -export log_path=/var/log/apache-stratos
>>> -
>>> -export host_user="" #A host user account for the machine which run
>>> Stratos component(s)
>>> -
>>> -export stratos_domain="stratos.apache.org"
>>> -
>>> -export host_ip="127.0.0.1" # Machine ip on host machine
>>> -export offset=0
>>> -
>>> -export puppet_ip="127.0.0.1"   # Machine ip on which puppet master run
>>> -export puppet_hostname="puppet-hostname" # Host name given to identify
>>> the puppet master
>>> -export puppet_environment="puppet_environment" # Name of puppet
>>> environment
>>> -
>>> -export mb_ip="127.0.0.1" # Machine ip on which mb run
>>> -export mb_port=61616 #default port which the message broker service runs
>>> -
>>> -export stratos_extract_path=$stratos_path/"apache-stratos"
>>> -export
>>> stratos_pack_zip=$stratos_packs/"apache-stratos-4.0.0-SNAPSHOT.zip"
>>> -
>>> -export activemq_pack=$stratos_packs/"apache-activemq-5.8.0-bin.tar.gz"
>>> -export activemq_path=$stratos_path/"apache-activemq-5.8.0"
>>> -
>>> -export resource_path=$setup_path/resources
>>> -
>>> -
>>> -# IaaS Providers
>>> -#
>>> ----------------------------------------------------------------------------
>>> -# Set <iaas-name>_provider_enabled parameter to true to enable desired
>>> IaaS. A hybrid cloud could be
>>> -# created using multiple IaaSs.
>>> -
>>> -# EC2
>>> -export ec2_provider_enabled=true
>>> -export ec2_identity="<ec2_identity>"
>>> -export ec2_credential="<ec2_credential>"
>>> -export ec2_keypair_name="<ec2_keypair_name>"
>>> -export ec2_owner_id="<ec2_owner_id>"
>>> -export ec2_availability_zone="<ec2_availability_zone>"
>>> -export ec2_security_groups="<ec2_security_groups>"
>>> -
>>> -# Openstack
>>> -export openstack_provider_enabled=false
>>> -export openstack_identity="stratos:stratos" # Openstack project
>>> name:Openstack login user
>>> -export openstack_credential="password" # Openstack login password
>>> -export openstack_jclouds_endpoint="http://hostname:5000/v2.0"
>>> -export openstack_keypair_name=""
>>> -export openstack_security_groups=""
>>> -
>>> -# vCloud
>>> -export vcloud_provider_enabled=false
>>> -export vcloud_identity="stratos" # vCloud login user
>>> -export vcloud_credential="password" # vCloud login password
>>> -export vcloud_jclouds_endpoint="https://vcloud/api"
>>> -
>>> -
>>> -# Database configuration
>>> -#
>>> ----------------------------------------------------------------------------
>>> -export
>>> mysql_connector_jar=$stratos_packs/"mysql-connector-java-5.1.29-bin.jar"
>>> #mysql connector jar file name
>>> -
>>> -export userstore_db_hostname="localhost"
>>> -export userstore_db_schema="userstore"
>>> -export userstore_db_port="3306"
>>> -export userstore_db_user="root"
>>> -export userstore_db_pass="root"
>>>
>>>
>>> http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7e4b3aee/tools/stratos-installer/ec2.sh
>>> ----------------------------------------------------------------------
>>> diff --git a/tools/stratos-installer/ec2.sh
>>> b/tools/stratos-installer/ec2.sh
>>> index 12aae8e..21d47a3 100755
>>> --- a/tools/stratos-installer/ec2.sh
>>> +++ b/tools/stratos-installer/ec2.sh
>>> @@ -35,45 +35,22 @@ if [[ ! -d $log_path ]]; then
>>>      mkdir -p $log_path
>>>  fi
>>>
>>> -pushd $cc_path
>>> +pushd $stratos_extract_path
>>>
>>>  echo "Set EC2 provider specific info in
>>> repository/conf/cloud-controller.xml" >> $LOG
>>>
>>> -cp -f repository/conf/cloud-controller.xml
>>> repository/conf/cloud-controller.xml.orig
>>> -cat repository/conf/cloud-controller.xml.orig | sed -e
>>> "s@EC2_PROVIDER_START@@g" > repository/conf/cloud-controller.xml
>>> -
>>> -cp -f repository/conf/cloud-controller.xml
>>> repository/conf/cloud-controller.xml.orig
>>> -cat repository/conf/cloud-controller.xml.orig | sed -e "s@EC2_IDENTITY
>>> @$ec2_identity@g" > repository/conf/cloud-controller.xml
>>> -
>>> -cp -f repository/conf/cloud-controller.xml
>>> repository/conf/cloud-controller.xml.orig
>>> -cat repository/conf/cloud-controller.xml.orig | sed -e "s@EC2_CREDENTIAL
>>> @$ec2_credential@g" > repository/conf/cloud-controller.xml
>>> -
>>> -cp -f repository/conf/cloud-controller.xml
>>> repository/conf/cloud-controller.xml.orig
>>> -cat repository/conf/cloud-controller.xml.orig | sed -e "s@EC2_OWNER_ID
>>> @$ec2_owner_id@g" > repository/conf/cloud-controller.xml
>>> -
>>> -cp -f repository/conf/cloud-controller.xml
>>> repository/conf/cloud-controller.xml.orig
>>> -cat repository/conf/cloud-controller.xml.orig | sed -e
>>> "s@EC2_AVAILABILITY_ZONE@$ec2_availability_zone@g" >
>>> repository/conf/cloud-controller.xml
>>> -
>>> -cp -f repository/conf/cloud-controller.xml
>>> repository/conf/cloud-controller.xml.orig
>>> -cat repository/conf/cloud-controller.xml.orig | sed -e
>>> "s@EC2_SECURITY_GROUPS@$ec2_security_groups@g" >
>>> repository/conf/cloud-controller.xml
>>> -
>>> -cp -f repository/conf/cloud-controller.xml
>>> repository/conf/cloud-controller.xml.orig
>>> -cat repository/conf/cloud-controller.xml.orig | sed -e "s@EC2_KEYPAIR
>>> @$ec2_keypair_name@g" > repository/conf/cloud-controller.xml
>>> -
>>> -cp -f repository/conf/cloud-controller.xml
>>> repository/conf/cloud-controller.xml.orig
>>> -cat repository/conf/cloud-controller.xml.orig | sed -e
>>> "s@EC2_PROVIDER_END@@g" > repository/conf/cloud-controller.xml
>>> -
>>> -cp -f repository/conf/cloud-controller.xml
>>> repository/conf/cloud-controller.xml.orig
>>> -cat repository/conf/cloud-controller.xml.orig | sed -e
>>> "s@OPENSTACK_PROVIDER_START@!--@g" >
>>> repository/conf/cloud-controller.xml
>>> -
>>> -cp -f repository/conf/cloud-controller.xml
>>> repository/conf/cloud-controller.xml.orig
>>> -cat repository/conf/cloud-controller.xml.orig | sed -e
>>> "s@OPENSTACK_PROVIDER_END@--@g" > repository/conf/cloud-controller.xml
>>> -
>>> -cp -f repository/conf/cloud-controller.xml
>>> repository/conf/cloud-controller.xml.orig
>>> -cat repository/conf/cloud-controller.xml.orig | sed -e
>>> "s@VCLOUD_PROVIDER_START@!--@g" > repository/conf/cloud-controller.xml
>>> -
>>> -cp -f repository/conf/cloud-controller.xml
>>> repository/conf/cloud-controller.xml.orig
>>> -cat repository/conf/cloud-controller.xml.orig | sed -e
>>> "s@VCLOUD_PROVIDER_END@--@g" > repository/conf/cloud-controller.xml
>>> +sed -i "s@EC2_PROVIDER_START@@g"  repository/conf/cloud-controller.xml
>>> +sed -i "s@EC2_IDENTITY@$ec2_identity@g"
>>> repository/conf/cloud-controller.xml
>>> +sed -i "s@EC2_CREDENTIAL@$ec2_credential@g"
>>> repository/conf/cloud-controller.xml
>>> +sed -i "s@EC2_OWNER_ID@$ec2_owner_id@g"
>>> repository/conf/cloud-controller.xml
>>> +sed -i "s@EC2_AVAILABILITY_ZONE@$ec2_availability_zone@g"
>>> repository/conf/cloud-controller.xml
>>> +sed -i "s@EC2_SECURITY_GROUPS@$ec2_security_groups@g"
>>> repository/conf/cloud-controller.xml
>>> +sed -i "s@EC2_KEYPAIR@$ec2_keypair_name@g"
>>> repository/conf/cloud-controller.xml
>>> +sed -i "s@EC2_PROVIDER_END@@g" repository/conf/cloud-controller.xml
>>> +sed -i "s@OPENSTACK_PROVIDER_START@!--@g"
>>> repository/conf/cloud-controller.xml
>>> +sed -i "s@OPENSTACK_PROVIDER_END@--@g"
>>> repository/conf/cloud-controller.xml
>>> +sed -i "s@VCLOUD_PROVIDER_START@!--@g"
>>> repository/conf/cloud-controller.xml
>>> +sed -i "s@VCLOUD_PROVIDER_END@--@g"
>>> repository/conf/cloud-controller.xml
>>>
>>>  popd
>>>
>>>
>>>
>>> http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7e4b3aee/tools/stratos-installer/openstack.sh
>>> ----------------------------------------------------------------------
>>> diff --git a/tools/stratos-installer/openstack.sh
>>> b/tools/stratos-installer/openstack.sh
>>> index dd893da..e774468 100755
>>> --- a/tools/stratos-installer/openstack.sh
>>> +++ b/tools/stratos-installer/openstack.sh
>>> @@ -35,35 +35,18 @@ if [[ ! -d $log_path ]]; then
>>>      mkdir -p $log_path
>>>  fi
>>>
>>> -pushd $cc_path
>>> +pushd $stratos_extract_path
>>>
>>>  echo "Set OpenStack provider specific info in
>>> repository/conf/cloud-controller.xml" >> $LOG
>>>
>>> -cp -f repository/conf/cloud-controller.xml
>>> repository/conf/cloud-controller.xml.orig
>>> -cat repository/conf/cloud-controller.xml.orig | sed -e
>>> "s@OPENSTACK_PROVIDER_START@@g" > repository/conf/cloud-controller.xml
>>> -
>>> -cp -f repository/conf/cloud-controller.xml
>>> repository/conf/cloud-controller.xml.orig
>>> -cat repository/conf/cloud-controller.xml.orig | sed -e
>>> "s@OPENSTACK_IDENTITY@$openstack_identity@g" >
>>> repository/conf/cloud-controller.xml
>>> -
>>> -cp -f repository/conf/cloud-controller.xml
>>> repository/conf/cloud-controller.xml.orig
>>> -cat repository/conf/cloud-controller.xml.orig | sed -e
>>> "s@OPENSTACK_CREDENTIAL@$openstack_credential@g" >
>>> repository/conf/cloud-controller.xml
>>> -
>>> -cp -f repository/conf/cloud-controller.xml
>>> repository/conf/cloud-controller.xml.orig
>>> -cat repository/conf/cloud-controller.xml.orig | sed -e
>>> "s@OPENSTACK_ENDPOINT@$openstack_jclouds_endpoint@g" >
>>> repository/conf/cloud-controller.xml
>>> -
>>> -cp -f repository/conf/cloud-controller.xml
>>> repository/conf/cloud-controller.xml.orig
>>> -cat repository/conf/cloud-controller.xml.orig | sed -e
>>> "s@OPENSTACK_PROVIDER_END@@g" > repository/conf/cloud-controller.xml
>>> -
>>> -cp -f repository/conf/cloud-controller.xml
>>> repository/conf/cloud-controller.xml.orig
>>> -cat repository/conf/cloud-controller.xml.orig | sed -e
>>> "s@EC2_PROVIDER_START@!--@g" > repository/conf/cloud-controller.xml
>>> -
>>> -cp -f repository/conf/cloud-controller.xml
>>> repository/conf/cloud-controller.xml.orig
>>> -cat repository/conf/cloud-controller.xml.orig | sed -e
>>> "s@EC2_PROVIDER_END@--@g" > repository/conf/cloud-controller.xml
>>> -
>>> -cp -f repository/conf/cloud-controller.xml
>>> repository/conf/cloud-controller.xml.orig
>>> -cat repository/conf/cloud-controller.xml.orig | sed -e
>>> "s@VCLOUD_PROVIDER_START@!--@g" > repository/conf/cloud-controller.xml
>>> -
>>> -cp -f repository/conf/cloud-controller.xml
>>> repository/conf/cloud-controller.xml.orig
>>> -cat repository/conf/cloud-controller.xml.orig | sed -e
>>> "s@VCLOUD_PROVIDER_END@--@g" > repository/conf/cloud-controller.xml
>>> +sed -i "s@OPENSTACK_PROVIDER_START@@g"
>>> repository/conf/cloud-controller.xml
>>> +sed -i "s@OPENSTACK_IDENTITY@$openstack_identity@g"
>>>  repository/conf/cloud-controller.xml
>>> +sed -i "s@OPENSTACK_CREDENTIAL@$openstack_credential@g"
>>>  repository/conf/cloud-controller.xml
>>> +sed -i "s@OPENSTACK_ENDPOINT@$openstack_jclouds_endpoint@g"
>>>  repository/conf/cloud-controller.xml
>>> +sed -i "s@OPENSTACK_PROVIDER_END@@g"
>>>  repository/conf/cloud-controller.xml
>>> +sed -i "s@EC2_PROVIDER_START@!--@g"
>>>  repository/conf/cloud-controller.xml
>>> +sed -i "s@EC2_PROVIDER_END@--@g"  repository/conf/cloud-controller.xml
>>> +sed -i "s@VCLOUD_PROVIDER_START@!--@g"
>>>  repository/conf/cloud-controller.xml
>>> +sed -i "s@VCLOUD_PROVIDER_END@--@g"
>>>  repository/conf/cloud-controller.xml
>>>
>>>  popd
>>>
>>>
>>> http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7e4b3aee/tools/stratos-installer/setup.sh
>>> ----------------------------------------------------------------------
>>> diff --git a/tools/stratos-installer/setup.sh
>>> b/tools/stratos-installer/setup.sh
>>> index e15617d..589ab79 100755
>>> --- a/tools/stratos-installer/setup.sh
>>> +++ b/tools/stratos-installer/setup.sh
>>> @@ -26,105 +26,29 @@
>>>  # Die on any error:
>>>  set -e
>>>
>>> -SLEEP=60
>>> -
>>>  source "./conf/setup.conf"
>>>  export LOG=$log_path/stratos-setup.log
>>>
>>> -mb="false"
>>> -cc="false"
>>> -as="false"
>>> -sm="false"
>>> -cep="false"
>>> -product_list="mb;cc;cep;as;sm"
>>> -enable_internal_git=false
>>> +profile="default"
>>> +config_mb="true"
>>> +activemq_client_libs=(activemq-broker-5.8.0.jar
>>>  activemq-client-5.8.0.jar  geronimo-j2ee-management_1.1_spec-1.0.1.jar
>>>  geronimo-jms_1.1_spec-1.1.1.jar  hawtbuf-1.2.jar)
>>> +auto_start_servers="false"
>>>
>>>  function help {
>>>      echo ""
>>>      echo "Usage:"
>>> -    echo "setup.sh -u <host username> -p \"<product list>\""
>>> -    echo "product list : [mb, cc, as, sm, cep]"
>>> +    echo "setup.sh -p \"<profile>\" [-s]"
>>> +    echo "product list : [default, cc, as, sm]"
>>>      echo "Example:"
>>> +    echo "sudo ./setup.sh -p \"default\""
>>>      echo "sudo ./setup.sh -p \"cc\""
>>> -    echo "sudo ./setup.sh -p \"all\""
>>>      echo ""
>>> -    echo "-u: <host username> The login user of the host."
>>> -    echo "-p: <product list> Apache Stratos products to be installed on
>>> this node. Provide one or more names of the servers."
>>> -    echo "    The available servers are cc, as, sm or all. 'all' means
>>> you need to setup all servers in this machine. Default is all"
>>> -    echo "-g: <enable_internal_git> true|false Whether enable internal
>>> git repo for Stratos2. Default is false"
>>> +    echo "-p: <profile> Apache Stratos products to be installed on this
>>> node. Provide one name of a profile."
>>> +    echo "    The available profiles are cc, as, sm or default.
>>> 'default' means you need to setup all servers in this machine. Default is
>>> 'default' profile"
>>> +    echo "-s: Silent mode - Start servers after installation."
>>>      echo ""
>>>  }
>>>
>>> -while getopts u:p:g: opts
>>> -do
>>> -  case $opts in
>>> -    p)
>>> -        product_list=${OPTARG}
>>> -        ;;
>>> -    g)
>>> -        enable_internal_git=${OPTARG}
>>> -        ;;
>>> -    \?)
>>> -        help
>>> -        exit 1
>>> -        ;;
>>> -  esac
>>> -done
>>> -
>>> -
>>> -arr=$(echo $product_list | tr " " "\n")
>>> -
>>> -for x in $arr
>>> -do
>>> -    if [[ $x = "mb" ]]; then
>>> -        mb="true"
>>> -    fi
>>> -    if [[ $x = "cc" ]]; then
>>> -        cc="true"
>>> -    fi
>>> -    if [[ $x = "cep" ]]; then
>>> -        cep="true"
>>> -    fi
>>> -    if [[ $x = "as" ]]; then
>>> -        as="true"
>>> -    fi
>>> -    if [[ $x = "sm" ]]; then
>>> -        sm="true"
>>> -    fi
>>> -    if [[ $x = "all" ]]; then
>>> -        mb="true"
>>> -        cep="true"
>>> -        cc="true"
>>> -        as="true"
>>> -        sm="true"
>>> -    fi
>>> -done
>>> -
>>> -product_list=`echo $product_list | sed 's/^ *//g' | sed 's/ *$//g'`
>>> -if [[ -z $product_list || $product_list = "" ]]; then
>>> -    help
>>> -    exit 1
>>> -fi
>>> -
>>> -if [[ $host_user == "" ]]; then
>>> -    echo "user provided in conf/setup.conf is null. Please provide a
>>> user"
>>> -    exit 1
>>> -fi
>>> -
>>> -echo "user provided in conf/setup.conf is $host_user. If you want to
>>> provide some other user name please specify it at the prompt."
>>> -echo "If you want to continue with $host_user just press enter to
>>> continue"
>>> -read username
>>> -if [[ $username != "" ]]; then
>>> -    host_user=$username
>>> -fi
>>> -user=`id $host_user`
>>> -if [[ $? = 1 ]]; then
>>> -    echo "User $host_user does not exist. The system will create it."
>>> -    adduser --home /home/$host_user $host_user
>>> -fi
>>> -
>>> -export $host_user
>>> -
>>>  # Check validity of IP
>>>  function valid_ip()
>>>  {
>>> @@ -143,19 +67,15 @@ function valid_ip()
>>>      return $stat
>>>  }
>>>
>>> -function helpsetup {
>>> -    echo ""
>>> -    echo "Please set up the $1 related environment variables correctly
>>> in conf/setup.conf"
>>> -    echo ""
>>> -}
>>> -
>>> -function general_conf_validate {
>>> +# General functions
>>> +# -------------------------------------------------------------------
>>> +function general_conf_validate() {
>>>      if [[ ! -d $setup_path ]]; then
>>>          echo "Please specify the setup_path folder which contains
>>> stratos setup"
>>>          exit 1
>>>      fi
>>> -    if [[ ! -d $stratos_pack_path ]]; then
>>> -        echo "Please specify the stratos_pack_path folder which
>>> contains stratos packages"
>>> +    if [[ ! -d $stratos_packs ]]; then
>>> +        echo "Please specify the stratos_packs folder which contains
>>> stratos packages"
>>>          exit 1
>>>      fi
>>>      if [[ ! -d $stratos_path ]]; then
>>> @@ -172,72 +92,106 @@ function general_conf_validate {
>>>          echo "Please specify the stratos domain"
>>>          exit 1
>>>      fi
>>> -    if [[ (-z $mb_port_offset || -z $mb_ip || -z $mb_hostname) ]]; then
>>> -        echo "Please specify the ip, the port offset and the hostname
>>> of MB"
>>> +    if [[ ! -f $stratos_pack_zip ]]; then
>>> +        echo "Please copy the startos zip to the stratos pack folder"
>>>          exit 1
>>>      fi
>>> -    if !(valid_ip $mb_ip); then
>>> -        echo "Please provide valid ip for MB's ip"
>>> +    if [[ -z $mb_port ]]; then
>>> +        echo "Please specify the port of MB"
>>>          exit 1
>>>      fi
>>> -}
>>>
>>> -function andes_jar_validate {
>>> -    if [[ ($cep = "true" || $cc = "true" || $as = "true" || $sm =
>>> "true") ]]; then
>>> -        if [[ ! -f $andes_client_jar ]]; then
>>> -            echo "Please copy the andes client jar into the same folder
>>> as this command(stratos release pack folder) and update conf/setup.conf
>>> file"
>>> -            exit 1
>>> -        fi
>>> +    if [[ $auto_start_servers != "true" ]]; then
>>> +       if [[ $profile = "default" ]]; then
>>> +            read -p "Do you want to configure ActiveMQ [y/n]: " answer
>>> +            if [[ $answer = y ]] ; then
>>> +               mb_ip=$host_ip
>>> +            else
>>> +               echo "Provided mb_ip in conf/setup.conf will be used"
>>> +               config_mb="false"
>>> +            fi
>>> +       fi
>>>      fi
>>>  }
>>>
>>> -function mb_conf_validate {
>>> -    if [[ -z $mb_path ]]; then
>>> -       helpsetup MB
>>> -       exit 1
>>> -    fi
>>> +# Setup General
>>> +function general_setup() {
>>> +
>>> +    cp -f ./config/all/repository/conf/activemq/jndi.properties
>>> $stratos_extract_path/repository/conf/
>>> +
>>> +    pushd $stratos_extract_path
>>> +    echo "In repository/conf/carbon.xml"
>>> +    sed -i "s@<Offset>0</Offset>@<Offset>${offset}</Offset>@g"
>>> repository/conf/carbon.xml
>>> +
>>> +    echo "In repository/conf/jndi.properties"
>>> +    sed -i "s@MB_HOSTNAME:MB_LISTEN_PORT@$mb_ip:$mb_port@g"
>>> repository/conf/jndi.properties
>>> +    popd
>>> +
>>> +    for activemq_client_lib in "${activemq_client_libs[@]}"
>>> +    do
>>> +       cp -f $stratos_packs/$activemq_client_lib
>>> $stratos_extract_path/repository/components/lib/
>>> +    done
>>>  }
>>>
>>> -function cep_conf_validate {
>>> -    if [[ (-z $cep_path || -z $cep_port_offset) ]]; then
>>> -       helpsetup CEP
>>> -       exit 1
>>> -    fi
>>> -    if [[ ! -d $cep_artifacts_path ]]; then
>>> -        echo "Please specify the cep_artifacts_path folder which
>>> contains cep artifacts files"
>>> -        exit 1
>>> -    fi
>>> -    if [[ ! -f $cep_extension_jar ]]; then
>>> -        echo "Please copy the cep extension jar into the same folder as
>>> this command(stratos release pack folder) and update conf/setup.conf file"
>>> +function activemq_validate() {
>>> +    if [[ ! -f $activemq_pack ]]; then
>>> +        echo "Please copy the activemq zip to the stratos pack folder
>>> and update the JAR name in conf/setup.conf file"
>>>          exit 1
>>>      fi
>>>  }
>>>
>>> -function cc_conf_validate {
>>> -    if [[ (-z $cc_path || -z $cc_port_offset) ]]; then
>>> -       helpsetup CC
>>> -       exit 1
>>> -    fi
>>>
>>> +# CC related functions
>>> +# -------------------------------------------------------------------
>>> +function cc_related_popup() {
>>> +    while read -p "Please provide cloud controller ip:" cc_ip
>>> +    do
>>> +       if !(valid_ip $cc_ip); then
>>> +           echo "Please provide valid ips for CC"
>>> +       else
>>> +            export cc_ip
>>> +           break
>>> +       fi
>>> +    done
>>> +
>>> +    while read -p "Please provide cloud controller hostname:"
>>> cc_hostname
>>> +    do
>>> +       if [[ -z $cc_hostname ]]; then
>>> +           echo "Please specify valid hostname for CC"
>>> +       else
>>> +            export cc_hostname
>>> +           break
>>> +       fi
>>> +    done
>>> +
>>> +    while read -p "Please provide cloud controller port offset:"
>>> cc_port_offset
>>> +    do
>>> +       if [[ -z $cc_port_offset ]]; then
>>> +           echo "Please specify the port offset of CC"
>>> +       else
>>> +            export cc_port_offset
>>> +           break
>>> +       fi
>>> +    done
>>> +}
>>> +
>>> +function cc_conf_validate() {
>>>      if [[ $ec2_provider_enabled = "false" &&
>>> $openstack_provider_enabled = "false" && $vcloud_provider_enabled = "false"
>>> ]]; then
>>>          echo "Please enable at least one of the IaaS providers in
>>> conf/setup.conf file"
>>>          exit 1
>>>      fi
>>> -
>>>      if [[ $openstack_provider_enabled = "true" ]]; then
>>>          if [[ ( -z $openstack_identity || -z $openstack_credential ||
>>> -z $openstack_jclouds_endpoint ) ]]; then
>>>              echo "Please set openstack configuration information in
>>> conf/setup.conf file"
>>>              exit 1
>>>          fi
>>>      fi
>>> -
>>>      if [[ $ec2_provider_enabled = "true" ]]; then
>>>          if [[ ( -z $ec2_identity || -z $ec2_credential || -z
>>> $ec2_keypair_name ) ]]; then
>>>              echo "Please set ec2 configuration information in
>>> conf/setup.conf file"
>>>              exit 1
>>>          fi
>>>      fi
>>> -
>>>      if [[ $vcloud_provider_enabled = "true" ]]; then
>>>          if [[ ( -z $vcloud_identity || -z $vcloud_credential || -z
>>> $vcloud_jclouds_endpoint ) ]]; then
>>>              echo "Please set vcloud configuration information in
>>> conf/setup.conf file"
>>> @@ -246,48 +200,135 @@ function cc_conf_validate {
>>>      fi
>>>  }
>>>
>>> -function as_conf_validate {
>>> -    if [[ (-z $as_path || -z $as_port_offset) ]]; then
>>> -       helpsetup AS
>>> -       exit 1
>>> -    fi
>>> -    if [[ -z $cc_port_offset || -z $sm_port_offset ]]; then
>>> -        echo "Please specify the port offset of SM and/or CC"
>>> -        exit 1
>>> +# Setup cc
>>> +function cc_setup() {
>>> +    echo "Setup CC" >> $LOG
>>> +    echo "Configuring the Cloud Controller"
>>> +
>>> +    cp -f ./config/all/repository/conf/cloud-controller.xml
>>> $stratos_extract_path/repository/conf/
>>> +
>>> +    export cc_path=$stratos_extract_path
>>> +    echo "In repository/conf/cloud-controller.xml"
>>> +    if [[ $ec2_provider_enabled = true ]]; then
>>> +        ./ec2.sh
>>>      fi
>>> -    if [[ -z $sm_ip || -z $cc_ip ]]; then
>>> -        echo "Please specify the ips of SM and/or CC"
>>> -        exit 1
>>> -    elif !(valid_ip $sm_ip && valid_ip $cc_ip ); then
>>> -        echo "Please provide valid ips for SM and/or CC"
>>> -        exit 1
>>> +    if [[ $openstack_provider_enabled = true ]]; then
>>> +        ./openstack.sh
>>>      fi
>>> -    if [[ -z $cc_hostname || -z $sm_hostname ]]; then
>>> -       echo "Please specify valid hostname for SM and/or CC"
>>> -       exit 1
>>> +    if [[ $vcloud_provider_enabled = true ]]; then
>>> +        ./vcloud.sh
>>>      fi
>>> +
>>> +    pushd $stratos_extract_path
>>> +
>>> +    popd
>>> +    echo "End configuring the Cloud Controller"
>>>  }
>>>
>>> -function sm_conf_validate {
>>> -    if [[ (-z $sm_path || -z $sm_port_offset) ]]; then
>>> -       helpsetup SM
>>> -       exit 1
>>> -    fi
>>> -    if [[ ! -f $mysql_connector_jar ]]; then
>>> -        echo "Please copy the mysql connector jar to the stratos
>>> release pack folder and update the JAR name in conf/setup.conf file"
>>> -        exit 1
>>> -    fi
>>> -    if [[ -z $cc_port_offset || -z $as_port_offset ]]; then
>>> -        echo "Please specify the port offset of AS and/or CC"
>>> -        exit 1
>>> -    fi
>>> -    if [[ -z $sm_ip || -z $as_ip || -z $cc_ip ]]; then
>>> -        echo "Please specify the ips of SM and/or AS and/or CC"
>>> -        exit 1
>>> -    elif !(valid_ip $sm_ip && valid_ip $cc_ip && valid_ip $as_ip); then
>>> -        echo "Please provide valid ips for SM and/or AS and/or CC"
>>> -        exit 1
>>> +
>>> +# AS related functions
>>> +# -------------------------------------------------------------------
>>> +function as_related_popup() {
>>> +    while read -p "Please provide Auto Scalar ip:" as_ip
>>> +    do
>>> +       if !(valid_ip $as_ip); then
>>> +           echo "Please provide valid ips for AS"
>>> +       else
>>> +            export as_ip
>>> +           break
>>> +       fi
>>> +    done
>>> +
>>> +    while read -p "Please provide Auto Scala hostname:" as_hostname
>>> +    do
>>> +       if [[ -z $as_hostname ]]; then
>>> +           echo "Please specify valid hostname for AS"
>>> +       else
>>> +            export as_hostname
>>> +           break
>>> +       fi
>>> +    done
>>> +
>>> +    while read -p "Please provide Auto Scala port offset:"
>>> as_port_offset
>>> +    do
>>> +       if [[ -z $as_port_offset ]]; then
>>> +           echo "Please specify the port offset of AS"
>>> +       else
>>> +            export as_port_offset
>>> +           break
>>> +       fi
>>> +    done
>>> +}
>>> +
>>> +function as_conf_validate() {
>>> +    if [[ !($profile = "default") ]]; then
>>> +       cc_related_popup
>>> +       sm_related_popup
>>> +       export as_cc_https_port=$((9443 + $cc_port_offset))
>>> +       export as_sm_https_port=$((9443 + $sm_port_offset))
>>> +    else
>>> +        cc_hostname=$stratos_domain
>>> +        sm_hostname=$stratos_domain
>>> +       export as_cc_https_port=$((9443 + $offset))
>>> +       export as_sm_https_port=$((9443 + $offset))
>>>      fi
>>> +}
>>> +
>>> +# Setup AS
>>> +function as_setup() {
>>> +    echo "Setup AS" >> $LOG
>>> +    echo "Configuring the Auto Scalar"
>>> +
>>> +    cp -f ./config/all/repository/conf/autoscaler.xml
>>> $stratos_extract_path/repository/conf/
>>> +
>>> +    pushd $stratos_extract_path
>>> +
>>> +    echo "In repository/conf/autoscaler.xml"
>>> +    sed -i "s@CC_HOSTNAME@$cc_hostname@g"
>>> repository/conf/autoscaler.xml
>>> +    sed -i "s@CC_LISTEN_PORT@$as_cc_https_port@g"
>>> repository/conf/autoscaler.xml
>>> +    sed -i "s@SM_HOSTNAME@$sm_hostname@g"
>>> repository/conf/autoscaler.xml
>>> +    sed -i "s@SM_LISTEN_PORT@$as_sm_https_port@g"
>>> repository/conf/autoscaler.xml
>>> +
>>> +    popd
>>> +    echo "End configuring the Auto scalar"
>>> +}
>>> +
>>> +
>>> +# SM related functions
>>> +# -------------------------------------------------------------------
>>> +function sm_related_popup() {
>>> +    while read -p "Please provide Stratos Manager ip:" sm_ip
>>> +    do
>>> +       if !(valid_ip $sm_ip); then
>>> +           echo "Please provide valid ips for SM"
>>> +       else
>>> +            export sm_ip
>>> +           break
>>> +       fi
>>> +    done
>>> +
>>> +    while read -p "Please provide Stratos Manager hostname:" sm_hostname
>>> +    do
>>> +       if [[ -z $sm_hostname ]]; then
>>> +           echo "Please specify valid hostname for SM"
>>> +       else
>>> +            export sm_hostname
>>> +           break
>>> +       fi
>>> +    done
>>> +
>>> +    while read -p "Please provide Stratos Manager port offset:"
>>> sm_port_offset
>>> +    do
>>> +       if [[ -z $sm_port_offset ]]; then
>>> +           echo "Please specify the port offset of SM"
>>> +       else
>>> +            export sm_port_offset
>>> +           break
>>> +       fi
>>> +    done
>>> +}
>>> +
>>> +function sm_conf_validate() {
>>>      if [[ -z $puppet_ip ]]; then
>>>          echo "Please specify the ip of puppet master"
>>>          exit 1
>>> @@ -303,348 +344,219 @@ function sm_conf_validate {
>>>          echo "Please specify the relevant puppet environment"
>>>          exit 1
>>>      fi
>>> -    if [[ -z $cc_hostname || -z $as_hostname ]]; then
>>> -       echo "Please specify valid hostname for AS and/or CC"
>>> -       exit 1
>>> +    if [[ ! -f $mysql_connector_jar ]]; then
>>> +        echo "Please copy the mysql connector jar to the stratos
>>> release pack folder and update the JAR name in conf/setup.conf file"
>>> +        exit 1
>>>      fi
>>> -}
>>> -
>>>
>>> -general_conf_validate
>>> -andes_jar_validate
>>> -if [[ $mb = "true" ]]; then
>>> -    mb_conf_validate
>>> -fi
>>> -if [[ $cep = "true" ]]; then
>>> -    cep_conf_validate
>>> -fi
>>> -if [[ $cc = "true" ]]; then
>>> -    cc_conf_validate
>>> -fi
>>> -if [[ $as = "true" ]]; then
>>> -    as_conf_validate
>>> -fi
>>> -if [[ $sm = "true" ]]; then
>>> -    sm_conf_validate
>>> -fi
>>> -
>>> -
>>> -# Make sure the user is running as root.
>>> -if [ "$UID" -ne "0" ]; then
>>> -       echo ; echo "  You must be root to run $0.  (Try running 'sudo
>>> bash' first.)" ; echo
>>> -       exit 69
>>> -fi
>>> +    if [[ !($profile = "default") ]]; then
>>> +       cc_related_popup
>>> +       as_related_popup
>>> +       export sm_cc_https_port=$((9443 + $cc_port_offset))
>>> +       export sm_as_https_port=$((9443 + $as_port_offset))
>>> +    else
>>> +        export cc_hostname=$stratos_domain
>>> +        export as_hostname=$stratos_domain
>>> +       export sm_cc_https_port=$((9443 + $offset))
>>> +       export sm_as_https_port=$((9443 + $offset))
>>> +    fi
>>> +    export sm_https_port=$((9443 + $offset))
>>> +}
>>>
>>> -if [[ ! -d $log_path ]]; then
>>> -    mkdir -p $log_path
>>> -fi
>>> +# Setup SM
>>> +function sm_setup() {
>>> +    echo "Setup SM" >> $LOG
>>> +    echo "Configuring Stratos Manager"
>>>
>>> +    cp -f ./config/all/repository/conf/cartridge-config.properties
>>> $stratos_extract_path/repository/conf/
>>> +    cp -f
>>> ./config/all/repository/conf/datasources/master-datasources.xml
>>> $stratos_extract_path/repository/conf/datasources/
>>> +    cp -f $mysql_connector_jar
>>> $stratos_extract_path/repository/components/lib/
>>>
>>> -echo ""
>>> -echo "For all the questions asked while during executing the script
>>> please just press the enter button"
>>> -echo ""
>>> +    pushd $stratos_extract_path
>>>
>>> -if [[ $mb = "true" ]]; then
>>> -    if [[ ! -d $mb_path ]]; then
>>> -        echo "Extracting Message Broker"
>>> -        unzip -q $mb_pack_path -d $stratos_path
>>> -    fi
>>> -fi
>>> -if [[ $cep = "true" ]]; then
>>> -    if [[ ! -d $cep_path ]]; then
>>> -        echo "Extracting Complex Event Processor"
>>> -        unzip -q $cep_pack_path -d $stratos_path
>>> -    fi
>>> -fi
>>> -if [[ $cc = "true" ]]; then
>>> -    if [[ ! -d $cc_path ]]; then
>>> -        echo "Extracting Cloud Controller"
>>> -        unzip -q $cc_pack_path -d $stratos_path
>>> -    fi
>>> -fi
>>> -if [[ $as = "true" ]]; then
>>> -    if [[ ! -d $as_path ]]; then
>>> -        echo "Extracting Autoscaler"
>>> -        unzip -q $as_pack_path -d $stratos_path
>>> -    fi
>>> -fi
>>> -if [[ $sm = "true" ]]; then
>>> -    if [[ ! -d $resource_path ]]; then
>>> -        cp -rf ./resources $stratos_path
>>> -    fi
>>> -    if [[ ! -d $sm_path ]]; then
>>> -        echo "Extracting Stratos Manager"
>>> -        unzip -q $sm_pack_path -d $stratos_path
>>> -    fi
>>> -fi
>>> +    echo "In repository/conf/cartridge-config.properties"
>>> +    sed -i "s@CC_HOSTNAME:CC_HTTPS_PORT@
>>> $cc_hostname:$sm_cc_https_port@g"
>>> repository/conf/cartridge-config.properties
>>> +    sed -i "s@AS_HOSTNAME:AS_HTTPS_PORT@
>>> $as_hostname:$sm_as_https_port@g"
>>> repository/conf/cartridge-config.properties
>>> +    sed -i "s@PUPPET_IP@$puppet_ip@g"
>>> repository/conf/cartridge-config.properties
>>> +    sed -i "s@PUPPET_HOSTNAME@$puppet_hostname@g"
>>> repository/conf/cartridge-config.properties
>>> +    sed -i "s@PUPPET_ENV@$puppet_environment@g"
>>> repository/conf/cartridge-config.properties
>>>
>>> +    echo "In repository/conf/datasources/master-datasources.xml"
>>> +    sed -i "s@USERSTORE_DB_HOSTNAME@$userstore_db_hostname@g"
>>> repository/conf/datasources/master-datasources.xml
>>> +    sed -i "s@USERSTORE_DB_PORT@$userstore_db_port@g"
>>> repository/conf/datasources/master-datasources.xml
>>> +    sed -i "s@USERSTORE_DB_SCHEMA@$userstore_db_schema@g"
>>> repository/conf/datasources/master-datasources.xml
>>> +    sed -i "s@USERSTORE_DB_USER@$userstore_db_user@g"
>>> repository/conf/datasources/master-datasources.xml
>>> +    sed -i "s@USERSTORE_DB_PASS@$userstore_db_pass@g"
>>> repository/conf/datasources/master-datasources.xml
>>>
>>> +    popd
>>>
>>> -# ------------------------------------------------
>>> -# Setup MB
>>> -# ------------------------------------------------
>>> -function mb_setup {
>>> -    echo "Setup MB" >> $LOG
>>> -    echo "Configuring the Message Broker"
>>> +    # Database Configuration
>>> +    # -----------------------------------------------
>>> +    echo "Create and configure MySql Databases" >> $LOG
>>> +    echo "Creating userstore database"
>>>
>>> -    pushd $mb_path
>>> +    pushd $resource_path
>>> +    sed -i "s@USERSTORE_DB_SCHEMA@$userstore_db_schema@g" mysql.sql
>>>
>>> -    echo "In repository/conf/carbon.xml"
>>> -    cp -f repository/conf/carbon.xml repository/conf/carbon.xml.orig
>>> -    cat repository/conf/carbon.xml.orig | sed -e "s@<Offset>0</Offset>@<Offset>${mb_port_offset}</Offset>@g"
>>> > repository/conf/carbon.xml
>>> +    popd
>>>
>>> -    echo "End configuring the Message Broker"
>>> -    popd #mb_path
>>> +    mysql -u$userstore_db_user -p$userstore_db_pass <
>>> $resource_path/mysql.sql
>>> +    echo "End configuring the SM"
>>>  }
>>>
>>> -if [[ $mb = "true" ]]; then
>>> -    mb_setup
>>> -fi
>>>
>>> -# ------------------------------------------------
>>>  # Setup CEP
>>> -# ------------------------------------------------
>>> -function cep_setup {
>>> +function cep_setup() {
>>>      echo "Setup CEP" >> $LOG
>>>      echo "Configuring the Complex Event Processor"
>>>
>>> -    cp -f ./config/cep/repository/conf/jndi.properties
>>> $cep_path/repository/conf/
>>> -    cp -f $cep_extension_jar $cep_path/repository/components/lib/
>>> -    cp -f $andes_client_jar $cep_path/repository/components/dropins/
>>> -    cp -f $cep_artifacts_path/eventbuilders/*.xml
>>> $cep_path/repository/deployment/server/eventbuilders/
>>> -    cp -f $cep_artifacts_path/inputeventadaptors/*.xml
>>> $cep_path/repository/deployment/server/inputeventadaptors/
>>> -    cp -f $cep_artifacts_path/outputeventadaptors/*.xml
>>> $cep_path/repository/deployment/server/outputeventadaptors/
>>> -    cp -f $cep_artifacts_path/executionplans/*.xml
>>> $cep_path/repository/deployment/server/executionplans/
>>> -    cp -f $cep_artifacts_path/eventformatters/*.xml
>>> $cep_path/repository/deployment/server/eventformatters/
>>> -    cp -f $cep_artifacts_path/streamdefinitions/*.xml
>>> $cep_path/repository/conf/
>>> -
>>> -    pushd $cep_path
>>> -
>>> -    echo "In repository/conf/carbon.xml"
>>> -    cp -f repository/conf/carbon.xml repository/conf/carbon.xml.orig
>>> -    cat repository/conf/carbon.xml.orig | sed -e "s@<Offset>0</Offset>@<Offset>${cep_port_offset}</Offset>@g"
>>> > repository/conf/carbon.xml
>>> -
>>> -    echo "In repository/conf/jndi.properties"
>>> -    cp -f repository/conf/jndi.properties
>>> repository/conf/jndi.properties.orig
>>> -    cat repository/conf/jndi.properties.orig | sed -e "s@MB_HOSTNAME
>>> :MB_LISTEN_PORT@$mb_hostname:$cep_mb_listen_port@g" >
>>> repository/conf/jndi.properties
>>> +    pushd $stratos_extract_path
>>>
>>>      echo "In outputeventadaptors"
>>> -    cp -f
>>> repository/deployment/server/outputeventadaptors/JMSOutputAdaptor.xml
>>> repository/deployment/server/outputeventadaptors/JMSOutputAdaptor.xml.orig
>>> -    cat
>>> repository/deployment/server/outputeventadaptors/JMSOutputAdaptor.xml.orig
>>> | sed -e "s@CEP_HOME@$cep_path@g" >
>>> repository/deployment/server/outputeventadaptors/JMSOutputAdaptor.xml
>>>
>>> -    echo "In repository/conf/siddhi/siddhi.extension"
>>> -    cp -f repository/conf/siddhi/siddhi.extension
>>> repository/conf/siddhi/siddhi.extension.orig
>>> -    echo
>>> "org.apache.stratos.cep.extension.GradientFinderWindowProcessor" >>
>>> repository/conf/siddhi/siddhi.extension.orig
>>> -    echo
>>> "org.apache.stratos.cep.extension.SecondDerivativeFinderWindowProcessor" >>
>>> repository/conf/siddhi/siddhi.extension.orig
>>> -    echo
>>> "org.apache.stratos.cep.extension.FaultHandlingWindowProcessor" >>
>>> repository/conf/siddhi/siddhi.extension.orig
>>> -    mv -f repository/conf/siddhi/siddhi.extension.orig
>>> repository/conf/siddhi/siddhi.extension
>>> +    sed -i "s@CEP_HOME@$stratos_extract_path@g"
>>> repository/deployment/server/outputeventadaptors/JMSOutputAdaptor.xml
>>> +    sed -i "s@MB_HOSTNAME:MB_LISTEN_PORT@$mb_ip:$mb_port@g"
>>> repository/deployment/server/outputeventadaptors/JMSOutputAdaptor.xml
>>>
>>>      echo "End configuring the Complex Event Processor"
>>> -    popd #cep_path
>>> +    popd
>>>  }
>>> -if [[ $cep = "true" ]]; then
>>> -    cep_setup
>>> -fi
>>>
>>>
>>>  # ------------------------------------------------
>>> -# Setup CC
>>> +# Execution
>>>  # ------------------------------------------------
>>> -function cc_setup {
>>> -    echo "Setup CC" >> $LOG
>>> -    echo "Configuring the Cloud Controller"
>>> -
>>> -    echo "Creating payload directory ... " >> $LOG
>>> -    if [[ ! -d $cc_path/repository/resources/payload ]]; then
>>> -        mkdir -p $cc_path/repository/resources/payload
>>> -    fi
>>> -
>>> -    cp -f ./config/cc/repository/conf/cloud-controller.xml
>>> $cc_path/repository/conf/
>>> -    cp -f ./config/cc/repository/conf/carbon.xml
>>> $cc_path/repository/conf/
>>> -    cp -f ./config/cc/repository/conf/jndi.properties
>>> $cc_path/repository/conf/
>>> -    cp -f $andes_client_jar $cc_path/repository/components/dropins/
>>> -
>>> -    echo "In repository/conf/cloud-controller.xml"
>>> -    if [[ $ec2_provider_enabled = true ]]; then
>>> -        ./ec2.sh
>>> -    fi
>>> -    if [[ $openstack_provider_enabled = true ]]; then
>>> -        ./openstack.sh
>>> -    fi
>>> -    if [[ $vcloud_provider_enabled = true ]]; then
>>> -        ./vcloud.sh
>>> -    fi
>>> -
>>> -    pushd $cc_path
>>> -
>>> -    cp -f repository/conf/cloud-controller.xml
>>> repository/conf/cloud-controller.xml.orig
>>> -    cat repository/conf/cloud-controller.xml.orig | sed -e
>>> "s@MB_HOSTNAME:MB_LISTEN_PORT@$mb_hostname:$cc_mb_listen_port@g" >
>>> repository/conf/cloud-controller.xml
>>>
>>> -    echo "In repository/conf/carbon.xml"
>>> -    cp -f repository/conf/carbon.xml repository/conf/carbon.xml.orig
>>> -    cat repository/conf/carbon.xml.orig | sed -e "s@CC_PORT_OFFSET
>>> @$cc_port_offset@g" > repository/conf/carbon.xml
>>> -
>>> -    echo "In repository/conf/jndi.properties"
>>> -    cp -f repository/conf/jndi.properties
>>> repository/conf/jndi.properties.orig
>>> -    cat repository/conf/jndi.properties.orig | sed -e "s@MB_HOSTNAME
>>> :MB_LISTEN_PORT@$mb_hostname:$cc_mb_listen_port@g" >
>>> repository/conf/jndi.properties
>>> -
>>> -    popd #cc_path
>>> -    echo "End configuring the Cloud Controller"
>>> -}
>>> +while getopts p:s opts
>>> +do
>>> +  case $opts in
>>> +    p)
>>> +        profile_list=${OPTARG}
>>> +        ;;
>>> +    s)
>>> +        auto_start_servers="true"
>>> +        ;;
>>> +    \?)
>>> +        help
>>> +        exit 1
>>> +        ;;
>>> +  esac
>>> +done
>>>
>>> -if [[ $cc = "true" ]]; then
>>> -   cc_setup
>>> +profile_list=`echo $profile_list | sed 's/^ *//g' | sed 's/ *$//g'`
>>> +if [[ !(-z $profile_list || $profile_list = "") ]]; then
>>> +    arr=$(echo $profile_list | tr " " "\n")
>>> +echo $arr
>>> +    for x in $arr
>>> +    do
>>> +       if [[ $x = "default" ]]; then
>>> +            profile="default"
>>> +       elif [[ $x = "cc" ]]; then
>>> +            profile="cc"
>>> +        elif [[ $x = "as" ]]; then
>>> +            profile="as"
>>> +        elif [[ $x = "sm" ]]; then
>>> +            profile="sm"
>>> +        else
>>> +            echo "Invalid profile."
>>> +            exit 1
>>> +       fi
>>> +    done
>>> +    echo "You have selected the profile : $profile"
>>> +else
>>> +    echo "You have not provided a profile : default profile will be
>>> selected."
>>>  fi
>>>
>>> -# ------------------------------------------------
>>> -# Setup AS
>>> -# ------------------------------------------------
>>> -function as_setup {
>>> -    echo "Setup AS" >> $LOG
>>> -    echo "Configuring the Auto Scalar"
>>> -
>>> -    cp -f ./config/as/repository/conf/carbon.xml
>>> $as_path/repository/conf/
>>> -    cp -f ./config/as/repository/conf/jndi.properties
>>> $as_path/repository/conf/
>>> -    cp -f ./config/as/repository/conf/autoscaler.xml
>>> $as_path/repository/conf/
>>> -    cp -f $andes_client_jar $as_path/repository/components/dropins/
>>> -
>>> -    pushd $as_path
>>> -
>>> -    echo "In repository/conf/carbon.xml"
>>> -    cp -f repository/conf/carbon.xml repository/conf/carbon.xml.orig
>>> -    cat repository/conf/carbon.xml.orig | sed -e "s@AS_PORT_OFFSET
>>> @$as_port_offset@g" > repository/conf/carbon.xml
>>> -
>>> -    echo "In repository/conf/jndi.properties"
>>> -    cp -f repository/conf/jndi.properties
>>> repository/conf/jndi.properties.orig
>>> -    cat repository/conf/jndi.properties.orig | sed -e "s@MB_HOSTNAME
>>> :MB_LISTEN_PORT@$mb_hostname:$as_mb_listen_port@g" >
>>> repository/conf/jndi.properties
>>> -
>>> -    echo "In repository/conf/autoscaler.xml"
>>> -    cp -f repository/conf/autoscaler.xml
>>> repository/conf/autoscaler.xml.orig
>>> -    cat repository/conf/autoscaler.xml.orig | sed -e "s@CC_HOSTNAME
>>> @$cc_hostname@g" > repository/conf/autoscaler.xml
>>>
>>> -    cp -f repository/conf/autoscaler.xml
>>> repository/conf/autoscaler.xml.orig
>>> -    cat repository/conf/autoscaler.xml.orig | sed -e "s@CC_LISTEN_PORT
>>> @$as_cc_https_port@g" > repository/conf/autoscaler.xml
>>> -
>>> -    cp -f repository/conf/autoscaler.xml
>>> repository/conf/autoscaler.xml.orig
>>> -    cat repository/conf/autoscaler.xml.orig | sed -e "s@SM_HOSTNAME
>>> @$sm_hostname@g" > repository/conf/autoscaler.xml
>>> -
>>> -    cp -f repository/conf/autoscaler.xml
>>> repository/conf/autoscaler.xml.orig
>>> -    cat repository/conf/autoscaler.xml.orig | sed -e "s@SM_LISTEN_PORT
>>> @$as_sm_https_port@g" > repository/conf/autoscaler.xml
>>> -
>>> -    popd #as_path
>>> -    echo "End configuring the Auto smalar"
>>> -}
>>> -
>>> -if [[ $as = "true" ]]; then
>>> -    as_setup
>>> +if [[ $host_user == "" ]]; then
>>> +    echo "user provided in conf/setup.conf is null. Please provide a
>>> user"
>>> +    exit 1
>>>  fi
>>>
>>> +echo "user provided in conf/setup.conf is $host_user. If you want to
>>> provide some other user name please specify it at the prompt."
>>> +echo "If you want to continue with $host_user just press enter to
>>> continue"
>>> +read username
>>> +if [[ $username != "" ]]; then
>>> +    host_user=$username
>>> +fi
>>> +user=`id $host_user`
>>> +if [[ $? = 1 ]]; then
>>> +    echo "User $host_user does not exist. The system will create it."
>>> +    adduser --home /home/$host_user $host_user
>>> +fi
>>>
>>> +export $host_user
>>>
>>> -# ------------------------------------------------
>>> -# Setup SM
>>> -# ------------------------------------------------
>>> -function sm_setup {
>>> -    echo "Setup SM" >> $LOG
>>> -    echo "Configuring Stratos Manager"
>>> -
>>> -    cp -f ./config/sm/repository/conf/carbon.xml
>>> $sm_path/repository/conf/
>>> -    cp -f ./config/sm/repository/conf/jndi.properties
>>> $sm_path/repository/conf/
>>> -    cp -f ./config/sm/repository/conf/cartridge-config.properties
>>> $sm_path/repository/conf/
>>> -    cp -f
>>> ./config/sm/repository/conf/datasources/master-datasources.xml
>>> $sm_path/repository/conf/datasources/
>>> -    cp -f $mysql_connector_jar $sm_path/repository/components/lib/
>>> -    cp -f $andes_client_jar $sm_path/repository/components/dropins/
>>> -
>>> -    pushd $sm_path
>>> -
>>> -    echo "In repository/conf/carbon.xml"
>>> -    cp -f repository/conf/carbon.xml repository/conf/carbon.xml.orig
>>> -    cat repository/conf/carbon.xml.orig | sed -e "s@SC_PORT_OFFSET
>>> @$sm_port_offset@g" > repository/conf/carbon.xml
>>> -
>>> -    echo "In repository/conf/jndi.properties"
>>> -    cp -f repository/conf/jndi.properties
>>> repository/conf/jndi.properties.orig
>>> -    cat repository/conf/jndi.properties.orig | sed -e "s@MB_HOSTNAME
>>> :MB_LISTEN_PORT@$mb_hostname:$sm_mb_listen_port@g" >
>>> repository/conf/jndi.properties
>>> -
>>> -    echo "In repository/conf/cartridge-config.properties" >> $LOG
>>> -    cp -f repository/conf/cartridge-config.properties
>>> repository/conf/cartridge-config.properties.orig
>>> -    cat repository/conf/cartridge-config.properties.orig | sed -e
>>> "s@CC_HOSTNAME:CC_HTTPS_PORT@$cc_hostname:$sm_cc_https_port@g" >
>>> repository/conf/cartridge-config.properties
>>> -
>>> -    cp -f repository/conf/cartridge-config.properties
>>> repository/conf/cartridge-config.properties.orig
>>> -    cat repository/conf/cartridge-config.properties.orig | sed -e
>>> "s@AS_HOSTNAME:AS_HTTPS_PORT@$as_hostname:$sm_as_https_port@g" >
>>> repository/conf/cartridge-config.properties
>>> -
>>> -    cp -f repository/conf/cartridge-config.properties
>>> repository/conf/cartridge-config.properties.orig
>>> -    cat repository/conf/cartridge-config.properties.orig | sed -e
>>> "s@PUPPET_IP@$sm_puppet_ip@g" >
>>> repository/conf/cartridge-config.properties
>>> -
>>> -    cp -f repository/conf/cartridge-config.properties
>>> repository/conf/cartridge-config.properties.orig
>>> -    cat repository/conf/cartridge-config.properties.orig | sed -e
>>> "s@PUPPET_HOSTNAME@$sm_puppet_hostname@g" >
>>> repository/conf/cartridge-config.properties
>>> -
>>> -    cp -f repository/conf/cartridge-config.properties
>>> repository/conf/cartridge-config.properties.orig
>>> -    cat repository/conf/cartridge-config.properties.orig | sed -e
>>> "s@PUPPET_ENV@$sm_puppet_environment@g" >
>>> repository/conf/cartridge-config.properties
>>> -
>>> -    echo "In repository/conf/datasources/master-datasources.xml" >> $LOG
>>> -    cp -f repository/conf/datasources/master-datasources.xml
>>> repository/conf/datasources/master-datasources.xml.orig
>>> -    cat repository/conf/datasources/master-datasources.xml.orig | sed
>>> -e "s@USERSTORE_DB_HOSTNAME@$userstore_db_hostname@g" >
>>> repository/conf/datasources/master-datasources.xml
>>> -
>>> -    cp -f repository/conf/datasources/master-datasources.xml
>>> repository/conf/datasources/master-datasources.xml.orig
>>> -    cat repository/conf/datasources/master-datasources.xml.orig | sed
>>> -e "s@USERSTORE_DB_PORT@$userstore_db_port@g" >
>>> repository/conf/datasources/master-datasources.xml
>>> -
>>> -    cp -f repository/conf/datasources/master-datasources.xml
>>> repository/conf/datasources/master-datasources.xml.orig
>>> -    cat repository/conf/datasources/master-datasources.xml.orig | sed
>>> -e "s@USERSTORE_DB_SCHEMA@$userstore_db_schema@g" >
>>> repository/conf/datasources/master-datasources.xml
>>> -
>>> -    cp -f repository/conf/datasources/master-datasources.xml
>>> repository/conf/datasources/master-datasources.xml.orig
>>> -    cat repository/conf/datasources/master-datasources.xml.orig | sed
>>> -e "s@USERSTORE_DB_USER@$userstore_db_user@g" >
>>> repository/conf/datasources/master-datasources.xml
>>> -
>>> -    cp -f repository/conf/datasources/master-datasources.xml
>>> repository/conf/datasources/master-datasources.xml.orig
>>> -    cat repository/conf/datasources/master-datasources.xml.orig | sed
>>> -e "s@USERSTORE_DB_PASS@$userstore_db_pass@g" >
>>> repository/conf/datasources/master-datasources.xml
>>> -
>>> -    popd # sm_path
>>> -
>>> +# Make sure the user is running as root.
>>> +if [ "$UID" -ne "0" ]; then
>>> +       echo ; echo "  You must be root to run $0.  (Try running 'sudo
>>> bash' first.)" ; echo
>>> +       exit 69
>>> +fi
>>>
>>> -    # Database Configuration
>>> -    # -----------------------------------------------
>>> -    echo "Create and configure MySql Databases" >> $LOG
>>> +general_conf_validate
>>> +if [[ $profile = "cc" ]]; then
>>> +    cc_conf_validate
>>> +elif [[ $profile = "as" ]]; then
>>> +    as_conf_validate
>>> +elif [[ $profile = "sm" ]]; then
>>> +    sm_conf_validate
>>> +else
>>> +    echo "In default profile CEP will be configured."
>>> +    activemq_validate
>>> +    cc_conf_validate
>>> +    as_conf_validate
>>> +    sm_conf_validate
>>> +fi
>>>
>>> -    echo "Creating userstore database"
>>> +if [[ ! -d $log_path ]]; then
>>> +    mkdir -p $log_path
>>> +fi
>>>
>>> -    pushd $resource_path
>>> -    cp -f mysql.sql mysql.sql.orig
>>> -    cat mysql.sql.orig | sed -e "s@USERSTORE_DB_SCHEMA
>>> @$userstore_db_schema@g" > mysql.sql
>>>
>>> -    popd # resource_path
>>> +echo ""
>>> +echo "For all the questions asked while during executing the script
>>> please just press the enter button"
>>> +echo ""
>>>
>>> -    mysql -u$userstore_db_user -p$userstore_db_pass <
>>> $resource_path/mysql.sql
>>> -
>>> -    #Copy
>>> https://svn.wso2.org/repos/wso2/scratch/hosting/build/tropos/resources/append_zone_file.shinto /opt/scripts folder
>>> -    if [[ ! -d $stratos_path/scripts ]]; then
>>> -        mkdir -p $stratos_path/scripts
>>> -    fi
>>> -    cp -f ./scripts/add_entry_zone_file.sh
>>> $stratos_path/scripts/add_entry_zone_file.sh
>>> -    cp -f ./scripts/remove_entry_zone_file.sh
>>> $stratos_path/scripts/remove_entry_zone_file.sh
>>>
>>> +# Extract stratos zip file
>>> +if [[ !(-d $stratos_extract_path) ]]; then
>>> +    echo "Extracting Apache Stratos"
>>> +    unzip -q $stratos_pack_zip -d $stratos_path
>>> +    mv -f $stratos_path/apache-stratos-4.0.0-SNAPSHOT
>>> $stratos_extract_path
>>> +fi
>>>
>>> -    echo "End configuring the SM"
>>> -}
>>> +if [[ ($profile = "default" && $config_mb = "true") ]]; then
>>> +    echo "Extracting ActiveMQ"
>>> +    tar -xzf $activemq_pack -C $stratos_path
>>> +fi
>>>
>>> -if [[ $sm = "true" ]]; then
>>> +general_setup
>>> +if [[ $profile = "cc" ]]; then
>>> +    cc_setup
>>> +elif [[ $profile = "as" ]]; then
>>> +    as_setup
>>> +elif [[ $profile = "sm" ]]; then
>>> +    sm_setup
>>> +else
>>> +    cc_setup
>>> +    as_setup
>>>      sm_setup
>>> +    cep_setup
>>>  fi
>>>
>>> -
>>>  # ------------------------------------------------
>>>  # Mapping domain/host names
>>>  # ------------------------------------------------
>>>
>>>  cp -f /etc/hosts hosts.tmp
>>>
>>> -
>>> -echo "$mb_ip $mb_hostname      # message broker hostname"      >>
>>> hosts.tmp
>>> -
>>> -if [[ $sm = "true" || $as = "true" ]]; then
>>> +echo "$host_ip $sm_hostname    # stratos domain"       >> hosts.tmp
>>> +
>>> +if [[ $profile = "sm" || $profile = "as" ]]; then
>>>      echo "$sm_ip $sm_hostname  # stratos domain"       >> hosts.tmp
>>>      echo "$cc_ip $cc_hostname  # cloud controller hostname"    >>
>>> hosts.tmp
>>>  fi
>>>
>>> -if [[ $sm = "true" ]]; then
>>> +if [[ $profile = "sm" ]]; then
>>>      echo "$as_ip $as_hostname  # auto scalar hostname" >> hosts.tmp
>>>  fi
>>>
>>> @@ -659,9 +571,11 @@ chown $host_user:$host_user $stratos_path -R
>>>
>>>  echo "Apache Stratos setup has successfully completed"
>>>
>>> -read -p "Do you want to start the servers [y/n]? " answer
>>> -if [[ $answer != y ]] ; then
>>> -   exit 1
>>> +if [[ $auto_start_servers != "true" ]]; then
>>> +    read -p "Do you want to start the servers [y/n]? " answer
>>> +    if [[ $answer != y ]] ; then
>>> +        exit 1
>>> +    fi
>>>  fi
>>>
>>>  echo "Starting the servers" >> $LOG
>>> @@ -672,14 +586,11 @@ chown -R $host_user.$host_user $log_path
>>>  chmod -R 777 $log_path
>>>
>>>  export setup_dir=$PWD
>>> -su - $host_user -c "source
>>> $setup_dir/conf/setup.conf;$setup_dir/start-servers.sh -p\"$product_list\"
>>> >> $LOG"
>>> +su - $host_user -c "source
>>> $setup_path/conf/setup.conf;$setup_path/start-servers.sh -p\"$profile\" >>
>>> $LOG"
>>>
>>>  echo "Servers started. Please look at $LOG file for server startup
>>> details"
>>> -if [[ $sm == "true" ]]; then
>>> +if [[ $profile == "default" || $profile == "sm" ]]; then
>>>      echo
>>> "**************************************************************"
>>>      echo "Management Console : https://
>>> $stratos_domain:$sm_https_port/console"
>>>      echo
>>> "**************************************************************"
>>>  fi
>>> -
>>> -
>>> -
>>>
>>>
>>> http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7e4b3aee/tools/stratos-installer/start-servers.sh
>>> ----------------------------------------------------------------------
>>> diff --git a/tools/stratos-installer/start-servers.sh
>>> b/tools/stratos-installer/start-servers.sh
>>> index c22eeea..78edf65 100755
>>> --- a/tools/stratos-installer/start-servers.sh
>>> +++ b/tools/stratos-installer/start-servers.sh
>>> @@ -29,18 +29,22 @@ product_list=$1
>>>  export LOG=$log_path/stratos.log
>>>  SLEEP=40
>>>
>>> +profile="default"
>>> +
>>>  if [[ -f ./conf/setup.conf ]]; then
>>>      source "./conf/setup.conf"
>>> +    echo "source it"
>>>  fi
>>>
>>> +
>>>  function help {
>>>      echo ""
>>>      echo "Give one or more of the servers to start on this machine. The
>>> available servers are"
>>> -    echo "mb, cc, as, sm, cep, all. 'all' means you need to start all
>>> servers."
>>> +    echo "cc, as, sm, default. 'default' means you need to start all
>>> servers."
>>>      echo "usage:"
>>> -    echo "start-servers.sh -p\"<product list>\""
>>> +    echo "start-servers.sh -p\"<profile>\""
>>>      echo "eg."
>>> -    echo "start-servers.sh -p\"cc sm\""
>>> +    echo "start-servers.sh -p\"cc\""
>>>      echo ""
>>>  }
>>>
>>> @@ -48,96 +52,45 @@ while getopts p: opts
>>>  do
>>>    case $opts in
>>>      p)
>>> -        product_list=${OPTARG}
>>> -        echo $product_list
>>> +        profile_list=${OPTARG}
>>>          ;;
>>> -    *)
>>> +    \?)
>>>          help
>>>          exit 1
>>>          ;;
>>>    esac
>>>  done
>>> -arr=$(echo $product_list | tr ";" "\n")
>>> +
>>> +
>>> +arr=$(echo $profile_list | tr " " "\n")
>>>
>>>  for x in $arr
>>>  do
>>> -    if [[ $x = "mb" ]]; then
>>> -        mb="true"
>>> -    fi
>>> -    if [[ $x = "cep" ]]; then
>>> -        cep="true"
>>> -    fi
>>>      if [[ $x = "cc" ]]; then
>>> -        cc="true"
>>> -    fi
>>> -    if [[ $x = "as" ]]; then
>>> -        as="true"
>>> -    fi
>>> -    if [[ $x = "sm" ]]; then
>>> -        sm="true"
>>> -    fi
>>> -    if [[ $x = "all" ]]; then
>>> -       mb="true"
>>> -        cc="true"
>>> -        as="true"
>>> -        sm="true"
>>> -        cep="true"
>>> +        profile="cc"
>>> +    elif [[ $x = "as" ]]; then
>>> +        profile="as"
>>> +    elif [[ $x = "sm" ]]; then
>>> +        profile="sm"
>>> +    else
>>> +        echo "Inavlid profile : 'default' profile will be selected."
>>> +        profile="default"
>>>      fi
>>>  done
>>> -product_list=`echo $product_list | sed 's/^ *//g' | sed 's/ *$//g'`
>>> -if [[ -z $product_list || $product_list = "" ]]; then
>>> -    help
>>> -    exit 1
>>> -fi
>>> -
>>> -if [[ $mb = "true" ]]; then
>>> -    echo ${mb_path}
>>> -
>>> -    echo "Starting MB server ..." >> $LOG
>>> -    nohup ${mb_path}/bin/wso2server.sh &
>>> -    echo "MB server started" >> $LOG
>>> -    sleep $SLEEP
>>> -    sleep $SLEEP
>>> -fi
>>>
>>> -if [[ $cep = "true" ]]; then
>>> -    echo ${cep_path}
>>> -
>>> -    echo "Starting CEP server ..." >> $LOG
>>> -    nohup ${cep_path}/bin/wso2server.sh &
>>> -    echo "CEP server started" >> $LOG
>>> -    sleep $SLEEP
>>> -    sleep $SLEEP
>>> -fi
>>> -
>>> -if [[ $cc = "true" ]]; then
>>> -    echo ${cc_path}
>>> -
>>> -    echo "Starting CC server ..." >> $LOG
>>> -    nohup ${cc_path}/bin/stratos.sh &
>>> -    echo "CC server started" >> $LOG
>>> +if [[ $profile = "default" ]]; then
>>> +    echo "Starting ActiveMQ server ..." >> $LOG
>>> +    $activemq_path/bin/activemq start
>>> +    echo "ActiveMQ server started" >> $LOG
>>>      sleep $SLEEP
>>>      sleep $SLEEP
>>>  fi
>>>
>>> -if [[ $as = "true" ]]; then
>>> -    echo ${as_path}
>>> -
>>> -    echo "Starting Auto Scalar server ..." >> $LOG
>>> -    nohup ${as_path}/bin/stratos.sh &
>>> -    echo "Auto Scalar server started" >> $LOG
>>> -    sleep $SLEEP
>>> -fi
>>> -
>>> -
>>> -if [[ $sm = "true" ]]; then
>>> -    echo ${sm_path}
>>> -
>>> -    echo "Starting SM server ..." >> $LOG
>>> -    nohup ${sm_path}/bin/stratos.sh &
>>> -    echo "SM server started" >> $LOG
>>> -    sleep $SLEEP
>>> -
>>> -fi
>>> +echo "Starting Stratos server ..." >> $LOG
>>> +echo "$stratos_extract_path/bin/stratos.sh -Dprofile=$profile start"
>>> +$stratos_extract_path/bin/stratos.sh -Dprofile=$profile start
>>> +echo "Stratos server started" >> $LOG
>>> +sleep $SLEEP
>>> +sleep $SLEEP
>>>
>>>
>>>
>>>
>>> http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7e4b3aee/tools/stratos-installer/stratos-clean.sh
>>> ----------------------------------------------------------------------
>>> diff --git a/tools/stratos-installer/stratos-clean.sh
>>> b/tools/stratos-installer/stratos-clean.sh
>>> deleted file mode 100755
>>> index 261dee7..0000000
>>> --- a/tools/stratos-installer/stratos-clean.sh
>>> +++ /dev/null
>>> @@ -1,104 +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 is for cleaning the host machine where one or more of
>>> the Stratos servers are run.
>>> -#
>>> ----------------------------------------------------------------------------
>>> -
>>> -source "./conf/stratos-setup.conf"
>>> -
>>> -if [ "$UID" -ne "0" ]; then
>>> -       echo ; echo "  You must be root to run $0.  (Try running 'sudo
>>> bash' first.)" ; echo
>>> -       exit 69
>>> -fi
>>> -
>>> -function help {
>>> -    echo ""
>>> -    echo "Clean the host machine where one or more of the Stratos2
>>> servers are run."
>>> -    echo "usage:"
>>> -    echo "stratos-clean.sh -u <mysql username> -p <mysql password>"
>>> -    echo ""
>>> -}
>>> -
>>> -while getopts u:p: opts
>>> -do
>>> -  case $opts in
>>> -    u)
>>> -        mysql_user=${OPTARG}
>>> -        ;;
>>> -    p)
>>> -        mysql_pass=${OPTARG}
>>> -        ;;
>>> -    *)
>>> -        help
>>> -        #exit 1
>>> -        ;;
>>> -  esac
>>> -done
>>> -
>>> -function helpclean {
>>> -    echo ""
>>> -    echo "Enter DB credentials if you need to clear Stratos DB"
>>> -    echo "usage:"
>>> -    echo "clean.sh -u <mysql username> -p <mysql password>"
>>> -    echo ""
>>> -}
>>> -
>>> -function clean_validate {
>>> -    if [ -z $stratos_path ]; then
>>> -        echo "stratos_path is not set"
>>> -        exit 1
>>> -    fi
>>> -    if [ -z $log_path ]; then
>>> -        echo "log_path is not set"
>>> -        exit 1
>>> -    fi
>>> -}
>>> -
>>> -clean_validate
>>> -if [[ ( -n $mysql_user && -n $mysql_pass ) ]]; then
>>> -       read -p "Please confirm that you want to remove stratos
>>> databases, servers and logs [y/n] " answer
>>> -       if [[ $answer != y ]] ; then
>>> -               exit 1
>>> -       fi
>>> -fi
>>> -echo 'Stopping all java processes'
>>> -killall java
>>> -echo 'Waiting for applications to exit'
>>> -sleep 15
>>> -
>>> -if [[ ( -n $mysql_user && -n $mysql_pass ) ]]; then
>>> -   echo 'Removing userstore database'
>>> -   mysql -u $mysql_user -p$mysql_pass -e "DROP DATABASE IF EXISTS
>>> $userstore_db_schema;"
>>> -fi
>>> -
>>> -if [[ -d $stratos_path/scripts ]]; then
>>> -   echo 'Removing scripts'
>>> -   rm -rf $stratos_path/scripts
>>> -fi
>>> -
>>> -if [[ -d $stratos_path ]]; then
>>> -   echo 'Removing Stratos'
>>> -   rm -rf $stratos_path/*
>>> -fi
>>> -
>>> -echo 'Removing logs'
>>> -rm -rf $log_path/*
>>>
>>>
>>> http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7e4b3aee/tools/stratos-installer/stratos-db-clean.sh
>>> ----------------------------------------------------------------------
>>> diff --git a/tools/stratos-installer/stratos-db-clean.sh
>>> b/tools/stratos-installer/stratos-db-clean.sh
>>> deleted file mode 100755
>>> index 74fec29..0000000
>>> --- a/tools/stratos-installer/stratos-db-clean.sh
>>> +++ /dev/null
>>> @@ -1,24 +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.
>>> -#
>>> -#
>>> -# cleans up databases
>>> -mysql -uroot -proot -e "DROP DATABASE IF EXISTS stratos_foundation;"
>>> -mysql -uroot -proot -e "DROP DATABASE IF EXISTS userstore;"
>>> -
>>>
>>>
>>> http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7e4b3aee/tools/stratos-installer/stratos-ec2.sh
>>> ----------------------------------------------------------------------
>>> diff --git a/tools/stratos-installer/stratos-ec2.sh
>>> b/tools/stratos-installer/stratos-ec2.sh
>>> deleted file mode 100755
>>> index 7e39a80..0000000
>>> --- a/tools/stratos-installer/stratos-ec2.sh
>>> +++ /dev/null
>>> @@ -1,56 +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 is invoked by setup.sh for configuring Amazon EC2 IaaS
>>> information.
>>> -#
>>> ----------------------------------------------------------------------------
>>> -
>>> -# Die on any error:
>>> -set -e
>>> -
>>> -SLEEP=60
>>> -export LOG=$log_path/stratos-ec2.log
>>> -
>>> -source "./conf/stratos-setup.conf"
>>> -
>>> -if [[ ! -d $log_path ]]; then
>>> -    mkdir -p $log_path
>>> -fi
>>> -
>>> -pushd $stratos_extract_path
>>> -
>>> -echo "Set EC2 provider specific info in
>>> repository/conf/cloud-controller.xml" >> $LOG
>>> -
>>> -sed -i "s@EC2_PROVIDER_START@@g"  repository/conf/cloud-controller.xml
>>> -sed -i "s@EC2_IDENTITY@$ec2_identity@g"
>>> repository/conf/cloud-controller.xml
>>> -sed -i "s@EC2_CREDENTIAL@$ec2_credential@g"
>>> repository/conf/cloud-controller.xml
>>> -sed -i "s@EC2_OWNER_ID@$ec2_owner_id@g"
>>> repository/conf/cloud-controller.xml
>>> -sed -i "s@EC2_AVAILABILITY_ZONE@$ec2_availability_zone@g"
>>> repository/conf/cloud-controller.xml
>>> -sed -i "s@EC2_SECURITY_GROUPS@$ec2_security_groups@g"
>>> repository/conf/cloud-controller.xml
>>> -sed -i "s@EC2_KEYPAIR@$ec2_keypair_name@g"
>>> repository/conf/cloud-controller.xml
>>> -sed -i "s@EC2_PROVIDER_END@@g" repository/conf/cloud-controller.xml
>>> -sed -i "s@OPENSTACK_PROVIDER_START@!--@g"
>>> repository/conf/cloud-controller.xml
>>> -sed -i "s@OPENSTACK_PROVIDER_END@--@g"
>>> repository/conf/cloud-controller.xml
>>> -sed -i "s@VCLOUD_PROVIDER_START@!--@g"
>>> repository/conf/cloud-controller.xml
>>> -sed -i "s@VCLOUD_PROVIDER_END@--@g"
>>> repository/conf/cloud-controller.xml
>>> -
>>> -popd
>>> -
>>>
>>>
>>> http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7e4b3aee/tools/stratos-installer/stratos-openstack.sh
>>> ----------------------------------------------------------------------
>>> diff --git a/tools/stratos-installer/stratos-openstack.sh
>>> b/tools/stratos-installer/stratos-openstack.sh
>>> deleted file mode 100755
>>> index 925333c..0000000
>>> --- a/tools/stratos-installer/stratos-openstack.sh
>>> +++ /dev/null
>>> @@ -1,52 +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 is invoked by setup.sh for configuring OpenStack IaaS
>>> information.
>>> -#
>>> ----------------------------------------------------------------------------
>>> -
>>> -# Die on any error:
>>> -set -e
>>> -
>>> -SLEEP=60
>>> -export LOG=$log_path/stratos-openstack.log
>>> -
>>> -source "./conf/stratos-setup.conf"
>>> -
>>> -if [[ ! -d $log_path ]]; then
>>> -    mkdir -p $log_path
>>> -fi
>>> -
>>> -pushd $stratos_extract_path
>>> -
>>> -echo "Set OpenStack provider specific info in
>>> repository/conf/cloud-controller.xml" >> $LOG
>>> -
>>> -sed -i "s@OPENSTACK_PROVIDER_START@@g"
>>> repository/conf/cloud-controller.xml
>>> -sed -i "s@OPENSTACK_IDENTITY@$openstack_identity@g"
>>>  repository/conf/cloud-controller.xml
>>> -sed -i "s@OPENSTACK_CREDENTIAL@$openstack_credential@g"
>>>  repository/conf/cloud-controller.xml
>>> -sed -i "s@OPENSTACK_ENDPOINT@$openstack_jclouds_endpoint@g"
>>>  repository/conf/cloud-controller.xml
>>> -sed -i "s@OPENSTACK_PROVIDER_END@@g"
>>>  repository/conf/cloud-controller.xml
>>> -sed -i "s@EC2_PROVIDER_START@!--@g"
>>>  repository/conf/cloud-controller.xml
>>> -sed -i "s@EC2_PROVIDER_END@--@g"  repository/conf/cloud-controller.xml
>>> -sed -i "s@VCLOUD_PROVIDER_START@!--@g"
>>>  repository/conf/cloud-controller.xml
>>> -sed -i "s@VCLOUD_PROVIDER_END@--@g"
>>>  repository/conf/cloud-controller.xml
>>> -
>>> -popd
>>>
>>>
>>>
>>>
>>> --
>>> Isuru Perera
>>> Senior Software Engineer | WSO2, Inc. | http://wso2.com/
>>> Lean . Enterprise . Middleware
>>>
>>> about.me/chrishantha
>>>
>>
>
>
> --
> Isuru Perera
> Senior Software Engineer | WSO2, Inc. | http://wso2.com/
> Lean . Enterprise . Middleware
>
> about.me/chrishantha
>



-- 
Best Regards,
Nirmal

Nirmal Fernando.
PPMC Member & Committer of Apache Stratos,
Senior Software Engineer, WSO2 Inc.

Blog: http://nirmalfdo.blogspot.com/

Re: Fwd: [2/3] git commit: Stratos Installer changes to use single product

Posted by Isuru Perera <is...@wso2.com>.
Well, yeah! :) I haven't done this kind of work in a single commit.

Perhaps I should have done the work in different commits.

I'm just worried that the commit has overwritten the efforts of other
people including you!

Is there a way to fix this?

On Fri, Apr 4, 2014 at 7:22 AM, Nirmal Fernando <ni...@gmail.com>wrote:

> Well, it's bit suprising that you weren't aware about the consequences of
> git rm :-)
>  On Apr 4, 2014 7:16 AM, "Isuru Perera" <is...@wso2.com> wrote:
>
>> Hi Devs,
>>
>> I pushed the Stratos installer changes.
>>
>> What I did was to 'git rm' old files and 'git mv' to rename.
>>
>> Looks like the commit went as file changes. Sorry for the mistake! :-/
>>
>> ---------- Forwarded message ----------
>> From: <is...@apache.org>
>> Date: Fri, Apr 4, 2014 at 7:06 AM
>> Subject: [2/3] git commit: Stratos Installer changes to use single product
>> To: commits@stratos.incubator.apache.org
>>
>>
>> Stratos Installer changes to use single product
>>
>>
>> Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
>> Commit:
>> http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/7e4b3aee
>> Tree:
>> http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/7e4b3aee
>> Diff:
>> http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/7e4b3aee
>>
>> Branch: refs/heads/master
>> Commit: 7e4b3aee15be72f1fa2771c623af920a4d5e9688
>> Parents: 0955f29
>> Author: M. Isuru Tharanga Chrishantha Perera <is...@apache.org>
>> Authored: Thu Apr 3 17:25:36 2014 +0530
>> Committer: M. Isuru Tharanga Chrishantha Perera <is...@apache.org>
>> Committed: Thu Apr 3 17:25:36 2014 +0530
>>
>> ----------------------------------------------------------------------
>>  tools/stratos-installer/clean.sh                |  39 +-
>>  tools/stratos-installer/conf/setup.conf         |  95 +--
>>  tools/stratos-installer/conf/stratos-setup.conf | 103 ---
>>  tools/stratos-installer/ec2.sh                  |  49 +-
>>  tools/stratos-installer/openstack.sh            |  37 +-
>>  tools/stratos-installer/setup.sh                | 825 +++++++++----------
>>  tools/stratos-installer/start-servers.sh        | 107 +--
>>  tools/stratos-installer/stratos-clean.sh        | 104 ---
>>  tools/stratos-installer/stratos-db-clean.sh     |  24 -
>>  tools/stratos-installer/stratos-ec2.sh          |  56 --
>>  tools/stratos-installer/stratos-openstack.sh    |  52 --
>>  tools/stratos-installer/stratos-setup.sh        | 596 --------------
>>  .../stratos-installer/stratos-start-servers.sh  |  96 ---
>>  tools/stratos-installer/stratos-vcloud.sh       |  52 --
>>  tools/stratos-installer/vcloud.sh               |  37 +-
>>  15 files changed, 453 insertions(+), 1819 deletions(-)
>> ----------------------------------------------------------------------
>>
>>
>>
>> http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7e4b3aee/tools/stratos-installer/clean.sh
>> ----------------------------------------------------------------------
>> diff --git a/tools/stratos-installer/clean.sh
>> b/tools/stratos-installer/clean.sh
>> index 5692739..b74879d 100755
>> --- a/tools/stratos-installer/clean.sh
>> +++ b/tools/stratos-installer/clean.sh
>> @@ -63,10 +63,6 @@ function helpclean {
>>  }
>>
>>  function clean_validate {
>> -#    if [[ ( -z $mysql_user || -z $mysql_pass ) ]]; then
>> - #       helpclean
>> -  #      exit 1
>> -   # fi
>>      if [ -z $stratos_path ]; then
>>          echo "stratos_path is not set"
>>          exit 1
>> @@ -90,13 +86,8 @@ echo 'Waiting for applications to exit'
>>  sleep 15
>>
>>  if [[ ( -n $mysql_user && -n $mysql_pass ) ]]; then
>> -
>> -       echo 'Removing stratos_foundation database'
>> -       mysql -u $mysql_user -p$mysql_pass -e "DROP DATABASE IF EXISTS
>> stratos_foundation;"
>> -
>> -       echo 'Removing userstore database'
>> -       mysql -u $mysql_user -p$mysql_pass -e "DROP DATABASE IF EXISTS
>> userstore;"
>> -
>> +   echo 'Removing userstore database'
>> +   mysql -u $mysql_user -p$mysql_pass -e "DROP DATABASE IF EXISTS
>> $userstore_db_schema;"
>>  fi
>>
>>  if [[ -d $stratos_path/scripts ]]; then
>> @@ -104,29 +95,9 @@ if [[ -d $stratos_path/scripts ]]; then
>>     rm -rf $stratos_path/scripts
>>  fi
>>
>> -if [[ -d $mb_path ]]; then
>> -   echo 'Removing MB'
>> -   rm -rf $mb_path
>> -fi
>> -
>> -if [[ -d $cep_path ]]; then
>> -   echo 'Removing CEP'
>> -   rm -rf $cep_path
>> -fi
>> -
>> -if [[ -d $cc_path ]]; then
>> -   echo 'Removing CC'
>> -   rm -rf $cc_path
>> -fi
>> -
>> -if [[ -d $as_path ]]; then
>> -   echo 'Removing AS'
>> -   rm -rf $as_path
>> -fi
>> -
>> -if [[ -d $sm_path ]]; then
>> -   echo 'Removing SM'
>> -   rm -rf $sm_path
>> +if [[ -d $stratos_path ]]; then
>> +   echo 'Removing Stratos'
>> +   rm -rf $stratos_path/*
>>  fi
>>
>>  echo 'Removing logs'
>>
>>
>> http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7e4b3aee/tools/stratos-installer/conf/setup.conf
>> ----------------------------------------------------------------------
>> diff --git a/tools/stratos-installer/conf/setup.conf
>> b/tools/stratos-installer/conf/setup.conf
>> index 10b4163..2abcb3e 100644
>> --- a/tools/stratos-installer/conf/setup.conf
>> +++ b/tools/stratos-installer/conf/setup.conf
>> @@ -24,8 +24,7 @@
>>  #
>> ----------------------------------------------------------------------------
>>  #
>>  #  Configure below parameters to install Apache Stratos using
>> ../setup.sh.
>> -#  General configuration parameters are mandatory and other sections are
>> optional. Configure each section on each node where
>> -#  Stratos product is installed.
>> +#  General configuration parameters are mandatory and other sections are
>> optional.
>>  #
>>  #
>> ----------------------------------------------------------------------------
>>
>> @@ -34,7 +33,7 @@
>>  # General configuration
>>  #
>> ----------------------------------------------------------------------------
>>  export setup_path= #Folder path containing stratos_setup
>> -export stratos_pack_path= #Folder path containing stratos packages
>> +export stratos_packs= #Folder path containing stratos package and other
>> third party packs and jars
>>  export stratos_path= #Folder which stratos will be installed
>>
>>  export JAVA_HOME= #Java home path
>> @@ -45,62 +44,25 @@ export host_user="" #A host user account for the
>> machine which run Stratos compo
>>
>>  export stratos_domain="stratos.apache.org"
>>
>> -export mb_ip="mb-ip"   # Machine ip on which mb run
>> -export cep_ip="cep-ip" # Machine ip on which cep run
>> -export cc_ip="cc-ip"   # Machine ip on which cc run
>> -export as_ip="as-ip"   # Machine ip on which auto scalar run
>> -export sm_ip="sc-ip"   # Machine ip on which sc run
>> -export puppet_ip="puppet-ip"   # Machine ip on which puppet master run
>> +export host_ip="127.0.0.1" # Machine ip on host machine
>> +export offset=0
>> +
>> +export puppet_ip="127.0.0.1"   # Machine ip on which puppet master run
>>  export puppet_hostname="puppet-hostname" # Host name given to identify
>> the puppet master
>>  export puppet_environment="puppet_environment" # Name of puppet
>> environment
>>
>> -export cc_port_offset=1
>> -export sm_port_offset=2
>> -export as_port_offset=3
>> -export cep_port_offset=4
>> -export mb_port_offset=5
>> -
>> -export mb_port=5672 #default port which the message broker service runs
>> +export mb_ip="127.0.0.1" # Machine ip on which mb run
>> +export mb_port=61616 #default port which the message broker service runs
>> +
>> +export stratos_extract_path=$stratos_path/"apache-stratos"
>> +export
>> stratos_pack_zip=$stratos_packs/"apache-stratos-4.0.0-SNAPSHOT.zip"
>>
>> -export mb_hostname="mb.$stratos_domain"
>> -export cep_hostname="cep.$stratos_domain"
>> -export sm_hostname="$stratos_domain"
>> -export cc_hostname="cc.$stratos_domain"
>> -export as_hostname="as.$stratos_domain"
>> +export activemq_pack=$stratos_packs/"apache-activemq-5.8.0-bin.tar.gz"
>> +export activemq_path=$stratos_path/"apache-activemq-5.8.0"
>>
>>  export resource_path=$setup_path/resources
>>
>>
>> -#
>> ----------------------------------------------------------------------------
>> -# MB configuration
>> -#
>> ----------------------------------------------------------------------------
>> -export mb_path=$stratos_path/"wso2mb-2.1.0"
>> -export mb_pack_path=$stratos_pack_path/"wso2mb-2.1.0.zip"
>> -
>> -
>> -#
>> ----------------------------------------------------------------------------
>> -# CEP configuration
>> -#
>> ----------------------------------------------------------------------------
>> -export cep_artifacts_path= #Folder path containing cep artifacts files
>> -export
>> cep_extension_jar=$stratos_pack_path/"org.apache.stratos.cep.extension-1.0.0-SNAPSHOT.jar"
>> # cep extensions jar file name
>> -export
>> andes_client_jar=$stratos_pack_path/"andes-client-0.13.wso2v8.jar" # andes
>> client jar file name
>> -
>> -export cep_path=$stratos_path/"wso2cep-3.0.0"
>> -export cep_pack_path=$stratos_pack_path/"wso2cep-3.0.0.zip"
>> -
>> -export cep_mb_ip=$mb_ip
>> -export cep_mb_listen_port=$(($mb_port + $mb_port_offset))
>> -
>> -
>> -#
>> ----------------------------------------------------------------------------
>> -# CC configuration
>> -#
>> ----------------------------------------------------------------------------
>> -export cc_path=$stratos_path/"apache-stratos-cc-4.0.0-SNAPSHOT"
>> -export
>> cc_pack_path=$stratos_pack_path/"apache-stratos-cc-4.0.0-SNAPSHOT.zip"
>> -
>> -export cc_mb_listen_port=$(($mb_port + $mb_port_offset))
>> -export cc_https_port=$((9443 + $cc_port_offset))
>> -
>>  # IaaS Providers
>>  #
>> ----------------------------------------------------------------------------
>>  # Set <iaas-name>_provider_enabled parameter to true to enable desired
>> IaaS. A hybrid cloud could be
>> @@ -121,7 +83,7 @@ export openstack_identity="stratos:stratos" #
>> Openstack project name:Openstack l
>>  export openstack_credential="password" # Openstack login password
>>  export openstack_jclouds_endpoint="http://hostname:5000/v2.0"
>>  export openstack_keypair_name=""
>> -export openstack_security_groups="security-groups"
>> +export openstack_security_groups=""
>>
>>  # vCloud
>>  export vcloud_provider_enabled=false
>> @@ -129,36 +91,13 @@ export vcloud_identity="stratos" # vCloud login user
>>  export vcloud_credential="password" # vCloud login password
>>  export vcloud_jclouds_endpoint="https://vcloud/api"
>>
>> -#
>> ----------------------------------------------------------------------------
>> -# Auto Scalar configuration
>> -#
>> ----------------------------------------------------------------------------
>> -export as_path=$stratos_path/"apache-stratos-autoscaler-4.0.0-SNAPSHOT"
>> -export
>> as_pack_path=$stratos_pack_path/"apache-stratos-autoscaler-4.0.0-SNAPSHOT.zip"
>>
>> -export as_mb_listen_port=$(($mb_port + $mb_port_offset))
>> -export as_cc_https_port=$((9443 + $cc_port_offset))
>> -export as_sm_https_port=$((9443 + $sm_port_offset))
>> -
>> -
>> -#
>> ----------------------------------------------------------------------------
>> -# SM configuration
>> +# Database configuration
>>  #
>> ----------------------------------------------------------------------------
>> -export sm_path=$stratos_path/"apache-stratos-manager-4.0.0-SNAPSHOT"
>> -export
>> sm_pack_path=$stratos_pack_path/"apache-stratos-manager-4.0.0-SNAPSHOT.zip"
>> -export
>> mysql_connector_jar=$stratos_pack_path/"mysql-connector-java-5.1.25.jar"
>> #mysql connector jar file name
>> +export
>> mysql_connector_jar=$stratos_packs/"mysql-connector-java-5.1.29-bin.jar"
>> #mysql connector jar file name
>>
>>  export userstore_db_hostname="localhost"
>>  export userstore_db_schema="userstore"
>>  export userstore_db_port="3306"
>>  export userstore_db_user="root"
>> -export userstore_db_pass="mysql"
>> -
>> -export sm_puppet_ip=$puppet_ip
>> -export sm_puppet_hostname=$puppet_hostname
>> -export sm_puppet_environment=$puppet_environment
>> -export sm_mb_listen_port=$(($mb_port + $mb_port_offset))
>> -export sm_cc_https_port=$((9443 + $cc_port_offset))
>> -export sm_as_https_port=$((9443 + $as_port_offset))
>> -export sm_https_port=$((9443 + $sm_port_offset))
>> -export sm_http_port=$((9763 + $sm_port_offset))
>> -
>> +export userstore_db_pass="root"
>>
>>
>> http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7e4b3aee/tools/stratos-installer/conf/stratos-setup.conf
>> ----------------------------------------------------------------------
>> diff --git a/tools/stratos-installer/conf/stratos-setup.conf
>> b/tools/stratos-installer/conf/stratos-setup.conf
>> deleted file mode 100644
>> index 2abcb3e..0000000
>> --- a/tools/stratos-installer/conf/stratos-setup.conf
>> +++ /dev/null
>> @@ -1,103 +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.
>> -#
>> -#
>> ----------------------------------------------------------------------------
>> -#
>> -#  Server configuration script for Apache Stratos
>> -#
>> ----------------------------------------------------------------------------
>> -#
>> -#  Configure below parameters to install Apache Stratos using
>> ../setup.sh.
>> -#  General configuration parameters are mandatory and other sections are
>> optional.
>> -#
>> -#
>> ----------------------------------------------------------------------------
>> -
>> -
>> -#
>> ----------------------------------------------------------------------------
>> -# General configuration
>> -#
>> ----------------------------------------------------------------------------
>> -export setup_path= #Folder path containing stratos_setup
>> -export stratos_packs= #Folder path containing stratos package and other
>> third party packs and jars
>> -export stratos_path= #Folder which stratos will be installed
>> -
>> -export JAVA_HOME= #Java home path
>> -
>> -export log_path=/var/log/apache-stratos
>> -
>> -export host_user="" #A host user account for the machine which run
>> Stratos component(s)
>> -
>> -export stratos_domain="stratos.apache.org"
>> -
>> -export host_ip="127.0.0.1" # Machine ip on host machine
>> -export offset=0
>> -
>> -export puppet_ip="127.0.0.1"   # Machine ip on which puppet master run
>> -export puppet_hostname="puppet-hostname" # Host name given to identify
>> the puppet master
>> -export puppet_environment="puppet_environment" # Name of puppet
>> environment
>> -
>> -export mb_ip="127.0.0.1" # Machine ip on which mb run
>> -export mb_port=61616 #default port which the message broker service runs
>> -
>> -export stratos_extract_path=$stratos_path/"apache-stratos"
>> -export
>> stratos_pack_zip=$stratos_packs/"apache-stratos-4.0.0-SNAPSHOT.zip"
>> -
>> -export activemq_pack=$stratos_packs/"apache-activemq-5.8.0-bin.tar.gz"
>> -export activemq_path=$stratos_path/"apache-activemq-5.8.0"
>> -
>> -export resource_path=$setup_path/resources
>> -
>> -
>> -# IaaS Providers
>> -#
>> ----------------------------------------------------------------------------
>> -# Set <iaas-name>_provider_enabled parameter to true to enable desired
>> IaaS. A hybrid cloud could be
>> -# created using multiple IaaSs.
>> -
>> -# EC2
>> -export ec2_provider_enabled=true
>> -export ec2_identity="<ec2_identity>"
>> -export ec2_credential="<ec2_credential>"
>> -export ec2_keypair_name="<ec2_keypair_name>"
>> -export ec2_owner_id="<ec2_owner_id>"
>> -export ec2_availability_zone="<ec2_availability_zone>"
>> -export ec2_security_groups="<ec2_security_groups>"
>> -
>> -# Openstack
>> -export openstack_provider_enabled=false
>> -export openstack_identity="stratos:stratos" # Openstack project
>> name:Openstack login user
>> -export openstack_credential="password" # Openstack login password
>> -export openstack_jclouds_endpoint="http://hostname:5000/v2.0"
>> -export openstack_keypair_name=""
>> -export openstack_security_groups=""
>> -
>> -# vCloud
>> -export vcloud_provider_enabled=false
>> -export vcloud_identity="stratos" # vCloud login user
>> -export vcloud_credential="password" # vCloud login password
>> -export vcloud_jclouds_endpoint="https://vcloud/api"
>> -
>> -
>> -# Database configuration
>> -#
>> ----------------------------------------------------------------------------
>> -export
>> mysql_connector_jar=$stratos_packs/"mysql-connector-java-5.1.29-bin.jar"
>> #mysql connector jar file name
>> -
>> -export userstore_db_hostname="localhost"
>> -export userstore_db_schema="userstore"
>> -export userstore_db_port="3306"
>> -export userstore_db_user="root"
>> -export userstore_db_pass="root"
>>
>>
>> http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7e4b3aee/tools/stratos-installer/ec2.sh
>> ----------------------------------------------------------------------
>> diff --git a/tools/stratos-installer/ec2.sh
>> b/tools/stratos-installer/ec2.sh
>> index 12aae8e..21d47a3 100755
>> --- a/tools/stratos-installer/ec2.sh
>> +++ b/tools/stratos-installer/ec2.sh
>> @@ -35,45 +35,22 @@ if [[ ! -d $log_path ]]; then
>>      mkdir -p $log_path
>>  fi
>>
>> -pushd $cc_path
>> +pushd $stratos_extract_path
>>
>>  echo "Set EC2 provider specific info in
>> repository/conf/cloud-controller.xml" >> $LOG
>>
>> -cp -f repository/conf/cloud-controller.xml
>> repository/conf/cloud-controller.xml.orig
>> -cat repository/conf/cloud-controller.xml.orig | sed -e
>> "s@EC2_PROVIDER_START@@g" > repository/conf/cloud-controller.xml
>> -
>> -cp -f repository/conf/cloud-controller.xml
>> repository/conf/cloud-controller.xml.orig
>> -cat repository/conf/cloud-controller.xml.orig | sed -e "s@EC2_IDENTITY
>> @$ec2_identity@g" > repository/conf/cloud-controller.xml
>> -
>> -cp -f repository/conf/cloud-controller.xml
>> repository/conf/cloud-controller.xml.orig
>> -cat repository/conf/cloud-controller.xml.orig | sed -e "s@EC2_CREDENTIAL
>> @$ec2_credential@g" > repository/conf/cloud-controller.xml
>> -
>> -cp -f repository/conf/cloud-controller.xml
>> repository/conf/cloud-controller.xml.orig
>> -cat repository/conf/cloud-controller.xml.orig | sed -e "s@EC2_OWNER_ID
>> @$ec2_owner_id@g" > repository/conf/cloud-controller.xml
>> -
>> -cp -f repository/conf/cloud-controller.xml
>> repository/conf/cloud-controller.xml.orig
>> -cat repository/conf/cloud-controller.xml.orig | sed -e
>> "s@EC2_AVAILABILITY_ZONE@$ec2_availability_zone@g" >
>> repository/conf/cloud-controller.xml
>> -
>> -cp -f repository/conf/cloud-controller.xml
>> repository/conf/cloud-controller.xml.orig
>> -cat repository/conf/cloud-controller.xml.orig | sed -e
>> "s@EC2_SECURITY_GROUPS@$ec2_security_groups@g" >
>> repository/conf/cloud-controller.xml
>> -
>> -cp -f repository/conf/cloud-controller.xml
>> repository/conf/cloud-controller.xml.orig
>> -cat repository/conf/cloud-controller.xml.orig | sed -e "s@EC2_KEYPAIR
>> @$ec2_keypair_name@g" > repository/conf/cloud-controller.xml
>> -
>> -cp -f repository/conf/cloud-controller.xml
>> repository/conf/cloud-controller.xml.orig
>> -cat repository/conf/cloud-controller.xml.orig | sed -e
>> "s@EC2_PROVIDER_END@@g" > repository/conf/cloud-controller.xml
>> -
>> -cp -f repository/conf/cloud-controller.xml
>> repository/conf/cloud-controller.xml.orig
>> -cat repository/conf/cloud-controller.xml.orig | sed -e
>> "s@OPENSTACK_PROVIDER_START@!--@g" > repository/conf/cloud-controller.xml
>> -
>> -cp -f repository/conf/cloud-controller.xml
>> repository/conf/cloud-controller.xml.orig
>> -cat repository/conf/cloud-controller.xml.orig | sed -e
>> "s@OPENSTACK_PROVIDER_END@--@g" > repository/conf/cloud-controller.xml
>> -
>> -cp -f repository/conf/cloud-controller.xml
>> repository/conf/cloud-controller.xml.orig
>> -cat repository/conf/cloud-controller.xml.orig | sed -e
>> "s@VCLOUD_PROVIDER_START@!--@g" > repository/conf/cloud-controller.xml
>> -
>> -cp -f repository/conf/cloud-controller.xml
>> repository/conf/cloud-controller.xml.orig
>> -cat repository/conf/cloud-controller.xml.orig | sed -e
>> "s@VCLOUD_PROVIDER_END@--@g" > repository/conf/cloud-controller.xml
>> +sed -i "s@EC2_PROVIDER_START@@g"  repository/conf/cloud-controller.xml
>> +sed -i "s@EC2_IDENTITY@$ec2_identity@g"
>> repository/conf/cloud-controller.xml
>> +sed -i "s@EC2_CREDENTIAL@$ec2_credential@g"
>> repository/conf/cloud-controller.xml
>> +sed -i "s@EC2_OWNER_ID@$ec2_owner_id@g"
>> repository/conf/cloud-controller.xml
>> +sed -i "s@EC2_AVAILABILITY_ZONE@$ec2_availability_zone@g"
>> repository/conf/cloud-controller.xml
>> +sed -i "s@EC2_SECURITY_GROUPS@$ec2_security_groups@g"
>> repository/conf/cloud-controller.xml
>> +sed -i "s@EC2_KEYPAIR@$ec2_keypair_name@g"
>> repository/conf/cloud-controller.xml
>> +sed -i "s@EC2_PROVIDER_END@@g" repository/conf/cloud-controller.xml
>> +sed -i "s@OPENSTACK_PROVIDER_START@!--@g"
>> repository/conf/cloud-controller.xml
>> +sed -i "s@OPENSTACK_PROVIDER_END@--@g"
>> repository/conf/cloud-controller.xml
>> +sed -i "s@VCLOUD_PROVIDER_START@!--@g"
>> repository/conf/cloud-controller.xml
>> +sed -i "s@VCLOUD_PROVIDER_END@--@g" repository/conf/cloud-controller.xml
>>
>>  popd
>>
>>
>>
>> http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7e4b3aee/tools/stratos-installer/openstack.sh
>> ----------------------------------------------------------------------
>> diff --git a/tools/stratos-installer/openstack.sh
>> b/tools/stratos-installer/openstack.sh
>> index dd893da..e774468 100755
>> --- a/tools/stratos-installer/openstack.sh
>> +++ b/tools/stratos-installer/openstack.sh
>> @@ -35,35 +35,18 @@ if [[ ! -d $log_path ]]; then
>>      mkdir -p $log_path
>>  fi
>>
>> -pushd $cc_path
>> +pushd $stratos_extract_path
>>
>>  echo "Set OpenStack provider specific info in
>> repository/conf/cloud-controller.xml" >> $LOG
>>
>> -cp -f repository/conf/cloud-controller.xml
>> repository/conf/cloud-controller.xml.orig
>> -cat repository/conf/cloud-controller.xml.orig | sed -e
>> "s@OPENSTACK_PROVIDER_START@@g" > repository/conf/cloud-controller.xml
>> -
>> -cp -f repository/conf/cloud-controller.xml
>> repository/conf/cloud-controller.xml.orig
>> -cat repository/conf/cloud-controller.xml.orig | sed -e
>> "s@OPENSTACK_IDENTITY@$openstack_identity@g" >
>> repository/conf/cloud-controller.xml
>> -
>> -cp -f repository/conf/cloud-controller.xml
>> repository/conf/cloud-controller.xml.orig
>> -cat repository/conf/cloud-controller.xml.orig | sed -e
>> "s@OPENSTACK_CREDENTIAL@$openstack_credential@g" >
>> repository/conf/cloud-controller.xml
>> -
>> -cp -f repository/conf/cloud-controller.xml
>> repository/conf/cloud-controller.xml.orig
>> -cat repository/conf/cloud-controller.xml.orig | sed -e
>> "s@OPENSTACK_ENDPOINT@$openstack_jclouds_endpoint@g" >
>> repository/conf/cloud-controller.xml
>> -
>> -cp -f repository/conf/cloud-controller.xml
>> repository/conf/cloud-controller.xml.orig
>> -cat repository/conf/cloud-controller.xml.orig | sed -e
>> "s@OPENSTACK_PROVIDER_END@@g" > repository/conf/cloud-controller.xml
>> -
>> -cp -f repository/conf/cloud-controller.xml
>> repository/conf/cloud-controller.xml.orig
>> -cat repository/conf/cloud-controller.xml.orig | sed -e
>> "s@EC2_PROVIDER_START@!--@g" > repository/conf/cloud-controller.xml
>> -
>> -cp -f repository/conf/cloud-controller.xml
>> repository/conf/cloud-controller.xml.orig
>> -cat repository/conf/cloud-controller.xml.orig | sed -e
>> "s@EC2_PROVIDER_END@--@g" > repository/conf/cloud-controller.xml
>> -
>> -cp -f repository/conf/cloud-controller.xml
>> repository/conf/cloud-controller.xml.orig
>> -cat repository/conf/cloud-controller.xml.orig | sed -e
>> "s@VCLOUD_PROVIDER_START@!--@g" > repository/conf/cloud-controller.xml
>> -
>> -cp -f repository/conf/cloud-controller.xml
>> repository/conf/cloud-controller.xml.orig
>> -cat repository/conf/cloud-controller.xml.orig | sed -e
>> "s@VCLOUD_PROVIDER_END@--@g" > repository/conf/cloud-controller.xml
>> +sed -i "s@OPENSTACK_PROVIDER_START@@g"
>> repository/conf/cloud-controller.xml
>> +sed -i "s@OPENSTACK_IDENTITY@$openstack_identity@g"
>>  repository/conf/cloud-controller.xml
>> +sed -i "s@OPENSTACK_CREDENTIAL@$openstack_credential@g"
>>  repository/conf/cloud-controller.xml
>> +sed -i "s@OPENSTACK_ENDPOINT@$openstack_jclouds_endpoint@g"
>>  repository/conf/cloud-controller.xml
>> +sed -i "s@OPENSTACK_PROVIDER_END@@g"
>>  repository/conf/cloud-controller.xml
>> +sed -i "s@EC2_PROVIDER_START@!--@g"
>>  repository/conf/cloud-controller.xml
>> +sed -i "s@EC2_PROVIDER_END@--@g"  repository/conf/cloud-controller.xml
>> +sed -i "s@VCLOUD_PROVIDER_START@!--@g"
>>  repository/conf/cloud-controller.xml
>> +sed -i "s@VCLOUD_PROVIDER_END@--@g"
>>  repository/conf/cloud-controller.xml
>>
>>  popd
>>
>>
>> http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7e4b3aee/tools/stratos-installer/setup.sh
>> ----------------------------------------------------------------------
>> diff --git a/tools/stratos-installer/setup.sh
>> b/tools/stratos-installer/setup.sh
>> index e15617d..589ab79 100755
>> --- a/tools/stratos-installer/setup.sh
>> +++ b/tools/stratos-installer/setup.sh
>> @@ -26,105 +26,29 @@
>>  # Die on any error:
>>  set -e
>>
>> -SLEEP=60
>> -
>>  source "./conf/setup.conf"
>>  export LOG=$log_path/stratos-setup.log
>>
>> -mb="false"
>> -cc="false"
>> -as="false"
>> -sm="false"
>> -cep="false"
>> -product_list="mb;cc;cep;as;sm"
>> -enable_internal_git=false
>> +profile="default"
>> +config_mb="true"
>> +activemq_client_libs=(activemq-broker-5.8.0.jar
>>  activemq-client-5.8.0.jar  geronimo-j2ee-management_1.1_spec-1.0.1.jar
>>  geronimo-jms_1.1_spec-1.1.1.jar  hawtbuf-1.2.jar)
>> +auto_start_servers="false"
>>
>>  function help {
>>      echo ""
>>      echo "Usage:"
>> -    echo "setup.sh -u <host username> -p \"<product list>\""
>> -    echo "product list : [mb, cc, as, sm, cep]"
>> +    echo "setup.sh -p \"<profile>\" [-s]"
>> +    echo "product list : [default, cc, as, sm]"
>>      echo "Example:"
>> +    echo "sudo ./setup.sh -p \"default\""
>>      echo "sudo ./setup.sh -p \"cc\""
>> -    echo "sudo ./setup.sh -p \"all\""
>>      echo ""
>> -    echo "-u: <host username> The login user of the host."
>> -    echo "-p: <product list> Apache Stratos products to be installed on
>> this node. Provide one or more names of the servers."
>> -    echo "    The available servers are cc, as, sm or all. 'all' means
>> you need to setup all servers in this machine. Default is all"
>> -    echo "-g: <enable_internal_git> true|false Whether enable internal
>> git repo for Stratos2. Default is false"
>> +    echo "-p: <profile> Apache Stratos products to be installed on this
>> node. Provide one name of a profile."
>> +    echo "    The available profiles are cc, as, sm or default.
>> 'default' means you need to setup all servers in this machine. Default is
>> 'default' profile"
>> +    echo "-s: Silent mode - Start servers after installation."
>>      echo ""
>>  }
>>
>> -while getopts u:p:g: opts
>> -do
>> -  case $opts in
>> -    p)
>> -        product_list=${OPTARG}
>> -        ;;
>> -    g)
>> -        enable_internal_git=${OPTARG}
>> -        ;;
>> -    \?)
>> -        help
>> -        exit 1
>> -        ;;
>> -  esac
>> -done
>> -
>> -
>> -arr=$(echo $product_list | tr " " "\n")
>> -
>> -for x in $arr
>> -do
>> -    if [[ $x = "mb" ]]; then
>> -        mb="true"
>> -    fi
>> -    if [[ $x = "cc" ]]; then
>> -        cc="true"
>> -    fi
>> -    if [[ $x = "cep" ]]; then
>> -        cep="true"
>> -    fi
>> -    if [[ $x = "as" ]]; then
>> -        as="true"
>> -    fi
>> -    if [[ $x = "sm" ]]; then
>> -        sm="true"
>> -    fi
>> -    if [[ $x = "all" ]]; then
>> -        mb="true"
>> -        cep="true"
>> -        cc="true"
>> -        as="true"
>> -        sm="true"
>> -    fi
>> -done
>> -
>> -product_list=`echo $product_list | sed 's/^ *//g' | sed 's/ *$//g'`
>> -if [[ -z $product_list || $product_list = "" ]]; then
>> -    help
>> -    exit 1
>> -fi
>> -
>> -if [[ $host_user == "" ]]; then
>> -    echo "user provided in conf/setup.conf is null. Please provide a
>> user"
>> -    exit 1
>> -fi
>> -
>> -echo "user provided in conf/setup.conf is $host_user. If you want to
>> provide some other user name please specify it at the prompt."
>> -echo "If you want to continue with $host_user just press enter to
>> continue"
>> -read username
>> -if [[ $username != "" ]]; then
>> -    host_user=$username
>> -fi
>> -user=`id $host_user`
>> -if [[ $? = 1 ]]; then
>> -    echo "User $host_user does not exist. The system will create it."
>> -    adduser --home /home/$host_user $host_user
>> -fi
>> -
>> -export $host_user
>> -
>>  # Check validity of IP
>>  function valid_ip()
>>  {
>> @@ -143,19 +67,15 @@ function valid_ip()
>>      return $stat
>>  }
>>
>> -function helpsetup {
>> -    echo ""
>> -    echo "Please set up the $1 related environment variables correctly
>> in conf/setup.conf"
>> -    echo ""
>> -}
>> -
>> -function general_conf_validate {
>> +# General functions
>> +# -------------------------------------------------------------------
>> +function general_conf_validate() {
>>      if [[ ! -d $setup_path ]]; then
>>          echo "Please specify the setup_path folder which contains
>> stratos setup"
>>          exit 1
>>      fi
>> -    if [[ ! -d $stratos_pack_path ]]; then
>> -        echo "Please specify the stratos_pack_path folder which contains
>> stratos packages"
>> +    if [[ ! -d $stratos_packs ]]; then
>> +        echo "Please specify the stratos_packs folder which contains
>> stratos packages"
>>          exit 1
>>      fi
>>      if [[ ! -d $stratos_path ]]; then
>> @@ -172,72 +92,106 @@ function general_conf_validate {
>>          echo "Please specify the stratos domain"
>>          exit 1
>>      fi
>> -    if [[ (-z $mb_port_offset || -z $mb_ip || -z $mb_hostname) ]]; then
>> -        echo "Please specify the ip, the port offset and the hostname of
>> MB"
>> +    if [[ ! -f $stratos_pack_zip ]]; then
>> +        echo "Please copy the startos zip to the stratos pack folder"
>>          exit 1
>>      fi
>> -    if !(valid_ip $mb_ip); then
>> -        echo "Please provide valid ip for MB's ip"
>> +    if [[ -z $mb_port ]]; then
>> +        echo "Please specify the port of MB"
>>          exit 1
>>      fi
>> -}
>>
>> -function andes_jar_validate {
>> -    if [[ ($cep = "true" || $cc = "true" || $as = "true" || $sm =
>> "true") ]]; then
>> -        if [[ ! -f $andes_client_jar ]]; then
>> -            echo "Please copy the andes client jar into the same folder
>> as this command(stratos release pack folder) and update conf/setup.conf
>> file"
>> -            exit 1
>> -        fi
>> +    if [[ $auto_start_servers != "true" ]]; then
>> +       if [[ $profile = "default" ]]; then
>> +            read -p "Do you want to configure ActiveMQ [y/n]: " answer
>> +            if [[ $answer = y ]] ; then
>> +               mb_ip=$host_ip
>> +            else
>> +               echo "Provided mb_ip in conf/setup.conf will be used"
>> +               config_mb="false"
>> +            fi
>> +       fi
>>      fi
>>  }
>>
>> -function mb_conf_validate {
>> -    if [[ -z $mb_path ]]; then
>> -       helpsetup MB
>> -       exit 1
>> -    fi
>> +# Setup General
>> +function general_setup() {
>> +
>> +    cp -f ./config/all/repository/conf/activemq/jndi.properties
>> $stratos_extract_path/repository/conf/
>> +
>> +    pushd $stratos_extract_path
>> +    echo "In repository/conf/carbon.xml"
>> +    sed -i "s@<Offset>0</Offset>@<Offset>${offset}</Offset>@g"
>> repository/conf/carbon.xml
>> +
>> +    echo "In repository/conf/jndi.properties"
>> +    sed -i "s@MB_HOSTNAME:MB_LISTEN_PORT@$mb_ip:$mb_port@g"
>> repository/conf/jndi.properties
>> +    popd
>> +
>> +    for activemq_client_lib in "${activemq_client_libs[@]}"
>> +    do
>> +       cp -f $stratos_packs/$activemq_client_lib
>> $stratos_extract_path/repository/components/lib/
>> +    done
>>  }
>>
>> -function cep_conf_validate {
>> -    if [[ (-z $cep_path || -z $cep_port_offset) ]]; then
>> -       helpsetup CEP
>> -       exit 1
>> -    fi
>> -    if [[ ! -d $cep_artifacts_path ]]; then
>> -        echo "Please specify the cep_artifacts_path folder which
>> contains cep artifacts files"
>> -        exit 1
>> -    fi
>> -    if [[ ! -f $cep_extension_jar ]]; then
>> -        echo "Please copy the cep extension jar into the same folder as
>> this command(stratos release pack folder) and update conf/setup.conf file"
>> +function activemq_validate() {
>> +    if [[ ! -f $activemq_pack ]]; then
>> +        echo "Please copy the activemq zip to the stratos pack folder
>> and update the JAR name in conf/setup.conf file"
>>          exit 1
>>      fi
>>  }
>>
>> -function cc_conf_validate {
>> -    if [[ (-z $cc_path || -z $cc_port_offset) ]]; then
>> -       helpsetup CC
>> -       exit 1
>> -    fi
>>
>> +# CC related functions
>> +# -------------------------------------------------------------------
>> +function cc_related_popup() {
>> +    while read -p "Please provide cloud controller ip:" cc_ip
>> +    do
>> +       if !(valid_ip $cc_ip); then
>> +           echo "Please provide valid ips for CC"
>> +       else
>> +            export cc_ip
>> +           break
>> +       fi
>> +    done
>> +
>> +    while read -p "Please provide cloud controller hostname:" cc_hostname
>> +    do
>> +       if [[ -z $cc_hostname ]]; then
>> +           echo "Please specify valid hostname for CC"
>> +       else
>> +            export cc_hostname
>> +           break
>> +       fi
>> +    done
>> +
>> +    while read -p "Please provide cloud controller port offset:"
>> cc_port_offset
>> +    do
>> +       if [[ -z $cc_port_offset ]]; then
>> +           echo "Please specify the port offset of CC"
>> +       else
>> +            export cc_port_offset
>> +           break
>> +       fi
>> +    done
>> +}
>> +
>> +function cc_conf_validate() {
>>      if [[ $ec2_provider_enabled = "false" && $openstack_provider_enabled
>> = "false" && $vcloud_provider_enabled = "false" ]]; then
>>          echo "Please enable at least one of the IaaS providers in
>> conf/setup.conf file"
>>          exit 1
>>      fi
>> -
>>      if [[ $openstack_provider_enabled = "true" ]]; then
>>          if [[ ( -z $openstack_identity || -z $openstack_credential || -z
>> $openstack_jclouds_endpoint ) ]]; then
>>              echo "Please set openstack configuration information in
>> conf/setup.conf file"
>>              exit 1
>>          fi
>>      fi
>> -
>>      if [[ $ec2_provider_enabled = "true" ]]; then
>>          if [[ ( -z $ec2_identity || -z $ec2_credential || -z
>> $ec2_keypair_name ) ]]; then
>>              echo "Please set ec2 configuration information in
>> conf/setup.conf file"
>>              exit 1
>>          fi
>>      fi
>> -
>>      if [[ $vcloud_provider_enabled = "true" ]]; then
>>          if [[ ( -z $vcloud_identity || -z $vcloud_credential || -z
>> $vcloud_jclouds_endpoint ) ]]; then
>>              echo "Please set vcloud configuration information in
>> conf/setup.conf file"
>> @@ -246,48 +200,135 @@ function cc_conf_validate {
>>      fi
>>  }
>>
>> -function as_conf_validate {
>> -    if [[ (-z $as_path || -z $as_port_offset) ]]; then
>> -       helpsetup AS
>> -       exit 1
>> -    fi
>> -    if [[ -z $cc_port_offset || -z $sm_port_offset ]]; then
>> -        echo "Please specify the port offset of SM and/or CC"
>> -        exit 1
>> +# Setup cc
>> +function cc_setup() {
>> +    echo "Setup CC" >> $LOG
>> +    echo "Configuring the Cloud Controller"
>> +
>> +    cp -f ./config/all/repository/conf/cloud-controller.xml
>> $stratos_extract_path/repository/conf/
>> +
>> +    export cc_path=$stratos_extract_path
>> +    echo "In repository/conf/cloud-controller.xml"
>> +    if [[ $ec2_provider_enabled = true ]]; then
>> +        ./ec2.sh
>>      fi
>> -    if [[ -z $sm_ip || -z $cc_ip ]]; then
>> -        echo "Please specify the ips of SM and/or CC"
>> -        exit 1
>> -    elif !(valid_ip $sm_ip && valid_ip $cc_ip ); then
>> -        echo "Please provide valid ips for SM and/or CC"
>> -        exit 1
>> +    if [[ $openstack_provider_enabled = true ]]; then
>> +        ./openstack.sh
>>      fi
>> -    if [[ -z $cc_hostname || -z $sm_hostname ]]; then
>> -       echo "Please specify valid hostname for SM and/or CC"
>> -       exit 1
>> +    if [[ $vcloud_provider_enabled = true ]]; then
>> +        ./vcloud.sh
>>      fi
>> +
>> +    pushd $stratos_extract_path
>> +
>> +    popd
>> +    echo "End configuring the Cloud Controller"
>>  }
>>
>> -function sm_conf_validate {
>> -    if [[ (-z $sm_path || -z $sm_port_offset) ]]; then
>> -       helpsetup SM
>> -       exit 1
>> -    fi
>> -    if [[ ! -f $mysql_connector_jar ]]; then
>> -        echo "Please copy the mysql connector jar to the stratos release
>> pack folder and update the JAR name in conf/setup.conf file"
>> -        exit 1
>> -    fi
>> -    if [[ -z $cc_port_offset || -z $as_port_offset ]]; then
>> -        echo "Please specify the port offset of AS and/or CC"
>> -        exit 1
>> -    fi
>> -    if [[ -z $sm_ip || -z $as_ip || -z $cc_ip ]]; then
>> -        echo "Please specify the ips of SM and/or AS and/or CC"
>> -        exit 1
>> -    elif !(valid_ip $sm_ip && valid_ip $cc_ip && valid_ip $as_ip); then
>> -        echo "Please provide valid ips for SM and/or AS and/or CC"
>> -        exit 1
>> +
>> +# AS related functions
>> +# -------------------------------------------------------------------
>> +function as_related_popup() {
>> +    while read -p "Please provide Auto Scalar ip:" as_ip
>> +    do
>> +       if !(valid_ip $as_ip); then
>> +           echo "Please provide valid ips for AS"
>> +       else
>> +            export as_ip
>> +           break
>> +       fi
>> +    done
>> +
>> +    while read -p "Please provide Auto Scala hostname:" as_hostname
>> +    do
>> +       if [[ -z $as_hostname ]]; then
>> +           echo "Please specify valid hostname for AS"
>> +       else
>> +            export as_hostname
>> +           break
>> +       fi
>> +    done
>> +
>> +    while read -p "Please provide Auto Scala port offset:" as_port_offset
>> +    do
>> +       if [[ -z $as_port_offset ]]; then
>> +           echo "Please specify the port offset of AS"
>> +       else
>> +            export as_port_offset
>> +           break
>> +       fi
>> +    done
>> +}
>> +
>> +function as_conf_validate() {
>> +    if [[ !($profile = "default") ]]; then
>> +       cc_related_popup
>> +       sm_related_popup
>> +       export as_cc_https_port=$((9443 + $cc_port_offset))
>> +       export as_sm_https_port=$((9443 + $sm_port_offset))
>> +    else
>> +        cc_hostname=$stratos_domain
>> +        sm_hostname=$stratos_domain
>> +       export as_cc_https_port=$((9443 + $offset))
>> +       export as_sm_https_port=$((9443 + $offset))
>>      fi
>> +}
>> +
>> +# Setup AS
>> +function as_setup() {
>> +    echo "Setup AS" >> $LOG
>> +    echo "Configuring the Auto Scalar"
>> +
>> +    cp -f ./config/all/repository/conf/autoscaler.xml
>> $stratos_extract_path/repository/conf/
>> +
>> +    pushd $stratos_extract_path
>> +
>> +    echo "In repository/conf/autoscaler.xml"
>> +    sed -i "s@CC_HOSTNAME@$cc_hostname@g" repository/conf/autoscaler.xml
>> +    sed -i "s@CC_LISTEN_PORT@$as_cc_https_port@g"
>> repository/conf/autoscaler.xml
>> +    sed -i "s@SM_HOSTNAME@$sm_hostname@g" repository/conf/autoscaler.xml
>> +    sed -i "s@SM_LISTEN_PORT@$as_sm_https_port@g"
>> repository/conf/autoscaler.xml
>> +
>> +    popd
>> +    echo "End configuring the Auto scalar"
>> +}
>> +
>> +
>> +# SM related functions
>> +# -------------------------------------------------------------------
>> +function sm_related_popup() {
>> +    while read -p "Please provide Stratos Manager ip:" sm_ip
>> +    do
>> +       if !(valid_ip $sm_ip); then
>> +           echo "Please provide valid ips for SM"
>> +       else
>> +            export sm_ip
>> +           break
>> +       fi
>> +    done
>> +
>> +    while read -p "Please provide Stratos Manager hostname:" sm_hostname
>> +    do
>> +       if [[ -z $sm_hostname ]]; then
>> +           echo "Please specify valid hostname for SM"
>> +       else
>> +            export sm_hostname
>> +           break
>> +       fi
>> +    done
>> +
>> +    while read -p "Please provide Stratos Manager port offset:"
>> sm_port_offset
>> +    do
>> +       if [[ -z $sm_port_offset ]]; then
>> +           echo "Please specify the port offset of SM"
>> +       else
>> +            export sm_port_offset
>> +           break
>> +       fi
>> +    done
>> +}
>> +
>> +function sm_conf_validate() {
>>      if [[ -z $puppet_ip ]]; then
>>          echo "Please specify the ip of puppet master"
>>          exit 1
>> @@ -303,348 +344,219 @@ function sm_conf_validate {
>>          echo "Please specify the relevant puppet environment"
>>          exit 1
>>      fi
>> -    if [[ -z $cc_hostname || -z $as_hostname ]]; then
>> -       echo "Please specify valid hostname for AS and/or CC"
>> -       exit 1
>> +    if [[ ! -f $mysql_connector_jar ]]; then
>> +        echo "Please copy the mysql connector jar to the stratos release
>> pack folder and update the JAR name in conf/setup.conf file"
>> +        exit 1
>>      fi
>> -}
>> -
>>
>> -general_conf_validate
>> -andes_jar_validate
>> -if [[ $mb = "true" ]]; then
>> -    mb_conf_validate
>> -fi
>> -if [[ $cep = "true" ]]; then
>> -    cep_conf_validate
>> -fi
>> -if [[ $cc = "true" ]]; then
>> -    cc_conf_validate
>> -fi
>> -if [[ $as = "true" ]]; then
>> -    as_conf_validate
>> -fi
>> -if [[ $sm = "true" ]]; then
>> -    sm_conf_validate
>> -fi
>> -
>> -
>> -# Make sure the user is running as root.
>> -if [ "$UID" -ne "0" ]; then
>> -       echo ; echo "  You must be root to run $0.  (Try running 'sudo
>> bash' first.)" ; echo
>> -       exit 69
>> -fi
>> +    if [[ !($profile = "default") ]]; then
>> +       cc_related_popup
>> +       as_related_popup
>> +       export sm_cc_https_port=$((9443 + $cc_port_offset))
>> +       export sm_as_https_port=$((9443 + $as_port_offset))
>> +    else
>> +        export cc_hostname=$stratos_domain
>> +        export as_hostname=$stratos_domain
>> +       export sm_cc_https_port=$((9443 + $offset))
>> +       export sm_as_https_port=$((9443 + $offset))
>> +    fi
>> +    export sm_https_port=$((9443 + $offset))
>> +}
>>
>> -if [[ ! -d $log_path ]]; then
>> -    mkdir -p $log_path
>> -fi
>> +# Setup SM
>> +function sm_setup() {
>> +    echo "Setup SM" >> $LOG
>> +    echo "Configuring Stratos Manager"
>>
>> +    cp -f ./config/all/repository/conf/cartridge-config.properties
>> $stratos_extract_path/repository/conf/
>> +    cp -f
>> ./config/all/repository/conf/datasources/master-datasources.xml
>> $stratos_extract_path/repository/conf/datasources/
>> +    cp -f $mysql_connector_jar
>> $stratos_extract_path/repository/components/lib/
>>
>> -echo ""
>> -echo "For all the questions asked while during executing the script
>> please just press the enter button"
>> -echo ""
>> +    pushd $stratos_extract_path
>>
>> -if [[ $mb = "true" ]]; then
>> -    if [[ ! -d $mb_path ]]; then
>> -        echo "Extracting Message Broker"
>> -        unzip -q $mb_pack_path -d $stratos_path
>> -    fi
>> -fi
>> -if [[ $cep = "true" ]]; then
>> -    if [[ ! -d $cep_path ]]; then
>> -        echo "Extracting Complex Event Processor"
>> -        unzip -q $cep_pack_path -d $stratos_path
>> -    fi
>> -fi
>> -if [[ $cc = "true" ]]; then
>> -    if [[ ! -d $cc_path ]]; then
>> -        echo "Extracting Cloud Controller"
>> -        unzip -q $cc_pack_path -d $stratos_path
>> -    fi
>> -fi
>> -if [[ $as = "true" ]]; then
>> -    if [[ ! -d $as_path ]]; then
>> -        echo "Extracting Autoscaler"
>> -        unzip -q $as_pack_path -d $stratos_path
>> -    fi
>> -fi
>> -if [[ $sm = "true" ]]; then
>> -    if [[ ! -d $resource_path ]]; then
>> -        cp -rf ./resources $stratos_path
>> -    fi
>> -    if [[ ! -d $sm_path ]]; then
>> -        echo "Extracting Stratos Manager"
>> -        unzip -q $sm_pack_path -d $stratos_path
>> -    fi
>> -fi
>> +    echo "In repository/conf/cartridge-config.properties"
>> +    sed -i "s@CC_HOSTNAME:CC_HTTPS_PORT@$cc_hostname:$sm_cc_https_port@g"
>> repository/conf/cartridge-config.properties
>> +    sed -i "s@AS_HOSTNAME:AS_HTTPS_PORT@$as_hostname:$sm_as_https_port@g"
>> repository/conf/cartridge-config.properties
>> +    sed -i "s@PUPPET_IP@$puppet_ip@g"
>> repository/conf/cartridge-config.properties
>> +    sed -i "s@PUPPET_HOSTNAME@$puppet_hostname@g"
>> repository/conf/cartridge-config.properties
>> +    sed -i "s@PUPPET_ENV@$puppet_environment@g"
>> repository/conf/cartridge-config.properties
>>
>> +    echo "In repository/conf/datasources/master-datasources.xml"
>> +    sed -i "s@USERSTORE_DB_HOSTNAME@$userstore_db_hostname@g"
>> repository/conf/datasources/master-datasources.xml
>> +    sed -i "s@USERSTORE_DB_PORT@$userstore_db_port@g"
>> repository/conf/datasources/master-datasources.xml
>> +    sed -i "s@USERSTORE_DB_SCHEMA@$userstore_db_schema@g"
>> repository/conf/datasources/master-datasources.xml
>> +    sed -i "s@USERSTORE_DB_USER@$userstore_db_user@g"
>> repository/conf/datasources/master-datasources.xml
>> +    sed -i "s@USERSTORE_DB_PASS@$userstore_db_pass@g"
>> repository/conf/datasources/master-datasources.xml
>>
>> +    popd
>>
>> -# ------------------------------------------------
>> -# Setup MB
>> -# ------------------------------------------------
>> -function mb_setup {
>> -    echo "Setup MB" >> $LOG
>> -    echo "Configuring the Message Broker"
>> +    # Database Configuration
>> +    # -----------------------------------------------
>> +    echo "Create and configure MySql Databases" >> $LOG
>> +    echo "Creating userstore database"
>>
>> -    pushd $mb_path
>> +    pushd $resource_path
>> +    sed -i "s@USERSTORE_DB_SCHEMA@$userstore_db_schema@g" mysql.sql
>>
>> -    echo "In repository/conf/carbon.xml"
>> -    cp -f repository/conf/carbon.xml repository/conf/carbon.xml.orig
>> -    cat repository/conf/carbon.xml.orig | sed -e "s@<Offset>0</Offset>@<Offset>${mb_port_offset}</Offset>@g"
>> > repository/conf/carbon.xml
>> +    popd
>>
>> -    echo "End configuring the Message Broker"
>> -    popd #mb_path
>> +    mysql -u$userstore_db_user -p$userstore_db_pass <
>> $resource_path/mysql.sql
>> +    echo "End configuring the SM"
>>  }
>>
>> -if [[ $mb = "true" ]]; then
>> -    mb_setup
>> -fi
>>
>> -# ------------------------------------------------
>>  # Setup CEP
>> -# ------------------------------------------------
>> -function cep_setup {
>> +function cep_setup() {
>>      echo "Setup CEP" >> $LOG
>>      echo "Configuring the Complex Event Processor"
>>
>> -    cp -f ./config/cep/repository/conf/jndi.properties
>> $cep_path/repository/conf/
>> -    cp -f $cep_extension_jar $cep_path/repository/components/lib/
>> -    cp -f $andes_client_jar $cep_path/repository/components/dropins/
>> -    cp -f $cep_artifacts_path/eventbuilders/*.xml
>> $cep_path/repository/deployment/server/eventbuilders/
>> -    cp -f $cep_artifacts_path/inputeventadaptors/*.xml
>> $cep_path/repository/deployment/server/inputeventadaptors/
>> -    cp -f $cep_artifacts_path/outputeventadaptors/*.xml
>> $cep_path/repository/deployment/server/outputeventadaptors/
>> -    cp -f $cep_artifacts_path/executionplans/*.xml
>> $cep_path/repository/deployment/server/executionplans/
>> -    cp -f $cep_artifacts_path/eventformatters/*.xml
>> $cep_path/repository/deployment/server/eventformatters/
>> -    cp -f $cep_artifacts_path/streamdefinitions/*.xml
>> $cep_path/repository/conf/
>> -
>> -    pushd $cep_path
>> -
>> -    echo "In repository/conf/carbon.xml"
>> -    cp -f repository/conf/carbon.xml repository/conf/carbon.xml.orig
>> -    cat repository/conf/carbon.xml.orig | sed -e "s@<Offset>0</Offset>@<Offset>${cep_port_offset}</Offset>@g"
>> > repository/conf/carbon.xml
>> -
>> -    echo "In repository/conf/jndi.properties"
>> -    cp -f repository/conf/jndi.properties
>> repository/conf/jndi.properties.orig
>> -    cat repository/conf/jndi.properties.orig | sed -e "s@MB_HOSTNAME
>> :MB_LISTEN_PORT@$mb_hostname:$cep_mb_listen_port@g" >
>> repository/conf/jndi.properties
>> +    pushd $stratos_extract_path
>>
>>      echo "In outputeventadaptors"
>> -    cp -f
>> repository/deployment/server/outputeventadaptors/JMSOutputAdaptor.xml
>> repository/deployment/server/outputeventadaptors/JMSOutputAdaptor.xml.orig
>> -    cat
>> repository/deployment/server/outputeventadaptors/JMSOutputAdaptor.xml.orig
>> | sed -e "s@CEP_HOME@$cep_path@g" >
>> repository/deployment/server/outputeventadaptors/JMSOutputAdaptor.xml
>>
>> -    echo "In repository/conf/siddhi/siddhi.extension"
>> -    cp -f repository/conf/siddhi/siddhi.extension
>> repository/conf/siddhi/siddhi.extension.orig
>> -    echo
>> "org.apache.stratos.cep.extension.GradientFinderWindowProcessor" >>
>> repository/conf/siddhi/siddhi.extension.orig
>> -    echo
>> "org.apache.stratos.cep.extension.SecondDerivativeFinderWindowProcessor" >>
>> repository/conf/siddhi/siddhi.extension.orig
>> -    echo "org.apache.stratos.cep.extension.FaultHandlingWindowProcessor"
>> >> repository/conf/siddhi/siddhi.extension.orig
>> -    mv -f repository/conf/siddhi/siddhi.extension.orig
>> repository/conf/siddhi/siddhi.extension
>> +    sed -i "s@CEP_HOME@$stratos_extract_path@g"
>> repository/deployment/server/outputeventadaptors/JMSOutputAdaptor.xml
>> +    sed -i "s@MB_HOSTNAME:MB_LISTEN_PORT@$mb_ip:$mb_port@g"
>> repository/deployment/server/outputeventadaptors/JMSOutputAdaptor.xml
>>
>>      echo "End configuring the Complex Event Processor"
>> -    popd #cep_path
>> +    popd
>>  }
>> -if [[ $cep = "true" ]]; then
>> -    cep_setup
>> -fi
>>
>>
>>  # ------------------------------------------------
>> -# Setup CC
>> +# Execution
>>  # ------------------------------------------------
>> -function cc_setup {
>> -    echo "Setup CC" >> $LOG
>> -    echo "Configuring the Cloud Controller"
>> -
>> -    echo "Creating payload directory ... " >> $LOG
>> -    if [[ ! -d $cc_path/repository/resources/payload ]]; then
>> -        mkdir -p $cc_path/repository/resources/payload
>> -    fi
>> -
>> -    cp -f ./config/cc/repository/conf/cloud-controller.xml
>> $cc_path/repository/conf/
>> -    cp -f ./config/cc/repository/conf/carbon.xml
>> $cc_path/repository/conf/
>> -    cp -f ./config/cc/repository/conf/jndi.properties
>> $cc_path/repository/conf/
>> -    cp -f $andes_client_jar $cc_path/repository/components/dropins/
>> -
>> -    echo "In repository/conf/cloud-controller.xml"
>> -    if [[ $ec2_provider_enabled = true ]]; then
>> -        ./ec2.sh
>> -    fi
>> -    if [[ $openstack_provider_enabled = true ]]; then
>> -        ./openstack.sh
>> -    fi
>> -    if [[ $vcloud_provider_enabled = true ]]; then
>> -        ./vcloud.sh
>> -    fi
>> -
>> -    pushd $cc_path
>> -
>> -    cp -f repository/conf/cloud-controller.xml
>> repository/conf/cloud-controller.xml.orig
>> -    cat repository/conf/cloud-controller.xml.orig | sed -e "s@MB_HOSTNAME
>> :MB_LISTEN_PORT@$mb_hostname:$cc_mb_listen_port@g" >
>> repository/conf/cloud-controller.xml
>>
>> -    echo "In repository/conf/carbon.xml"
>> -    cp -f repository/conf/carbon.xml repository/conf/carbon.xml.orig
>> -    cat repository/conf/carbon.xml.orig | sed -e "s@CC_PORT_OFFSET
>> @$cc_port_offset@g" > repository/conf/carbon.xml
>> -
>> -    echo "In repository/conf/jndi.properties"
>> -    cp -f repository/conf/jndi.properties
>> repository/conf/jndi.properties.orig
>> -    cat repository/conf/jndi.properties.orig | sed -e "s@MB_HOSTNAME
>> :MB_LISTEN_PORT@$mb_hostname:$cc_mb_listen_port@g" >
>> repository/conf/jndi.properties
>> -
>> -    popd #cc_path
>> -    echo "End configuring the Cloud Controller"
>> -}
>> +while getopts p:s opts
>> +do
>> +  case $opts in
>> +    p)
>> +        profile_list=${OPTARG}
>> +        ;;
>> +    s)
>> +        auto_start_servers="true"
>> +        ;;
>> +    \?)
>> +        help
>> +        exit 1
>> +        ;;
>> +  esac
>> +done
>>
>> -if [[ $cc = "true" ]]; then
>> -   cc_setup
>> +profile_list=`echo $profile_list | sed 's/^ *//g' | sed 's/ *$//g'`
>> +if [[ !(-z $profile_list || $profile_list = "") ]]; then
>> +    arr=$(echo $profile_list | tr " " "\n")
>> +echo $arr
>> +    for x in $arr
>> +    do
>> +       if [[ $x = "default" ]]; then
>> +            profile="default"
>> +       elif [[ $x = "cc" ]]; then
>> +            profile="cc"
>> +        elif [[ $x = "as" ]]; then
>> +            profile="as"
>> +        elif [[ $x = "sm" ]]; then
>> +            profile="sm"
>> +        else
>> +            echo "Invalid profile."
>> +            exit 1
>> +       fi
>> +    done
>> +    echo "You have selected the profile : $profile"
>> +else
>> +    echo "You have not provided a profile : default profile will be
>> selected."
>>  fi
>>
>> -# ------------------------------------------------
>> -# Setup AS
>> -# ------------------------------------------------
>> -function as_setup {
>> -    echo "Setup AS" >> $LOG
>> -    echo "Configuring the Auto Scalar"
>> -
>> -    cp -f ./config/as/repository/conf/carbon.xml
>> $as_path/repository/conf/
>> -    cp -f ./config/as/repository/conf/jndi.properties
>> $as_path/repository/conf/
>> -    cp -f ./config/as/repository/conf/autoscaler.xml
>> $as_path/repository/conf/
>> -    cp -f $andes_client_jar $as_path/repository/components/dropins/
>> -
>> -    pushd $as_path
>> -
>> -    echo "In repository/conf/carbon.xml"
>> -    cp -f repository/conf/carbon.xml repository/conf/carbon.xml.orig
>> -    cat repository/conf/carbon.xml.orig | sed -e "s@AS_PORT_OFFSET
>> @$as_port_offset@g" > repository/conf/carbon.xml
>> -
>> -    echo "In repository/conf/jndi.properties"
>> -    cp -f repository/conf/jndi.properties
>> repository/conf/jndi.properties.orig
>> -    cat repository/conf/jndi.properties.orig | sed -e "s@MB_HOSTNAME
>> :MB_LISTEN_PORT@$mb_hostname:$as_mb_listen_port@g" >
>> repository/conf/jndi.properties
>> -
>> -    echo "In repository/conf/autoscaler.xml"
>> -    cp -f repository/conf/autoscaler.xml
>> repository/conf/autoscaler.xml.orig
>> -    cat repository/conf/autoscaler.xml.orig | sed -e "s@CC_HOSTNAME
>> @$cc_hostname@g" > repository/conf/autoscaler.xml
>>
>> -    cp -f repository/conf/autoscaler.xml
>> repository/conf/autoscaler.xml.orig
>> -    cat repository/conf/autoscaler.xml.orig | sed -e "s@CC_LISTEN_PORT
>> @$as_cc_https_port@g" > repository/conf/autoscaler.xml
>> -
>> -    cp -f repository/conf/autoscaler.xml
>> repository/conf/autoscaler.xml.orig
>> -    cat repository/conf/autoscaler.xml.orig | sed -e "s@SM_HOSTNAME
>> @$sm_hostname@g" > repository/conf/autoscaler.xml
>> -
>> -    cp -f repository/conf/autoscaler.xml
>> repository/conf/autoscaler.xml.orig
>> -    cat repository/conf/autoscaler.xml.orig | sed -e "s@SM_LISTEN_PORT
>> @$as_sm_https_port@g" > repository/conf/autoscaler.xml
>> -
>> -    popd #as_path
>> -    echo "End configuring the Auto smalar"
>> -}
>> -
>> -if [[ $as = "true" ]]; then
>> -    as_setup
>> +if [[ $host_user == "" ]]; then
>> +    echo "user provided in conf/setup.conf is null. Please provide a
>> user"
>> +    exit 1
>>  fi
>>
>> +echo "user provided in conf/setup.conf is $host_user. If you want to
>> provide some other user name please specify it at the prompt."
>> +echo "If you want to continue with $host_user just press enter to
>> continue"
>> +read username
>> +if [[ $username != "" ]]; then
>> +    host_user=$username
>> +fi
>> +user=`id $host_user`
>> +if [[ $? = 1 ]]; then
>> +    echo "User $host_user does not exist. The system will create it."
>> +    adduser --home /home/$host_user $host_user
>> +fi
>>
>> +export $host_user
>>
>> -# ------------------------------------------------
>> -# Setup SM
>> -# ------------------------------------------------
>> -function sm_setup {
>> -    echo "Setup SM" >> $LOG
>> -    echo "Configuring Stratos Manager"
>> -
>> -    cp -f ./config/sm/repository/conf/carbon.xml
>> $sm_path/repository/conf/
>> -    cp -f ./config/sm/repository/conf/jndi.properties
>> $sm_path/repository/conf/
>> -    cp -f ./config/sm/repository/conf/cartridge-config.properties
>> $sm_path/repository/conf/
>> -    cp -f ./config/sm/repository/conf/datasources/master-datasources.xml
>> $sm_path/repository/conf/datasources/
>> -    cp -f $mysql_connector_jar $sm_path/repository/components/lib/
>> -    cp -f $andes_client_jar $sm_path/repository/components/dropins/
>> -
>> -    pushd $sm_path
>> -
>> -    echo "In repository/conf/carbon.xml"
>> -    cp -f repository/conf/carbon.xml repository/conf/carbon.xml.orig
>> -    cat repository/conf/carbon.xml.orig | sed -e "s@SC_PORT_OFFSET
>> @$sm_port_offset@g" > repository/conf/carbon.xml
>> -
>> -    echo "In repository/conf/jndi.properties"
>> -    cp -f repository/conf/jndi.properties
>> repository/conf/jndi.properties.orig
>> -    cat repository/conf/jndi.properties.orig | sed -e "s@MB_HOSTNAME
>> :MB_LISTEN_PORT@$mb_hostname:$sm_mb_listen_port@g" >
>> repository/conf/jndi.properties
>> -
>> -    echo "In repository/conf/cartridge-config.properties" >> $LOG
>> -    cp -f repository/conf/cartridge-config.properties
>> repository/conf/cartridge-config.properties.orig
>> -    cat repository/conf/cartridge-config.properties.orig | sed -e
>> "s@CC_HOSTNAME:CC_HTTPS_PORT@$cc_hostname:$sm_cc_https_port@g" >
>> repository/conf/cartridge-config.properties
>> -
>> -    cp -f repository/conf/cartridge-config.properties
>> repository/conf/cartridge-config.properties.orig
>> -    cat repository/conf/cartridge-config.properties.orig | sed -e
>> "s@AS_HOSTNAME:AS_HTTPS_PORT@$as_hostname:$sm_as_https_port@g" >
>> repository/conf/cartridge-config.properties
>> -
>> -    cp -f repository/conf/cartridge-config.properties
>> repository/conf/cartridge-config.properties.orig
>> -    cat repository/conf/cartridge-config.properties.orig | sed -e
>> "s@PUPPET_IP@$sm_puppet_ip@g" >
>> repository/conf/cartridge-config.properties
>> -
>> -    cp -f repository/conf/cartridge-config.properties
>> repository/conf/cartridge-config.properties.orig
>> -    cat repository/conf/cartridge-config.properties.orig | sed -e
>> "s@PUPPET_HOSTNAME@$sm_puppet_hostname@g" >
>> repository/conf/cartridge-config.properties
>> -
>> -    cp -f repository/conf/cartridge-config.properties
>> repository/conf/cartridge-config.properties.orig
>> -    cat repository/conf/cartridge-config.properties.orig | sed -e
>> "s@PUPPET_ENV@$sm_puppet_environment@g" >
>> repository/conf/cartridge-config.properties
>> -
>> -    echo "In repository/conf/datasources/master-datasources.xml" >> $LOG
>> -    cp -f repository/conf/datasources/master-datasources.xml
>> repository/conf/datasources/master-datasources.xml.orig
>> -    cat repository/conf/datasources/master-datasources.xml.orig | sed -e
>> "s@USERSTORE_DB_HOSTNAME@$userstore_db_hostname@g" >
>> repository/conf/datasources/master-datasources.xml
>> -
>> -    cp -f repository/conf/datasources/master-datasources.xml
>> repository/conf/datasources/master-datasources.xml.orig
>> -    cat repository/conf/datasources/master-datasources.xml.orig | sed -e
>> "s@USERSTORE_DB_PORT@$userstore_db_port@g" >
>> repository/conf/datasources/master-datasources.xml
>> -
>> -    cp -f repository/conf/datasources/master-datasources.xml
>> repository/conf/datasources/master-datasources.xml.orig
>> -    cat repository/conf/datasources/master-datasources.xml.orig | sed -e
>> "s@USERSTORE_DB_SCHEMA@$userstore_db_schema@g" >
>> repository/conf/datasources/master-datasources.xml
>> -
>> -    cp -f repository/conf/datasources/master-datasources.xml
>> repository/conf/datasources/master-datasources.xml.orig
>> -    cat repository/conf/datasources/master-datasources.xml.orig | sed -e
>> "s@USERSTORE_DB_USER@$userstore_db_user@g" >
>> repository/conf/datasources/master-datasources.xml
>> -
>> -    cp -f repository/conf/datasources/master-datasources.xml
>> repository/conf/datasources/master-datasources.xml.orig
>> -    cat repository/conf/datasources/master-datasources.xml.orig | sed -e
>> "s@USERSTORE_DB_PASS@$userstore_db_pass@g" >
>> repository/conf/datasources/master-datasources.xml
>> -
>> -    popd # sm_path
>> -
>> +# Make sure the user is running as root.
>> +if [ "$UID" -ne "0" ]; then
>> +       echo ; echo "  You must be root to run $0.  (Try running 'sudo
>> bash' first.)" ; echo
>> +       exit 69
>> +fi
>>
>> -    # Database Configuration
>> -    # -----------------------------------------------
>> -    echo "Create and configure MySql Databases" >> $LOG
>> +general_conf_validate
>> +if [[ $profile = "cc" ]]; then
>> +    cc_conf_validate
>> +elif [[ $profile = "as" ]]; then
>> +    as_conf_validate
>> +elif [[ $profile = "sm" ]]; then
>> +    sm_conf_validate
>> +else
>> +    echo "In default profile CEP will be configured."
>> +    activemq_validate
>> +    cc_conf_validate
>> +    as_conf_validate
>> +    sm_conf_validate
>> +fi
>>
>> -    echo "Creating userstore database"
>> +if [[ ! -d $log_path ]]; then
>> +    mkdir -p $log_path
>> +fi
>>
>> -    pushd $resource_path
>> -    cp -f mysql.sql mysql.sql.orig
>> -    cat mysql.sql.orig | sed -e "s@USERSTORE_DB_SCHEMA
>> @$userstore_db_schema@g" > mysql.sql
>>
>> -    popd # resource_path
>> +echo ""
>> +echo "For all the questions asked while during executing the script
>> please just press the enter button"
>> +echo ""
>>
>> -    mysql -u$userstore_db_user -p$userstore_db_pass <
>> $resource_path/mysql.sql
>> -
>> -    #Copy
>> https://svn.wso2.org/repos/wso2/scratch/hosting/build/tropos/resources/append_zone_file.shinto /opt/scripts folder
>> -    if [[ ! -d $stratos_path/scripts ]]; then
>> -        mkdir -p $stratos_path/scripts
>> -    fi
>> -    cp -f ./scripts/add_entry_zone_file.sh
>> $stratos_path/scripts/add_entry_zone_file.sh
>> -    cp -f ./scripts/remove_entry_zone_file.sh
>> $stratos_path/scripts/remove_entry_zone_file.sh
>>
>> +# Extract stratos zip file
>> +if [[ !(-d $stratos_extract_path) ]]; then
>> +    echo "Extracting Apache Stratos"
>> +    unzip -q $stratos_pack_zip -d $stratos_path
>> +    mv -f $stratos_path/apache-stratos-4.0.0-SNAPSHOT
>> $stratos_extract_path
>> +fi
>>
>> -    echo "End configuring the SM"
>> -}
>> +if [[ ($profile = "default" && $config_mb = "true") ]]; then
>> +    echo "Extracting ActiveMQ"
>> +    tar -xzf $activemq_pack -C $stratos_path
>> +fi
>>
>> -if [[ $sm = "true" ]]; then
>> +general_setup
>> +if [[ $profile = "cc" ]]; then
>> +    cc_setup
>> +elif [[ $profile = "as" ]]; then
>> +    as_setup
>> +elif [[ $profile = "sm" ]]; then
>> +    sm_setup
>> +else
>> +    cc_setup
>> +    as_setup
>>      sm_setup
>> +    cep_setup
>>  fi
>>
>> -
>>  # ------------------------------------------------
>>  # Mapping domain/host names
>>  # ------------------------------------------------
>>
>>  cp -f /etc/hosts hosts.tmp
>>
>> -
>> -echo "$mb_ip $mb_hostname      # message broker hostname"      >>
>> hosts.tmp
>> -
>> -if [[ $sm = "true" || $as = "true" ]]; then
>> +echo "$host_ip $sm_hostname    # stratos domain"       >> hosts.tmp
>> +
>> +if [[ $profile = "sm" || $profile = "as" ]]; then
>>      echo "$sm_ip $sm_hostname  # stratos domain"       >> hosts.tmp
>>      echo "$cc_ip $cc_hostname  # cloud controller hostname"    >>
>> hosts.tmp
>>  fi
>>
>> -if [[ $sm = "true" ]]; then
>> +if [[ $profile = "sm" ]]; then
>>      echo "$as_ip $as_hostname  # auto scalar hostname" >> hosts.tmp
>>  fi
>>
>> @@ -659,9 +571,11 @@ chown $host_user:$host_user $stratos_path -R
>>
>>  echo "Apache Stratos setup has successfully completed"
>>
>> -read -p "Do you want to start the servers [y/n]? " answer
>> -if [[ $answer != y ]] ; then
>> -   exit 1
>> +if [[ $auto_start_servers != "true" ]]; then
>> +    read -p "Do you want to start the servers [y/n]? " answer
>> +    if [[ $answer != y ]] ; then
>> +        exit 1
>> +    fi
>>  fi
>>
>>  echo "Starting the servers" >> $LOG
>> @@ -672,14 +586,11 @@ chown -R $host_user.$host_user $log_path
>>  chmod -R 777 $log_path
>>
>>  export setup_dir=$PWD
>> -su - $host_user -c "source
>> $setup_dir/conf/setup.conf;$setup_dir/start-servers.sh -p\"$product_list\"
>> >> $LOG"
>> +su - $host_user -c "source
>> $setup_path/conf/setup.conf;$setup_path/start-servers.sh -p\"$profile\" >>
>> $LOG"
>>
>>  echo "Servers started. Please look at $LOG file for server startup
>> details"
>> -if [[ $sm == "true" ]]; then
>> +if [[ $profile == "default" || $profile == "sm" ]]; then
>>      echo "**************************************************************"
>>      echo "Management Console : https://
>> $stratos_domain:$sm_https_port/console"
>>      echo "**************************************************************"
>>  fi
>> -
>> -
>> -
>>
>>
>> http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7e4b3aee/tools/stratos-installer/start-servers.sh
>> ----------------------------------------------------------------------
>> diff --git a/tools/stratos-installer/start-servers.sh
>> b/tools/stratos-installer/start-servers.sh
>> index c22eeea..78edf65 100755
>> --- a/tools/stratos-installer/start-servers.sh
>> +++ b/tools/stratos-installer/start-servers.sh
>> @@ -29,18 +29,22 @@ product_list=$1
>>  export LOG=$log_path/stratos.log
>>  SLEEP=40
>>
>> +profile="default"
>> +
>>  if [[ -f ./conf/setup.conf ]]; then
>>      source "./conf/setup.conf"
>> +    echo "source it"
>>  fi
>>
>> +
>>  function help {
>>      echo ""
>>      echo "Give one or more of the servers to start on this machine. The
>> available servers are"
>> -    echo "mb, cc, as, sm, cep, all. 'all' means you need to start all
>> servers."
>> +    echo "cc, as, sm, default. 'default' means you need to start all
>> servers."
>>      echo "usage:"
>> -    echo "start-servers.sh -p\"<product list>\""
>> +    echo "start-servers.sh -p\"<profile>\""
>>      echo "eg."
>> -    echo "start-servers.sh -p\"cc sm\""
>> +    echo "start-servers.sh -p\"cc\""
>>      echo ""
>>  }
>>
>> @@ -48,96 +52,45 @@ while getopts p: opts
>>  do
>>    case $opts in
>>      p)
>> -        product_list=${OPTARG}
>> -        echo $product_list
>> +        profile_list=${OPTARG}
>>          ;;
>> -    *)
>> +    \?)
>>          help
>>          exit 1
>>          ;;
>>    esac
>>  done
>> -arr=$(echo $product_list | tr ";" "\n")
>> +
>> +
>> +arr=$(echo $profile_list | tr " " "\n")
>>
>>  for x in $arr
>>  do
>> -    if [[ $x = "mb" ]]; then
>> -        mb="true"
>> -    fi
>> -    if [[ $x = "cep" ]]; then
>> -        cep="true"
>> -    fi
>>      if [[ $x = "cc" ]]; then
>> -        cc="true"
>> -    fi
>> -    if [[ $x = "as" ]]; then
>> -        as="true"
>> -    fi
>> -    if [[ $x = "sm" ]]; then
>> -        sm="true"
>> -    fi
>> -    if [[ $x = "all" ]]; then
>> -       mb="true"
>> -        cc="true"
>> -        as="true"
>> -        sm="true"
>> -        cep="true"
>> +        profile="cc"
>> +    elif [[ $x = "as" ]]; then
>> +        profile="as"
>> +    elif [[ $x = "sm" ]]; then
>> +        profile="sm"
>> +    else
>> +        echo "Inavlid profile : 'default' profile will be selected."
>> +        profile="default"
>>      fi
>>  done
>> -product_list=`echo $product_list | sed 's/^ *//g' | sed 's/ *$//g'`
>> -if [[ -z $product_list || $product_list = "" ]]; then
>> -    help
>> -    exit 1
>> -fi
>> -
>> -if [[ $mb = "true" ]]; then
>> -    echo ${mb_path}
>> -
>> -    echo "Starting MB server ..." >> $LOG
>> -    nohup ${mb_path}/bin/wso2server.sh &
>> -    echo "MB server started" >> $LOG
>> -    sleep $SLEEP
>> -    sleep $SLEEP
>> -fi
>>
>> -if [[ $cep = "true" ]]; then
>> -    echo ${cep_path}
>> -
>> -    echo "Starting CEP server ..." >> $LOG
>> -    nohup ${cep_path}/bin/wso2server.sh &
>> -    echo "CEP server started" >> $LOG
>> -    sleep $SLEEP
>> -    sleep $SLEEP
>> -fi
>> -
>> -if [[ $cc = "true" ]]; then
>> -    echo ${cc_path}
>> -
>> -    echo "Starting CC server ..." >> $LOG
>> -    nohup ${cc_path}/bin/stratos.sh &
>> -    echo "CC server started" >> $LOG
>> +if [[ $profile = "default" ]]; then
>> +    echo "Starting ActiveMQ server ..." >> $LOG
>> +    $activemq_path/bin/activemq start
>> +    echo "ActiveMQ server started" >> $LOG
>>      sleep $SLEEP
>>      sleep $SLEEP
>>  fi
>>
>> -if [[ $as = "true" ]]; then
>> -    echo ${as_path}
>> -
>> -    echo "Starting Auto Scalar server ..." >> $LOG
>> -    nohup ${as_path}/bin/stratos.sh &
>> -    echo "Auto Scalar server started" >> $LOG
>> -    sleep $SLEEP
>> -fi
>> -
>> -
>> -if [[ $sm = "true" ]]; then
>> -    echo ${sm_path}
>> -
>> -    echo "Starting SM server ..." >> $LOG
>> -    nohup ${sm_path}/bin/stratos.sh &
>> -    echo "SM server started" >> $LOG
>> -    sleep $SLEEP
>> -
>> -fi
>> +echo "Starting Stratos server ..." >> $LOG
>> +echo "$stratos_extract_path/bin/stratos.sh -Dprofile=$profile start"
>> +$stratos_extract_path/bin/stratos.sh -Dprofile=$profile start
>> +echo "Stratos server started" >> $LOG
>> +sleep $SLEEP
>> +sleep $SLEEP
>>
>>
>>
>>
>> http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7e4b3aee/tools/stratos-installer/stratos-clean.sh
>> ----------------------------------------------------------------------
>> diff --git a/tools/stratos-installer/stratos-clean.sh
>> b/tools/stratos-installer/stratos-clean.sh
>> deleted file mode 100755
>> index 261dee7..0000000
>> --- a/tools/stratos-installer/stratos-clean.sh
>> +++ /dev/null
>> @@ -1,104 +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 is for cleaning the host machine where one or more of the
>> Stratos servers are run.
>> -#
>> ----------------------------------------------------------------------------
>> -
>> -source "./conf/stratos-setup.conf"
>> -
>> -if [ "$UID" -ne "0" ]; then
>> -       echo ; echo "  You must be root to run $0.  (Try running 'sudo
>> bash' first.)" ; echo
>> -       exit 69
>> -fi
>> -
>> -function help {
>> -    echo ""
>> -    echo "Clean the host machine where one or more of the Stratos2
>> servers are run."
>> -    echo "usage:"
>> -    echo "stratos-clean.sh -u <mysql username> -p <mysql password>"
>> -    echo ""
>> -}
>> -
>> -while getopts u:p: opts
>> -do
>> -  case $opts in
>> -    u)
>> -        mysql_user=${OPTARG}
>> -        ;;
>> -    p)
>> -        mysql_pass=${OPTARG}
>> -        ;;
>> -    *)
>> -        help
>> -        #exit 1
>> -        ;;
>> -  esac
>> -done
>> -
>> -function helpclean {
>> -    echo ""
>> -    echo "Enter DB credentials if you need to clear Stratos DB"
>> -    echo "usage:"
>> -    echo "clean.sh -u <mysql username> -p <mysql password>"
>> -    echo ""
>> -}
>> -
>> -function clean_validate {
>> -    if [ -z $stratos_path ]; then
>> -        echo "stratos_path is not set"
>> -        exit 1
>> -    fi
>> -    if [ -z $log_path ]; then
>> -        echo "log_path is not set"
>> -        exit 1
>> -    fi
>> -}
>> -
>> -clean_validate
>> -if [[ ( -n $mysql_user && -n $mysql_pass ) ]]; then
>> -       read -p "Please confirm that you want to remove stratos
>> databases, servers and logs [y/n] " answer
>> -       if [[ $answer != y ]] ; then
>> -               exit 1
>> -       fi
>> -fi
>> -echo 'Stopping all java processes'
>> -killall java
>> -echo 'Waiting for applications to exit'
>> -sleep 15
>> -
>> -if [[ ( -n $mysql_user && -n $mysql_pass ) ]]; then
>> -   echo 'Removing userstore database'
>> -   mysql -u $mysql_user -p$mysql_pass -e "DROP DATABASE IF EXISTS
>> $userstore_db_schema;"
>> -fi
>> -
>> -if [[ -d $stratos_path/scripts ]]; then
>> -   echo 'Removing scripts'
>> -   rm -rf $stratos_path/scripts
>> -fi
>> -
>> -if [[ -d $stratos_path ]]; then
>> -   echo 'Removing Stratos'
>> -   rm -rf $stratos_path/*
>> -fi
>> -
>> -echo 'Removing logs'
>> -rm -rf $log_path/*
>>
>>
>> http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7e4b3aee/tools/stratos-installer/stratos-db-clean.sh
>> ----------------------------------------------------------------------
>> diff --git a/tools/stratos-installer/stratos-db-clean.sh
>> b/tools/stratos-installer/stratos-db-clean.sh
>> deleted file mode 100755
>> index 74fec29..0000000
>> --- a/tools/stratos-installer/stratos-db-clean.sh
>> +++ /dev/null
>> @@ -1,24 +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.
>> -#
>> -#
>> -# cleans up databases
>> -mysql -uroot -proot -e "DROP DATABASE IF EXISTS stratos_foundation;"
>> -mysql -uroot -proot -e "DROP DATABASE IF EXISTS userstore;"
>> -
>>
>>
>> http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7e4b3aee/tools/stratos-installer/stratos-ec2.sh
>> ----------------------------------------------------------------------
>> diff --git a/tools/stratos-installer/stratos-ec2.sh
>> b/tools/stratos-installer/stratos-ec2.sh
>> deleted file mode 100755
>> index 7e39a80..0000000
>> --- a/tools/stratos-installer/stratos-ec2.sh
>> +++ /dev/null
>> @@ -1,56 +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 is invoked by setup.sh for configuring Amazon EC2 IaaS
>> information.
>> -#
>> ----------------------------------------------------------------------------
>> -
>> -# Die on any error:
>> -set -e
>> -
>> -SLEEP=60
>> -export LOG=$log_path/stratos-ec2.log
>> -
>> -source "./conf/stratos-setup.conf"
>> -
>> -if [[ ! -d $log_path ]]; then
>> -    mkdir -p $log_path
>> -fi
>> -
>> -pushd $stratos_extract_path
>> -
>> -echo "Set EC2 provider specific info in
>> repository/conf/cloud-controller.xml" >> $LOG
>> -
>> -sed -i "s@EC2_PROVIDER_START@@g"  repository/conf/cloud-controller.xml
>> -sed -i "s@EC2_IDENTITY@$ec2_identity@g"
>> repository/conf/cloud-controller.xml
>> -sed -i "s@EC2_CREDENTIAL@$ec2_credential@g"
>> repository/conf/cloud-controller.xml
>> -sed -i "s@EC2_OWNER_ID@$ec2_owner_id@g"
>> repository/conf/cloud-controller.xml
>> -sed -i "s@EC2_AVAILABILITY_ZONE@$ec2_availability_zone@g"
>> repository/conf/cloud-controller.xml
>> -sed -i "s@EC2_SECURITY_GROUPS@$ec2_security_groups@g"
>> repository/conf/cloud-controller.xml
>> -sed -i "s@EC2_KEYPAIR@$ec2_keypair_name@g"
>> repository/conf/cloud-controller.xml
>> -sed -i "s@EC2_PROVIDER_END@@g" repository/conf/cloud-controller.xml
>> -sed -i "s@OPENSTACK_PROVIDER_START@!--@g"
>> repository/conf/cloud-controller.xml
>> -sed -i "s@OPENSTACK_PROVIDER_END@--@g"
>> repository/conf/cloud-controller.xml
>> -sed -i "s@VCLOUD_PROVIDER_START@!--@g"
>> repository/conf/cloud-controller.xml
>> -sed -i "s@VCLOUD_PROVIDER_END@--@g" repository/conf/cloud-controller.xml
>> -
>> -popd
>> -
>>
>>
>> http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7e4b3aee/tools/stratos-installer/stratos-openstack.sh
>> ----------------------------------------------------------------------
>> diff --git a/tools/stratos-installer/stratos-openstack.sh
>> b/tools/stratos-installer/stratos-openstack.sh
>> deleted file mode 100755
>> index 925333c..0000000
>> --- a/tools/stratos-installer/stratos-openstack.sh
>> +++ /dev/null
>> @@ -1,52 +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 is invoked by setup.sh for configuring OpenStack IaaS
>> information.
>> -#
>> ----------------------------------------------------------------------------
>> -
>> -# Die on any error:
>> -set -e
>> -
>> -SLEEP=60
>> -export LOG=$log_path/stratos-openstack.log
>> -
>> -source "./conf/stratos-setup.conf"
>> -
>> -if [[ ! -d $log_path ]]; then
>> -    mkdir -p $log_path
>> -fi
>> -
>> -pushd $stratos_extract_path
>> -
>> -echo "Set OpenStack provider specific info in
>> repository/conf/cloud-controller.xml" >> $LOG
>> -
>> -sed -i "s@OPENSTACK_PROVIDER_START@@g"
>> repository/conf/cloud-controller.xml
>> -sed -i "s@OPENSTACK_IDENTITY@$openstack_identity@g"
>>  repository/conf/cloud-controller.xml
>> -sed -i "s@OPENSTACK_CREDENTIAL@$openstack_credential@g"
>>  repository/conf/cloud-controller.xml
>> -sed -i "s@OPENSTACK_ENDPOINT@$openstack_jclouds_endpoint@g"
>>  repository/conf/cloud-controller.xml
>> -sed -i "s@OPENSTACK_PROVIDER_END@@g"
>>  repository/conf/cloud-controller.xml
>> -sed -i "s@EC2_PROVIDER_START@!--@g"
>>  repository/conf/cloud-controller.xml
>> -sed -i "s@EC2_PROVIDER_END@--@g"  repository/conf/cloud-controller.xml
>> -sed -i "s@VCLOUD_PROVIDER_START@!--@g"
>>  repository/conf/cloud-controller.xml
>> -sed -i "s@VCLOUD_PROVIDER_END@--@g"
>>  repository/conf/cloud-controller.xml
>> -
>> -popd
>>
>>
>>
>>
>> --
>> Isuru Perera
>> Senior Software Engineer | WSO2, Inc. | http://wso2.com/
>> Lean . Enterprise . Middleware
>>
>> about.me/chrishantha
>>
>


-- 
Isuru Perera
Senior Software Engineer | WSO2, Inc. | http://wso2.com/
Lean . Enterprise . Middleware

about.me/chrishantha

Re: Fwd: [2/3] git commit: Stratos Installer changes to use single product

Posted by Nirmal Fernando <ni...@gmail.com>.
Well, it's bit suprising that you weren't aware about the consequences of
git rm :-)
On Apr 4, 2014 7:16 AM, "Isuru Perera" <is...@wso2.com> wrote:

> Hi Devs,
>
> I pushed the Stratos installer changes.
>
> What I did was to 'git rm' old files and 'git mv' to rename.
>
> Looks like the commit went as file changes. Sorry for the mistake! :-/
>
> ---------- Forwarded message ----------
> From: <is...@apache.org>
> Date: Fri, Apr 4, 2014 at 7:06 AM
> Subject: [2/3] git commit: Stratos Installer changes to use single product
> To: commits@stratos.incubator.apache.org
>
>
> Stratos Installer changes to use single product
>
>
> Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
> Commit:
> http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/7e4b3aee
> Tree:
> http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/7e4b3aee
> Diff:
> http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/7e4b3aee
>
> Branch: refs/heads/master
> Commit: 7e4b3aee15be72f1fa2771c623af920a4d5e9688
> Parents: 0955f29
> Author: M. Isuru Tharanga Chrishantha Perera <is...@apache.org>
> Authored: Thu Apr 3 17:25:36 2014 +0530
> Committer: M. Isuru Tharanga Chrishantha Perera <is...@apache.org>
> Committed: Thu Apr 3 17:25:36 2014 +0530
>
> ----------------------------------------------------------------------
>  tools/stratos-installer/clean.sh                |  39 +-
>  tools/stratos-installer/conf/setup.conf         |  95 +--
>  tools/stratos-installer/conf/stratos-setup.conf | 103 ---
>  tools/stratos-installer/ec2.sh                  |  49 +-
>  tools/stratos-installer/openstack.sh            |  37 +-
>  tools/stratos-installer/setup.sh                | 825 +++++++++----------
>  tools/stratos-installer/start-servers.sh        | 107 +--
>  tools/stratos-installer/stratos-clean.sh        | 104 ---
>  tools/stratos-installer/stratos-db-clean.sh     |  24 -
>  tools/stratos-installer/stratos-ec2.sh          |  56 --
>  tools/stratos-installer/stratos-openstack.sh    |  52 --
>  tools/stratos-installer/stratos-setup.sh        | 596 --------------
>  .../stratos-installer/stratos-start-servers.sh  |  96 ---
>  tools/stratos-installer/stratos-vcloud.sh       |  52 --
>  tools/stratos-installer/vcloud.sh               |  37 +-
>  15 files changed, 453 insertions(+), 1819 deletions(-)
> ----------------------------------------------------------------------
>
>
>
> http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7e4b3aee/tools/stratos-installer/clean.sh
> ----------------------------------------------------------------------
> diff --git a/tools/stratos-installer/clean.sh
> b/tools/stratos-installer/clean.sh
> index 5692739..b74879d 100755
> --- a/tools/stratos-installer/clean.sh
> +++ b/tools/stratos-installer/clean.sh
> @@ -63,10 +63,6 @@ function helpclean {
>  }
>
>  function clean_validate {
> -#    if [[ ( -z $mysql_user || -z $mysql_pass ) ]]; then
> - #       helpclean
> -  #      exit 1
> -   # fi
>      if [ -z $stratos_path ]; then
>          echo "stratos_path is not set"
>          exit 1
> @@ -90,13 +86,8 @@ echo 'Waiting for applications to exit'
>  sleep 15
>
>  if [[ ( -n $mysql_user && -n $mysql_pass ) ]]; then
> -
> -       echo 'Removing stratos_foundation database'
> -       mysql -u $mysql_user -p$mysql_pass -e "DROP DATABASE IF EXISTS
> stratos_foundation;"
> -
> -       echo 'Removing userstore database'
> -       mysql -u $mysql_user -p$mysql_pass -e "DROP DATABASE IF EXISTS
> userstore;"
> -
> +   echo 'Removing userstore database'
> +   mysql -u $mysql_user -p$mysql_pass -e "DROP DATABASE IF EXISTS
> $userstore_db_schema;"
>  fi
>
>  if [[ -d $stratos_path/scripts ]]; then
> @@ -104,29 +95,9 @@ if [[ -d $stratos_path/scripts ]]; then
>     rm -rf $stratos_path/scripts
>  fi
>
> -if [[ -d $mb_path ]]; then
> -   echo 'Removing MB'
> -   rm -rf $mb_path
> -fi
> -
> -if [[ -d $cep_path ]]; then
> -   echo 'Removing CEP'
> -   rm -rf $cep_path
> -fi
> -
> -if [[ -d $cc_path ]]; then
> -   echo 'Removing CC'
> -   rm -rf $cc_path
> -fi
> -
> -if [[ -d $as_path ]]; then
> -   echo 'Removing AS'
> -   rm -rf $as_path
> -fi
> -
> -if [[ -d $sm_path ]]; then
> -   echo 'Removing SM'
> -   rm -rf $sm_path
> +if [[ -d $stratos_path ]]; then
> +   echo 'Removing Stratos'
> +   rm -rf $stratos_path/*
>  fi
>
>  echo 'Removing logs'
>
>
> http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7e4b3aee/tools/stratos-installer/conf/setup.conf
> ----------------------------------------------------------------------
> diff --git a/tools/stratos-installer/conf/setup.conf
> b/tools/stratos-installer/conf/setup.conf
> index 10b4163..2abcb3e 100644
> --- a/tools/stratos-installer/conf/setup.conf
> +++ b/tools/stratos-installer/conf/setup.conf
> @@ -24,8 +24,7 @@
>  #
> ----------------------------------------------------------------------------
>  #
>  #  Configure below parameters to install Apache Stratos using ../setup.sh.
> -#  General configuration parameters are mandatory and other sections are
> optional. Configure each section on each node where
> -#  Stratos product is installed.
> +#  General configuration parameters are mandatory and other sections are
> optional.
>  #
>  #
> ----------------------------------------------------------------------------
>
> @@ -34,7 +33,7 @@
>  # General configuration
>  #
> ----------------------------------------------------------------------------
>  export setup_path= #Folder path containing stratos_setup
> -export stratos_pack_path= #Folder path containing stratos packages
> +export stratos_packs= #Folder path containing stratos package and other
> third party packs and jars
>  export stratos_path= #Folder which stratos will be installed
>
>  export JAVA_HOME= #Java home path
> @@ -45,62 +44,25 @@ export host_user="" #A host user account for the
> machine which run Stratos compo
>
>  export stratos_domain="stratos.apache.org"
>
> -export mb_ip="mb-ip"   # Machine ip on which mb run
> -export cep_ip="cep-ip" # Machine ip on which cep run
> -export cc_ip="cc-ip"   # Machine ip on which cc run
> -export as_ip="as-ip"   # Machine ip on which auto scalar run
> -export sm_ip="sc-ip"   # Machine ip on which sc run
> -export puppet_ip="puppet-ip"   # Machine ip on which puppet master run
> +export host_ip="127.0.0.1" # Machine ip on host machine
> +export offset=0
> +
> +export puppet_ip="127.0.0.1"   # Machine ip on which puppet master run
>  export puppet_hostname="puppet-hostname" # Host name given to identify
> the puppet master
>  export puppet_environment="puppet_environment" # Name of puppet
> environment
>
> -export cc_port_offset=1
> -export sm_port_offset=2
> -export as_port_offset=3
> -export cep_port_offset=4
> -export mb_port_offset=5
> -
> -export mb_port=5672 #default port which the message broker service runs
> +export mb_ip="127.0.0.1" # Machine ip on which mb run
> +export mb_port=61616 #default port which the message broker service runs
> +
> +export stratos_extract_path=$stratos_path/"apache-stratos"
> +export stratos_pack_zip=$stratos_packs/"apache-stratos-4.0.0-SNAPSHOT.zip"
>
> -export mb_hostname="mb.$stratos_domain"
> -export cep_hostname="cep.$stratos_domain"
> -export sm_hostname="$stratos_domain"
> -export cc_hostname="cc.$stratos_domain"
> -export as_hostname="as.$stratos_domain"
> +export activemq_pack=$stratos_packs/"apache-activemq-5.8.0-bin.tar.gz"
> +export activemq_path=$stratos_path/"apache-activemq-5.8.0"
>
>  export resource_path=$setup_path/resources
>
>
> -#
> ----------------------------------------------------------------------------
> -# MB configuration
> -#
> ----------------------------------------------------------------------------
> -export mb_path=$stratos_path/"wso2mb-2.1.0"
> -export mb_pack_path=$stratos_pack_path/"wso2mb-2.1.0.zip"
> -
> -
> -#
> ----------------------------------------------------------------------------
> -# CEP configuration
> -#
> ----------------------------------------------------------------------------
> -export cep_artifacts_path= #Folder path containing cep artifacts files
> -export
> cep_extension_jar=$stratos_pack_path/"org.apache.stratos.cep.extension-1.0.0-SNAPSHOT.jar"
> # cep extensions jar file name
> -export andes_client_jar=$stratos_pack_path/"andes-client-0.13.wso2v8.jar"
> # andes client jar file name
> -
> -export cep_path=$stratos_path/"wso2cep-3.0.0"
> -export cep_pack_path=$stratos_pack_path/"wso2cep-3.0.0.zip"
> -
> -export cep_mb_ip=$mb_ip
> -export cep_mb_listen_port=$(($mb_port + $mb_port_offset))
> -
> -
> -#
> ----------------------------------------------------------------------------
> -# CC configuration
> -#
> ----------------------------------------------------------------------------
> -export cc_path=$stratos_path/"apache-stratos-cc-4.0.0-SNAPSHOT"
> -export
> cc_pack_path=$stratos_pack_path/"apache-stratos-cc-4.0.0-SNAPSHOT.zip"
> -
> -export cc_mb_listen_port=$(($mb_port + $mb_port_offset))
> -export cc_https_port=$((9443 + $cc_port_offset))
> -
>  # IaaS Providers
>  #
> ----------------------------------------------------------------------------
>  # Set <iaas-name>_provider_enabled parameter to true to enable desired
> IaaS. A hybrid cloud could be
> @@ -121,7 +83,7 @@ export openstack_identity="stratos:stratos" # Openstack
> project name:Openstack l
>  export openstack_credential="password" # Openstack login password
>  export openstack_jclouds_endpoint="http://hostname:5000/v2.0"
>  export openstack_keypair_name=""
> -export openstack_security_groups="security-groups"
> +export openstack_security_groups=""
>
>  # vCloud
>  export vcloud_provider_enabled=false
> @@ -129,36 +91,13 @@ export vcloud_identity="stratos" # vCloud login user
>  export vcloud_credential="password" # vCloud login password
>  export vcloud_jclouds_endpoint="https://vcloud/api"
>
> -#
> ----------------------------------------------------------------------------
> -# Auto Scalar configuration
> -#
> ----------------------------------------------------------------------------
> -export as_path=$stratos_path/"apache-stratos-autoscaler-4.0.0-SNAPSHOT"
> -export
> as_pack_path=$stratos_pack_path/"apache-stratos-autoscaler-4.0.0-SNAPSHOT.zip"
>
> -export as_mb_listen_port=$(($mb_port + $mb_port_offset))
> -export as_cc_https_port=$((9443 + $cc_port_offset))
> -export as_sm_https_port=$((9443 + $sm_port_offset))
> -
> -
> -#
> ----------------------------------------------------------------------------
> -# SM configuration
> +# Database configuration
>  #
> ----------------------------------------------------------------------------
> -export sm_path=$stratos_path/"apache-stratos-manager-4.0.0-SNAPSHOT"
> -export
> sm_pack_path=$stratos_pack_path/"apache-stratos-manager-4.0.0-SNAPSHOT.zip"
> -export
> mysql_connector_jar=$stratos_pack_path/"mysql-connector-java-5.1.25.jar"
> #mysql connector jar file name
> +export
> mysql_connector_jar=$stratos_packs/"mysql-connector-java-5.1.29-bin.jar"
> #mysql connector jar file name
>
>  export userstore_db_hostname="localhost"
>  export userstore_db_schema="userstore"
>  export userstore_db_port="3306"
>  export userstore_db_user="root"
> -export userstore_db_pass="mysql"
> -
> -export sm_puppet_ip=$puppet_ip
> -export sm_puppet_hostname=$puppet_hostname
> -export sm_puppet_environment=$puppet_environment
> -export sm_mb_listen_port=$(($mb_port + $mb_port_offset))
> -export sm_cc_https_port=$((9443 + $cc_port_offset))
> -export sm_as_https_port=$((9443 + $as_port_offset))
> -export sm_https_port=$((9443 + $sm_port_offset))
> -export sm_http_port=$((9763 + $sm_port_offset))
> -
> +export userstore_db_pass="root"
>
>
> http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7e4b3aee/tools/stratos-installer/conf/stratos-setup.conf
> ----------------------------------------------------------------------
> diff --git a/tools/stratos-installer/conf/stratos-setup.conf
> b/tools/stratos-installer/conf/stratos-setup.conf
> deleted file mode 100644
> index 2abcb3e..0000000
> --- a/tools/stratos-installer/conf/stratos-setup.conf
> +++ /dev/null
> @@ -1,103 +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.
> -#
> -#
> ----------------------------------------------------------------------------
> -#
> -#  Server configuration script for Apache Stratos
> -#
> ----------------------------------------------------------------------------
> -#
> -#  Configure below parameters to install Apache Stratos using ../setup.sh.
> -#  General configuration parameters are mandatory and other sections are
> optional.
> -#
> -#
> ----------------------------------------------------------------------------
> -
> -
> -#
> ----------------------------------------------------------------------------
> -# General configuration
> -#
> ----------------------------------------------------------------------------
> -export setup_path= #Folder path containing stratos_setup
> -export stratos_packs= #Folder path containing stratos package and other
> third party packs and jars
> -export stratos_path= #Folder which stratos will be installed
> -
> -export JAVA_HOME= #Java home path
> -
> -export log_path=/var/log/apache-stratos
> -
> -export host_user="" #A host user account for the machine which run
> Stratos component(s)
> -
> -export stratos_domain="stratos.apache.org"
> -
> -export host_ip="127.0.0.1" # Machine ip on host machine
> -export offset=0
> -
> -export puppet_ip="127.0.0.1"   # Machine ip on which puppet master run
> -export puppet_hostname="puppet-hostname" # Host name given to identify
> the puppet master
> -export puppet_environment="puppet_environment" # Name of puppet
> environment
> -
> -export mb_ip="127.0.0.1" # Machine ip on which mb run
> -export mb_port=61616 #default port which the message broker service runs
> -
> -export stratos_extract_path=$stratos_path/"apache-stratos"
> -export stratos_pack_zip=$stratos_packs/"apache-stratos-4.0.0-SNAPSHOT.zip"
> -
> -export activemq_pack=$stratos_packs/"apache-activemq-5.8.0-bin.tar.gz"
> -export activemq_path=$stratos_path/"apache-activemq-5.8.0"
> -
> -export resource_path=$setup_path/resources
> -
> -
> -# IaaS Providers
> -#
> ----------------------------------------------------------------------------
> -# Set <iaas-name>_provider_enabled parameter to true to enable desired
> IaaS. A hybrid cloud could be
> -# created using multiple IaaSs.
> -
> -# EC2
> -export ec2_provider_enabled=true
> -export ec2_identity="<ec2_identity>"
> -export ec2_credential="<ec2_credential>"
> -export ec2_keypair_name="<ec2_keypair_name>"
> -export ec2_owner_id="<ec2_owner_id>"
> -export ec2_availability_zone="<ec2_availability_zone>"
> -export ec2_security_groups="<ec2_security_groups>"
> -
> -# Openstack
> -export openstack_provider_enabled=false
> -export openstack_identity="stratos:stratos" # Openstack project
> name:Openstack login user
> -export openstack_credential="password" # Openstack login password
> -export openstack_jclouds_endpoint="http://hostname:5000/v2.0"
> -export openstack_keypair_name=""
> -export openstack_security_groups=""
> -
> -# vCloud
> -export vcloud_provider_enabled=false
> -export vcloud_identity="stratos" # vCloud login user
> -export vcloud_credential="password" # vCloud login password
> -export vcloud_jclouds_endpoint="https://vcloud/api"
> -
> -
> -# Database configuration
> -#
> ----------------------------------------------------------------------------
> -export
> mysql_connector_jar=$stratos_packs/"mysql-connector-java-5.1.29-bin.jar"
> #mysql connector jar file name
> -
> -export userstore_db_hostname="localhost"
> -export userstore_db_schema="userstore"
> -export userstore_db_port="3306"
> -export userstore_db_user="root"
> -export userstore_db_pass="root"
>
>
> http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7e4b3aee/tools/stratos-installer/ec2.sh
> ----------------------------------------------------------------------
> diff --git a/tools/stratos-installer/ec2.sh
> b/tools/stratos-installer/ec2.sh
> index 12aae8e..21d47a3 100755
> --- a/tools/stratos-installer/ec2.sh
> +++ b/tools/stratos-installer/ec2.sh
> @@ -35,45 +35,22 @@ if [[ ! -d $log_path ]]; then
>      mkdir -p $log_path
>  fi
>
> -pushd $cc_path
> +pushd $stratos_extract_path
>
>  echo "Set EC2 provider specific info in
> repository/conf/cloud-controller.xml" >> $LOG
>
> -cp -f repository/conf/cloud-controller.xml
> repository/conf/cloud-controller.xml.orig
> -cat repository/conf/cloud-controller.xml.orig | sed -e
> "s@EC2_PROVIDER_START@@g" > repository/conf/cloud-controller.xml
> -
> -cp -f repository/conf/cloud-controller.xml
> repository/conf/cloud-controller.xml.orig
> -cat repository/conf/cloud-controller.xml.orig | sed -e "s@EC2_IDENTITY
> @$ec2_identity@g" > repository/conf/cloud-controller.xml
> -
> -cp -f repository/conf/cloud-controller.xml
> repository/conf/cloud-controller.xml.orig
> -cat repository/conf/cloud-controller.xml.orig | sed -e "s@EC2_CREDENTIAL
> @$ec2_credential@g" > repository/conf/cloud-controller.xml
> -
> -cp -f repository/conf/cloud-controller.xml
> repository/conf/cloud-controller.xml.orig
> -cat repository/conf/cloud-controller.xml.orig | sed -e "s@EC2_OWNER_ID
> @$ec2_owner_id@g" > repository/conf/cloud-controller.xml
> -
> -cp -f repository/conf/cloud-controller.xml
> repository/conf/cloud-controller.xml.orig
> -cat repository/conf/cloud-controller.xml.orig | sed -e
> "s@EC2_AVAILABILITY_ZONE@$ec2_availability_zone@g" >
> repository/conf/cloud-controller.xml
> -
> -cp -f repository/conf/cloud-controller.xml
> repository/conf/cloud-controller.xml.orig
> -cat repository/conf/cloud-controller.xml.orig | sed -e
> "s@EC2_SECURITY_GROUPS@$ec2_security_groups@g" >
> repository/conf/cloud-controller.xml
> -
> -cp -f repository/conf/cloud-controller.xml
> repository/conf/cloud-controller.xml.orig
> -cat repository/conf/cloud-controller.xml.orig | sed -e "s@EC2_KEYPAIR
> @$ec2_keypair_name@g" > repository/conf/cloud-controller.xml
> -
> -cp -f repository/conf/cloud-controller.xml
> repository/conf/cloud-controller.xml.orig
> -cat repository/conf/cloud-controller.xml.orig | sed -e "s@EC2_PROVIDER_END@@g"
> > repository/conf/cloud-controller.xml
> -
> -cp -f repository/conf/cloud-controller.xml
> repository/conf/cloud-controller.xml.orig
> -cat repository/conf/cloud-controller.xml.orig | sed -e
> "s@OPENSTACK_PROVIDER_START@!--@g" > repository/conf/cloud-controller.xml
> -
> -cp -f repository/conf/cloud-controller.xml
> repository/conf/cloud-controller.xml.orig
> -cat repository/conf/cloud-controller.xml.orig | sed -e
> "s@OPENSTACK_PROVIDER_END@--@g" > repository/conf/cloud-controller.xml
> -
> -cp -f repository/conf/cloud-controller.xml
> repository/conf/cloud-controller.xml.orig
> -cat repository/conf/cloud-controller.xml.orig | sed -e
> "s@VCLOUD_PROVIDER_START@!--@g" > repository/conf/cloud-controller.xml
> -
> -cp -f repository/conf/cloud-controller.xml
> repository/conf/cloud-controller.xml.orig
> -cat repository/conf/cloud-controller.xml.orig | sed -e
> "s@VCLOUD_PROVIDER_END@--@g" > repository/conf/cloud-controller.xml
> +sed -i "s@EC2_PROVIDER_START@@g"  repository/conf/cloud-controller.xml
> +sed -i "s@EC2_IDENTITY@$ec2_identity@g"
> repository/conf/cloud-controller.xml
> +sed -i "s@EC2_CREDENTIAL@$ec2_credential@g"
> repository/conf/cloud-controller.xml
> +sed -i "s@EC2_OWNER_ID@$ec2_owner_id@g"
> repository/conf/cloud-controller.xml
> +sed -i "s@EC2_AVAILABILITY_ZONE@$ec2_availability_zone@g"
> repository/conf/cloud-controller.xml
> +sed -i "s@EC2_SECURITY_GROUPS@$ec2_security_groups@g"
> repository/conf/cloud-controller.xml
> +sed -i "s@EC2_KEYPAIR@$ec2_keypair_name@g"
> repository/conf/cloud-controller.xml
> +sed -i "s@EC2_PROVIDER_END@@g" repository/conf/cloud-controller.xml
> +sed -i "s@OPENSTACK_PROVIDER_START@!--@g"
> repository/conf/cloud-controller.xml
> +sed -i "s@OPENSTACK_PROVIDER_END@--@g"
> repository/conf/cloud-controller.xml
> +sed -i "s@VCLOUD_PROVIDER_START@!--@g"
> repository/conf/cloud-controller.xml
> +sed -i "s@VCLOUD_PROVIDER_END@--@g" repository/conf/cloud-controller.xml
>
>  popd
>
>
>
> http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7e4b3aee/tools/stratos-installer/openstack.sh
> ----------------------------------------------------------------------
> diff --git a/tools/stratos-installer/openstack.sh
> b/tools/stratos-installer/openstack.sh
> index dd893da..e774468 100755
> --- a/tools/stratos-installer/openstack.sh
> +++ b/tools/stratos-installer/openstack.sh
> @@ -35,35 +35,18 @@ if [[ ! -d $log_path ]]; then
>      mkdir -p $log_path
>  fi
>
> -pushd $cc_path
> +pushd $stratos_extract_path
>
>  echo "Set OpenStack provider specific info in
> repository/conf/cloud-controller.xml" >> $LOG
>
> -cp -f repository/conf/cloud-controller.xml
> repository/conf/cloud-controller.xml.orig
> -cat repository/conf/cloud-controller.xml.orig | sed -e
> "s@OPENSTACK_PROVIDER_START@@g" > repository/conf/cloud-controller.xml
> -
> -cp -f repository/conf/cloud-controller.xml
> repository/conf/cloud-controller.xml.orig
> -cat repository/conf/cloud-controller.xml.orig | sed -e
> "s@OPENSTACK_IDENTITY@$openstack_identity@g" >
> repository/conf/cloud-controller.xml
> -
> -cp -f repository/conf/cloud-controller.xml
> repository/conf/cloud-controller.xml.orig
> -cat repository/conf/cloud-controller.xml.orig | sed -e
> "s@OPENSTACK_CREDENTIAL@$openstack_credential@g" >
> repository/conf/cloud-controller.xml
> -
> -cp -f repository/conf/cloud-controller.xml
> repository/conf/cloud-controller.xml.orig
> -cat repository/conf/cloud-controller.xml.orig | sed -e
> "s@OPENSTACK_ENDPOINT@$openstack_jclouds_endpoint@g" >
> repository/conf/cloud-controller.xml
> -
> -cp -f repository/conf/cloud-controller.xml
> repository/conf/cloud-controller.xml.orig
> -cat repository/conf/cloud-controller.xml.orig | sed -e
> "s@OPENSTACK_PROVIDER_END@@g" > repository/conf/cloud-controller.xml
> -
> -cp -f repository/conf/cloud-controller.xml
> repository/conf/cloud-controller.xml.orig
> -cat repository/conf/cloud-controller.xml.orig | sed -e
> "s@EC2_PROVIDER_START@!--@g" > repository/conf/cloud-controller.xml
> -
> -cp -f repository/conf/cloud-controller.xml
> repository/conf/cloud-controller.xml.orig
> -cat repository/conf/cloud-controller.xml.orig | sed -e "s@EC2_PROVIDER_END@--@g"
> > repository/conf/cloud-controller.xml
> -
> -cp -f repository/conf/cloud-controller.xml
> repository/conf/cloud-controller.xml.orig
> -cat repository/conf/cloud-controller.xml.orig | sed -e
> "s@VCLOUD_PROVIDER_START@!--@g" > repository/conf/cloud-controller.xml
> -
> -cp -f repository/conf/cloud-controller.xml
> repository/conf/cloud-controller.xml.orig
> -cat repository/conf/cloud-controller.xml.orig | sed -e
> "s@VCLOUD_PROVIDER_END@--@g" > repository/conf/cloud-controller.xml
> +sed -i "s@OPENSTACK_PROVIDER_START@@g"
> repository/conf/cloud-controller.xml
> +sed -i "s@OPENSTACK_IDENTITY@$openstack_identity@g"
>  repository/conf/cloud-controller.xml
> +sed -i "s@OPENSTACK_CREDENTIAL@$openstack_credential@g"
>  repository/conf/cloud-controller.xml
> +sed -i "s@OPENSTACK_ENDPOINT@$openstack_jclouds_endpoint@g"
>  repository/conf/cloud-controller.xml
> +sed -i "s@OPENSTACK_PROVIDER_END@@g"
>  repository/conf/cloud-controller.xml
> +sed -i "s@EC2_PROVIDER_START@!--@g"  repository/conf/cloud-controller.xml
> +sed -i "s@EC2_PROVIDER_END@--@g"  repository/conf/cloud-controller.xml
> +sed -i "s@VCLOUD_PROVIDER_START@!--@g"
>  repository/conf/cloud-controller.xml
> +sed -i "s@VCLOUD_PROVIDER_END@--@g"  repository/conf/cloud-controller.xml
>
>  popd
>
>
> http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7e4b3aee/tools/stratos-installer/setup.sh
> ----------------------------------------------------------------------
> diff --git a/tools/stratos-installer/setup.sh
> b/tools/stratos-installer/setup.sh
> index e15617d..589ab79 100755
> --- a/tools/stratos-installer/setup.sh
> +++ b/tools/stratos-installer/setup.sh
> @@ -26,105 +26,29 @@
>  # Die on any error:
>  set -e
>
> -SLEEP=60
> -
>  source "./conf/setup.conf"
>  export LOG=$log_path/stratos-setup.log
>
> -mb="false"
> -cc="false"
> -as="false"
> -sm="false"
> -cep="false"
> -product_list="mb;cc;cep;as;sm"
> -enable_internal_git=false
> +profile="default"
> +config_mb="true"
> +activemq_client_libs=(activemq-broker-5.8.0.jar
>  activemq-client-5.8.0.jar  geronimo-j2ee-management_1.1_spec-1.0.1.jar
>  geronimo-jms_1.1_spec-1.1.1.jar  hawtbuf-1.2.jar)
> +auto_start_servers="false"
>
>  function help {
>      echo ""
>      echo "Usage:"
> -    echo "setup.sh -u <host username> -p \"<product list>\""
> -    echo "product list : [mb, cc, as, sm, cep]"
> +    echo "setup.sh -p \"<profile>\" [-s]"
> +    echo "product list : [default, cc, as, sm]"
>      echo "Example:"
> +    echo "sudo ./setup.sh -p \"default\""
>      echo "sudo ./setup.sh -p \"cc\""
> -    echo "sudo ./setup.sh -p \"all\""
>      echo ""
> -    echo "-u: <host username> The login user of the host."
> -    echo "-p: <product list> Apache Stratos products to be installed on
> this node. Provide one or more names of the servers."
> -    echo "    The available servers are cc, as, sm or all. 'all' means
> you need to setup all servers in this machine. Default is all"
> -    echo "-g: <enable_internal_git> true|false Whether enable internal
> git repo for Stratos2. Default is false"
> +    echo "-p: <profile> Apache Stratos products to be installed on this
> node. Provide one name of a profile."
> +    echo "    The available profiles are cc, as, sm or default. 'default'
> means you need to setup all servers in this machine. Default is 'default'
> profile"
> +    echo "-s: Silent mode - Start servers after installation."
>      echo ""
>  }
>
> -while getopts u:p:g: opts
> -do
> -  case $opts in
> -    p)
> -        product_list=${OPTARG}
> -        ;;
> -    g)
> -        enable_internal_git=${OPTARG}
> -        ;;
> -    \?)
> -        help
> -        exit 1
> -        ;;
> -  esac
> -done
> -
> -
> -arr=$(echo $product_list | tr " " "\n")
> -
> -for x in $arr
> -do
> -    if [[ $x = "mb" ]]; then
> -        mb="true"
> -    fi
> -    if [[ $x = "cc" ]]; then
> -        cc="true"
> -    fi
> -    if [[ $x = "cep" ]]; then
> -        cep="true"
> -    fi
> -    if [[ $x = "as" ]]; then
> -        as="true"
> -    fi
> -    if [[ $x = "sm" ]]; then
> -        sm="true"
> -    fi
> -    if [[ $x = "all" ]]; then
> -        mb="true"
> -        cep="true"
> -        cc="true"
> -        as="true"
> -        sm="true"
> -    fi
> -done
> -
> -product_list=`echo $product_list | sed 's/^ *//g' | sed 's/ *$//g'`
> -if [[ -z $product_list || $product_list = "" ]]; then
> -    help
> -    exit 1
> -fi
> -
> -if [[ $host_user == "" ]]; then
> -    echo "user provided in conf/setup.conf is null. Please provide a user"
> -    exit 1
> -fi
> -
> -echo "user provided in conf/setup.conf is $host_user. If you want to
> provide some other user name please specify it at the prompt."
> -echo "If you want to continue with $host_user just press enter to
> continue"
> -read username
> -if [[ $username != "" ]]; then
> -    host_user=$username
> -fi
> -user=`id $host_user`
> -if [[ $? = 1 ]]; then
> -    echo "User $host_user does not exist. The system will create it."
> -    adduser --home /home/$host_user $host_user
> -fi
> -
> -export $host_user
> -
>  # Check validity of IP
>  function valid_ip()
>  {
> @@ -143,19 +67,15 @@ function valid_ip()
>      return $stat
>  }
>
> -function helpsetup {
> -    echo ""
> -    echo "Please set up the $1 related environment variables correctly in
> conf/setup.conf"
> -    echo ""
> -}
> -
> -function general_conf_validate {
> +# General functions
> +# -------------------------------------------------------------------
> +function general_conf_validate() {
>      if [[ ! -d $setup_path ]]; then
>          echo "Please specify the setup_path folder which contains stratos
> setup"
>          exit 1
>      fi
> -    if [[ ! -d $stratos_pack_path ]]; then
> -        echo "Please specify the stratos_pack_path folder which contains
> stratos packages"
> +    if [[ ! -d $stratos_packs ]]; then
> +        echo "Please specify the stratos_packs folder which contains
> stratos packages"
>          exit 1
>      fi
>      if [[ ! -d $stratos_path ]]; then
> @@ -172,72 +92,106 @@ function general_conf_validate {
>          echo "Please specify the stratos domain"
>          exit 1
>      fi
> -    if [[ (-z $mb_port_offset || -z $mb_ip || -z $mb_hostname) ]]; then
> -        echo "Please specify the ip, the port offset and the hostname of
> MB"
> +    if [[ ! -f $stratos_pack_zip ]]; then
> +        echo "Please copy the startos zip to the stratos pack folder"
>          exit 1
>      fi
> -    if !(valid_ip $mb_ip); then
> -        echo "Please provide valid ip for MB's ip"
> +    if [[ -z $mb_port ]]; then
> +        echo "Please specify the port of MB"
>          exit 1
>      fi
> -}
>
> -function andes_jar_validate {
> -    if [[ ($cep = "true" || $cc = "true" || $as = "true" || $sm = "true")
> ]]; then
> -        if [[ ! -f $andes_client_jar ]]; then
> -            echo "Please copy the andes client jar into the same folder
> as this command(stratos release pack folder) and update conf/setup.conf
> file"
> -            exit 1
> -        fi
> +    if [[ $auto_start_servers != "true" ]]; then
> +       if [[ $profile = "default" ]]; then
> +            read -p "Do you want to configure ActiveMQ [y/n]: " answer
> +            if [[ $answer = y ]] ; then
> +               mb_ip=$host_ip
> +            else
> +               echo "Provided mb_ip in conf/setup.conf will be used"
> +               config_mb="false"
> +            fi
> +       fi
>      fi
>  }
>
> -function mb_conf_validate {
> -    if [[ -z $mb_path ]]; then
> -       helpsetup MB
> -       exit 1
> -    fi
> +# Setup General
> +function general_setup() {
> +
> +    cp -f ./config/all/repository/conf/activemq/jndi.properties
> $stratos_extract_path/repository/conf/
> +
> +    pushd $stratos_extract_path
> +    echo "In repository/conf/carbon.xml"
> +    sed -i "s@<Offset>0</Offset>@<Offset>${offset}</Offset>@g"
> repository/conf/carbon.xml
> +
> +    echo "In repository/conf/jndi.properties"
> +    sed -i "s@MB_HOSTNAME:MB_LISTEN_PORT@$mb_ip:$mb_port@g"
> repository/conf/jndi.properties
> +    popd
> +
> +    for activemq_client_lib in "${activemq_client_libs[@]}"
> +    do
> +       cp -f $stratos_packs/$activemq_client_lib
> $stratos_extract_path/repository/components/lib/
> +    done
>  }
>
> -function cep_conf_validate {
> -    if [[ (-z $cep_path || -z $cep_port_offset) ]]; then
> -       helpsetup CEP
> -       exit 1
> -    fi
> -    if [[ ! -d $cep_artifacts_path ]]; then
> -        echo "Please specify the cep_artifacts_path folder which contains
> cep artifacts files"
> -        exit 1
> -    fi
> -    if [[ ! -f $cep_extension_jar ]]; then
> -        echo "Please copy the cep extension jar into the same folder as
> this command(stratos release pack folder) and update conf/setup.conf file"
> +function activemq_validate() {
> +    if [[ ! -f $activemq_pack ]]; then
> +        echo "Please copy the activemq zip to the stratos pack folder and
> update the JAR name in conf/setup.conf file"
>          exit 1
>      fi
>  }
>
> -function cc_conf_validate {
> -    if [[ (-z $cc_path || -z $cc_port_offset) ]]; then
> -       helpsetup CC
> -       exit 1
> -    fi
>
> +# CC related functions
> +# -------------------------------------------------------------------
> +function cc_related_popup() {
> +    while read -p "Please provide cloud controller ip:" cc_ip
> +    do
> +       if !(valid_ip $cc_ip); then
> +           echo "Please provide valid ips for CC"
> +       else
> +            export cc_ip
> +           break
> +       fi
> +    done
> +
> +    while read -p "Please provide cloud controller hostname:" cc_hostname
> +    do
> +       if [[ -z $cc_hostname ]]; then
> +           echo "Please specify valid hostname for CC"
> +       else
> +            export cc_hostname
> +           break
> +       fi
> +    done
> +
> +    while read -p "Please provide cloud controller port offset:"
> cc_port_offset
> +    do
> +       if [[ -z $cc_port_offset ]]; then
> +           echo "Please specify the port offset of CC"
> +       else
> +            export cc_port_offset
> +           break
> +       fi
> +    done
> +}
> +
> +function cc_conf_validate() {
>      if [[ $ec2_provider_enabled = "false" && $openstack_provider_enabled
> = "false" && $vcloud_provider_enabled = "false" ]]; then
>          echo "Please enable at least one of the IaaS providers in
> conf/setup.conf file"
>          exit 1
>      fi
> -
>      if [[ $openstack_provider_enabled = "true" ]]; then
>          if [[ ( -z $openstack_identity || -z $openstack_credential || -z
> $openstack_jclouds_endpoint ) ]]; then
>              echo "Please set openstack configuration information in
> conf/setup.conf file"
>              exit 1
>          fi
>      fi
> -
>      if [[ $ec2_provider_enabled = "true" ]]; then
>          if [[ ( -z $ec2_identity || -z $ec2_credential || -z
> $ec2_keypair_name ) ]]; then
>              echo "Please set ec2 configuration information in
> conf/setup.conf file"
>              exit 1
>          fi
>      fi
> -
>      if [[ $vcloud_provider_enabled = "true" ]]; then
>          if [[ ( -z $vcloud_identity || -z $vcloud_credential || -z
> $vcloud_jclouds_endpoint ) ]]; then
>              echo "Please set vcloud configuration information in
> conf/setup.conf file"
> @@ -246,48 +200,135 @@ function cc_conf_validate {
>      fi
>  }
>
> -function as_conf_validate {
> -    if [[ (-z $as_path || -z $as_port_offset) ]]; then
> -       helpsetup AS
> -       exit 1
> -    fi
> -    if [[ -z $cc_port_offset || -z $sm_port_offset ]]; then
> -        echo "Please specify the port offset of SM and/or CC"
> -        exit 1
> +# Setup cc
> +function cc_setup() {
> +    echo "Setup CC" >> $LOG
> +    echo "Configuring the Cloud Controller"
> +
> +    cp -f ./config/all/repository/conf/cloud-controller.xml
> $stratos_extract_path/repository/conf/
> +
> +    export cc_path=$stratos_extract_path
> +    echo "In repository/conf/cloud-controller.xml"
> +    if [[ $ec2_provider_enabled = true ]]; then
> +        ./ec2.sh
>      fi
> -    if [[ -z $sm_ip || -z $cc_ip ]]; then
> -        echo "Please specify the ips of SM and/or CC"
> -        exit 1
> -    elif !(valid_ip $sm_ip && valid_ip $cc_ip ); then
> -        echo "Please provide valid ips for SM and/or CC"
> -        exit 1
> +    if [[ $openstack_provider_enabled = true ]]; then
> +        ./openstack.sh
>      fi
> -    if [[ -z $cc_hostname || -z $sm_hostname ]]; then
> -       echo "Please specify valid hostname for SM and/or CC"
> -       exit 1
> +    if [[ $vcloud_provider_enabled = true ]]; then
> +        ./vcloud.sh
>      fi
> +
> +    pushd $stratos_extract_path
> +
> +    popd
> +    echo "End configuring the Cloud Controller"
>  }
>
> -function sm_conf_validate {
> -    if [[ (-z $sm_path || -z $sm_port_offset) ]]; then
> -       helpsetup SM
> -       exit 1
> -    fi
> -    if [[ ! -f $mysql_connector_jar ]]; then
> -        echo "Please copy the mysql connector jar to the stratos release
> pack folder and update the JAR name in conf/setup.conf file"
> -        exit 1
> -    fi
> -    if [[ -z $cc_port_offset || -z $as_port_offset ]]; then
> -        echo "Please specify the port offset of AS and/or CC"
> -        exit 1
> -    fi
> -    if [[ -z $sm_ip || -z $as_ip || -z $cc_ip ]]; then
> -        echo "Please specify the ips of SM and/or AS and/or CC"
> -        exit 1
> -    elif !(valid_ip $sm_ip && valid_ip $cc_ip && valid_ip $as_ip); then
> -        echo "Please provide valid ips for SM and/or AS and/or CC"
> -        exit 1
> +
> +# AS related functions
> +# -------------------------------------------------------------------
> +function as_related_popup() {
> +    while read -p "Please provide Auto Scalar ip:" as_ip
> +    do
> +       if !(valid_ip $as_ip); then
> +           echo "Please provide valid ips for AS"
> +       else
> +            export as_ip
> +           break
> +       fi
> +    done
> +
> +    while read -p "Please provide Auto Scala hostname:" as_hostname
> +    do
> +       if [[ -z $as_hostname ]]; then
> +           echo "Please specify valid hostname for AS"
> +       else
> +            export as_hostname
> +           break
> +       fi
> +    done
> +
> +    while read -p "Please provide Auto Scala port offset:" as_port_offset
> +    do
> +       if [[ -z $as_port_offset ]]; then
> +           echo "Please specify the port offset of AS"
> +       else
> +            export as_port_offset
> +           break
> +       fi
> +    done
> +}
> +
> +function as_conf_validate() {
> +    if [[ !($profile = "default") ]]; then
> +       cc_related_popup
> +       sm_related_popup
> +       export as_cc_https_port=$((9443 + $cc_port_offset))
> +       export as_sm_https_port=$((9443 + $sm_port_offset))
> +    else
> +        cc_hostname=$stratos_domain
> +        sm_hostname=$stratos_domain
> +       export as_cc_https_port=$((9443 + $offset))
> +       export as_sm_https_port=$((9443 + $offset))
>      fi
> +}
> +
> +# Setup AS
> +function as_setup() {
> +    echo "Setup AS" >> $LOG
> +    echo "Configuring the Auto Scalar"
> +
> +    cp -f ./config/all/repository/conf/autoscaler.xml
> $stratos_extract_path/repository/conf/
> +
> +    pushd $stratos_extract_path
> +
> +    echo "In repository/conf/autoscaler.xml"
> +    sed -i "s@CC_HOSTNAME@$cc_hostname@g" repository/conf/autoscaler.xml
> +    sed -i "s@CC_LISTEN_PORT@$as_cc_https_port@g"
> repository/conf/autoscaler.xml
> +    sed -i "s@SM_HOSTNAME@$sm_hostname@g" repository/conf/autoscaler.xml
> +    sed -i "s@SM_LISTEN_PORT@$as_sm_https_port@g"
> repository/conf/autoscaler.xml
> +
> +    popd
> +    echo "End configuring the Auto scalar"
> +}
> +
> +
> +# SM related functions
> +# -------------------------------------------------------------------
> +function sm_related_popup() {
> +    while read -p "Please provide Stratos Manager ip:" sm_ip
> +    do
> +       if !(valid_ip $sm_ip); then
> +           echo "Please provide valid ips for SM"
> +       else
> +            export sm_ip
> +           break
> +       fi
> +    done
> +
> +    while read -p "Please provide Stratos Manager hostname:" sm_hostname
> +    do
> +       if [[ -z $sm_hostname ]]; then
> +           echo "Please specify valid hostname for SM"
> +       else
> +            export sm_hostname
> +           break
> +       fi
> +    done
> +
> +    while read -p "Please provide Stratos Manager port offset:"
> sm_port_offset
> +    do
> +       if [[ -z $sm_port_offset ]]; then
> +           echo "Please specify the port offset of SM"
> +       else
> +            export sm_port_offset
> +           break
> +       fi
> +    done
> +}
> +
> +function sm_conf_validate() {
>      if [[ -z $puppet_ip ]]; then
>          echo "Please specify the ip of puppet master"
>          exit 1
> @@ -303,348 +344,219 @@ function sm_conf_validate {
>          echo "Please specify the relevant puppet environment"
>          exit 1
>      fi
> -    if [[ -z $cc_hostname || -z $as_hostname ]]; then
> -       echo "Please specify valid hostname for AS and/or CC"
> -       exit 1
> +    if [[ ! -f $mysql_connector_jar ]]; then
> +        echo "Please copy the mysql connector jar to the stratos release
> pack folder and update the JAR name in conf/setup.conf file"
> +        exit 1
>      fi
> -}
> -
>
> -general_conf_validate
> -andes_jar_validate
> -if [[ $mb = "true" ]]; then
> -    mb_conf_validate
> -fi
> -if [[ $cep = "true" ]]; then
> -    cep_conf_validate
> -fi
> -if [[ $cc = "true" ]]; then
> -    cc_conf_validate
> -fi
> -if [[ $as = "true" ]]; then
> -    as_conf_validate
> -fi
> -if [[ $sm = "true" ]]; then
> -    sm_conf_validate
> -fi
> -
> -
> -# Make sure the user is running as root.
> -if [ "$UID" -ne "0" ]; then
> -       echo ; echo "  You must be root to run $0.  (Try running 'sudo
> bash' first.)" ; echo
> -       exit 69
> -fi
> +    if [[ !($profile = "default") ]]; then
> +       cc_related_popup
> +       as_related_popup
> +       export sm_cc_https_port=$((9443 + $cc_port_offset))
> +       export sm_as_https_port=$((9443 + $as_port_offset))
> +    else
> +        export cc_hostname=$stratos_domain
> +        export as_hostname=$stratos_domain
> +       export sm_cc_https_port=$((9443 + $offset))
> +       export sm_as_https_port=$((9443 + $offset))
> +    fi
> +    export sm_https_port=$((9443 + $offset))
> +}
>
> -if [[ ! -d $log_path ]]; then
> -    mkdir -p $log_path
> -fi
> +# Setup SM
> +function sm_setup() {
> +    echo "Setup SM" >> $LOG
> +    echo "Configuring Stratos Manager"
>
> +    cp -f ./config/all/repository/conf/cartridge-config.properties
> $stratos_extract_path/repository/conf/
> +    cp -f ./config/all/repository/conf/datasources/master-datasources.xml
> $stratos_extract_path/repository/conf/datasources/
> +    cp -f $mysql_connector_jar
> $stratos_extract_path/repository/components/lib/
>
> -echo ""
> -echo "For all the questions asked while during executing the script
> please just press the enter button"
> -echo ""
> +    pushd $stratos_extract_path
>
> -if [[ $mb = "true" ]]; then
> -    if [[ ! -d $mb_path ]]; then
> -        echo "Extracting Message Broker"
> -        unzip -q $mb_pack_path -d $stratos_path
> -    fi
> -fi
> -if [[ $cep = "true" ]]; then
> -    if [[ ! -d $cep_path ]]; then
> -        echo "Extracting Complex Event Processor"
> -        unzip -q $cep_pack_path -d $stratos_path
> -    fi
> -fi
> -if [[ $cc = "true" ]]; then
> -    if [[ ! -d $cc_path ]]; then
> -        echo "Extracting Cloud Controller"
> -        unzip -q $cc_pack_path -d $stratos_path
> -    fi
> -fi
> -if [[ $as = "true" ]]; then
> -    if [[ ! -d $as_path ]]; then
> -        echo "Extracting Autoscaler"
> -        unzip -q $as_pack_path -d $stratos_path
> -    fi
> -fi
> -if [[ $sm = "true" ]]; then
> -    if [[ ! -d $resource_path ]]; then
> -        cp -rf ./resources $stratos_path
> -    fi
> -    if [[ ! -d $sm_path ]]; then
> -        echo "Extracting Stratos Manager"
> -        unzip -q $sm_pack_path -d $stratos_path
> -    fi
> -fi
> +    echo "In repository/conf/cartridge-config.properties"
> +    sed -i "s@CC_HOSTNAME:CC_HTTPS_PORT@$cc_hostname:$sm_cc_https_port@g"
> repository/conf/cartridge-config.properties
> +    sed -i "s@AS_HOSTNAME:AS_HTTPS_PORT@$as_hostname:$sm_as_https_port@g"
> repository/conf/cartridge-config.properties
> +    sed -i "s@PUPPET_IP@$puppet_ip@g"
> repository/conf/cartridge-config.properties
> +    sed -i "s@PUPPET_HOSTNAME@$puppet_hostname@g"
> repository/conf/cartridge-config.properties
> +    sed -i "s@PUPPET_ENV@$puppet_environment@g"
> repository/conf/cartridge-config.properties
>
> +    echo "In repository/conf/datasources/master-datasources.xml"
> +    sed -i "s@USERSTORE_DB_HOSTNAME@$userstore_db_hostname@g"
> repository/conf/datasources/master-datasources.xml
> +    sed -i "s@USERSTORE_DB_PORT@$userstore_db_port@g"
> repository/conf/datasources/master-datasources.xml
> +    sed -i "s@USERSTORE_DB_SCHEMA@$userstore_db_schema@g"
> repository/conf/datasources/master-datasources.xml
> +    sed -i "s@USERSTORE_DB_USER@$userstore_db_user@g"
> repository/conf/datasources/master-datasources.xml
> +    sed -i "s@USERSTORE_DB_PASS@$userstore_db_pass@g"
> repository/conf/datasources/master-datasources.xml
>
> +    popd
>
> -# ------------------------------------------------
> -# Setup MB
> -# ------------------------------------------------
> -function mb_setup {
> -    echo "Setup MB" >> $LOG
> -    echo "Configuring the Message Broker"
> +    # Database Configuration
> +    # -----------------------------------------------
> +    echo "Create and configure MySql Databases" >> $LOG
> +    echo "Creating userstore database"
>
> -    pushd $mb_path
> +    pushd $resource_path
> +    sed -i "s@USERSTORE_DB_SCHEMA@$userstore_db_schema@g" mysql.sql
>
> -    echo "In repository/conf/carbon.xml"
> -    cp -f repository/conf/carbon.xml repository/conf/carbon.xml.orig
> -    cat repository/conf/carbon.xml.orig | sed -e "s@<Offset>0</Offset>@<Offset>${mb_port_offset}</Offset>@g"
> > repository/conf/carbon.xml
> +    popd
>
> -    echo "End configuring the Message Broker"
> -    popd #mb_path
> +    mysql -u$userstore_db_user -p$userstore_db_pass <
> $resource_path/mysql.sql
> +    echo "End configuring the SM"
>  }
>
> -if [[ $mb = "true" ]]; then
> -    mb_setup
> -fi
>
> -# ------------------------------------------------
>  # Setup CEP
> -# ------------------------------------------------
> -function cep_setup {
> +function cep_setup() {
>      echo "Setup CEP" >> $LOG
>      echo "Configuring the Complex Event Processor"
>
> -    cp -f ./config/cep/repository/conf/jndi.properties
> $cep_path/repository/conf/
> -    cp -f $cep_extension_jar $cep_path/repository/components/lib/
> -    cp -f $andes_client_jar $cep_path/repository/components/dropins/
> -    cp -f $cep_artifacts_path/eventbuilders/*.xml
> $cep_path/repository/deployment/server/eventbuilders/
> -    cp -f $cep_artifacts_path/inputeventadaptors/*.xml
> $cep_path/repository/deployment/server/inputeventadaptors/
> -    cp -f $cep_artifacts_path/outputeventadaptors/*.xml
> $cep_path/repository/deployment/server/outputeventadaptors/
> -    cp -f $cep_artifacts_path/executionplans/*.xml
> $cep_path/repository/deployment/server/executionplans/
> -    cp -f $cep_artifacts_path/eventformatters/*.xml
> $cep_path/repository/deployment/server/eventformatters/
> -    cp -f $cep_artifacts_path/streamdefinitions/*.xml
> $cep_path/repository/conf/
> -
> -    pushd $cep_path
> -
> -    echo "In repository/conf/carbon.xml"
> -    cp -f repository/conf/carbon.xml repository/conf/carbon.xml.orig
> -    cat repository/conf/carbon.xml.orig | sed -e "s@<Offset>0</Offset>@<Offset>${cep_port_offset}</Offset>@g"
> > repository/conf/carbon.xml
> -
> -    echo "In repository/conf/jndi.properties"
> -    cp -f repository/conf/jndi.properties
> repository/conf/jndi.properties.orig
> -    cat repository/conf/jndi.properties.orig | sed -e "s@MB_HOSTNAME
> :MB_LISTEN_PORT@$mb_hostname:$cep_mb_listen_port@g" >
> repository/conf/jndi.properties
> +    pushd $stratos_extract_path
>
>      echo "In outputeventadaptors"
> -    cp -f
> repository/deployment/server/outputeventadaptors/JMSOutputAdaptor.xml
> repository/deployment/server/outputeventadaptors/JMSOutputAdaptor.xml.orig
> -    cat
> repository/deployment/server/outputeventadaptors/JMSOutputAdaptor.xml.orig
> | sed -e "s@CEP_HOME@$cep_path@g" >
> repository/deployment/server/outputeventadaptors/JMSOutputAdaptor.xml
>
> -    echo "In repository/conf/siddhi/siddhi.extension"
> -    cp -f repository/conf/siddhi/siddhi.extension
> repository/conf/siddhi/siddhi.extension.orig
> -    echo "org.apache.stratos.cep.extension.GradientFinderWindowProcessor"
> >> repository/conf/siddhi/siddhi.extension.orig
> -    echo
> "org.apache.stratos.cep.extension.SecondDerivativeFinderWindowProcessor" >>
> repository/conf/siddhi/siddhi.extension.orig
> -    echo "org.apache.stratos.cep.extension.FaultHandlingWindowProcessor"
> >> repository/conf/siddhi/siddhi.extension.orig
> -    mv -f repository/conf/siddhi/siddhi.extension.orig
> repository/conf/siddhi/siddhi.extension
> +    sed -i "s@CEP_HOME@$stratos_extract_path@g"
> repository/deployment/server/outputeventadaptors/JMSOutputAdaptor.xml
> +    sed -i "s@MB_HOSTNAME:MB_LISTEN_PORT@$mb_ip:$mb_port@g"
> repository/deployment/server/outputeventadaptors/JMSOutputAdaptor.xml
>
>      echo "End configuring the Complex Event Processor"
> -    popd #cep_path
> +    popd
>  }
> -if [[ $cep = "true" ]]; then
> -    cep_setup
> -fi
>
>
>  # ------------------------------------------------
> -# Setup CC
> +# Execution
>  # ------------------------------------------------
> -function cc_setup {
> -    echo "Setup CC" >> $LOG
> -    echo "Configuring the Cloud Controller"
> -
> -    echo "Creating payload directory ... " >> $LOG
> -    if [[ ! -d $cc_path/repository/resources/payload ]]; then
> -        mkdir -p $cc_path/repository/resources/payload
> -    fi
> -
> -    cp -f ./config/cc/repository/conf/cloud-controller.xml
> $cc_path/repository/conf/
> -    cp -f ./config/cc/repository/conf/carbon.xml $cc_path/repository/conf/
> -    cp -f ./config/cc/repository/conf/jndi.properties
> $cc_path/repository/conf/
> -    cp -f $andes_client_jar $cc_path/repository/components/dropins/
> -
> -    echo "In repository/conf/cloud-controller.xml"
> -    if [[ $ec2_provider_enabled = true ]]; then
> -        ./ec2.sh
> -    fi
> -    if [[ $openstack_provider_enabled = true ]]; then
> -        ./openstack.sh
> -    fi
> -    if [[ $vcloud_provider_enabled = true ]]; then
> -        ./vcloud.sh
> -    fi
> -
> -    pushd $cc_path
> -
> -    cp -f repository/conf/cloud-controller.xml
> repository/conf/cloud-controller.xml.orig
> -    cat repository/conf/cloud-controller.xml.orig | sed -e "s@MB_HOSTNAME
> :MB_LISTEN_PORT@$mb_hostname:$cc_mb_listen_port@g" >
> repository/conf/cloud-controller.xml
>
> -    echo "In repository/conf/carbon.xml"
> -    cp -f repository/conf/carbon.xml repository/conf/carbon.xml.orig
> -    cat repository/conf/carbon.xml.orig | sed -e "s@CC_PORT_OFFSET
> @$cc_port_offset@g" > repository/conf/carbon.xml
> -
> -    echo "In repository/conf/jndi.properties"
> -    cp -f repository/conf/jndi.properties
> repository/conf/jndi.properties.orig
> -    cat repository/conf/jndi.properties.orig | sed -e "s@MB_HOSTNAME
> :MB_LISTEN_PORT@$mb_hostname:$cc_mb_listen_port@g" >
> repository/conf/jndi.properties
> -
> -    popd #cc_path
> -    echo "End configuring the Cloud Controller"
> -}
> +while getopts p:s opts
> +do
> +  case $opts in
> +    p)
> +        profile_list=${OPTARG}
> +        ;;
> +    s)
> +        auto_start_servers="true"
> +        ;;
> +    \?)
> +        help
> +        exit 1
> +        ;;
> +  esac
> +done
>
> -if [[ $cc = "true" ]]; then
> -   cc_setup
> +profile_list=`echo $profile_list | sed 's/^ *//g' | sed 's/ *$//g'`
> +if [[ !(-z $profile_list || $profile_list = "") ]]; then
> +    arr=$(echo $profile_list | tr " " "\n")
> +echo $arr
> +    for x in $arr
> +    do
> +       if [[ $x = "default" ]]; then
> +            profile="default"
> +       elif [[ $x = "cc" ]]; then
> +            profile="cc"
> +        elif [[ $x = "as" ]]; then
> +            profile="as"
> +        elif [[ $x = "sm" ]]; then
> +            profile="sm"
> +        else
> +            echo "Invalid profile."
> +            exit 1
> +       fi
> +    done
> +    echo "You have selected the profile : $profile"
> +else
> +    echo "You have not provided a profile : default profile will be
> selected."
>  fi
>
> -# ------------------------------------------------
> -# Setup AS
> -# ------------------------------------------------
> -function as_setup {
> -    echo "Setup AS" >> $LOG
> -    echo "Configuring the Auto Scalar"
> -
> -    cp -f ./config/as/repository/conf/carbon.xml $as_path/repository/conf/
> -    cp -f ./config/as/repository/conf/jndi.properties
> $as_path/repository/conf/
> -    cp -f ./config/as/repository/conf/autoscaler.xml
> $as_path/repository/conf/
> -    cp -f $andes_client_jar $as_path/repository/components/dropins/
> -
> -    pushd $as_path
> -
> -    echo "In repository/conf/carbon.xml"
> -    cp -f repository/conf/carbon.xml repository/conf/carbon.xml.orig
> -    cat repository/conf/carbon.xml.orig | sed -e "s@AS_PORT_OFFSET
> @$as_port_offset@g" > repository/conf/carbon.xml
> -
> -    echo "In repository/conf/jndi.properties"
> -    cp -f repository/conf/jndi.properties
> repository/conf/jndi.properties.orig
> -    cat repository/conf/jndi.properties.orig | sed -e "s@MB_HOSTNAME
> :MB_LISTEN_PORT@$mb_hostname:$as_mb_listen_port@g" >
> repository/conf/jndi.properties
> -
> -    echo "In repository/conf/autoscaler.xml"
> -    cp -f repository/conf/autoscaler.xml
> repository/conf/autoscaler.xml.orig
> -    cat repository/conf/autoscaler.xml.orig | sed -e "s@CC_HOSTNAME
> @$cc_hostname@g" > repository/conf/autoscaler.xml
>
> -    cp -f repository/conf/autoscaler.xml
> repository/conf/autoscaler.xml.orig
> -    cat repository/conf/autoscaler.xml.orig | sed -e "s@CC_LISTEN_PORT
> @$as_cc_https_port@g" > repository/conf/autoscaler.xml
> -
> -    cp -f repository/conf/autoscaler.xml
> repository/conf/autoscaler.xml.orig
> -    cat repository/conf/autoscaler.xml.orig | sed -e "s@SM_HOSTNAME
> @$sm_hostname@g" > repository/conf/autoscaler.xml
> -
> -    cp -f repository/conf/autoscaler.xml
> repository/conf/autoscaler.xml.orig
> -    cat repository/conf/autoscaler.xml.orig | sed -e "s@SM_LISTEN_PORT
> @$as_sm_https_port@g" > repository/conf/autoscaler.xml
> -
> -    popd #as_path
> -    echo "End configuring the Auto smalar"
> -}
> -
> -if [[ $as = "true" ]]; then
> -    as_setup
> +if [[ $host_user == "" ]]; then
> +    echo "user provided in conf/setup.conf is null. Please provide a user"
> +    exit 1
>  fi
>
> +echo "user provided in conf/setup.conf is $host_user. If you want to
> provide some other user name please specify it at the prompt."
> +echo "If you want to continue with $host_user just press enter to
> continue"
> +read username
> +if [[ $username != "" ]]; then
> +    host_user=$username
> +fi
> +user=`id $host_user`
> +if [[ $? = 1 ]]; then
> +    echo "User $host_user does not exist. The system will create it."
> +    adduser --home /home/$host_user $host_user
> +fi
>
> +export $host_user
>
> -# ------------------------------------------------
> -# Setup SM
> -# ------------------------------------------------
> -function sm_setup {
> -    echo "Setup SM" >> $LOG
> -    echo "Configuring Stratos Manager"
> -
> -    cp -f ./config/sm/repository/conf/carbon.xml $sm_path/repository/conf/
> -    cp -f ./config/sm/repository/conf/jndi.properties
> $sm_path/repository/conf/
> -    cp -f ./config/sm/repository/conf/cartridge-config.properties
> $sm_path/repository/conf/
> -    cp -f ./config/sm/repository/conf/datasources/master-datasources.xml
> $sm_path/repository/conf/datasources/
> -    cp -f $mysql_connector_jar $sm_path/repository/components/lib/
> -    cp -f $andes_client_jar $sm_path/repository/components/dropins/
> -
> -    pushd $sm_path
> -
> -    echo "In repository/conf/carbon.xml"
> -    cp -f repository/conf/carbon.xml repository/conf/carbon.xml.orig
> -    cat repository/conf/carbon.xml.orig | sed -e "s@SC_PORT_OFFSET
> @$sm_port_offset@g" > repository/conf/carbon.xml
> -
> -    echo "In repository/conf/jndi.properties"
> -    cp -f repository/conf/jndi.properties
> repository/conf/jndi.properties.orig
> -    cat repository/conf/jndi.properties.orig | sed -e "s@MB_HOSTNAME
> :MB_LISTEN_PORT@$mb_hostname:$sm_mb_listen_port@g" >
> repository/conf/jndi.properties
> -
> -    echo "In repository/conf/cartridge-config.properties" >> $LOG
> -    cp -f repository/conf/cartridge-config.properties
> repository/conf/cartridge-config.properties.orig
> -    cat repository/conf/cartridge-config.properties.orig | sed -e
> "s@CC_HOSTNAME:CC_HTTPS_PORT@$cc_hostname:$sm_cc_https_port@g" >
> repository/conf/cartridge-config.properties
> -
> -    cp -f repository/conf/cartridge-config.properties
> repository/conf/cartridge-config.properties.orig
> -    cat repository/conf/cartridge-config.properties.orig | sed -e
> "s@AS_HOSTNAME:AS_HTTPS_PORT@$as_hostname:$sm_as_https_port@g" >
> repository/conf/cartridge-config.properties
> -
> -    cp -f repository/conf/cartridge-config.properties
> repository/conf/cartridge-config.properties.orig
> -    cat repository/conf/cartridge-config.properties.orig | sed -e
> "s@PUPPET_IP@$sm_puppet_ip@g" >
> repository/conf/cartridge-config.properties
> -
> -    cp -f repository/conf/cartridge-config.properties
> repository/conf/cartridge-config.properties.orig
> -    cat repository/conf/cartridge-config.properties.orig | sed -e
> "s@PUPPET_HOSTNAME@$sm_puppet_hostname@g" >
> repository/conf/cartridge-config.properties
> -
> -    cp -f repository/conf/cartridge-config.properties
> repository/conf/cartridge-config.properties.orig
> -    cat repository/conf/cartridge-config.properties.orig | sed -e
> "s@PUPPET_ENV@$sm_puppet_environment@g" >
> repository/conf/cartridge-config.properties
> -
> -    echo "In repository/conf/datasources/master-datasources.xml" >> $LOG
> -    cp -f repository/conf/datasources/master-datasources.xml
> repository/conf/datasources/master-datasources.xml.orig
> -    cat repository/conf/datasources/master-datasources.xml.orig | sed -e
> "s@USERSTORE_DB_HOSTNAME@$userstore_db_hostname@g" >
> repository/conf/datasources/master-datasources.xml
> -
> -    cp -f repository/conf/datasources/master-datasources.xml
> repository/conf/datasources/master-datasources.xml.orig
> -    cat repository/conf/datasources/master-datasources.xml.orig | sed -e
> "s@USERSTORE_DB_PORT@$userstore_db_port@g" >
> repository/conf/datasources/master-datasources.xml
> -
> -    cp -f repository/conf/datasources/master-datasources.xml
> repository/conf/datasources/master-datasources.xml.orig
> -    cat repository/conf/datasources/master-datasources.xml.orig | sed -e
> "s@USERSTORE_DB_SCHEMA@$userstore_db_schema@g" >
> repository/conf/datasources/master-datasources.xml
> -
> -    cp -f repository/conf/datasources/master-datasources.xml
> repository/conf/datasources/master-datasources.xml.orig
> -    cat repository/conf/datasources/master-datasources.xml.orig | sed -e
> "s@USERSTORE_DB_USER@$userstore_db_user@g" >
> repository/conf/datasources/master-datasources.xml
> -
> -    cp -f repository/conf/datasources/master-datasources.xml
> repository/conf/datasources/master-datasources.xml.orig
> -    cat repository/conf/datasources/master-datasources.xml.orig | sed -e
> "s@USERSTORE_DB_PASS@$userstore_db_pass@g" >
> repository/conf/datasources/master-datasources.xml
> -
> -    popd # sm_path
> -
> +# Make sure the user is running as root.
> +if [ "$UID" -ne "0" ]; then
> +       echo ; echo "  You must be root to run $0.  (Try running 'sudo
> bash' first.)" ; echo
> +       exit 69
> +fi
>
> -    # Database Configuration
> -    # -----------------------------------------------
> -    echo "Create and configure MySql Databases" >> $LOG
> +general_conf_validate
> +if [[ $profile = "cc" ]]; then
> +    cc_conf_validate
> +elif [[ $profile = "as" ]]; then
> +    as_conf_validate
> +elif [[ $profile = "sm" ]]; then
> +    sm_conf_validate
> +else
> +    echo "In default profile CEP will be configured."
> +    activemq_validate
> +    cc_conf_validate
> +    as_conf_validate
> +    sm_conf_validate
> +fi
>
> -    echo "Creating userstore database"
> +if [[ ! -d $log_path ]]; then
> +    mkdir -p $log_path
> +fi
>
> -    pushd $resource_path
> -    cp -f mysql.sql mysql.sql.orig
> -    cat mysql.sql.orig | sed -e "s@USERSTORE_DB_SCHEMA
> @$userstore_db_schema@g" > mysql.sql
>
> -    popd # resource_path
> +echo ""
> +echo "For all the questions asked while during executing the script
> please just press the enter button"
> +echo ""
>
> -    mysql -u$userstore_db_user -p$userstore_db_pass <
> $resource_path/mysql.sql
> -
> -    #Copy
> https://svn.wso2.org/repos/wso2/scratch/hosting/build/tropos/resources/append_zone_file.shinto /opt/scripts folder
> -    if [[ ! -d $stratos_path/scripts ]]; then
> -        mkdir -p $stratos_path/scripts
> -    fi
> -    cp -f ./scripts/add_entry_zone_file.sh
> $stratos_path/scripts/add_entry_zone_file.sh
> -    cp -f ./scripts/remove_entry_zone_file.sh
> $stratos_path/scripts/remove_entry_zone_file.sh
>
> +# Extract stratos zip file
> +if [[ !(-d $stratos_extract_path) ]]; then
> +    echo "Extracting Apache Stratos"
> +    unzip -q $stratos_pack_zip -d $stratos_path
> +    mv -f $stratos_path/apache-stratos-4.0.0-SNAPSHOT
> $stratos_extract_path
> +fi
>
> -    echo "End configuring the SM"
> -}
> +if [[ ($profile = "default" && $config_mb = "true") ]]; then
> +    echo "Extracting ActiveMQ"
> +    tar -xzf $activemq_pack -C $stratos_path
> +fi
>
> -if [[ $sm = "true" ]]; then
> +general_setup
> +if [[ $profile = "cc" ]]; then
> +    cc_setup
> +elif [[ $profile = "as" ]]; then
> +    as_setup
> +elif [[ $profile = "sm" ]]; then
> +    sm_setup
> +else
> +    cc_setup
> +    as_setup
>      sm_setup
> +    cep_setup
>  fi
>
> -
>  # ------------------------------------------------
>  # Mapping domain/host names
>  # ------------------------------------------------
>
>  cp -f /etc/hosts hosts.tmp
>
> -
> -echo "$mb_ip $mb_hostname      # message broker hostname"      >>
> hosts.tmp
> -
> -if [[ $sm = "true" || $as = "true" ]]; then
> +echo "$host_ip $sm_hostname    # stratos domain"       >> hosts.tmp
> +
> +if [[ $profile = "sm" || $profile = "as" ]]; then
>      echo "$sm_ip $sm_hostname  # stratos domain"       >> hosts.tmp
>      echo "$cc_ip $cc_hostname  # cloud controller hostname"    >>
> hosts.tmp
>  fi
>
> -if [[ $sm = "true" ]]; then
> +if [[ $profile = "sm" ]]; then
>      echo "$as_ip $as_hostname  # auto scalar hostname" >> hosts.tmp
>  fi
>
> @@ -659,9 +571,11 @@ chown $host_user:$host_user $stratos_path -R
>
>  echo "Apache Stratos setup has successfully completed"
>
> -read -p "Do you want to start the servers [y/n]? " answer
> -if [[ $answer != y ]] ; then
> -   exit 1
> +if [[ $auto_start_servers != "true" ]]; then
> +    read -p "Do you want to start the servers [y/n]? " answer
> +    if [[ $answer != y ]] ; then
> +        exit 1
> +    fi
>  fi
>
>  echo "Starting the servers" >> $LOG
> @@ -672,14 +586,11 @@ chown -R $host_user.$host_user $log_path
>  chmod -R 777 $log_path
>
>  export setup_dir=$PWD
> -su - $host_user -c "source
> $setup_dir/conf/setup.conf;$setup_dir/start-servers.sh -p\"$product_list\"
> >> $LOG"
> +su - $host_user -c "source
> $setup_path/conf/setup.conf;$setup_path/start-servers.sh -p\"$profile\" >>
> $LOG"
>
>  echo "Servers started. Please look at $LOG file for server startup
> details"
> -if [[ $sm == "true" ]]; then
> +if [[ $profile == "default" || $profile == "sm" ]]; then
>      echo "**************************************************************"
>      echo "Management Console : https://
> $stratos_domain:$sm_https_port/console"
>      echo "**************************************************************"
>  fi
> -
> -
> -
>
>
> http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7e4b3aee/tools/stratos-installer/start-servers.sh
> ----------------------------------------------------------------------
> diff --git a/tools/stratos-installer/start-servers.sh
> b/tools/stratos-installer/start-servers.sh
> index c22eeea..78edf65 100755
> --- a/tools/stratos-installer/start-servers.sh
> +++ b/tools/stratos-installer/start-servers.sh
> @@ -29,18 +29,22 @@ product_list=$1
>  export LOG=$log_path/stratos.log
>  SLEEP=40
>
> +profile="default"
> +
>  if [[ -f ./conf/setup.conf ]]; then
>      source "./conf/setup.conf"
> +    echo "source it"
>  fi
>
> +
>  function help {
>      echo ""
>      echo "Give one or more of the servers to start on this machine. The
> available servers are"
> -    echo "mb, cc, as, sm, cep, all. 'all' means you need to start all
> servers."
> +    echo "cc, as, sm, default. 'default' means you need to start all
> servers."
>      echo "usage:"
> -    echo "start-servers.sh -p\"<product list>\""
> +    echo "start-servers.sh -p\"<profile>\""
>      echo "eg."
> -    echo "start-servers.sh -p\"cc sm\""
> +    echo "start-servers.sh -p\"cc\""
>      echo ""
>  }
>
> @@ -48,96 +52,45 @@ while getopts p: opts
>  do
>    case $opts in
>      p)
> -        product_list=${OPTARG}
> -        echo $product_list
> +        profile_list=${OPTARG}
>          ;;
> -    *)
> +    \?)
>          help
>          exit 1
>          ;;
>    esac
>  done
> -arr=$(echo $product_list | tr ";" "\n")
> +
> +
> +arr=$(echo $profile_list | tr " " "\n")
>
>  for x in $arr
>  do
> -    if [[ $x = "mb" ]]; then
> -        mb="true"
> -    fi
> -    if [[ $x = "cep" ]]; then
> -        cep="true"
> -    fi
>      if [[ $x = "cc" ]]; then
> -        cc="true"
> -    fi
> -    if [[ $x = "as" ]]; then
> -        as="true"
> -    fi
> -    if [[ $x = "sm" ]]; then
> -        sm="true"
> -    fi
> -    if [[ $x = "all" ]]; then
> -       mb="true"
> -        cc="true"
> -        as="true"
> -        sm="true"
> -        cep="true"
> +        profile="cc"
> +    elif [[ $x = "as" ]]; then
> +        profile="as"
> +    elif [[ $x = "sm" ]]; then
> +        profile="sm"
> +    else
> +        echo "Inavlid profile : 'default' profile will be selected."
> +        profile="default"
>      fi
>  done
> -product_list=`echo $product_list | sed 's/^ *//g' | sed 's/ *$//g'`
> -if [[ -z $product_list || $product_list = "" ]]; then
> -    help
> -    exit 1
> -fi
> -
> -if [[ $mb = "true" ]]; then
> -    echo ${mb_path}
> -
> -    echo "Starting MB server ..." >> $LOG
> -    nohup ${mb_path}/bin/wso2server.sh &
> -    echo "MB server started" >> $LOG
> -    sleep $SLEEP
> -    sleep $SLEEP
> -fi
>
> -if [[ $cep = "true" ]]; then
> -    echo ${cep_path}
> -
> -    echo "Starting CEP server ..." >> $LOG
> -    nohup ${cep_path}/bin/wso2server.sh &
> -    echo "CEP server started" >> $LOG
> -    sleep $SLEEP
> -    sleep $SLEEP
> -fi
> -
> -if [[ $cc = "true" ]]; then
> -    echo ${cc_path}
> -
> -    echo "Starting CC server ..." >> $LOG
> -    nohup ${cc_path}/bin/stratos.sh &
> -    echo "CC server started" >> $LOG
> +if [[ $profile = "default" ]]; then
> +    echo "Starting ActiveMQ server ..." >> $LOG
> +    $activemq_path/bin/activemq start
> +    echo "ActiveMQ server started" >> $LOG
>      sleep $SLEEP
>      sleep $SLEEP
>  fi
>
> -if [[ $as = "true" ]]; then
> -    echo ${as_path}
> -
> -    echo "Starting Auto Scalar server ..." >> $LOG
> -    nohup ${as_path}/bin/stratos.sh &
> -    echo "Auto Scalar server started" >> $LOG
> -    sleep $SLEEP
> -fi
> -
> -
> -if [[ $sm = "true" ]]; then
> -    echo ${sm_path}
> -
> -    echo "Starting SM server ..." >> $LOG
> -    nohup ${sm_path}/bin/stratos.sh &
> -    echo "SM server started" >> $LOG
> -    sleep $SLEEP
> -
> -fi
> +echo "Starting Stratos server ..." >> $LOG
> +echo "$stratos_extract_path/bin/stratos.sh -Dprofile=$profile start"
> +$stratos_extract_path/bin/stratos.sh -Dprofile=$profile start
> +echo "Stratos server started" >> $LOG
> +sleep $SLEEP
> +sleep $SLEEP
>
>
>
>
> http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7e4b3aee/tools/stratos-installer/stratos-clean.sh
> ----------------------------------------------------------------------
> diff --git a/tools/stratos-installer/stratos-clean.sh
> b/tools/stratos-installer/stratos-clean.sh
> deleted file mode 100755
> index 261dee7..0000000
> --- a/tools/stratos-installer/stratos-clean.sh
> +++ /dev/null
> @@ -1,104 +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 is for cleaning the host machine where one or more of the
> Stratos servers are run.
> -#
> ----------------------------------------------------------------------------
> -
> -source "./conf/stratos-setup.conf"
> -
> -if [ "$UID" -ne "0" ]; then
> -       echo ; echo "  You must be root to run $0.  (Try running 'sudo
> bash' first.)" ; echo
> -       exit 69
> -fi
> -
> -function help {
> -    echo ""
> -    echo "Clean the host machine where one or more of the Stratos2
> servers are run."
> -    echo "usage:"
> -    echo "stratos-clean.sh -u <mysql username> -p <mysql password>"
> -    echo ""
> -}
> -
> -while getopts u:p: opts
> -do
> -  case $opts in
> -    u)
> -        mysql_user=${OPTARG}
> -        ;;
> -    p)
> -        mysql_pass=${OPTARG}
> -        ;;
> -    *)
> -        help
> -        #exit 1
> -        ;;
> -  esac
> -done
> -
> -function helpclean {
> -    echo ""
> -    echo "Enter DB credentials if you need to clear Stratos DB"
> -    echo "usage:"
> -    echo "clean.sh -u <mysql username> -p <mysql password>"
> -    echo ""
> -}
> -
> -function clean_validate {
> -    if [ -z $stratos_path ]; then
> -        echo "stratos_path is not set"
> -        exit 1
> -    fi
> -    if [ -z $log_path ]; then
> -        echo "log_path is not set"
> -        exit 1
> -    fi
> -}
> -
> -clean_validate
> -if [[ ( -n $mysql_user && -n $mysql_pass ) ]]; then
> -       read -p "Please confirm that you want to remove stratos databases,
> servers and logs [y/n] " answer
> -       if [[ $answer != y ]] ; then
> -               exit 1
> -       fi
> -fi
> -echo 'Stopping all java processes'
> -killall java
> -echo 'Waiting for applications to exit'
> -sleep 15
> -
> -if [[ ( -n $mysql_user && -n $mysql_pass ) ]]; then
> -   echo 'Removing userstore database'
> -   mysql -u $mysql_user -p$mysql_pass -e "DROP DATABASE IF EXISTS
> $userstore_db_schema;"
> -fi
> -
> -if [[ -d $stratos_path/scripts ]]; then
> -   echo 'Removing scripts'
> -   rm -rf $stratos_path/scripts
> -fi
> -
> -if [[ -d $stratos_path ]]; then
> -   echo 'Removing Stratos'
> -   rm -rf $stratos_path/*
> -fi
> -
> -echo 'Removing logs'
> -rm -rf $log_path/*
>
>
> http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7e4b3aee/tools/stratos-installer/stratos-db-clean.sh
> ----------------------------------------------------------------------
> diff --git a/tools/stratos-installer/stratos-db-clean.sh
> b/tools/stratos-installer/stratos-db-clean.sh
> deleted file mode 100755
> index 74fec29..0000000
> --- a/tools/stratos-installer/stratos-db-clean.sh
> +++ /dev/null
> @@ -1,24 +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.
> -#
> -#
> -# cleans up databases
> -mysql -uroot -proot -e "DROP DATABASE IF EXISTS stratos_foundation;"
> -mysql -uroot -proot -e "DROP DATABASE IF EXISTS userstore;"
> -
>
>
> http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7e4b3aee/tools/stratos-installer/stratos-ec2.sh
> ----------------------------------------------------------------------
> diff --git a/tools/stratos-installer/stratos-ec2.sh
> b/tools/stratos-installer/stratos-ec2.sh
> deleted file mode 100755
> index 7e39a80..0000000
> --- a/tools/stratos-installer/stratos-ec2.sh
> +++ /dev/null
> @@ -1,56 +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 is invoked by setup.sh for configuring Amazon EC2 IaaS
> information.
> -#
> ----------------------------------------------------------------------------
> -
> -# Die on any error:
> -set -e
> -
> -SLEEP=60
> -export LOG=$log_path/stratos-ec2.log
> -
> -source "./conf/stratos-setup.conf"
> -
> -if [[ ! -d $log_path ]]; then
> -    mkdir -p $log_path
> -fi
> -
> -pushd $stratos_extract_path
> -
> -echo "Set EC2 provider specific info in
> repository/conf/cloud-controller.xml" >> $LOG
> -
> -sed -i "s@EC2_PROVIDER_START@@g"  repository/conf/cloud-controller.xml
> -sed -i "s@EC2_IDENTITY@$ec2_identity@g"
> repository/conf/cloud-controller.xml
> -sed -i "s@EC2_CREDENTIAL@$ec2_credential@g"
> repository/conf/cloud-controller.xml
> -sed -i "s@EC2_OWNER_ID@$ec2_owner_id@g"
> repository/conf/cloud-controller.xml
> -sed -i "s@EC2_AVAILABILITY_ZONE@$ec2_availability_zone@g"
> repository/conf/cloud-controller.xml
> -sed -i "s@EC2_SECURITY_GROUPS@$ec2_security_groups@g"
> repository/conf/cloud-controller.xml
> -sed -i "s@EC2_KEYPAIR@$ec2_keypair_name@g"
> repository/conf/cloud-controller.xml
> -sed -i "s@EC2_PROVIDER_END@@g" repository/conf/cloud-controller.xml
> -sed -i "s@OPENSTACK_PROVIDER_START@!--@g"
> repository/conf/cloud-controller.xml
> -sed -i "s@OPENSTACK_PROVIDER_END@--@g"
> repository/conf/cloud-controller.xml
> -sed -i "s@VCLOUD_PROVIDER_START@!--@g"
> repository/conf/cloud-controller.xml
> -sed -i "s@VCLOUD_PROVIDER_END@--@g" repository/conf/cloud-controller.xml
> -
> -popd
> -
>
>
> http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7e4b3aee/tools/stratos-installer/stratos-openstack.sh
> ----------------------------------------------------------------------
> diff --git a/tools/stratos-installer/stratos-openstack.sh
> b/tools/stratos-installer/stratos-openstack.sh
> deleted file mode 100755
> index 925333c..0000000
> --- a/tools/stratos-installer/stratos-openstack.sh
> +++ /dev/null
> @@ -1,52 +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 is invoked by setup.sh for configuring OpenStack IaaS
> information.
> -#
> ----------------------------------------------------------------------------
> -
> -# Die on any error:
> -set -e
> -
> -SLEEP=60
> -export LOG=$log_path/stratos-openstack.log
> -
> -source "./conf/stratos-setup.conf"
> -
> -if [[ ! -d $log_path ]]; then
> -    mkdir -p $log_path
> -fi
> -
> -pushd $stratos_extract_path
> -
> -echo "Set OpenStack provider specific info in
> repository/conf/cloud-controller.xml" >> $LOG
> -
> -sed -i "s@OPENSTACK_PROVIDER_START@@g"
> repository/conf/cloud-controller.xml
> -sed -i "s@OPENSTACK_IDENTITY@$openstack_identity@g"
>  repository/conf/cloud-controller.xml
> -sed -i "s@OPENSTACK_CREDENTIAL@$openstack_credential@g"
>  repository/conf/cloud-controller.xml
> -sed -i "s@OPENSTACK_ENDPOINT@$openstack_jclouds_endpoint@g"
>  repository/conf/cloud-controller.xml
> -sed -i "s@OPENSTACK_PROVIDER_END@@g"
>  repository/conf/cloud-controller.xml
> -sed -i "s@EC2_PROVIDER_START@!--@g"  repository/conf/cloud-controller.xml
> -sed -i "s@EC2_PROVIDER_END@--@g"  repository/conf/cloud-controller.xml
> -sed -i "s@VCLOUD_PROVIDER_START@!--@g"
>  repository/conf/cloud-controller.xml
> -sed -i "s@VCLOUD_PROVIDER_END@--@g"  repository/conf/cloud-controller.xml
> -
> -popd
>
>
>
>
> --
> Isuru Perera
> Senior Software Engineer | WSO2, Inc. | http://wso2.com/
> Lean . Enterprise . Middleware
>
> about.me/chrishantha
>

Fwd: [2/3] git commit: Stratos Installer changes to use single product

Posted by Isuru Perera <is...@wso2.com>.
Hi Devs,

I pushed the Stratos installer changes.

What I did was to 'git rm' old files and 'git mv' to rename.

Looks like the commit went as file changes. Sorry for the mistake! :-/

---------- Forwarded message ----------
From: <is...@apache.org>
Date: Fri, Apr 4, 2014 at 7:06 AM
Subject: [2/3] git commit: Stratos Installer changes to use single product
To: commits@stratos.incubator.apache.org


Stratos Installer changes to use single product


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

Branch: refs/heads/master
Commit: 7e4b3aee15be72f1fa2771c623af920a4d5e9688
Parents: 0955f29
Author: M. Isuru Tharanga Chrishantha Perera <is...@apache.org>
Authored: Thu Apr 3 17:25:36 2014 +0530
Committer: M. Isuru Tharanga Chrishantha Perera <is...@apache.org>
Committed: Thu Apr 3 17:25:36 2014 +0530

----------------------------------------------------------------------
 tools/stratos-installer/clean.sh                |  39 +-
 tools/stratos-installer/conf/setup.conf         |  95 +--
 tools/stratos-installer/conf/stratos-setup.conf | 103 ---
 tools/stratos-installer/ec2.sh                  |  49 +-
 tools/stratos-installer/openstack.sh            |  37 +-
 tools/stratos-installer/setup.sh                | 825 +++++++++----------
 tools/stratos-installer/start-servers.sh        | 107 +--
 tools/stratos-installer/stratos-clean.sh        | 104 ---
 tools/stratos-installer/stratos-db-clean.sh     |  24 -
 tools/stratos-installer/stratos-ec2.sh          |  56 --
 tools/stratos-installer/stratos-openstack.sh    |  52 --
 tools/stratos-installer/stratos-setup.sh        | 596 --------------
 .../stratos-installer/stratos-start-servers.sh  |  96 ---
 tools/stratos-installer/stratos-vcloud.sh       |  52 --
 tools/stratos-installer/vcloud.sh               |  37 +-
 15 files changed, 453 insertions(+), 1819 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7e4b3aee/tools/stratos-installer/clean.sh
----------------------------------------------------------------------
diff --git a/tools/stratos-installer/clean.sh
b/tools/stratos-installer/clean.sh
index 5692739..b74879d 100755
--- a/tools/stratos-installer/clean.sh
+++ b/tools/stratos-installer/clean.sh
@@ -63,10 +63,6 @@ function helpclean {
 }

 function clean_validate {
-#    if [[ ( -z $mysql_user || -z $mysql_pass ) ]]; then
- #       helpclean
-  #      exit 1
-   # fi
     if [ -z $stratos_path ]; then
         echo "stratos_path is not set"
         exit 1
@@ -90,13 +86,8 @@ echo 'Waiting for applications to exit'
 sleep 15

 if [[ ( -n $mysql_user && -n $mysql_pass ) ]]; then
-
-       echo 'Removing stratos_foundation database'
-       mysql -u $mysql_user -p$mysql_pass -e "DROP DATABASE IF EXISTS
stratos_foundation;"
-
-       echo 'Removing userstore database'
-       mysql -u $mysql_user -p$mysql_pass -e "DROP DATABASE IF EXISTS
userstore;"
-
+   echo 'Removing userstore database'
+   mysql -u $mysql_user -p$mysql_pass -e "DROP DATABASE IF EXISTS
$userstore_db_schema;"
 fi

 if [[ -d $stratos_path/scripts ]]; then
@@ -104,29 +95,9 @@ if [[ -d $stratos_path/scripts ]]; then
    rm -rf $stratos_path/scripts
 fi

-if [[ -d $mb_path ]]; then
-   echo 'Removing MB'
-   rm -rf $mb_path
-fi
-
-if [[ -d $cep_path ]]; then
-   echo 'Removing CEP'
-   rm -rf $cep_path
-fi
-
-if [[ -d $cc_path ]]; then
-   echo 'Removing CC'
-   rm -rf $cc_path
-fi
-
-if [[ -d $as_path ]]; then
-   echo 'Removing AS'
-   rm -rf $as_path
-fi
-
-if [[ -d $sm_path ]]; then
-   echo 'Removing SM'
-   rm -rf $sm_path
+if [[ -d $stratos_path ]]; then
+   echo 'Removing Stratos'
+   rm -rf $stratos_path/*
 fi

 echo 'Removing logs'

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7e4b3aee/tools/stratos-installer/conf/setup.conf
----------------------------------------------------------------------
diff --git a/tools/stratos-installer/conf/setup.conf
b/tools/stratos-installer/conf/setup.conf
index 10b4163..2abcb3e 100644
--- a/tools/stratos-installer/conf/setup.conf
+++ b/tools/stratos-installer/conf/setup.conf
@@ -24,8 +24,7 @@
 #
----------------------------------------------------------------------------
 #
 #  Configure below parameters to install Apache Stratos using ../setup.sh.
-#  General configuration parameters are mandatory and other sections are
optional. Configure each section on each node where
-#  Stratos product is installed.
+#  General configuration parameters are mandatory and other sections are
optional.
 #
 #
----------------------------------------------------------------------------

@@ -34,7 +33,7 @@
 # General configuration
 #
----------------------------------------------------------------------------
 export setup_path= #Folder path containing stratos_setup
-export stratos_pack_path= #Folder path containing stratos packages
+export stratos_packs= #Folder path containing stratos package and other
third party packs and jars
 export stratos_path= #Folder which stratos will be installed

 export JAVA_HOME= #Java home path
@@ -45,62 +44,25 @@ export host_user="" #A host user account for the
machine which run Stratos compo

 export stratos_domain="stratos.apache.org"

-export mb_ip="mb-ip"   # Machine ip on which mb run
-export cep_ip="cep-ip" # Machine ip on which cep run
-export cc_ip="cc-ip"   # Machine ip on which cc run
-export as_ip="as-ip"   # Machine ip on which auto scalar run
-export sm_ip="sc-ip"   # Machine ip on which sc run
-export puppet_ip="puppet-ip"   # Machine ip on which puppet master run
+export host_ip="127.0.0.1" # Machine ip on host machine
+export offset=0
+
+export puppet_ip="127.0.0.1"   # Machine ip on which puppet master run
 export puppet_hostname="puppet-hostname" # Host name given to identify the
puppet master
 export puppet_environment="puppet_environment" # Name of puppet environment

-export cc_port_offset=1
-export sm_port_offset=2
-export as_port_offset=3
-export cep_port_offset=4
-export mb_port_offset=5
-
-export mb_port=5672 #default port which the message broker service runs
+export mb_ip="127.0.0.1" # Machine ip on which mb run
+export mb_port=61616 #default port which the message broker service runs
+
+export stratos_extract_path=$stratos_path/"apache-stratos"
+export stratos_pack_zip=$stratos_packs/"apache-stratos-4.0.0-SNAPSHOT.zip"

-export mb_hostname="mb.$stratos_domain"
-export cep_hostname="cep.$stratos_domain"
-export sm_hostname="$stratos_domain"
-export cc_hostname="cc.$stratos_domain"
-export as_hostname="as.$stratos_domain"
+export activemq_pack=$stratos_packs/"apache-activemq-5.8.0-bin.tar.gz"
+export activemq_path=$stratos_path/"apache-activemq-5.8.0"

 export resource_path=$setup_path/resources


-#
----------------------------------------------------------------------------
-# MB configuration
-#
----------------------------------------------------------------------------
-export mb_path=$stratos_path/"wso2mb-2.1.0"
-export mb_pack_path=$stratos_pack_path/"wso2mb-2.1.0.zip"
-
-
-#
----------------------------------------------------------------------------
-# CEP configuration
-#
----------------------------------------------------------------------------
-export cep_artifacts_path= #Folder path containing cep artifacts files
-export
cep_extension_jar=$stratos_pack_path/"org.apache.stratos.cep.extension-1.0.0-SNAPSHOT.jar"
# cep extensions jar file name
-export andes_client_jar=$stratos_pack_path/"andes-client-0.13.wso2v8.jar"
# andes client jar file name
-
-export cep_path=$stratos_path/"wso2cep-3.0.0"
-export cep_pack_path=$stratos_pack_path/"wso2cep-3.0.0.zip"
-
-export cep_mb_ip=$mb_ip
-export cep_mb_listen_port=$(($mb_port + $mb_port_offset))
-
-
-#
----------------------------------------------------------------------------
-# CC configuration
-#
----------------------------------------------------------------------------
-export cc_path=$stratos_path/"apache-stratos-cc-4.0.0-SNAPSHOT"
-export
cc_pack_path=$stratos_pack_path/"apache-stratos-cc-4.0.0-SNAPSHOT.zip"
-
-export cc_mb_listen_port=$(($mb_port + $mb_port_offset))
-export cc_https_port=$((9443 + $cc_port_offset))
-
 # IaaS Providers
 #
----------------------------------------------------------------------------
 # Set <iaas-name>_provider_enabled parameter to true to enable desired
IaaS. A hybrid cloud could be
@@ -121,7 +83,7 @@ export openstack_identity="stratos:stratos" # Openstack
project name:Openstack l
 export openstack_credential="password" # Openstack login password
 export openstack_jclouds_endpoint="http://hostname:5000/v2.0"
 export openstack_keypair_name=""
-export openstack_security_groups="security-groups"
+export openstack_security_groups=""

 # vCloud
 export vcloud_provider_enabled=false
@@ -129,36 +91,13 @@ export vcloud_identity="stratos" # vCloud login user
 export vcloud_credential="password" # vCloud login password
 export vcloud_jclouds_endpoint="https://vcloud/api"

-#
----------------------------------------------------------------------------
-# Auto Scalar configuration
-#
----------------------------------------------------------------------------
-export as_path=$stratos_path/"apache-stratos-autoscaler-4.0.0-SNAPSHOT"
-export
as_pack_path=$stratos_pack_path/"apache-stratos-autoscaler-4.0.0-SNAPSHOT.zip"

-export as_mb_listen_port=$(($mb_port + $mb_port_offset))
-export as_cc_https_port=$((9443 + $cc_port_offset))
-export as_sm_https_port=$((9443 + $sm_port_offset))
-
-
-#
----------------------------------------------------------------------------
-# SM configuration
+# Database configuration
 #
----------------------------------------------------------------------------
-export sm_path=$stratos_path/"apache-stratos-manager-4.0.0-SNAPSHOT"
-export
sm_pack_path=$stratos_pack_path/"apache-stratos-manager-4.0.0-SNAPSHOT.zip"
-export
mysql_connector_jar=$stratos_pack_path/"mysql-connector-java-5.1.25.jar"
#mysql connector jar file name
+export
mysql_connector_jar=$stratos_packs/"mysql-connector-java-5.1.29-bin.jar"
#mysql connector jar file name

 export userstore_db_hostname="localhost"
 export userstore_db_schema="userstore"
 export userstore_db_port="3306"
 export userstore_db_user="root"
-export userstore_db_pass="mysql"
-
-export sm_puppet_ip=$puppet_ip
-export sm_puppet_hostname=$puppet_hostname
-export sm_puppet_environment=$puppet_environment
-export sm_mb_listen_port=$(($mb_port + $mb_port_offset))
-export sm_cc_https_port=$((9443 + $cc_port_offset))
-export sm_as_https_port=$((9443 + $as_port_offset))
-export sm_https_port=$((9443 + $sm_port_offset))
-export sm_http_port=$((9763 + $sm_port_offset))
-
+export userstore_db_pass="root"

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7e4b3aee/tools/stratos-installer/conf/stratos-setup.conf
----------------------------------------------------------------------
diff --git a/tools/stratos-installer/conf/stratos-setup.conf
b/tools/stratos-installer/conf/stratos-setup.conf
deleted file mode 100644
index 2abcb3e..0000000
--- a/tools/stratos-installer/conf/stratos-setup.conf
+++ /dev/null
@@ -1,103 +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.
-#
-#
----------------------------------------------------------------------------
-#
-#  Server configuration script for Apache Stratos
-#
----------------------------------------------------------------------------
-#
-#  Configure below parameters to install Apache Stratos using ../setup.sh.
-#  General configuration parameters are mandatory and other sections are
optional.
-#
-#
----------------------------------------------------------------------------
-
-
-#
----------------------------------------------------------------------------
-# General configuration
-#
----------------------------------------------------------------------------
-export setup_path= #Folder path containing stratos_setup
-export stratos_packs= #Folder path containing stratos package and other
third party packs and jars
-export stratos_path= #Folder which stratos will be installed
-
-export JAVA_HOME= #Java home path
-
-export log_path=/var/log/apache-stratos
-
-export host_user="" #A host user account for the machine which run Stratos
component(s)
-
-export stratos_domain="stratos.apache.org"
-
-export host_ip="127.0.0.1" # Machine ip on host machine
-export offset=0
-
-export puppet_ip="127.0.0.1"   # Machine ip on which puppet master run
-export puppet_hostname="puppet-hostname" # Host name given to identify the
puppet master
-export puppet_environment="puppet_environment" # Name of puppet environment
-
-export mb_ip="127.0.0.1" # Machine ip on which mb run
-export mb_port=61616 #default port which the message broker service runs
-
-export stratos_extract_path=$stratos_path/"apache-stratos"
-export stratos_pack_zip=$stratos_packs/"apache-stratos-4.0.0-SNAPSHOT.zip"
-
-export activemq_pack=$stratos_packs/"apache-activemq-5.8.0-bin.tar.gz"
-export activemq_path=$stratos_path/"apache-activemq-5.8.0"
-
-export resource_path=$setup_path/resources
-
-
-# IaaS Providers
-#
----------------------------------------------------------------------------
-# Set <iaas-name>_provider_enabled parameter to true to enable desired
IaaS. A hybrid cloud could be
-# created using multiple IaaSs.
-
-# EC2
-export ec2_provider_enabled=true
-export ec2_identity="<ec2_identity>"
-export ec2_credential="<ec2_credential>"
-export ec2_keypair_name="<ec2_keypair_name>"
-export ec2_owner_id="<ec2_owner_id>"
-export ec2_availability_zone="<ec2_availability_zone>"
-export ec2_security_groups="<ec2_security_groups>"
-
-# Openstack
-export openstack_provider_enabled=false
-export openstack_identity="stratos:stratos" # Openstack project
name:Openstack login user
-export openstack_credential="password" # Openstack login password
-export openstack_jclouds_endpoint="http://hostname:5000/v2.0"
-export openstack_keypair_name=""
-export openstack_security_groups=""
-
-# vCloud
-export vcloud_provider_enabled=false
-export vcloud_identity="stratos" # vCloud login user
-export vcloud_credential="password" # vCloud login password
-export vcloud_jclouds_endpoint="https://vcloud/api"
-
-
-# Database configuration
-#
----------------------------------------------------------------------------
-export
mysql_connector_jar=$stratos_packs/"mysql-connector-java-5.1.29-bin.jar"
#mysql connector jar file name
-
-export userstore_db_hostname="localhost"
-export userstore_db_schema="userstore"
-export userstore_db_port="3306"
-export userstore_db_user="root"
-export userstore_db_pass="root"

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7e4b3aee/tools/stratos-installer/ec2.sh
----------------------------------------------------------------------
diff --git a/tools/stratos-installer/ec2.sh b/tools/stratos-installer/ec2.sh
index 12aae8e..21d47a3 100755
--- a/tools/stratos-installer/ec2.sh
+++ b/tools/stratos-installer/ec2.sh
@@ -35,45 +35,22 @@ if [[ ! -d $log_path ]]; then
     mkdir -p $log_path
 fi

-pushd $cc_path
+pushd $stratos_extract_path

 echo "Set EC2 provider specific info in
repository/conf/cloud-controller.xml" >> $LOG

-cp -f repository/conf/cloud-controller.xml
repository/conf/cloud-controller.xml.orig
-cat repository/conf/cloud-controller.xml.orig | sed -e
"s@EC2_PROVIDER_START@@g" > repository/conf/cloud-controller.xml
-
-cp -f repository/conf/cloud-controller.xml
repository/conf/cloud-controller.xml.orig
-cat repository/conf/cloud-controller.xml.orig | sed -e "s@EC2_IDENTITY
@$ec2_identity@g" > repository/conf/cloud-controller.xml
-
-cp -f repository/conf/cloud-controller.xml
repository/conf/cloud-controller.xml.orig
-cat repository/conf/cloud-controller.xml.orig | sed -e "s@EC2_CREDENTIAL
@$ec2_credential@g" > repository/conf/cloud-controller.xml
-
-cp -f repository/conf/cloud-controller.xml
repository/conf/cloud-controller.xml.orig
-cat repository/conf/cloud-controller.xml.orig | sed -e "s@EC2_OWNER_ID
@$ec2_owner_id@g" > repository/conf/cloud-controller.xml
-
-cp -f repository/conf/cloud-controller.xml
repository/conf/cloud-controller.xml.orig
-cat repository/conf/cloud-controller.xml.orig | sed -e
"s@EC2_AVAILABILITY_ZONE@$ec2_availability_zone@g" >
repository/conf/cloud-controller.xml
-
-cp -f repository/conf/cloud-controller.xml
repository/conf/cloud-controller.xml.orig
-cat repository/conf/cloud-controller.xml.orig | sed -e
"s@EC2_SECURITY_GROUPS@$ec2_security_groups@g" >
repository/conf/cloud-controller.xml
-
-cp -f repository/conf/cloud-controller.xml
repository/conf/cloud-controller.xml.orig
-cat repository/conf/cloud-controller.xml.orig | sed -e "s@EC2_KEYPAIR
@$ec2_keypair_name@g" > repository/conf/cloud-controller.xml
-
-cp -f repository/conf/cloud-controller.xml
repository/conf/cloud-controller.xml.orig
-cat repository/conf/cloud-controller.xml.orig | sed -e "s@EC2_PROVIDER_END@@g"
> repository/conf/cloud-controller.xml
-
-cp -f repository/conf/cloud-controller.xml
repository/conf/cloud-controller.xml.orig
-cat repository/conf/cloud-controller.xml.orig | sed -e
"s@OPENSTACK_PROVIDER_START@!--@g" > repository/conf/cloud-controller.xml
-
-cp -f repository/conf/cloud-controller.xml
repository/conf/cloud-controller.xml.orig
-cat repository/conf/cloud-controller.xml.orig | sed -e
"s@OPENSTACK_PROVIDER_END@--@g" > repository/conf/cloud-controller.xml
-
-cp -f repository/conf/cloud-controller.xml
repository/conf/cloud-controller.xml.orig
-cat repository/conf/cloud-controller.xml.orig | sed -e
"s@VCLOUD_PROVIDER_START@!--@g" > repository/conf/cloud-controller.xml
-
-cp -f repository/conf/cloud-controller.xml
repository/conf/cloud-controller.xml.orig
-cat repository/conf/cloud-controller.xml.orig | sed -e
"s@VCLOUD_PROVIDER_END@--@g" > repository/conf/cloud-controller.xml
+sed -i "s@EC2_PROVIDER_START@@g"  repository/conf/cloud-controller.xml
+sed -i "s@EC2_IDENTITY@$ec2_identity@g"
repository/conf/cloud-controller.xml
+sed -i "s@EC2_CREDENTIAL@$ec2_credential@g"
repository/conf/cloud-controller.xml
+sed -i "s@EC2_OWNER_ID@$ec2_owner_id@g"
repository/conf/cloud-controller.xml
+sed -i "s@EC2_AVAILABILITY_ZONE@$ec2_availability_zone@g"
repository/conf/cloud-controller.xml
+sed -i "s@EC2_SECURITY_GROUPS@$ec2_security_groups@g"
repository/conf/cloud-controller.xml
+sed -i "s@EC2_KEYPAIR@$ec2_keypair_name@g"
repository/conf/cloud-controller.xml
+sed -i "s@EC2_PROVIDER_END@@g" repository/conf/cloud-controller.xml
+sed -i "s@OPENSTACK_PROVIDER_START@!--@g"
repository/conf/cloud-controller.xml
+sed -i "s@OPENSTACK_PROVIDER_END@--@g" repository/conf/cloud-controller.xml
+sed -i "s@VCLOUD_PROVIDER_START@!--@g" repository/conf/cloud-controller.xml
+sed -i "s@VCLOUD_PROVIDER_END@--@g" repository/conf/cloud-controller.xml

 popd


http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7e4b3aee/tools/stratos-installer/openstack.sh
----------------------------------------------------------------------
diff --git a/tools/stratos-installer/openstack.sh
b/tools/stratos-installer/openstack.sh
index dd893da..e774468 100755
--- a/tools/stratos-installer/openstack.sh
+++ b/tools/stratos-installer/openstack.sh
@@ -35,35 +35,18 @@ if [[ ! -d $log_path ]]; then
     mkdir -p $log_path
 fi

-pushd $cc_path
+pushd $stratos_extract_path

 echo "Set OpenStack provider specific info in
repository/conf/cloud-controller.xml" >> $LOG

-cp -f repository/conf/cloud-controller.xml
repository/conf/cloud-controller.xml.orig
-cat repository/conf/cloud-controller.xml.orig | sed -e
"s@OPENSTACK_PROVIDER_START@@g" > repository/conf/cloud-controller.xml
-
-cp -f repository/conf/cloud-controller.xml
repository/conf/cloud-controller.xml.orig
-cat repository/conf/cloud-controller.xml.orig | sed -e
"s@OPENSTACK_IDENTITY@$openstack_identity@g" >
repository/conf/cloud-controller.xml
-
-cp -f repository/conf/cloud-controller.xml
repository/conf/cloud-controller.xml.orig
-cat repository/conf/cloud-controller.xml.orig | sed -e
"s@OPENSTACK_CREDENTIAL@$openstack_credential@g" >
repository/conf/cloud-controller.xml
-
-cp -f repository/conf/cloud-controller.xml
repository/conf/cloud-controller.xml.orig
-cat repository/conf/cloud-controller.xml.orig | sed -e
"s@OPENSTACK_ENDPOINT@$openstack_jclouds_endpoint@g" >
repository/conf/cloud-controller.xml
-
-cp -f repository/conf/cloud-controller.xml
repository/conf/cloud-controller.xml.orig
-cat repository/conf/cloud-controller.xml.orig | sed -e
"s@OPENSTACK_PROVIDER_END@@g" > repository/conf/cloud-controller.xml
-
-cp -f repository/conf/cloud-controller.xml
repository/conf/cloud-controller.xml.orig
-cat repository/conf/cloud-controller.xml.orig | sed -e
"s@EC2_PROVIDER_START@!--@g" > repository/conf/cloud-controller.xml
-
-cp -f repository/conf/cloud-controller.xml
repository/conf/cloud-controller.xml.orig
-cat repository/conf/cloud-controller.xml.orig | sed -e
"s@EC2_PROVIDER_END@--@g"
> repository/conf/cloud-controller.xml
-
-cp -f repository/conf/cloud-controller.xml
repository/conf/cloud-controller.xml.orig
-cat repository/conf/cloud-controller.xml.orig | sed -e
"s@VCLOUD_PROVIDER_START@!--@g" > repository/conf/cloud-controller.xml
-
-cp -f repository/conf/cloud-controller.xml
repository/conf/cloud-controller.xml.orig
-cat repository/conf/cloud-controller.xml.orig | sed -e
"s@VCLOUD_PROVIDER_END@--@g" > repository/conf/cloud-controller.xml
+sed -i "s@OPENSTACK_PROVIDER_START@@g" repository/conf/cloud-controller.xml
+sed -i "s@OPENSTACK_IDENTITY@$openstack_identity@g"
 repository/conf/cloud-controller.xml
+sed -i "s@OPENSTACK_CREDENTIAL@$openstack_credential@g"
 repository/conf/cloud-controller.xml
+sed -i "s@OPENSTACK_ENDPOINT@$openstack_jclouds_endpoint@g"
 repository/conf/cloud-controller.xml
+sed -i "s@OPENSTACK_PROVIDER_END@@g"  repository/conf/cloud-controller.xml
+sed -i "s@EC2_PROVIDER_START@!--@g"  repository/conf/cloud-controller.xml
+sed -i "s@EC2_PROVIDER_END@--@g"  repository/conf/cloud-controller.xml
+sed -i "s@VCLOUD_PROVIDER_START@!--@g"
 repository/conf/cloud-controller.xml
+sed -i "s@VCLOUD_PROVIDER_END@--@g"  repository/conf/cloud-controller.xml

 popd

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7e4b3aee/tools/stratos-installer/setup.sh
----------------------------------------------------------------------
diff --git a/tools/stratos-installer/setup.sh
b/tools/stratos-installer/setup.sh
index e15617d..589ab79 100755
--- a/tools/stratos-installer/setup.sh
+++ b/tools/stratos-installer/setup.sh
@@ -26,105 +26,29 @@
 # Die on any error:
 set -e

-SLEEP=60
-
 source "./conf/setup.conf"
 export LOG=$log_path/stratos-setup.log

-mb="false"
-cc="false"
-as="false"
-sm="false"
-cep="false"
-product_list="mb;cc;cep;as;sm"
-enable_internal_git=false
+profile="default"
+config_mb="true"
+activemq_client_libs=(activemq-broker-5.8.0.jar  activemq-client-5.8.0.jar
 geronimo-j2ee-management_1.1_spec-1.0.1.jar
 geronimo-jms_1.1_spec-1.1.1.jar  hawtbuf-1.2.jar)
+auto_start_servers="false"

 function help {
     echo ""
     echo "Usage:"
-    echo "setup.sh -u <host username> -p \"<product list>\""
-    echo "product list : [mb, cc, as, sm, cep]"
+    echo "setup.sh -p \"<profile>\" [-s]"
+    echo "product list : [default, cc, as, sm]"
     echo "Example:"
+    echo "sudo ./setup.sh -p \"default\""
     echo "sudo ./setup.sh -p \"cc\""
-    echo "sudo ./setup.sh -p \"all\""
     echo ""
-    echo "-u: <host username> The login user of the host."
-    echo "-p: <product list> Apache Stratos products to be installed on
this node. Provide one or more names of the servers."
-    echo "    The available servers are cc, as, sm or all. 'all' means you
need to setup all servers in this machine. Default is all"
-    echo "-g: <enable_internal_git> true|false Whether enable internal git
repo for Stratos2. Default is false"
+    echo "-p: <profile> Apache Stratos products to be installed on this
node. Provide one name of a profile."
+    echo "    The available profiles are cc, as, sm or default. 'default'
means you need to setup all servers in this machine. Default is 'default'
profile"
+    echo "-s: Silent mode - Start servers after installation."
     echo ""
 }

-while getopts u:p:g: opts
-do
-  case $opts in
-    p)
-        product_list=${OPTARG}
-        ;;
-    g)
-        enable_internal_git=${OPTARG}
-        ;;
-    \?)
-        help
-        exit 1
-        ;;
-  esac
-done
-
-
-arr=$(echo $product_list | tr " " "\n")
-
-for x in $arr
-do
-    if [[ $x = "mb" ]]; then
-        mb="true"
-    fi
-    if [[ $x = "cc" ]]; then
-        cc="true"
-    fi
-    if [[ $x = "cep" ]]; then
-        cep="true"
-    fi
-    if [[ $x = "as" ]]; then
-        as="true"
-    fi
-    if [[ $x = "sm" ]]; then
-        sm="true"
-    fi
-    if [[ $x = "all" ]]; then
-        mb="true"
-        cep="true"
-        cc="true"
-        as="true"
-        sm="true"
-    fi
-done
-
-product_list=`echo $product_list | sed 's/^ *//g' | sed 's/ *$//g'`
-if [[ -z $product_list || $product_list = "" ]]; then
-    help
-    exit 1
-fi
-
-if [[ $host_user == "" ]]; then
-    echo "user provided in conf/setup.conf is null. Please provide a user"
-    exit 1
-fi
-
-echo "user provided in conf/setup.conf is $host_user. If you want to
provide some other user name please specify it at the prompt."
-echo "If you want to continue with $host_user just press enter to continue"
-read username
-if [[ $username != "" ]]; then
-    host_user=$username
-fi
-user=`id $host_user`
-if [[ $? = 1 ]]; then
-    echo "User $host_user does not exist. The system will create it."
-    adduser --home /home/$host_user $host_user
-fi
-
-export $host_user
-
 # Check validity of IP
 function valid_ip()
 {
@@ -143,19 +67,15 @@ function valid_ip()
     return $stat
 }

-function helpsetup {
-    echo ""
-    echo "Please set up the $1 related environment variables correctly in
conf/setup.conf"
-    echo ""
-}
-
-function general_conf_validate {
+# General functions
+# -------------------------------------------------------------------
+function general_conf_validate() {
     if [[ ! -d $setup_path ]]; then
         echo "Please specify the setup_path folder which contains stratos
setup"
         exit 1
     fi
-    if [[ ! -d $stratos_pack_path ]]; then
-        echo "Please specify the stratos_pack_path folder which contains
stratos packages"
+    if [[ ! -d $stratos_packs ]]; then
+        echo "Please specify the stratos_packs folder which contains
stratos packages"
         exit 1
     fi
     if [[ ! -d $stratos_path ]]; then
@@ -172,72 +92,106 @@ function general_conf_validate {
         echo "Please specify the stratos domain"
         exit 1
     fi
-    if [[ (-z $mb_port_offset || -z $mb_ip || -z $mb_hostname) ]]; then
-        echo "Please specify the ip, the port offset and the hostname of
MB"
+    if [[ ! -f $stratos_pack_zip ]]; then
+        echo "Please copy the startos zip to the stratos pack folder"
         exit 1
     fi
-    if !(valid_ip $mb_ip); then
-        echo "Please provide valid ip for MB's ip"
+    if [[ -z $mb_port ]]; then
+        echo "Please specify the port of MB"
         exit 1
     fi
-}

-function andes_jar_validate {
-    if [[ ($cep = "true" || $cc = "true" || $as = "true" || $sm = "true")
]]; then
-        if [[ ! -f $andes_client_jar ]]; then
-            echo "Please copy the andes client jar into the same folder as
this command(stratos release pack folder) and update conf/setup.conf file"
-            exit 1
-        fi
+    if [[ $auto_start_servers != "true" ]]; then
+       if [[ $profile = "default" ]]; then
+            read -p "Do you want to configure ActiveMQ [y/n]: " answer
+            if [[ $answer = y ]] ; then
+               mb_ip=$host_ip
+            else
+               echo "Provided mb_ip in conf/setup.conf will be used"
+               config_mb="false"
+            fi
+       fi
     fi
 }

-function mb_conf_validate {
-    if [[ -z $mb_path ]]; then
-       helpsetup MB
-       exit 1
-    fi
+# Setup General
+function general_setup() {
+
+    cp -f ./config/all/repository/conf/activemq/jndi.properties
$stratos_extract_path/repository/conf/
+
+    pushd $stratos_extract_path
+    echo "In repository/conf/carbon.xml"
+    sed -i "s@<Offset>0</Offset>@<Offset>${offset}</Offset>@g"
repository/conf/carbon.xml
+
+    echo "In repository/conf/jndi.properties"
+    sed -i "s@MB_HOSTNAME:MB_LISTEN_PORT@$mb_ip:$mb_port@g"
repository/conf/jndi.properties
+    popd
+
+    for activemq_client_lib in "${activemq_client_libs[@]}"
+    do
+       cp -f $stratos_packs/$activemq_client_lib
$stratos_extract_path/repository/components/lib/
+    done
 }

-function cep_conf_validate {
-    if [[ (-z $cep_path || -z $cep_port_offset) ]]; then
-       helpsetup CEP
-       exit 1
-    fi
-    if [[ ! -d $cep_artifacts_path ]]; then
-        echo "Please specify the cep_artifacts_path folder which contains
cep artifacts files"
-        exit 1
-    fi
-    if [[ ! -f $cep_extension_jar ]]; then
-        echo "Please copy the cep extension jar into the same folder as
this command(stratos release pack folder) and update conf/setup.conf file"
+function activemq_validate() {
+    if [[ ! -f $activemq_pack ]]; then
+        echo "Please copy the activemq zip to the stratos pack folder and
update the JAR name in conf/setup.conf file"
         exit 1
     fi
 }

-function cc_conf_validate {
-    if [[ (-z $cc_path || -z $cc_port_offset) ]]; then
-       helpsetup CC
-       exit 1
-    fi

+# CC related functions
+# -------------------------------------------------------------------
+function cc_related_popup() {
+    while read -p "Please provide cloud controller ip:" cc_ip
+    do
+       if !(valid_ip $cc_ip); then
+           echo "Please provide valid ips for CC"
+       else
+            export cc_ip
+           break
+       fi
+    done
+
+    while read -p "Please provide cloud controller hostname:" cc_hostname
+    do
+       if [[ -z $cc_hostname ]]; then
+           echo "Please specify valid hostname for CC"
+       else
+            export cc_hostname
+           break
+       fi
+    done
+
+    while read -p "Please provide cloud controller port offset:"
cc_port_offset
+    do
+       if [[ -z $cc_port_offset ]]; then
+           echo "Please specify the port offset of CC"
+       else
+            export cc_port_offset
+           break
+       fi
+    done
+}
+
+function cc_conf_validate() {
     if [[ $ec2_provider_enabled = "false" && $openstack_provider_enabled =
"false" && $vcloud_provider_enabled = "false" ]]; then
         echo "Please enable at least one of the IaaS providers in
conf/setup.conf file"
         exit 1
     fi
-
     if [[ $openstack_provider_enabled = "true" ]]; then
         if [[ ( -z $openstack_identity || -z $openstack_credential || -z
$openstack_jclouds_endpoint ) ]]; then
             echo "Please set openstack configuration information in
conf/setup.conf file"
             exit 1
         fi
     fi
-
     if [[ $ec2_provider_enabled = "true" ]]; then
         if [[ ( -z $ec2_identity || -z $ec2_credential || -z
$ec2_keypair_name ) ]]; then
             echo "Please set ec2 configuration information in
conf/setup.conf file"
             exit 1
         fi
     fi
-
     if [[ $vcloud_provider_enabled = "true" ]]; then
         if [[ ( -z $vcloud_identity || -z $vcloud_credential || -z
$vcloud_jclouds_endpoint ) ]]; then
             echo "Please set vcloud configuration information in
conf/setup.conf file"
@@ -246,48 +200,135 @@ function cc_conf_validate {
     fi
 }

-function as_conf_validate {
-    if [[ (-z $as_path || -z $as_port_offset) ]]; then
-       helpsetup AS
-       exit 1
-    fi
-    if [[ -z $cc_port_offset || -z $sm_port_offset ]]; then
-        echo "Please specify the port offset of SM and/or CC"
-        exit 1
+# Setup cc
+function cc_setup() {
+    echo "Setup CC" >> $LOG
+    echo "Configuring the Cloud Controller"
+
+    cp -f ./config/all/repository/conf/cloud-controller.xml
$stratos_extract_path/repository/conf/
+
+    export cc_path=$stratos_extract_path
+    echo "In repository/conf/cloud-controller.xml"
+    if [[ $ec2_provider_enabled = true ]]; then
+        ./ec2.sh
     fi
-    if [[ -z $sm_ip || -z $cc_ip ]]; then
-        echo "Please specify the ips of SM and/or CC"
-        exit 1
-    elif !(valid_ip $sm_ip && valid_ip $cc_ip ); then
-        echo "Please provide valid ips for SM and/or CC"
-        exit 1
+    if [[ $openstack_provider_enabled = true ]]; then
+        ./openstack.sh
     fi
-    if [[ -z $cc_hostname || -z $sm_hostname ]]; then
-       echo "Please specify valid hostname for SM and/or CC"
-       exit 1
+    if [[ $vcloud_provider_enabled = true ]]; then
+        ./vcloud.sh
     fi
+
+    pushd $stratos_extract_path
+
+    popd
+    echo "End configuring the Cloud Controller"
 }

-function sm_conf_validate {
-    if [[ (-z $sm_path || -z $sm_port_offset) ]]; then
-       helpsetup SM
-       exit 1
-    fi
-    if [[ ! -f $mysql_connector_jar ]]; then
-        echo "Please copy the mysql connector jar to the stratos release
pack folder and update the JAR name in conf/setup.conf file"
-        exit 1
-    fi
-    if [[ -z $cc_port_offset || -z $as_port_offset ]]; then
-        echo "Please specify the port offset of AS and/or CC"
-        exit 1
-    fi
-    if [[ -z $sm_ip || -z $as_ip || -z $cc_ip ]]; then
-        echo "Please specify the ips of SM and/or AS and/or CC"
-        exit 1
-    elif !(valid_ip $sm_ip && valid_ip $cc_ip && valid_ip $as_ip); then
-        echo "Please provide valid ips for SM and/or AS and/or CC"
-        exit 1
+
+# AS related functions
+# -------------------------------------------------------------------
+function as_related_popup() {
+    while read -p "Please provide Auto Scalar ip:" as_ip
+    do
+       if !(valid_ip $as_ip); then
+           echo "Please provide valid ips for AS"
+       else
+            export as_ip
+           break
+       fi
+    done
+
+    while read -p "Please provide Auto Scala hostname:" as_hostname
+    do
+       if [[ -z $as_hostname ]]; then
+           echo "Please specify valid hostname for AS"
+       else
+            export as_hostname
+           break
+       fi
+    done
+
+    while read -p "Please provide Auto Scala port offset:" as_port_offset
+    do
+       if [[ -z $as_port_offset ]]; then
+           echo "Please specify the port offset of AS"
+       else
+            export as_port_offset
+           break
+       fi
+    done
+}
+
+function as_conf_validate() {
+    if [[ !($profile = "default") ]]; then
+       cc_related_popup
+       sm_related_popup
+       export as_cc_https_port=$((9443 + $cc_port_offset))
+       export as_sm_https_port=$((9443 + $sm_port_offset))
+    else
+        cc_hostname=$stratos_domain
+        sm_hostname=$stratos_domain
+       export as_cc_https_port=$((9443 + $offset))
+       export as_sm_https_port=$((9443 + $offset))
     fi
+}
+
+# Setup AS
+function as_setup() {
+    echo "Setup AS" >> $LOG
+    echo "Configuring the Auto Scalar"
+
+    cp -f ./config/all/repository/conf/autoscaler.xml
$stratos_extract_path/repository/conf/
+
+    pushd $stratos_extract_path
+
+    echo "In repository/conf/autoscaler.xml"
+    sed -i "s@CC_HOSTNAME@$cc_hostname@g" repository/conf/autoscaler.xml
+    sed -i "s@CC_LISTEN_PORT@$as_cc_https_port@g"
repository/conf/autoscaler.xml
+    sed -i "s@SM_HOSTNAME@$sm_hostname@g" repository/conf/autoscaler.xml
+    sed -i "s@SM_LISTEN_PORT@$as_sm_https_port@g"
repository/conf/autoscaler.xml
+
+    popd
+    echo "End configuring the Auto scalar"
+}
+
+
+# SM related functions
+# -------------------------------------------------------------------
+function sm_related_popup() {
+    while read -p "Please provide Stratos Manager ip:" sm_ip
+    do
+       if !(valid_ip $sm_ip); then
+           echo "Please provide valid ips for SM"
+       else
+            export sm_ip
+           break
+       fi
+    done
+
+    while read -p "Please provide Stratos Manager hostname:" sm_hostname
+    do
+       if [[ -z $sm_hostname ]]; then
+           echo "Please specify valid hostname for SM"
+       else
+            export sm_hostname
+           break
+       fi
+    done
+
+    while read -p "Please provide Stratos Manager port offset:"
sm_port_offset
+    do
+       if [[ -z $sm_port_offset ]]; then
+           echo "Please specify the port offset of SM"
+       else
+            export sm_port_offset
+           break
+       fi
+    done
+}
+
+function sm_conf_validate() {
     if [[ -z $puppet_ip ]]; then
         echo "Please specify the ip of puppet master"
         exit 1
@@ -303,348 +344,219 @@ function sm_conf_validate {
         echo "Please specify the relevant puppet environment"
         exit 1
     fi
-    if [[ -z $cc_hostname || -z $as_hostname ]]; then
-       echo "Please specify valid hostname for AS and/or CC"
-       exit 1
+    if [[ ! -f $mysql_connector_jar ]]; then
+        echo "Please copy the mysql connector jar to the stratos release
pack folder and update the JAR name in conf/setup.conf file"
+        exit 1
     fi
-}
-

-general_conf_validate
-andes_jar_validate
-if [[ $mb = "true" ]]; then
-    mb_conf_validate
-fi
-if [[ $cep = "true" ]]; then
-    cep_conf_validate
-fi
-if [[ $cc = "true" ]]; then
-    cc_conf_validate
-fi
-if [[ $as = "true" ]]; then
-    as_conf_validate
-fi
-if [[ $sm = "true" ]]; then
-    sm_conf_validate
-fi
-
-
-# Make sure the user is running as root.
-if [ "$UID" -ne "0" ]; then
-       echo ; echo "  You must be root to run $0.  (Try running 'sudo
bash' first.)" ; echo
-       exit 69
-fi
+    if [[ !($profile = "default") ]]; then
+       cc_related_popup
+       as_related_popup
+       export sm_cc_https_port=$((9443 + $cc_port_offset))
+       export sm_as_https_port=$((9443 + $as_port_offset))
+    else
+        export cc_hostname=$stratos_domain
+        export as_hostname=$stratos_domain
+       export sm_cc_https_port=$((9443 + $offset))
+       export sm_as_https_port=$((9443 + $offset))
+    fi
+    export sm_https_port=$((9443 + $offset))
+}

-if [[ ! -d $log_path ]]; then
-    mkdir -p $log_path
-fi
+# Setup SM
+function sm_setup() {
+    echo "Setup SM" >> $LOG
+    echo "Configuring Stratos Manager"

+    cp -f ./config/all/repository/conf/cartridge-config.properties
$stratos_extract_path/repository/conf/
+    cp -f ./config/all/repository/conf/datasources/master-datasources.xml
$stratos_extract_path/repository/conf/datasources/
+    cp -f $mysql_connector_jar
$stratos_extract_path/repository/components/lib/

-echo ""
-echo "For all the questions asked while during executing the script please
just press the enter button"
-echo ""
+    pushd $stratos_extract_path

-if [[ $mb = "true" ]]; then
-    if [[ ! -d $mb_path ]]; then
-        echo "Extracting Message Broker"
-        unzip -q $mb_pack_path -d $stratos_path
-    fi
-fi
-if [[ $cep = "true" ]]; then
-    if [[ ! -d $cep_path ]]; then
-        echo "Extracting Complex Event Processor"
-        unzip -q $cep_pack_path -d $stratos_path
-    fi
-fi
-if [[ $cc = "true" ]]; then
-    if [[ ! -d $cc_path ]]; then
-        echo "Extracting Cloud Controller"
-        unzip -q $cc_pack_path -d $stratos_path
-    fi
-fi
-if [[ $as = "true" ]]; then
-    if [[ ! -d $as_path ]]; then
-        echo "Extracting Autoscaler"
-        unzip -q $as_pack_path -d $stratos_path
-    fi
-fi
-if [[ $sm = "true" ]]; then
-    if [[ ! -d $resource_path ]]; then
-        cp -rf ./resources $stratos_path
-    fi
-    if [[ ! -d $sm_path ]]; then
-        echo "Extracting Stratos Manager"
-        unzip -q $sm_pack_path -d $stratos_path
-    fi
-fi
+    echo "In repository/conf/cartridge-config.properties"
+    sed -i "s@CC_HOSTNAME:CC_HTTPS_PORT@$cc_hostname:$sm_cc_https_port@g"
repository/conf/cartridge-config.properties
+    sed -i "s@AS_HOSTNAME:AS_HTTPS_PORT@$as_hostname:$sm_as_https_port@g"
repository/conf/cartridge-config.properties
+    sed -i "s@PUPPET_IP@$puppet_ip@g"
repository/conf/cartridge-config.properties
+    sed -i "s@PUPPET_HOSTNAME@$puppet_hostname@g"
repository/conf/cartridge-config.properties
+    sed -i "s@PUPPET_ENV@$puppet_environment@g"
repository/conf/cartridge-config.properties

+    echo "In repository/conf/datasources/master-datasources.xml"
+    sed -i "s@USERSTORE_DB_HOSTNAME@$userstore_db_hostname@g"
repository/conf/datasources/master-datasources.xml
+    sed -i "s@USERSTORE_DB_PORT@$userstore_db_port@g"
repository/conf/datasources/master-datasources.xml
+    sed -i "s@USERSTORE_DB_SCHEMA@$userstore_db_schema@g"
repository/conf/datasources/master-datasources.xml
+    sed -i "s@USERSTORE_DB_USER@$userstore_db_user@g"
repository/conf/datasources/master-datasources.xml
+    sed -i "s@USERSTORE_DB_PASS@$userstore_db_pass@g"
repository/conf/datasources/master-datasources.xml

+    popd

-# ------------------------------------------------
-# Setup MB
-# ------------------------------------------------
-function mb_setup {
-    echo "Setup MB" >> $LOG
-    echo "Configuring the Message Broker"
+    # Database Configuration
+    # -----------------------------------------------
+    echo "Create and configure MySql Databases" >> $LOG
+    echo "Creating userstore database"

-    pushd $mb_path
+    pushd $resource_path
+    sed -i "s@USERSTORE_DB_SCHEMA@$userstore_db_schema@g" mysql.sql

-    echo "In repository/conf/carbon.xml"
-    cp -f repository/conf/carbon.xml repository/conf/carbon.xml.orig
-    cat repository/conf/carbon.xml.orig | sed -e
"s@<Offset>0</Offset>@<Offset>${mb_port_offset}</Offset>@g"
> repository/conf/carbon.xml
+    popd

-    echo "End configuring the Message Broker"
-    popd #mb_path
+    mysql -u$userstore_db_user -p$userstore_db_pass <
$resource_path/mysql.sql
+    echo "End configuring the SM"
 }

-if [[ $mb = "true" ]]; then
-    mb_setup
-fi

-# ------------------------------------------------
 # Setup CEP
-# ------------------------------------------------
-function cep_setup {
+function cep_setup() {
     echo "Setup CEP" >> $LOG
     echo "Configuring the Complex Event Processor"

-    cp -f ./config/cep/repository/conf/jndi.properties
$cep_path/repository/conf/
-    cp -f $cep_extension_jar $cep_path/repository/components/lib/
-    cp -f $andes_client_jar $cep_path/repository/components/dropins/
-    cp -f $cep_artifacts_path/eventbuilders/*.xml
$cep_path/repository/deployment/server/eventbuilders/
-    cp -f $cep_artifacts_path/inputeventadaptors/*.xml
$cep_path/repository/deployment/server/inputeventadaptors/
-    cp -f $cep_artifacts_path/outputeventadaptors/*.xml
$cep_path/repository/deployment/server/outputeventadaptors/
-    cp -f $cep_artifacts_path/executionplans/*.xml
$cep_path/repository/deployment/server/executionplans/
-    cp -f $cep_artifacts_path/eventformatters/*.xml
$cep_path/repository/deployment/server/eventformatters/
-    cp -f $cep_artifacts_path/streamdefinitions/*.xml
$cep_path/repository/conf/
-
-    pushd $cep_path
-
-    echo "In repository/conf/carbon.xml"
-    cp -f repository/conf/carbon.xml repository/conf/carbon.xml.orig
-    cat repository/conf/carbon.xml.orig | sed -e
"s@<Offset>0</Offset>@<Offset>${cep_port_offset}</Offset>@g"
> repository/conf/carbon.xml
-
-    echo "In repository/conf/jndi.properties"
-    cp -f repository/conf/jndi.properties
repository/conf/jndi.properties.orig
-    cat repository/conf/jndi.properties.orig | sed -e "s@MB_HOSTNAME
:MB_LISTEN_PORT@$mb_hostname:$cep_mb_listen_port@g" >
repository/conf/jndi.properties
+    pushd $stratos_extract_path

     echo "In outputeventadaptors"
-    cp -f
repository/deployment/server/outputeventadaptors/JMSOutputAdaptor.xml
repository/deployment/server/outputeventadaptors/JMSOutputAdaptor.xml.orig
-    cat
repository/deployment/server/outputeventadaptors/JMSOutputAdaptor.xml.orig
| sed -e "s@CEP_HOME@$cep_path@g" >
repository/deployment/server/outputeventadaptors/JMSOutputAdaptor.xml

-    echo "In repository/conf/siddhi/siddhi.extension"
-    cp -f repository/conf/siddhi/siddhi.extension
repository/conf/siddhi/siddhi.extension.orig
-    echo "org.apache.stratos.cep.extension.GradientFinderWindowProcessor"
>> repository/conf/siddhi/siddhi.extension.orig
-    echo
"org.apache.stratos.cep.extension.SecondDerivativeFinderWindowProcessor" >>
repository/conf/siddhi/siddhi.extension.orig
-    echo "org.apache.stratos.cep.extension.FaultHandlingWindowProcessor"
>> repository/conf/siddhi/siddhi.extension.orig
-    mv -f repository/conf/siddhi/siddhi.extension.orig
repository/conf/siddhi/siddhi.extension
+    sed -i "s@CEP_HOME@$stratos_extract_path@g"
repository/deployment/server/outputeventadaptors/JMSOutputAdaptor.xml
+    sed -i "s@MB_HOSTNAME:MB_LISTEN_PORT@$mb_ip:$mb_port@g"
repository/deployment/server/outputeventadaptors/JMSOutputAdaptor.xml

     echo "End configuring the Complex Event Processor"
-    popd #cep_path
+    popd
 }
-if [[ $cep = "true" ]]; then
-    cep_setup
-fi


 # ------------------------------------------------
-# Setup CC
+# Execution
 # ------------------------------------------------
-function cc_setup {
-    echo "Setup CC" >> $LOG
-    echo "Configuring the Cloud Controller"
-
-    echo "Creating payload directory ... " >> $LOG
-    if [[ ! -d $cc_path/repository/resources/payload ]]; then
-        mkdir -p $cc_path/repository/resources/payload
-    fi
-
-    cp -f ./config/cc/repository/conf/cloud-controller.xml
$cc_path/repository/conf/
-    cp -f ./config/cc/repository/conf/carbon.xml $cc_path/repository/conf/
-    cp -f ./config/cc/repository/conf/jndi.properties
$cc_path/repository/conf/
-    cp -f $andes_client_jar $cc_path/repository/components/dropins/
-
-    echo "In repository/conf/cloud-controller.xml"
-    if [[ $ec2_provider_enabled = true ]]; then
-        ./ec2.sh
-    fi
-    if [[ $openstack_provider_enabled = true ]]; then
-        ./openstack.sh
-    fi
-    if [[ $vcloud_provider_enabled = true ]]; then
-        ./vcloud.sh
-    fi
-
-    pushd $cc_path
-
-    cp -f repository/conf/cloud-controller.xml
repository/conf/cloud-controller.xml.orig
-    cat repository/conf/cloud-controller.xml.orig | sed -e "s@MB_HOSTNAME
:MB_LISTEN_PORT@$mb_hostname:$cc_mb_listen_port@g" >
repository/conf/cloud-controller.xml

-    echo "In repository/conf/carbon.xml"
-    cp -f repository/conf/carbon.xml repository/conf/carbon.xml.orig
-    cat repository/conf/carbon.xml.orig | sed -e "s@CC_PORT_OFFSET
@$cc_port_offset@g" > repository/conf/carbon.xml
-
-    echo "In repository/conf/jndi.properties"
-    cp -f repository/conf/jndi.properties
repository/conf/jndi.properties.orig
-    cat repository/conf/jndi.properties.orig | sed -e "s@MB_HOSTNAME
:MB_LISTEN_PORT@$mb_hostname:$cc_mb_listen_port@g" >
repository/conf/jndi.properties
-
-    popd #cc_path
-    echo "End configuring the Cloud Controller"
-}
+while getopts p:s opts
+do
+  case $opts in
+    p)
+        profile_list=${OPTARG}
+        ;;
+    s)
+        auto_start_servers="true"
+        ;;
+    \?)
+        help
+        exit 1
+        ;;
+  esac
+done

-if [[ $cc = "true" ]]; then
-   cc_setup
+profile_list=`echo $profile_list | sed 's/^ *//g' | sed 's/ *$//g'`
+if [[ !(-z $profile_list || $profile_list = "") ]]; then
+    arr=$(echo $profile_list | tr " " "\n")
+echo $arr
+    for x in $arr
+    do
+       if [[ $x = "default" ]]; then
+            profile="default"
+       elif [[ $x = "cc" ]]; then
+            profile="cc"
+        elif [[ $x = "as" ]]; then
+            profile="as"
+        elif [[ $x = "sm" ]]; then
+            profile="sm"
+        else
+            echo "Invalid profile."
+            exit 1
+       fi
+    done
+    echo "You have selected the profile : $profile"
+else
+    echo "You have not provided a profile : default profile will be
selected."
 fi

-# ------------------------------------------------
-# Setup AS
-# ------------------------------------------------
-function as_setup {
-    echo "Setup AS" >> $LOG
-    echo "Configuring the Auto Scalar"
-
-    cp -f ./config/as/repository/conf/carbon.xml $as_path/repository/conf/
-    cp -f ./config/as/repository/conf/jndi.properties
$as_path/repository/conf/
-    cp -f ./config/as/repository/conf/autoscaler.xml
$as_path/repository/conf/
-    cp -f $andes_client_jar $as_path/repository/components/dropins/
-
-    pushd $as_path
-
-    echo "In repository/conf/carbon.xml"
-    cp -f repository/conf/carbon.xml repository/conf/carbon.xml.orig
-    cat repository/conf/carbon.xml.orig | sed -e "s@AS_PORT_OFFSET
@$as_port_offset@g" > repository/conf/carbon.xml
-
-    echo "In repository/conf/jndi.properties"
-    cp -f repository/conf/jndi.properties
repository/conf/jndi.properties.orig
-    cat repository/conf/jndi.properties.orig | sed -e "s@MB_HOSTNAME
:MB_LISTEN_PORT@$mb_hostname:$as_mb_listen_port@g" >
repository/conf/jndi.properties
-
-    echo "In repository/conf/autoscaler.xml"
-    cp -f repository/conf/autoscaler.xml
repository/conf/autoscaler.xml.orig
-    cat repository/conf/autoscaler.xml.orig | sed -e "s@CC_HOSTNAME
@$cc_hostname@g" > repository/conf/autoscaler.xml

-    cp -f repository/conf/autoscaler.xml
repository/conf/autoscaler.xml.orig
-    cat repository/conf/autoscaler.xml.orig | sed -e "s@CC_LISTEN_PORT
@$as_cc_https_port@g" > repository/conf/autoscaler.xml
-
-    cp -f repository/conf/autoscaler.xml
repository/conf/autoscaler.xml.orig
-    cat repository/conf/autoscaler.xml.orig | sed -e "s@SM_HOSTNAME
@$sm_hostname@g" > repository/conf/autoscaler.xml
-
-    cp -f repository/conf/autoscaler.xml
repository/conf/autoscaler.xml.orig
-    cat repository/conf/autoscaler.xml.orig | sed -e "s@SM_LISTEN_PORT
@$as_sm_https_port@g" > repository/conf/autoscaler.xml
-
-    popd #as_path
-    echo "End configuring the Auto smalar"
-}
-
-if [[ $as = "true" ]]; then
-    as_setup
+if [[ $host_user == "" ]]; then
+    echo "user provided in conf/setup.conf is null. Please provide a user"
+    exit 1
 fi

+echo "user provided in conf/setup.conf is $host_user. If you want to
provide some other user name please specify it at the prompt."
+echo "If you want to continue with $host_user just press enter to continue"
+read username
+if [[ $username != "" ]]; then
+    host_user=$username
+fi
+user=`id $host_user`
+if [[ $? = 1 ]]; then
+    echo "User $host_user does not exist. The system will create it."
+    adduser --home /home/$host_user $host_user
+fi

+export $host_user

-# ------------------------------------------------
-# Setup SM
-# ------------------------------------------------
-function sm_setup {
-    echo "Setup SM" >> $LOG
-    echo "Configuring Stratos Manager"
-
-    cp -f ./config/sm/repository/conf/carbon.xml $sm_path/repository/conf/
-    cp -f ./config/sm/repository/conf/jndi.properties
$sm_path/repository/conf/
-    cp -f ./config/sm/repository/conf/cartridge-config.properties
$sm_path/repository/conf/
-    cp -f ./config/sm/repository/conf/datasources/master-datasources.xml
$sm_path/repository/conf/datasources/
-    cp -f $mysql_connector_jar $sm_path/repository/components/lib/
-    cp -f $andes_client_jar $sm_path/repository/components/dropins/
-
-    pushd $sm_path
-
-    echo "In repository/conf/carbon.xml"
-    cp -f repository/conf/carbon.xml repository/conf/carbon.xml.orig
-    cat repository/conf/carbon.xml.orig | sed -e "s@SC_PORT_OFFSET
@$sm_port_offset@g" > repository/conf/carbon.xml
-
-    echo "In repository/conf/jndi.properties"
-    cp -f repository/conf/jndi.properties
repository/conf/jndi.properties.orig
-    cat repository/conf/jndi.properties.orig | sed -e "s@MB_HOSTNAME
:MB_LISTEN_PORT@$mb_hostname:$sm_mb_listen_port@g" >
repository/conf/jndi.properties
-
-    echo "In repository/conf/cartridge-config.properties" >> $LOG
-    cp -f repository/conf/cartridge-config.properties
repository/conf/cartridge-config.properties.orig
-    cat repository/conf/cartridge-config.properties.orig | sed -e
"s@CC_HOSTNAME:CC_HTTPS_PORT@$cc_hostname:$sm_cc_https_port@g" >
repository/conf/cartridge-config.properties
-
-    cp -f repository/conf/cartridge-config.properties
repository/conf/cartridge-config.properties.orig
-    cat repository/conf/cartridge-config.properties.orig | sed -e
"s@AS_HOSTNAME:AS_HTTPS_PORT@$as_hostname:$sm_as_https_port@g" >
repository/conf/cartridge-config.properties
-
-    cp -f repository/conf/cartridge-config.properties
repository/conf/cartridge-config.properties.orig
-    cat repository/conf/cartridge-config.properties.orig | sed -e
"s@PUPPET_IP@$sm_puppet_ip@g" > repository/conf/cartridge-config.properties
-
-    cp -f repository/conf/cartridge-config.properties
repository/conf/cartridge-config.properties.orig
-    cat repository/conf/cartridge-config.properties.orig | sed -e
"s@PUPPET_HOSTNAME@$sm_puppet_hostname@g" >
repository/conf/cartridge-config.properties
-
-    cp -f repository/conf/cartridge-config.properties
repository/conf/cartridge-config.properties.orig
-    cat repository/conf/cartridge-config.properties.orig | sed -e
"s@PUPPET_ENV@$sm_puppet_environment@g" >
repository/conf/cartridge-config.properties
-
-    echo "In repository/conf/datasources/master-datasources.xml" >> $LOG
-    cp -f repository/conf/datasources/master-datasources.xml
repository/conf/datasources/master-datasources.xml.orig
-    cat repository/conf/datasources/master-datasources.xml.orig | sed -e
"s@USERSTORE_DB_HOSTNAME@$userstore_db_hostname@g" >
repository/conf/datasources/master-datasources.xml
-
-    cp -f repository/conf/datasources/master-datasources.xml
repository/conf/datasources/master-datasources.xml.orig
-    cat repository/conf/datasources/master-datasources.xml.orig | sed -e
"s@USERSTORE_DB_PORT@$userstore_db_port@g" >
repository/conf/datasources/master-datasources.xml
-
-    cp -f repository/conf/datasources/master-datasources.xml
repository/conf/datasources/master-datasources.xml.orig
-    cat repository/conf/datasources/master-datasources.xml.orig | sed -e
"s@USERSTORE_DB_SCHEMA@$userstore_db_schema@g" >
repository/conf/datasources/master-datasources.xml
-
-    cp -f repository/conf/datasources/master-datasources.xml
repository/conf/datasources/master-datasources.xml.orig
-    cat repository/conf/datasources/master-datasources.xml.orig | sed -e
"s@USERSTORE_DB_USER@$userstore_db_user@g" >
repository/conf/datasources/master-datasources.xml
-
-    cp -f repository/conf/datasources/master-datasources.xml
repository/conf/datasources/master-datasources.xml.orig
-    cat repository/conf/datasources/master-datasources.xml.orig | sed -e
"s@USERSTORE_DB_PASS@$userstore_db_pass@g" >
repository/conf/datasources/master-datasources.xml
-
-    popd # sm_path
-
+# Make sure the user is running as root.
+if [ "$UID" -ne "0" ]; then
+       echo ; echo "  You must be root to run $0.  (Try running 'sudo
bash' first.)" ; echo
+       exit 69
+fi

-    # Database Configuration
-    # -----------------------------------------------
-    echo "Create and configure MySql Databases" >> $LOG
+general_conf_validate
+if [[ $profile = "cc" ]]; then
+    cc_conf_validate
+elif [[ $profile = "as" ]]; then
+    as_conf_validate
+elif [[ $profile = "sm" ]]; then
+    sm_conf_validate
+else
+    echo "In default profile CEP will be configured."
+    activemq_validate
+    cc_conf_validate
+    as_conf_validate
+    sm_conf_validate
+fi

-    echo "Creating userstore database"
+if [[ ! -d $log_path ]]; then
+    mkdir -p $log_path
+fi

-    pushd $resource_path
-    cp -f mysql.sql mysql.sql.orig
-    cat mysql.sql.orig | sed -e "s@USERSTORE_DB_SCHEMA
@$userstore_db_schema@g" > mysql.sql

-    popd # resource_path
+echo ""
+echo "For all the questions asked while during executing the script please
just press the enter button"
+echo ""

-    mysql -u$userstore_db_user -p$userstore_db_pass <
$resource_path/mysql.sql
-
-    #Copy
https://svn.wso2.org/repos/wso2/scratch/hosting/build/tropos/resources/append_zone_file.shinto
/opt/scripts folder
-    if [[ ! -d $stratos_path/scripts ]]; then
-        mkdir -p $stratos_path/scripts
-    fi
-    cp -f ./scripts/add_entry_zone_file.sh
$stratos_path/scripts/add_entry_zone_file.sh
-    cp -f ./scripts/remove_entry_zone_file.sh
$stratos_path/scripts/remove_entry_zone_file.sh

+# Extract stratos zip file
+if [[ !(-d $stratos_extract_path) ]]; then
+    echo "Extracting Apache Stratos"
+    unzip -q $stratos_pack_zip -d $stratos_path
+    mv -f $stratos_path/apache-stratos-4.0.0-SNAPSHOT $stratos_extract_path
+fi

-    echo "End configuring the SM"
-}
+if [[ ($profile = "default" && $config_mb = "true") ]]; then
+    echo "Extracting ActiveMQ"
+    tar -xzf $activemq_pack -C $stratos_path
+fi

-if [[ $sm = "true" ]]; then
+general_setup
+if [[ $profile = "cc" ]]; then
+    cc_setup
+elif [[ $profile = "as" ]]; then
+    as_setup
+elif [[ $profile = "sm" ]]; then
+    sm_setup
+else
+    cc_setup
+    as_setup
     sm_setup
+    cep_setup
 fi

-
 # ------------------------------------------------
 # Mapping domain/host names
 # ------------------------------------------------

 cp -f /etc/hosts hosts.tmp

-
-echo "$mb_ip $mb_hostname      # message broker hostname"      >> hosts.tmp
-
-if [[ $sm = "true" || $as = "true" ]]; then
+echo "$host_ip $sm_hostname    # stratos domain"       >> hosts.tmp
+
+if [[ $profile = "sm" || $profile = "as" ]]; then
     echo "$sm_ip $sm_hostname  # stratos domain"       >> hosts.tmp
     echo "$cc_ip $cc_hostname  # cloud controller hostname"    >> hosts.tmp
 fi

-if [[ $sm = "true" ]]; then
+if [[ $profile = "sm" ]]; then
     echo "$as_ip $as_hostname  # auto scalar hostname" >> hosts.tmp
 fi

@@ -659,9 +571,11 @@ chown $host_user:$host_user $stratos_path -R

 echo "Apache Stratos setup has successfully completed"

-read -p "Do you want to start the servers [y/n]? " answer
-if [[ $answer != y ]] ; then
-   exit 1
+if [[ $auto_start_servers != "true" ]]; then
+    read -p "Do you want to start the servers [y/n]? " answer
+    if [[ $answer != y ]] ; then
+        exit 1
+    fi
 fi

 echo "Starting the servers" >> $LOG
@@ -672,14 +586,11 @@ chown -R $host_user.$host_user $log_path
 chmod -R 777 $log_path

 export setup_dir=$PWD
-su - $host_user -c "source
$setup_dir/conf/setup.conf;$setup_dir/start-servers.sh -p\"$product_list\"
>> $LOG"
+su - $host_user -c "source
$setup_path/conf/setup.conf;$setup_path/start-servers.sh -p\"$profile\" >>
$LOG"

 echo "Servers started. Please look at $LOG file for server startup details"
-if [[ $sm == "true" ]]; then
+if [[ $profile == "default" || $profile == "sm" ]]; then
     echo "**************************************************************"
     echo "Management Console : https://
$stratos_domain:$sm_https_port/console"
     echo "**************************************************************"
 fi
-
-
-

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7e4b3aee/tools/stratos-installer/start-servers.sh
----------------------------------------------------------------------
diff --git a/tools/stratos-installer/start-servers.sh
b/tools/stratos-installer/start-servers.sh
index c22eeea..78edf65 100755
--- a/tools/stratos-installer/start-servers.sh
+++ b/tools/stratos-installer/start-servers.sh
@@ -29,18 +29,22 @@ product_list=$1
 export LOG=$log_path/stratos.log
 SLEEP=40

+profile="default"
+
 if [[ -f ./conf/setup.conf ]]; then
     source "./conf/setup.conf"
+    echo "source it"
 fi

+
 function help {
     echo ""
     echo "Give one or more of the servers to start on this machine. The
available servers are"
-    echo "mb, cc, as, sm, cep, all. 'all' means you need to start all
servers."
+    echo "cc, as, sm, default. 'default' means you need to start all
servers."
     echo "usage:"
-    echo "start-servers.sh -p\"<product list>\""
+    echo "start-servers.sh -p\"<profile>\""
     echo "eg."
-    echo "start-servers.sh -p\"cc sm\""
+    echo "start-servers.sh -p\"cc\""
     echo ""
 }

@@ -48,96 +52,45 @@ while getopts p: opts
 do
   case $opts in
     p)
-        product_list=${OPTARG}
-        echo $product_list
+        profile_list=${OPTARG}
         ;;
-    *)
+    \?)
         help
         exit 1
         ;;
   esac
 done
-arr=$(echo $product_list | tr ";" "\n")
+
+
+arr=$(echo $profile_list | tr " " "\n")

 for x in $arr
 do
-    if [[ $x = "mb" ]]; then
-        mb="true"
-    fi
-    if [[ $x = "cep" ]]; then
-        cep="true"
-    fi
     if [[ $x = "cc" ]]; then
-        cc="true"
-    fi
-    if [[ $x = "as" ]]; then
-        as="true"
-    fi
-    if [[ $x = "sm" ]]; then
-        sm="true"
-    fi
-    if [[ $x = "all" ]]; then
-       mb="true"
-        cc="true"
-        as="true"
-        sm="true"
-        cep="true"
+        profile="cc"
+    elif [[ $x = "as" ]]; then
+        profile="as"
+    elif [[ $x = "sm" ]]; then
+        profile="sm"
+    else
+        echo "Inavlid profile : 'default' profile will be selected."
+        profile="default"
     fi
 done
-product_list=`echo $product_list | sed 's/^ *//g' | sed 's/ *$//g'`
-if [[ -z $product_list || $product_list = "" ]]; then
-    help
-    exit 1
-fi
-
-if [[ $mb = "true" ]]; then
-    echo ${mb_path}
-
-    echo "Starting MB server ..." >> $LOG
-    nohup ${mb_path}/bin/wso2server.sh &
-    echo "MB server started" >> $LOG
-    sleep $SLEEP
-    sleep $SLEEP
-fi

-if [[ $cep = "true" ]]; then
-    echo ${cep_path}
-
-    echo "Starting CEP server ..." >> $LOG
-    nohup ${cep_path}/bin/wso2server.sh &
-    echo "CEP server started" >> $LOG
-    sleep $SLEEP
-    sleep $SLEEP
-fi
-
-if [[ $cc = "true" ]]; then
-    echo ${cc_path}
-
-    echo "Starting CC server ..." >> $LOG
-    nohup ${cc_path}/bin/stratos.sh &
-    echo "CC server started" >> $LOG
+if [[ $profile = "default" ]]; then
+    echo "Starting ActiveMQ server ..." >> $LOG
+    $activemq_path/bin/activemq start
+    echo "ActiveMQ server started" >> $LOG
     sleep $SLEEP
     sleep $SLEEP
 fi

-if [[ $as = "true" ]]; then
-    echo ${as_path}
-
-    echo "Starting Auto Scalar server ..." >> $LOG
-    nohup ${as_path}/bin/stratos.sh &
-    echo "Auto Scalar server started" >> $LOG
-    sleep $SLEEP
-fi
-
-
-if [[ $sm = "true" ]]; then
-    echo ${sm_path}
-
-    echo "Starting SM server ..." >> $LOG
-    nohup ${sm_path}/bin/stratos.sh &
-    echo "SM server started" >> $LOG
-    sleep $SLEEP
-
-fi
+echo "Starting Stratos server ..." >> $LOG
+echo "$stratos_extract_path/bin/stratos.sh -Dprofile=$profile start"
+$stratos_extract_path/bin/stratos.sh -Dprofile=$profile start
+echo "Stratos server started" >> $LOG
+sleep $SLEEP
+sleep $SLEEP



http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7e4b3aee/tools/stratos-installer/stratos-clean.sh
----------------------------------------------------------------------
diff --git a/tools/stratos-installer/stratos-clean.sh
b/tools/stratos-installer/stratos-clean.sh
deleted file mode 100755
index 261dee7..0000000
--- a/tools/stratos-installer/stratos-clean.sh
+++ /dev/null
@@ -1,104 +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 is for cleaning the host machine where one or more of the
Stratos servers are run.
-#
----------------------------------------------------------------------------
-
-source "./conf/stratos-setup.conf"
-
-if [ "$UID" -ne "0" ]; then
-       echo ; echo "  You must be root to run $0.  (Try running 'sudo
bash' first.)" ; echo
-       exit 69
-fi
-
-function help {
-    echo ""
-    echo "Clean the host machine where one or more of the Stratos2 servers
are run."
-    echo "usage:"
-    echo "stratos-clean.sh -u <mysql username> -p <mysql password>"
-    echo ""
-}
-
-while getopts u:p: opts
-do
-  case $opts in
-    u)
-        mysql_user=${OPTARG}
-        ;;
-    p)
-        mysql_pass=${OPTARG}
-        ;;
-    *)
-        help
-        #exit 1
-        ;;
-  esac
-done
-
-function helpclean {
-    echo ""
-    echo "Enter DB credentials if you need to clear Stratos DB"
-    echo "usage:"
-    echo "clean.sh -u <mysql username> -p <mysql password>"
-    echo ""
-}
-
-function clean_validate {
-    if [ -z $stratos_path ]; then
-        echo "stratos_path is not set"
-        exit 1
-    fi
-    if [ -z $log_path ]; then
-        echo "log_path is not set"
-        exit 1
-    fi
-}
-
-clean_validate
-if [[ ( -n $mysql_user && -n $mysql_pass ) ]]; then
-       read -p "Please confirm that you want to remove stratos databases,
servers and logs [y/n] " answer
-       if [[ $answer != y ]] ; then
-               exit 1
-       fi
-fi
-echo 'Stopping all java processes'
-killall java
-echo 'Waiting for applications to exit'
-sleep 15
-
-if [[ ( -n $mysql_user && -n $mysql_pass ) ]]; then
-   echo 'Removing userstore database'
-   mysql -u $mysql_user -p$mysql_pass -e "DROP DATABASE IF EXISTS
$userstore_db_schema;"
-fi
-
-if [[ -d $stratos_path/scripts ]]; then
-   echo 'Removing scripts'
-   rm -rf $stratos_path/scripts
-fi
-
-if [[ -d $stratos_path ]]; then
-   echo 'Removing Stratos'
-   rm -rf $stratos_path/*
-fi
-
-echo 'Removing logs'
-rm -rf $log_path/*

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7e4b3aee/tools/stratos-installer/stratos-db-clean.sh
----------------------------------------------------------------------
diff --git a/tools/stratos-installer/stratos-db-clean.sh
b/tools/stratos-installer/stratos-db-clean.sh
deleted file mode 100755
index 74fec29..0000000
--- a/tools/stratos-installer/stratos-db-clean.sh
+++ /dev/null
@@ -1,24 +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.
-#
-#
-# cleans up databases
-mysql -uroot -proot -e "DROP DATABASE IF EXISTS stratos_foundation;"
-mysql -uroot -proot -e "DROP DATABASE IF EXISTS userstore;"
-

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7e4b3aee/tools/stratos-installer/stratos-ec2.sh
----------------------------------------------------------------------
diff --git a/tools/stratos-installer/stratos-ec2.sh
b/tools/stratos-installer/stratos-ec2.sh
deleted file mode 100755
index 7e39a80..0000000
--- a/tools/stratos-installer/stratos-ec2.sh
+++ /dev/null
@@ -1,56 +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 is invoked by setup.sh for configuring Amazon EC2 IaaS
information.
-#
----------------------------------------------------------------------------
-
-# Die on any error:
-set -e
-
-SLEEP=60
-export LOG=$log_path/stratos-ec2.log
-
-source "./conf/stratos-setup.conf"
-
-if [[ ! -d $log_path ]]; then
-    mkdir -p $log_path
-fi
-
-pushd $stratos_extract_path
-
-echo "Set EC2 provider specific info in
repository/conf/cloud-controller.xml" >> $LOG
-
-sed -i "s@EC2_PROVIDER_START@@g"  repository/conf/cloud-controller.xml
-sed -i "s@EC2_IDENTITY@$ec2_identity@g"
repository/conf/cloud-controller.xml
-sed -i "s@EC2_CREDENTIAL@$ec2_credential@g"
repository/conf/cloud-controller.xml
-sed -i "s@EC2_OWNER_ID@$ec2_owner_id@g"
repository/conf/cloud-controller.xml
-sed -i "s@EC2_AVAILABILITY_ZONE@$ec2_availability_zone@g"
repository/conf/cloud-controller.xml
-sed -i "s@EC2_SECURITY_GROUPS@$ec2_security_groups@g"
repository/conf/cloud-controller.xml
-sed -i "s@EC2_KEYPAIR@$ec2_keypair_name@g"
repository/conf/cloud-controller.xml
-sed -i "s@EC2_PROVIDER_END@@g" repository/conf/cloud-controller.xml
-sed -i "s@OPENSTACK_PROVIDER_START@!--@g"
repository/conf/cloud-controller.xml
-sed -i "s@OPENSTACK_PROVIDER_END@--@g" repository/conf/cloud-controller.xml
-sed -i "s@VCLOUD_PROVIDER_START@!--@g" repository/conf/cloud-controller.xml
-sed -i "s@VCLOUD_PROVIDER_END@--@g" repository/conf/cloud-controller.xml
-
-popd
-

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7e4b3aee/tools/stratos-installer/stratos-openstack.sh
----------------------------------------------------------------------
diff --git a/tools/stratos-installer/stratos-openstack.sh
b/tools/stratos-installer/stratos-openstack.sh
deleted file mode 100755
index 925333c..0000000
--- a/tools/stratos-installer/stratos-openstack.sh
+++ /dev/null
@@ -1,52 +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 is invoked by setup.sh for configuring OpenStack IaaS
information.
-#
----------------------------------------------------------------------------
-
-# Die on any error:
-set -e
-
-SLEEP=60
-export LOG=$log_path/stratos-openstack.log
-
-source "./conf/stratos-setup.conf"
-
-if [[ ! -d $log_path ]]; then
-    mkdir -p $log_path
-fi
-
-pushd $stratos_extract_path
-
-echo "Set OpenStack provider specific info in
repository/conf/cloud-controller.xml" >> $LOG
-
-sed -i "s@OPENSTACK_PROVIDER_START@@g" repository/conf/cloud-controller.xml
-sed -i "s@OPENSTACK_IDENTITY@$openstack_identity@g"
 repository/conf/cloud-controller.xml
-sed -i "s@OPENSTACK_CREDENTIAL@$openstack_credential@g"
 repository/conf/cloud-controller.xml
-sed -i "s@OPENSTACK_ENDPOINT@$openstack_jclouds_endpoint@g"
 repository/conf/cloud-controller.xml
-sed -i "s@OPENSTACK_PROVIDER_END@@g"  repository/conf/cloud-controller.xml
-sed -i "s@EC2_PROVIDER_START@!--@g"  repository/conf/cloud-controller.xml
-sed -i "s@EC2_PROVIDER_END@--@g"  repository/conf/cloud-controller.xml
-sed -i "s@VCLOUD_PROVIDER_START@!--@g"
 repository/conf/cloud-controller.xml
-sed -i "s@VCLOUD_PROVIDER_END@--@g"  repository/conf/cloud-controller.xml
-
-popd




-- 
Isuru Perera
Senior Software Engineer | WSO2, Inc. | http://wso2.com/
Lean . Enterprise . Middleware

about.me/chrishantha

[2/3] git commit: Stratos Installer changes to use single product

Posted by is...@apache.org.
Stratos Installer changes to use single product


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

Branch: refs/heads/master
Commit: 7e4b3aee15be72f1fa2771c623af920a4d5e9688
Parents: 0955f29
Author: M. Isuru Tharanga Chrishantha Perera <is...@apache.org>
Authored: Thu Apr 3 17:25:36 2014 +0530
Committer: M. Isuru Tharanga Chrishantha Perera <is...@apache.org>
Committed: Thu Apr 3 17:25:36 2014 +0530

----------------------------------------------------------------------
 tools/stratos-installer/clean.sh                |  39 +-
 tools/stratos-installer/conf/setup.conf         |  95 +--
 tools/stratos-installer/conf/stratos-setup.conf | 103 ---
 tools/stratos-installer/ec2.sh                  |  49 +-
 tools/stratos-installer/openstack.sh            |  37 +-
 tools/stratos-installer/setup.sh                | 825 +++++++++----------
 tools/stratos-installer/start-servers.sh        | 107 +--
 tools/stratos-installer/stratos-clean.sh        | 104 ---
 tools/stratos-installer/stratos-db-clean.sh     |  24 -
 tools/stratos-installer/stratos-ec2.sh          |  56 --
 tools/stratos-installer/stratos-openstack.sh    |  52 --
 tools/stratos-installer/stratos-setup.sh        | 596 --------------
 .../stratos-installer/stratos-start-servers.sh  |  96 ---
 tools/stratos-installer/stratos-vcloud.sh       |  52 --
 tools/stratos-installer/vcloud.sh               |  37 +-
 15 files changed, 453 insertions(+), 1819 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7e4b3aee/tools/stratos-installer/clean.sh
----------------------------------------------------------------------
diff --git a/tools/stratos-installer/clean.sh b/tools/stratos-installer/clean.sh
index 5692739..b74879d 100755
--- a/tools/stratos-installer/clean.sh
+++ b/tools/stratos-installer/clean.sh
@@ -63,10 +63,6 @@ function helpclean {
 }
 
 function clean_validate {
-#    if [[ ( -z $mysql_user || -z $mysql_pass ) ]]; then
- #       helpclean
-  #      exit 1
-   # fi
     if [ -z $stratos_path ]; then
         echo "stratos_path is not set"
         exit 1
@@ -90,13 +86,8 @@ echo 'Waiting for applications to exit'
 sleep 15
 
 if [[ ( -n $mysql_user && -n $mysql_pass ) ]]; then
-
-	echo 'Removing stratos_foundation database'
-	mysql -u $mysql_user -p$mysql_pass -e "DROP DATABASE IF EXISTS stratos_foundation;"
-
-	echo 'Removing userstore database'
-	mysql -u $mysql_user -p$mysql_pass -e "DROP DATABASE IF EXISTS userstore;"
-
+   echo 'Removing userstore database'
+   mysql -u $mysql_user -p$mysql_pass -e "DROP DATABASE IF EXISTS $userstore_db_schema;"
 fi
 
 if [[ -d $stratos_path/scripts ]]; then
@@ -104,29 +95,9 @@ if [[ -d $stratos_path/scripts ]]; then
    rm -rf $stratos_path/scripts
 fi
 
-if [[ -d $mb_path ]]; then
-   echo 'Removing MB'
-   rm -rf $mb_path
-fi
-
-if [[ -d $cep_path ]]; then
-   echo 'Removing CEP'
-   rm -rf $cep_path
-fi
-
-if [[ -d $cc_path ]]; then
-   echo 'Removing CC'
-   rm -rf $cc_path
-fi
-
-if [[ -d $as_path ]]; then
-   echo 'Removing AS'
-   rm -rf $as_path
-fi
-
-if [[ -d $sm_path ]]; then
-   echo 'Removing SM'
-   rm -rf $sm_path
+if [[ -d $stratos_path ]]; then
+   echo 'Removing Stratos'
+   rm -rf $stratos_path/*
 fi
 
 echo 'Removing logs'

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7e4b3aee/tools/stratos-installer/conf/setup.conf
----------------------------------------------------------------------
diff --git a/tools/stratos-installer/conf/setup.conf b/tools/stratos-installer/conf/setup.conf
index 10b4163..2abcb3e 100644
--- a/tools/stratos-installer/conf/setup.conf
+++ b/tools/stratos-installer/conf/setup.conf
@@ -24,8 +24,7 @@
 # ----------------------------------------------------------------------------
 #
 #  Configure below parameters to install Apache Stratos using ../setup.sh.
-#  General configuration parameters are mandatory and other sections are optional. Configure each section on each node where
-#  Stratos product is installed.
+#  General configuration parameters are mandatory and other sections are optional. 
 #
 # ----------------------------------------------------------------------------
 
@@ -34,7 +33,7 @@
 # General configuration
 # ----------------------------------------------------------------------------
 export setup_path= #Folder path containing stratos_setup
-export stratos_pack_path= #Folder path containing stratos packages 
+export stratos_packs= #Folder path containing stratos package and other third party packs and jars 
 export stratos_path= #Folder which stratos will be installed
 
 export JAVA_HOME= #Java home path
@@ -45,62 +44,25 @@ export host_user="" #A host user account for the machine which run Stratos compo
 
 export stratos_domain="stratos.apache.org"
 
-export mb_ip="mb-ip"	# Machine ip on which mb run
-export cep_ip="cep-ip"	# Machine ip on which cep run
-export cc_ip="cc-ip" 	# Machine ip on which cc run
-export as_ip="as-ip"	# Machine ip on which auto scalar run
-export sm_ip="sc-ip"	# Machine ip on which sc run
-export puppet_ip="puppet-ip" 	# Machine ip on which puppet master run
+export host_ip="127.0.0.1" # Machine ip on host machine
+export offset=0
+
+export puppet_ip="127.0.0.1" 	# Machine ip on which puppet master run
 export puppet_hostname="puppet-hostname" # Host name given to identify the puppet master
 export puppet_environment="puppet_environment" # Name of puppet environment
 
-export cc_port_offset=1
-export sm_port_offset=2
-export as_port_offset=3
-export cep_port_offset=4
-export mb_port_offset=5
-
-export mb_port=5672 #default port which the message broker service runs 
+export mb_ip="127.0.0.1" # Machine ip on which mb run
+export mb_port=61616 #default port which the message broker service runs
+ 
+export stratos_extract_path=$stratos_path/"apache-stratos"
+export stratos_pack_zip=$stratos_packs/"apache-stratos-4.0.0-SNAPSHOT.zip" 
 
-export mb_hostname="mb.$stratos_domain"
-export cep_hostname="cep.$stratos_domain"
-export sm_hostname="$stratos_domain"
-export cc_hostname="cc.$stratos_domain"
-export as_hostname="as.$stratos_domain"
+export activemq_pack=$stratos_packs/"apache-activemq-5.8.0-bin.tar.gz"
+export activemq_path=$stratos_path/"apache-activemq-5.8.0"
 
 export resource_path=$setup_path/resources
 
 
-# ----------------------------------------------------------------------------
-# MB configuration
-# ----------------------------------------------------------------------------
-export mb_path=$stratos_path/"wso2mb-2.1.0"
-export mb_pack_path=$stratos_pack_path/"wso2mb-2.1.0.zip"
-
-
-# ----------------------------------------------------------------------------
-# CEP configuration
-# ----------------------------------------------------------------------------
-export cep_artifacts_path= #Folder path containing cep artifacts files
-export cep_extension_jar=$stratos_pack_path/"org.apache.stratos.cep.extension-1.0.0-SNAPSHOT.jar" # cep extensions jar file name
-export andes_client_jar=$stratos_pack_path/"andes-client-0.13.wso2v8.jar" # andes client jar file name
-
-export cep_path=$stratos_path/"wso2cep-3.0.0"
-export cep_pack_path=$stratos_pack_path/"wso2cep-3.0.0.zip"
-
-export cep_mb_ip=$mb_ip
-export cep_mb_listen_port=$(($mb_port + $mb_port_offset))
-
-
-# ----------------------------------------------------------------------------
-# CC configuration
-# ----------------------------------------------------------------------------
-export cc_path=$stratos_path/"apache-stratos-cc-4.0.0-SNAPSHOT"
-export cc_pack_path=$stratos_pack_path/"apache-stratos-cc-4.0.0-SNAPSHOT.zip"
-
-export cc_mb_listen_port=$(($mb_port + $mb_port_offset))
-export cc_https_port=$((9443 + $cc_port_offset))
-
 # IaaS Providers
 # ----------------------------------------------------------------------------
 # Set <iaas-name>_provider_enabled parameter to true to enable desired IaaS. A hybrid cloud could be
@@ -121,7 +83,7 @@ export openstack_identity="stratos:stratos" # Openstack project name:Openstack l
 export openstack_credential="password" # Openstack login password
 export openstack_jclouds_endpoint="http://hostname:5000/v2.0"
 export openstack_keypair_name=""
-export openstack_security_groups="security-groups"
+export openstack_security_groups=""
 
 # vCloud
 export vcloud_provider_enabled=false
@@ -129,36 +91,13 @@ export vcloud_identity="stratos" # vCloud login user
 export vcloud_credential="password" # vCloud login password
 export vcloud_jclouds_endpoint="https://vcloud/api"
 
-# ----------------------------------------------------------------------------
-# Auto Scalar configuration
-# ----------------------------------------------------------------------------
-export as_path=$stratos_path/"apache-stratos-autoscaler-4.0.0-SNAPSHOT"
-export as_pack_path=$stratos_pack_path/"apache-stratos-autoscaler-4.0.0-SNAPSHOT.zip"
 
-export as_mb_listen_port=$(($mb_port + $mb_port_offset))
-export as_cc_https_port=$((9443 + $cc_port_offset))
-export as_sm_https_port=$((9443 + $sm_port_offset))
-
-
-# ----------------------------------------------------------------------------
-# SM configuration
+# Database configuration
 # ----------------------------------------------------------------------------
-export sm_path=$stratos_path/"apache-stratos-manager-4.0.0-SNAPSHOT"
-export sm_pack_path=$stratos_pack_path/"apache-stratos-manager-4.0.0-SNAPSHOT.zip"
-export mysql_connector_jar=$stratos_pack_path/"mysql-connector-java-5.1.25.jar" #mysql connector jar file name
+export mysql_connector_jar=$stratos_packs/"mysql-connector-java-5.1.29-bin.jar" #mysql connector jar file name
 
 export userstore_db_hostname="localhost"
 export userstore_db_schema="userstore"
 export userstore_db_port="3306"
 export userstore_db_user="root"
-export userstore_db_pass="mysql"
-
-export sm_puppet_ip=$puppet_ip
-export sm_puppet_hostname=$puppet_hostname
-export sm_puppet_environment=$puppet_environment
-export sm_mb_listen_port=$(($mb_port + $mb_port_offset))
-export sm_cc_https_port=$((9443 + $cc_port_offset))
-export sm_as_https_port=$((9443 + $as_port_offset))
-export sm_https_port=$((9443 + $sm_port_offset))
-export sm_http_port=$((9763 + $sm_port_offset))
-
+export userstore_db_pass="root"

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7e4b3aee/tools/stratos-installer/conf/stratos-setup.conf
----------------------------------------------------------------------
diff --git a/tools/stratos-installer/conf/stratos-setup.conf b/tools/stratos-installer/conf/stratos-setup.conf
deleted file mode 100644
index 2abcb3e..0000000
--- a/tools/stratos-installer/conf/stratos-setup.conf
+++ /dev/null
@@ -1,103 +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.
-#
-# ----------------------------------------------------------------------------
-#
-#  Server configuration script for Apache Stratos
-# ----------------------------------------------------------------------------
-#
-#  Configure below parameters to install Apache Stratos using ../setup.sh.
-#  General configuration parameters are mandatory and other sections are optional. 
-#
-# ----------------------------------------------------------------------------
-
-
-# ----------------------------------------------------------------------------
-# General configuration
-# ----------------------------------------------------------------------------
-export setup_path= #Folder path containing stratos_setup
-export stratos_packs= #Folder path containing stratos package and other third party packs and jars 
-export stratos_path= #Folder which stratos will be installed
-
-export JAVA_HOME= #Java home path
-
-export log_path=/var/log/apache-stratos
-
-export host_user="" #A host user account for the machine which run Stratos component(s)
-
-export stratos_domain="stratos.apache.org"
-
-export host_ip="127.0.0.1" # Machine ip on host machine
-export offset=0
-
-export puppet_ip="127.0.0.1" 	# Machine ip on which puppet master run
-export puppet_hostname="puppet-hostname" # Host name given to identify the puppet master
-export puppet_environment="puppet_environment" # Name of puppet environment
-
-export mb_ip="127.0.0.1" # Machine ip on which mb run
-export mb_port=61616 #default port which the message broker service runs
- 
-export stratos_extract_path=$stratos_path/"apache-stratos"
-export stratos_pack_zip=$stratos_packs/"apache-stratos-4.0.0-SNAPSHOT.zip" 
-
-export activemq_pack=$stratos_packs/"apache-activemq-5.8.0-bin.tar.gz"
-export activemq_path=$stratos_path/"apache-activemq-5.8.0"
-
-export resource_path=$setup_path/resources
-
-
-# IaaS Providers
-# ----------------------------------------------------------------------------
-# Set <iaas-name>_provider_enabled parameter to true to enable desired IaaS. A hybrid cloud could be
-# created using multiple IaaSs.
-
-# EC2
-export ec2_provider_enabled=true
-export ec2_identity="<ec2_identity>"
-export ec2_credential="<ec2_credential>"
-export ec2_keypair_name="<ec2_keypair_name>"
-export ec2_owner_id="<ec2_owner_id>"
-export ec2_availability_zone="<ec2_availability_zone>"
-export ec2_security_groups="<ec2_security_groups>"
-
-# Openstack
-export openstack_provider_enabled=false
-export openstack_identity="stratos:stratos" # Openstack project name:Openstack login user
-export openstack_credential="password" # Openstack login password
-export openstack_jclouds_endpoint="http://hostname:5000/v2.0"
-export openstack_keypair_name=""
-export openstack_security_groups=""
-
-# vCloud
-export vcloud_provider_enabled=false
-export vcloud_identity="stratos" # vCloud login user
-export vcloud_credential="password" # vCloud login password
-export vcloud_jclouds_endpoint="https://vcloud/api"
-
-
-# Database configuration
-# ----------------------------------------------------------------------------
-export mysql_connector_jar=$stratos_packs/"mysql-connector-java-5.1.29-bin.jar" #mysql connector jar file name
-
-export userstore_db_hostname="localhost"
-export userstore_db_schema="userstore"
-export userstore_db_port="3306"
-export userstore_db_user="root"
-export userstore_db_pass="root"

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7e4b3aee/tools/stratos-installer/ec2.sh
----------------------------------------------------------------------
diff --git a/tools/stratos-installer/ec2.sh b/tools/stratos-installer/ec2.sh
index 12aae8e..21d47a3 100755
--- a/tools/stratos-installer/ec2.sh
+++ b/tools/stratos-installer/ec2.sh
@@ -35,45 +35,22 @@ if [[ ! -d $log_path ]]; then
     mkdir -p $log_path
 fi
 
-pushd $cc_path
+pushd $stratos_extract_path
 
 echo "Set EC2 provider specific info in repository/conf/cloud-controller.xml" >> $LOG
 
-cp -f repository/conf/cloud-controller.xml repository/conf/cloud-controller.xml.orig
-cat repository/conf/cloud-controller.xml.orig | sed -e "s@EC2_PROVIDER_START@@g" > repository/conf/cloud-controller.xml
- 
-cp -f repository/conf/cloud-controller.xml repository/conf/cloud-controller.xml.orig
-cat repository/conf/cloud-controller.xml.orig | sed -e "s@EC2_IDENTITY@$ec2_identity@g" > repository/conf/cloud-controller.xml
-       
-cp -f repository/conf/cloud-controller.xml repository/conf/cloud-controller.xml.orig
-cat repository/conf/cloud-controller.xml.orig | sed -e "s@EC2_CREDENTIAL@$ec2_credential@g" > repository/conf/cloud-controller.xml
-       
-cp -f repository/conf/cloud-controller.xml repository/conf/cloud-controller.xml.orig
-cat repository/conf/cloud-controller.xml.orig | sed -e "s@EC2_OWNER_ID@$ec2_owner_id@g" > repository/conf/cloud-controller.xml
-
-cp -f repository/conf/cloud-controller.xml repository/conf/cloud-controller.xml.orig
-cat repository/conf/cloud-controller.xml.orig | sed -e "s@EC2_AVAILABILITY_ZONE@$ec2_availability_zone@g" > repository/conf/cloud-controller.xml
-       
-cp -f repository/conf/cloud-controller.xml repository/conf/cloud-controller.xml.orig
-cat repository/conf/cloud-controller.xml.orig | sed -e "s@EC2_SECURITY_GROUPS@$ec2_security_groups@g" > repository/conf/cloud-controller.xml
-
-cp -f repository/conf/cloud-controller.xml repository/conf/cloud-controller.xml.orig
-cat repository/conf/cloud-controller.xml.orig | sed -e "s@EC2_KEYPAIR@$ec2_keypair_name@g" > repository/conf/cloud-controller.xml
-
-cp -f repository/conf/cloud-controller.xml repository/conf/cloud-controller.xml.orig
-cat repository/conf/cloud-controller.xml.orig | sed -e "s@EC2_PROVIDER_END@@g" > repository/conf/cloud-controller.xml
-   
-cp -f repository/conf/cloud-controller.xml repository/conf/cloud-controller.xml.orig
-cat repository/conf/cloud-controller.xml.orig | sed -e "s@OPENSTACK_PROVIDER_START@!--@g" > repository/conf/cloud-controller.xml
-    
-cp -f repository/conf/cloud-controller.xml repository/conf/cloud-controller.xml.orig
-cat repository/conf/cloud-controller.xml.orig | sed -e "s@OPENSTACK_PROVIDER_END@--@g" > repository/conf/cloud-controller.xml
-
-cp -f repository/conf/cloud-controller.xml repository/conf/cloud-controller.xml.orig
-cat repository/conf/cloud-controller.xml.orig | sed -e "s@VCLOUD_PROVIDER_START@!--@g" > repository/conf/cloud-controller.xml
-
-cp -f repository/conf/cloud-controller.xml repository/conf/cloud-controller.xml.orig
-cat repository/conf/cloud-controller.xml.orig | sed -e "s@VCLOUD_PROVIDER_END@--@g" > repository/conf/cloud-controller.xml
+sed -i "s@EC2_PROVIDER_START@@g"  repository/conf/cloud-controller.xml
+sed -i "s@EC2_IDENTITY@$ec2_identity@g" repository/conf/cloud-controller.xml
+sed -i "s@EC2_CREDENTIAL@$ec2_credential@g" repository/conf/cloud-controller.xml
+sed -i "s@EC2_OWNER_ID@$ec2_owner_id@g" repository/conf/cloud-controller.xml
+sed -i "s@EC2_AVAILABILITY_ZONE@$ec2_availability_zone@g" repository/conf/cloud-controller.xml
+sed -i "s@EC2_SECURITY_GROUPS@$ec2_security_groups@g" repository/conf/cloud-controller.xml
+sed -i "s@EC2_KEYPAIR@$ec2_keypair_name@g" repository/conf/cloud-controller.xml
+sed -i "s@EC2_PROVIDER_END@@g" repository/conf/cloud-controller.xml
+sed -i "s@OPENSTACK_PROVIDER_START@!--@g" repository/conf/cloud-controller.xml
+sed -i "s@OPENSTACK_PROVIDER_END@--@g" repository/conf/cloud-controller.xml
+sed -i "s@VCLOUD_PROVIDER_START@!--@g" repository/conf/cloud-controller.xml
+sed -i "s@VCLOUD_PROVIDER_END@--@g" repository/conf/cloud-controller.xml
 
 popd
 

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7e4b3aee/tools/stratos-installer/openstack.sh
----------------------------------------------------------------------
diff --git a/tools/stratos-installer/openstack.sh b/tools/stratos-installer/openstack.sh
index dd893da..e774468 100755
--- a/tools/stratos-installer/openstack.sh
+++ b/tools/stratos-installer/openstack.sh
@@ -35,35 +35,18 @@ if [[ ! -d $log_path ]]; then
     mkdir -p $log_path
 fi
 
-pushd $cc_path
+pushd $stratos_extract_path
 
 echo "Set OpenStack provider specific info in repository/conf/cloud-controller.xml" >> $LOG
 
-cp -f repository/conf/cloud-controller.xml repository/conf/cloud-controller.xml.orig
-cat repository/conf/cloud-controller.xml.orig | sed -e "s@OPENSTACK_PROVIDER_START@@g" > repository/conf/cloud-controller.xml
-
-cp -f repository/conf/cloud-controller.xml repository/conf/cloud-controller.xml.orig
-cat repository/conf/cloud-controller.xml.orig | sed -e "s@OPENSTACK_IDENTITY@$openstack_identity@g" > repository/conf/cloud-controller.xml
-
-cp -f repository/conf/cloud-controller.xml repository/conf/cloud-controller.xml.orig
-cat repository/conf/cloud-controller.xml.orig | sed -e "s@OPENSTACK_CREDENTIAL@$openstack_credential@g" > repository/conf/cloud-controller.xml
-
-cp -f repository/conf/cloud-controller.xml repository/conf/cloud-controller.xml.orig
-cat repository/conf/cloud-controller.xml.orig | sed -e "s@OPENSTACK_ENDPOINT@$openstack_jclouds_endpoint@g" > repository/conf/cloud-controller.xml
-
-cp -f repository/conf/cloud-controller.xml repository/conf/cloud-controller.xml.orig
-cat repository/conf/cloud-controller.xml.orig | sed -e "s@OPENSTACK_PROVIDER_END@@g" > repository/conf/cloud-controller.xml
-
-cp -f repository/conf/cloud-controller.xml repository/conf/cloud-controller.xml.orig
-cat repository/conf/cloud-controller.xml.orig | sed -e "s@EC2_PROVIDER_START@!--@g" > repository/conf/cloud-controller.xml
-
-cp -f repository/conf/cloud-controller.xml repository/conf/cloud-controller.xml.orig
-cat repository/conf/cloud-controller.xml.orig | sed -e "s@EC2_PROVIDER_END@--@g" > repository/conf/cloud-controller.xml
-
-cp -f repository/conf/cloud-controller.xml repository/conf/cloud-controller.xml.orig
-cat repository/conf/cloud-controller.xml.orig | sed -e "s@VCLOUD_PROVIDER_START@!--@g" > repository/conf/cloud-controller.xml
-
-cp -f repository/conf/cloud-controller.xml repository/conf/cloud-controller.xml.orig
-cat repository/conf/cloud-controller.xml.orig | sed -e "s@VCLOUD_PROVIDER_END@--@g" > repository/conf/cloud-controller.xml
+sed -i "s@OPENSTACK_PROVIDER_START@@g" repository/conf/cloud-controller.xml
+sed -i "s@OPENSTACK_IDENTITY@$openstack_identity@g"  repository/conf/cloud-controller.xml
+sed -i "s@OPENSTACK_CREDENTIAL@$openstack_credential@g"  repository/conf/cloud-controller.xml
+sed -i "s@OPENSTACK_ENDPOINT@$openstack_jclouds_endpoint@g"  repository/conf/cloud-controller.xml
+sed -i "s@OPENSTACK_PROVIDER_END@@g"  repository/conf/cloud-controller.xml
+sed -i "s@EC2_PROVIDER_START@!--@g"  repository/conf/cloud-controller.xml
+sed -i "s@EC2_PROVIDER_END@--@g"  repository/conf/cloud-controller.xml
+sed -i "s@VCLOUD_PROVIDER_START@!--@g"  repository/conf/cloud-controller.xml
+sed -i "s@VCLOUD_PROVIDER_END@--@g"  repository/conf/cloud-controller.xml
 
 popd

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7e4b3aee/tools/stratos-installer/setup.sh
----------------------------------------------------------------------
diff --git a/tools/stratos-installer/setup.sh b/tools/stratos-installer/setup.sh
index e15617d..589ab79 100755
--- a/tools/stratos-installer/setup.sh
+++ b/tools/stratos-installer/setup.sh
@@ -26,105 +26,29 @@
 # Die on any error:
 set -e
 
-SLEEP=60
-
 source "./conf/setup.conf"
 export LOG=$log_path/stratos-setup.log
 
-mb="false"
-cc="false"
-as="false"
-sm="false"
-cep="false"
-product_list="mb;cc;cep;as;sm"
-enable_internal_git=false
+profile="default"
+config_mb="true"
+activemq_client_libs=(activemq-broker-5.8.0.jar  activemq-client-5.8.0.jar  geronimo-j2ee-management_1.1_spec-1.0.1.jar  geronimo-jms_1.1_spec-1.1.1.jar  hawtbuf-1.2.jar)
+auto_start_servers="false"
 
 function help {
     echo ""
     echo "Usage:"
-    echo "setup.sh -u <host username> -p \"<product list>\""
-    echo "product list : [mb, cc, as, sm, cep]"
+    echo "setup.sh -p \"<profile>\" [-s]"
+    echo "product list : [default, cc, as, sm]"
     echo "Example:"
+    echo "sudo ./setup.sh -p \"default\""
     echo "sudo ./setup.sh -p \"cc\""
-    echo "sudo ./setup.sh -p \"all\""
     echo ""
-    echo "-u: <host username> The login user of the host."
-    echo "-p: <product list> Apache Stratos products to be installed on this node. Provide one or more names of the servers."
-    echo "    The available servers are cc, as, sm or all. 'all' means you need to setup all servers in this machine. Default is all"
-    echo "-g: <enable_internal_git> true|false Whether enable internal git repo for Stratos2. Default is false"
+    echo "-p: <profile> Apache Stratos products to be installed on this node. Provide one name of a profile."
+    echo "    The available profiles are cc, as, sm or default. 'default' means you need to setup all servers in this machine. Default is 'default' profile"
+    echo "-s: Silent mode - Start servers after installation."
     echo ""
 }
 
-while getopts u:p:g: opts
-do
-  case $opts in
-    p)
-        product_list=${OPTARG}
-        ;;
-    g)
-        enable_internal_git=${OPTARG}
-        ;;
-    \?)
-        help
-        exit 1
-        ;;
-  esac
-done
-
-
-arr=$(echo $product_list | tr " " "\n")
-
-for x in $arr
-do
-    if [[ $x = "mb" ]]; then
-        mb="true"
-    fi
-    if [[ $x = "cc" ]]; then
-        cc="true"
-    fi
-    if [[ $x = "cep" ]]; then
-        cep="true"
-    fi
-    if [[ $x = "as" ]]; then
-        as="true"
-    fi
-    if [[ $x = "sm" ]]; then
-        sm="true"
-    fi
-    if [[ $x = "all" ]]; then
-        mb="true"
-        cep="true"
-        cc="true"
-        as="true"
-        sm="true"
-    fi
-done
-
-product_list=`echo $product_list | sed 's/^ *//g' | sed 's/ *$//g'`
-if [[ -z $product_list || $product_list = "" ]]; then
-    help
-    exit 1
-fi
-
-if [[ $host_user == "" ]]; then
-    echo "user provided in conf/setup.conf is null. Please provide a user"
-    exit 1
-fi
-
-echo "user provided in conf/setup.conf is $host_user. If you want to provide some other user name please specify it at the prompt."
-echo "If you want to continue with $host_user just press enter to continue"
-read username
-if [[ $username != "" ]]; then
-    host_user=$username
-fi
-user=`id $host_user`
-if [[ $? = 1 ]]; then
-    echo "User $host_user does not exist. The system will create it."
-    adduser --home /home/$host_user $host_user
-fi
-
-export $host_user
-
 # Check validity of IP
 function valid_ip()
 {
@@ -143,19 +67,15 @@ function valid_ip()
     return $stat
 }
 
-function helpsetup {
-    echo ""
-    echo "Please set up the $1 related environment variables correctly in conf/setup.conf"
-    echo ""
-}
-
-function general_conf_validate {
+# General functions
+# -------------------------------------------------------------------
+function general_conf_validate() {
     if [[ ! -d $setup_path ]]; then
         echo "Please specify the setup_path folder which contains stratos setup"
         exit 1
     fi
-    if [[ ! -d $stratos_pack_path ]]; then
-        echo "Please specify the stratos_pack_path folder which contains stratos packages"
+    if [[ ! -d $stratos_packs ]]; then
+        echo "Please specify the stratos_packs folder which contains stratos packages"
         exit 1
     fi
     if [[ ! -d $stratos_path ]]; then
@@ -172,72 +92,106 @@ function general_conf_validate {
         echo "Please specify the stratos domain"
         exit 1
     fi
-    if [[ (-z $mb_port_offset || -z $mb_ip || -z $mb_hostname) ]]; then
-        echo "Please specify the ip, the port offset and the hostname of MB"
+    if [[ ! -f $stratos_pack_zip ]]; then
+        echo "Please copy the startos zip to the stratos pack folder"
         exit 1
     fi
-    if !(valid_ip $mb_ip); then 
-        echo "Please provide valid ip for MB's ip"
+    if [[ -z $mb_port ]]; then
+        echo "Please specify the port of MB"
         exit 1
     fi
-}
 
-function andes_jar_validate {
-    if [[ ($cep = "true" || $cc = "true" || $as = "true" || $sm = "true") ]]; then
-        if [[ ! -f $andes_client_jar ]]; then
-            echo "Please copy the andes client jar into the same folder as this command(stratos release pack folder) and update conf/setup.conf file"
-            exit 1
-        fi
+    if [[ $auto_start_servers != "true" ]]; then
+    	if [[ $profile = "default" ]]; then
+            read -p "Do you want to configure ActiveMQ [y/n]: " answer
+            if [[ $answer = y ]] ; then
+            	mb_ip=$host_ip
+            else
+            	echo "Provided mb_ip in conf/setup.conf will be used"
+            	config_mb="false"
+            fi
+    	fi
     fi
 }
 
-function mb_conf_validate {
-    if [[ -z $mb_path ]]; then
-	helpsetup MB
-	exit 1
-    fi
+# Setup General
+function general_setup() {
+
+    cp -f ./config/all/repository/conf/activemq/jndi.properties $stratos_extract_path/repository/conf/
+
+    pushd $stratos_extract_path
+    echo "In repository/conf/carbon.xml"
+    sed -i "s@<Offset>0</Offset>@<Offset>${offset}</Offset>@g" repository/conf/carbon.xml
+
+    echo "In repository/conf/jndi.properties"
+    sed -i "s@MB_HOSTNAME:MB_LISTEN_PORT@$mb_ip:$mb_port@g" repository/conf/jndi.properties
+    popd
+
+    for activemq_client_lib in "${activemq_client_libs[@]}" 
+    do
+    	cp -f $stratos_packs/$activemq_client_lib $stratos_extract_path/repository/components/lib/
+    done
 }
 
-function cep_conf_validate {
-    if [[ (-z $cep_path || -z $cep_port_offset) ]]; then
-	helpsetup CEP
-	exit 1
-    fi
-    if [[ ! -d $cep_artifacts_path ]]; then
-        echo "Please specify the cep_artifacts_path folder which contains cep artifacts files"
-        exit 1
-    fi
-    if [[ ! -f $cep_extension_jar ]]; then
-        echo "Please copy the cep extension jar into the same folder as this command(stratos release pack folder) and update conf/setup.conf file"
+function activemq_validate() {
+    if [[ ! -f $activemq_pack ]]; then
+        echo "Please copy the activemq zip to the stratos pack folder and update the JAR name in conf/setup.conf file"
         exit 1
     fi
 }
 
-function cc_conf_validate {
-    if [[ (-z $cc_path || -z $cc_port_offset) ]]; then
-	helpsetup CC
-	exit 1
-    fi
 
+# CC related functions
+# -------------------------------------------------------------------
+function cc_related_popup() {
+    while read -p "Please provide cloud controller ip:" cc_ip
+    do
+	if !(valid_ip $cc_ip); then
+	    echo "Please provide valid ips for CC"	 
+	else 
+            export cc_ip
+	    break 
+	fi
+    done 
+
+    while read -p "Please provide cloud controller hostname:" cc_hostname
+    do
+	if [[ -z $cc_hostname ]]; then
+	    echo "Please specify valid hostname for CC"	 
+	else 
+            export cc_hostname
+	    break 
+	fi
+    done
+
+    while read -p "Please provide cloud controller port offset:" cc_port_offset
+    do
+	if [[ -z $cc_port_offset ]]; then
+	    echo "Please specify the port offset of CC"	 
+	else 
+            export cc_port_offset
+	    break 
+	fi
+    done
+}
+
+function cc_conf_validate() {
     if [[ $ec2_provider_enabled = "false" && $openstack_provider_enabled = "false" && $vcloud_provider_enabled = "false" ]]; then
         echo "Please enable at least one of the IaaS providers in conf/setup.conf file"
         exit 1
     fi
-
     if [[ $openstack_provider_enabled = "true" ]]; then
         if [[ ( -z $openstack_identity || -z $openstack_credential || -z $openstack_jclouds_endpoint ) ]]; then
             echo "Please set openstack configuration information in conf/setup.conf file"
             exit 1
         fi
     fi
-
     if [[ $ec2_provider_enabled = "true" ]]; then
         if [[ ( -z $ec2_identity || -z $ec2_credential || -z $ec2_keypair_name ) ]]; then
             echo "Please set ec2 configuration information in conf/setup.conf file"
             exit 1
         fi
     fi
-
     if [[ $vcloud_provider_enabled = "true" ]]; then
         if [[ ( -z $vcloud_identity || -z $vcloud_credential || -z $vcloud_jclouds_endpoint ) ]]; then
             echo "Please set vcloud configuration information in conf/setup.conf file"
@@ -246,48 +200,135 @@ function cc_conf_validate {
     fi
 }
 
-function as_conf_validate {
-    if [[ (-z $as_path || -z $as_port_offset) ]]; then
-	helpsetup AS
-	exit 1
-    fi
-    if [[ -z $cc_port_offset || -z $sm_port_offset ]]; then
-        echo "Please specify the port offset of SM and/or CC"
-        exit 1
+# Setup cc
+function cc_setup() {
+    echo "Setup CC" >> $LOG
+    echo "Configuring the Cloud Controller"
+
+    cp -f ./config/all/repository/conf/cloud-controller.xml $stratos_extract_path/repository/conf/ 
+
+    export cc_path=$stratos_extract_path
+    echo "In repository/conf/cloud-controller.xml"
+    if [[ $ec2_provider_enabled = true ]]; then
+        ./ec2.sh
     fi
-    if [[ -z $sm_ip || -z $cc_ip ]]; then
-        echo "Please specify the ips of SM and/or CC"
-        exit 1
-    elif !(valid_ip $sm_ip && valid_ip $cc_ip ); then
-        echo "Please provide valid ips for SM and/or CC"
-        exit 1
+    if [[ $openstack_provider_enabled = true ]]; then
+        ./openstack.sh
     fi
-    if [[ -z $cc_hostname || -z $sm_hostname ]]; then
-	echo "Please specify valid hostname for SM and/or CC"
-	exit 1
+    if [[ $vcloud_provider_enabled = true ]]; then
+        ./vcloud.sh
     fi
+
+    pushd $stratos_extract_path
+    
+    popd 
+    echo "End configuring the Cloud Controller"
 }
 
-function sm_conf_validate {
-    if [[ (-z $sm_path || -z $sm_port_offset) ]]; then
-	helpsetup SM
-	exit 1
-    fi
-    if [[ ! -f $mysql_connector_jar ]]; then
-        echo "Please copy the mysql connector jar to the stratos release pack folder and update the JAR name in conf/setup.conf file"
-        exit 1
-    fi
-    if [[ -z $cc_port_offset || -z $as_port_offset ]]; then
-        echo "Please specify the port offset of AS and/or CC"
-        exit 1
-    fi
-    if [[ -z $sm_ip || -z $as_ip || -z $cc_ip ]]; then
-        echo "Please specify the ips of SM and/or AS and/or CC"
-        exit 1
-    elif !(valid_ip $sm_ip && valid_ip $cc_ip && valid_ip $as_ip); then
-        echo "Please provide valid ips for SM and/or AS and/or CC"
-        exit 1
+
+# AS related functions
+# -------------------------------------------------------------------
+function as_related_popup() {
+    while read -p "Please provide Auto Scalar ip:" as_ip
+    do
+	if !(valid_ip $as_ip); then
+	    echo "Please provide valid ips for AS"	 
+	else 
+            export as_ip
+	    break 
+	fi
+    done 
+
+    while read -p "Please provide Auto Scala hostname:" as_hostname
+    do
+	if [[ -z $as_hostname ]]; then
+	    echo "Please specify valid hostname for AS"	 
+	else 
+            export as_hostname
+	    break 
+	fi
+    done
+
+    while read -p "Please provide Auto Scala port offset:" as_port_offset
+    do
+	if [[ -z $as_port_offset ]]; then
+	    echo "Please specify the port offset of AS"	 
+	else 
+            export as_port_offset
+	    break 
+	fi
+    done
+}
+
+function as_conf_validate() {
+    if [[ !($profile = "default") ]]; then
+	cc_related_popup
+	sm_related_popup
+	export as_cc_https_port=$((9443 + $cc_port_offset))
+	export as_sm_https_port=$((9443 + $sm_port_offset))
+    else
+        cc_hostname=$stratos_domain
+        sm_hostname=$stratos_domain
+	export as_cc_https_port=$((9443 + $offset))
+	export as_sm_https_port=$((9443 + $offset))
     fi
+}
+
+# Setup AS 
+function as_setup() {
+    echo "Setup AS" >> $LOG
+    echo "Configuring the Auto Scalar"
+
+    cp -f ./config/all/repository/conf/autoscaler.xml $stratos_extract_path/repository/conf/
+
+    pushd $stratos_extract_path
+
+    echo "In repository/conf/autoscaler.xml"
+    sed -i "s@CC_HOSTNAME@$cc_hostname@g" repository/conf/autoscaler.xml
+    sed -i "s@CC_LISTEN_PORT@$as_cc_https_port@g" repository/conf/autoscaler.xml
+    sed -i "s@SM_HOSTNAME@$sm_hostname@g" repository/conf/autoscaler.xml
+    sed -i "s@SM_LISTEN_PORT@$as_sm_https_port@g" repository/conf/autoscaler.xml
+
+    popd
+    echo "End configuring the Auto scalar"
+}
+
+
+# SM related functions
+# -------------------------------------------------------------------
+function sm_related_popup() {
+    while read -p "Please provide Stratos Manager ip:" sm_ip
+    do
+	if !(valid_ip $sm_ip); then
+	    echo "Please provide valid ips for SM"	 
+	else 
+            export sm_ip
+	    break 
+	fi
+    done 
+
+    while read -p "Please provide Stratos Manager hostname:" sm_hostname
+    do
+	if [[ -z $sm_hostname ]]; then
+	    echo "Please specify valid hostname for SM"	 
+	else 
+            export sm_hostname
+	    break 
+	fi
+    done
+
+    while read -p "Please provide Stratos Manager port offset:" sm_port_offset
+    do
+	if [[ -z $sm_port_offset ]]; then
+	    echo "Please specify the port offset of SM"	 
+	else 
+            export sm_port_offset
+	    break 
+	fi
+    done
+}
+
+function sm_conf_validate() {
     if [[ -z $puppet_ip ]]; then
         echo "Please specify the ip of puppet master"
         exit 1
@@ -303,348 +344,219 @@ function sm_conf_validate {
         echo "Please specify the relevant puppet environment"
         exit 1
     fi
-    if [[ -z $cc_hostname || -z $as_hostname ]]; then
-	echo "Please specify valid hostname for AS and/or CC"
-	exit 1
+    if [[ ! -f $mysql_connector_jar ]]; then
+        echo "Please copy the mysql connector jar to the stratos release pack folder and update the JAR name in conf/setup.conf file"
+        exit 1
     fi
-}
-
 
-general_conf_validate
-andes_jar_validate
-if [[ $mb = "true" ]]; then
-    mb_conf_validate
-fi
-if [[ $cep = "true" ]]; then
-    cep_conf_validate
-fi
-if [[ $cc = "true" ]]; then
-    cc_conf_validate
-fi
-if [[ $as = "true" ]]; then
-    as_conf_validate
-fi
-if [[ $sm = "true" ]]; then
-    sm_conf_validate
-fi
-
-
-# Make sure the user is running as root.
-if [ "$UID" -ne "0" ]; then
-	echo ; echo "  You must be root to run $0.  (Try running 'sudo bash' first.)" ; echo 
-	exit 69
-fi
+    if [[ !($profile = "default") ]]; then
+	cc_related_popup
+	as_related_popup
+	export sm_cc_https_port=$((9443 + $cc_port_offset))
+	export sm_as_https_port=$((9443 + $as_port_offset))
+    else
+        export cc_hostname=$stratos_domain
+        export as_hostname=$stratos_domain
+	export sm_cc_https_port=$((9443 + $offset))
+	export sm_as_https_port=$((9443 + $offset))
+    fi
+    export sm_https_port=$((9443 + $offset))
+}
 
-if [[ ! -d $log_path ]]; then
-    mkdir -p $log_path
-fi
+# Setup SM
+function sm_setup() {
+    echo "Setup SM" >> $LOG
+    echo "Configuring Stratos Manager"
 
+    cp -f ./config/all/repository/conf/cartridge-config.properties $stratos_extract_path/repository/conf/
+    cp -f ./config/all/repository/conf/datasources/master-datasources.xml $stratos_extract_path/repository/conf/datasources/
+    cp -f $mysql_connector_jar $stratos_extract_path/repository/components/lib/
 
-echo ""
-echo "For all the questions asked while during executing the script please just press the enter button"
-echo ""
+    pushd $stratos_extract_path
 
-if [[ $mb = "true" ]]; then
-    if [[ ! -d $mb_path ]]; then
-        echo "Extracting Message Broker"
-        unzip -q $mb_pack_path -d $stratos_path
-    fi
-fi
-if [[ $cep = "true" ]]; then
-    if [[ ! -d $cep_path ]]; then
-        echo "Extracting Complex Event Processor"
-        unzip -q $cep_pack_path -d $stratos_path
-    fi
-fi
-if [[ $cc = "true" ]]; then
-    if [[ ! -d $cc_path ]]; then
-        echo "Extracting Cloud Controller"
-        unzip -q $cc_pack_path -d $stratos_path
-    fi
-fi
-if [[ $as = "true" ]]; then
-    if [[ ! -d $as_path ]]; then
-        echo "Extracting Autoscaler"
-        unzip -q $as_pack_path -d $stratos_path
-    fi
-fi
-if [[ $sm = "true" ]]; then
-    if [[ ! -d $resource_path ]]; then
-        cp -rf ./resources $stratos_path
-    fi
-    if [[ ! -d $sm_path ]]; then
-        echo "Extracting Stratos Manager"
-        unzip -q $sm_pack_path -d $stratos_path
-    fi
-fi
+    echo "In repository/conf/cartridge-config.properties"
+    sed -i "s@CC_HOSTNAME:CC_HTTPS_PORT@$cc_hostname:$sm_cc_https_port@g" repository/conf/cartridge-config.properties
+    sed -i "s@AS_HOSTNAME:AS_HTTPS_PORT@$as_hostname:$sm_as_https_port@g" repository/conf/cartridge-config.properties
+    sed -i "s@PUPPET_IP@$puppet_ip@g" repository/conf/cartridge-config.properties
+    sed -i "s@PUPPET_HOSTNAME@$puppet_hostname@g" repository/conf/cartridge-config.properties
+    sed -i "s@PUPPET_ENV@$puppet_environment@g" repository/conf/cartridge-config.properties
 
+    echo "In repository/conf/datasources/master-datasources.xml"
+    sed -i "s@USERSTORE_DB_HOSTNAME@$userstore_db_hostname@g" repository/conf/datasources/master-datasources.xml
+    sed -i "s@USERSTORE_DB_PORT@$userstore_db_port@g" repository/conf/datasources/master-datasources.xml
+    sed -i "s@USERSTORE_DB_SCHEMA@$userstore_db_schema@g" repository/conf/datasources/master-datasources.xml
+    sed -i "s@USERSTORE_DB_USER@$userstore_db_user@g" repository/conf/datasources/master-datasources.xml
+    sed -i "s@USERSTORE_DB_PASS@$userstore_db_pass@g" repository/conf/datasources/master-datasources.xml
 
+    popd
 
-# ------------------------------------------------
-# Setup MB
-# ------------------------------------------------
-function mb_setup {
-    echo "Setup MB" >> $LOG
-    echo "Configuring the Message Broker"
+    # Database Configuration
+    # -----------------------------------------------
+    echo "Create and configure MySql Databases" >> $LOG 
+    echo "Creating userstore database"
 
-    pushd $mb_path
+    pushd $resource_path
+    sed -i "s@USERSTORE_DB_SCHEMA@$userstore_db_schema@g" mysql.sql
 
-    echo "In repository/conf/carbon.xml"
-    cp -f repository/conf/carbon.xml repository/conf/carbon.xml.orig
-    cat repository/conf/carbon.xml.orig | sed -e "s@<Offset>0</Offset>@<Offset>${mb_port_offset}</Offset>@g" > repository/conf/carbon.xml
+    popd
 
-    echo "End configuring the Message Broker"
-    popd #mb_path
+    mysql -u$userstore_db_user -p$userstore_db_pass < $resource_path/mysql.sql
+    echo "End configuring the SM"
 }
 
-if [[ $mb = "true" ]]; then
-    mb_setup
-fi
 
-# ------------------------------------------------
 # Setup CEP
-# ------------------------------------------------
-function cep_setup {
+function cep_setup() {
     echo "Setup CEP" >> $LOG
     echo "Configuring the Complex Event Processor"
 
-    cp -f ./config/cep/repository/conf/jndi.properties $cep_path/repository/conf/
-    cp -f $cep_extension_jar $cep_path/repository/components/lib/
-    cp -f $andes_client_jar $cep_path/repository/components/dropins/
-    cp -f $cep_artifacts_path/eventbuilders/*.xml $cep_path/repository/deployment/server/eventbuilders/
-    cp -f $cep_artifacts_path/inputeventadaptors/*.xml $cep_path/repository/deployment/server/inputeventadaptors/
-    cp -f $cep_artifacts_path/outputeventadaptors/*.xml $cep_path/repository/deployment/server/outputeventadaptors/
-    cp -f $cep_artifacts_path/executionplans/*.xml $cep_path/repository/deployment/server/executionplans/
-    cp -f $cep_artifacts_path/eventformatters/*.xml $cep_path/repository/deployment/server/eventformatters/
-    cp -f $cep_artifacts_path/streamdefinitions/*.xml $cep_path/repository/conf/
-
-    pushd $cep_path
-
-    echo "In repository/conf/carbon.xml"
-    cp -f repository/conf/carbon.xml repository/conf/carbon.xml.orig
-    cat repository/conf/carbon.xml.orig | sed -e "s@<Offset>0</Offset>@<Offset>${cep_port_offset}</Offset>@g" > repository/conf/carbon.xml
-
-    echo "In repository/conf/jndi.properties"
-    cp -f repository/conf/jndi.properties repository/conf/jndi.properties.orig
-    cat repository/conf/jndi.properties.orig | sed -e "s@MB_HOSTNAME:MB_LISTEN_PORT@$mb_hostname:$cep_mb_listen_port@g" > repository/conf/jndi.properties
+    pushd $stratos_extract_path
 
     echo "In outputeventadaptors"
-    cp -f repository/deployment/server/outputeventadaptors/JMSOutputAdaptor.xml repository/deployment/server/outputeventadaptors/JMSOutputAdaptor.xml.orig
-    cat repository/deployment/server/outputeventadaptors/JMSOutputAdaptor.xml.orig | sed -e "s@CEP_HOME@$cep_path@g" > repository/deployment/server/outputeventadaptors/JMSOutputAdaptor.xml
 
-    echo "In repository/conf/siddhi/siddhi.extension"
-    cp -f repository/conf/siddhi/siddhi.extension repository/conf/siddhi/siddhi.extension.orig
-    echo "org.apache.stratos.cep.extension.GradientFinderWindowProcessor" >> repository/conf/siddhi/siddhi.extension.orig
-    echo "org.apache.stratos.cep.extension.SecondDerivativeFinderWindowProcessor" >> repository/conf/siddhi/siddhi.extension.orig
-    echo "org.apache.stratos.cep.extension.FaultHandlingWindowProcessor" >> repository/conf/siddhi/siddhi.extension.orig
-    mv -f repository/conf/siddhi/siddhi.extension.orig repository/conf/siddhi/siddhi.extension
+    sed -i "s@CEP_HOME@$stratos_extract_path@g" repository/deployment/server/outputeventadaptors/JMSOutputAdaptor.xml
+    sed -i "s@MB_HOSTNAME:MB_LISTEN_PORT@$mb_ip:$mb_port@g" repository/deployment/server/outputeventadaptors/JMSOutputAdaptor.xml
 
     echo "End configuring the Complex Event Processor"
-    popd #cep_path
+    popd
 }
-if [[ $cep = "true" ]]; then
-    cep_setup
-fi
 
 
 # ------------------------------------------------
-# Setup CC
+# Execution 
 # ------------------------------------------------
-function cc_setup {
-    echo "Setup CC" >> $LOG
-    echo "Configuring the Cloud Controller"
-
-    echo "Creating payload directory ... " >> $LOG
-    if [[ ! -d $cc_path/repository/resources/payload ]]; then
-        mkdir -p $cc_path/repository/resources/payload
-    fi
-
-    cp -f ./config/cc/repository/conf/cloud-controller.xml $cc_path/repository/conf/
-    cp -f ./config/cc/repository/conf/carbon.xml $cc_path/repository/conf/
-    cp -f ./config/cc/repository/conf/jndi.properties $cc_path/repository/conf/
-    cp -f $andes_client_jar $cc_path/repository/components/dropins/
-
-    echo "In repository/conf/cloud-controller.xml"
-    if [[ $ec2_provider_enabled = true ]]; then
-        ./ec2.sh
-    fi
-    if [[ $openstack_provider_enabled = true ]]; then
-        ./openstack.sh
-    fi
-    if [[ $vcloud_provider_enabled = true ]]; then
-        ./vcloud.sh
-    fi
-
-    pushd $cc_path
-    
-    cp -f repository/conf/cloud-controller.xml repository/conf/cloud-controller.xml.orig
-    cat repository/conf/cloud-controller.xml.orig | sed -e "s@MB_HOSTNAME:MB_LISTEN_PORT@$mb_hostname:$cc_mb_listen_port@g" > repository/conf/cloud-controller.xml
 
-    echo "In repository/conf/carbon.xml"
-    cp -f repository/conf/carbon.xml repository/conf/carbon.xml.orig
-    cat repository/conf/carbon.xml.orig | sed -e "s@CC_PORT_OFFSET@$cc_port_offset@g" > repository/conf/carbon.xml
-
-    echo "In repository/conf/jndi.properties"
-    cp -f repository/conf/jndi.properties repository/conf/jndi.properties.orig
-    cat repository/conf/jndi.properties.orig | sed -e "s@MB_HOSTNAME:MB_LISTEN_PORT@$mb_hostname:$cc_mb_listen_port@g" > repository/conf/jndi.properties
-
-    popd #cc_path
-    echo "End configuring the Cloud Controller"
-}
+while getopts p:s opts
+do
+  case $opts in
+    p)
+        profile_list=${OPTARG}
+        ;;
+    s)
+        auto_start_servers="true"
+        ;;
+    \?)
+        help
+        exit 1
+        ;;
+  esac
+done
 
-if [[ $cc = "true" ]]; then
-   cc_setup
+profile_list=`echo $profile_list | sed 's/^ *//g' | sed 's/ *$//g'`
+if [[ !(-z $profile_list || $profile_list = "") ]]; then
+    arr=$(echo $profile_list | tr " " "\n")
+echo $arr
+    for x in $arr
+    do
+    	if [[ $x = "default" ]]; then
+            profile="default"
+    	elif [[ $x = "cc" ]]; then
+            profile="cc"
+        elif [[ $x = "as" ]]; then
+            profile="as"
+        elif [[ $x = "sm" ]]; then
+            profile="sm"
+        else
+            echo "Invalid profile."
+            exit 1
+    	fi
+    done
+    echo "You have selected the profile : $profile"
+else 
+    echo "You have not provided a profile : default profile will be selected."
 fi
 
-# ------------------------------------------------
-# Setup AS
-# ------------------------------------------------   
-function as_setup {
-    echo "Setup AS" >> $LOG
-    echo "Configuring the Auto Scalar"
-
-    cp -f ./config/as/repository/conf/carbon.xml $as_path/repository/conf/
-    cp -f ./config/as/repository/conf/jndi.properties $as_path/repository/conf/
-    cp -f ./config/as/repository/conf/autoscaler.xml $as_path/repository/conf/
-    cp -f $andes_client_jar $as_path/repository/components/dropins/
-
-    pushd $as_path
-
-    echo "In repository/conf/carbon.xml"
-    cp -f repository/conf/carbon.xml repository/conf/carbon.xml.orig
-    cat repository/conf/carbon.xml.orig | sed -e "s@AS_PORT_OFFSET@$as_port_offset@g" > repository/conf/carbon.xml
-
-    echo "In repository/conf/jndi.properties"
-    cp -f repository/conf/jndi.properties repository/conf/jndi.properties.orig
-    cat repository/conf/jndi.properties.orig | sed -e "s@MB_HOSTNAME:MB_LISTEN_PORT@$mb_hostname:$as_mb_listen_port@g" > repository/conf/jndi.properties
-
-    echo "In repository/conf/autoscaler.xml"
-    cp -f repository/conf/autoscaler.xml repository/conf/autoscaler.xml.orig
-    cat repository/conf/autoscaler.xml.orig | sed -e "s@CC_HOSTNAME@$cc_hostname@g" > repository/conf/autoscaler.xml
 
-    cp -f repository/conf/autoscaler.xml repository/conf/autoscaler.xml.orig
-    cat repository/conf/autoscaler.xml.orig | sed -e "s@CC_LISTEN_PORT@$as_cc_https_port@g" > repository/conf/autoscaler.xml
-
-    cp -f repository/conf/autoscaler.xml repository/conf/autoscaler.xml.orig
-    cat repository/conf/autoscaler.xml.orig | sed -e "s@SM_HOSTNAME@$sm_hostname@g" > repository/conf/autoscaler.xml
-
-    cp -f repository/conf/autoscaler.xml repository/conf/autoscaler.xml.orig
-    cat repository/conf/autoscaler.xml.orig | sed -e "s@SM_LISTEN_PORT@$as_sm_https_port@g" > repository/conf/autoscaler.xml
-
-    popd #as_path
-    echo "End configuring the Auto smalar"
-}
-
-if [[ $as = "true" ]]; then
-    as_setup
+if [[ $host_user == "" ]]; then
+    echo "user provided in conf/setup.conf is null. Please provide a user"
+    exit 1
 fi
 
+echo "user provided in conf/setup.conf is $host_user. If you want to provide some other user name please specify it at the prompt."
+echo "If you want to continue with $host_user just press enter to continue"
+read username
+if [[ $username != "" ]]; then
+    host_user=$username
+fi
+user=`id $host_user`
+if [[ $? = 1 ]]; then
+    echo "User $host_user does not exist. The system will create it."
+    adduser --home /home/$host_user $host_user
+fi
 
+export $host_user
 
-# ------------------------------------------------
-# Setup SM
-# ------------------------------------------------
-function sm_setup {
-    echo "Setup SM" >> $LOG
-    echo "Configuring Stratos Manager"
-
-    cp -f ./config/sm/repository/conf/carbon.xml $sm_path/repository/conf/
-    cp -f ./config/sm/repository/conf/jndi.properties $sm_path/repository/conf/
-    cp -f ./config/sm/repository/conf/cartridge-config.properties $sm_path/repository/conf/
-    cp -f ./config/sm/repository/conf/datasources/master-datasources.xml $sm_path/repository/conf/datasources/
-    cp -f $mysql_connector_jar $sm_path/repository/components/lib/
-    cp -f $andes_client_jar $sm_path/repository/components/dropins/
-
-    pushd $sm_path
-
-    echo "In repository/conf/carbon.xml"
-    cp -f repository/conf/carbon.xml repository/conf/carbon.xml.orig
-    cat repository/conf/carbon.xml.orig | sed -e "s@SC_PORT_OFFSET@$sm_port_offset@g" > repository/conf/carbon.xml
-
-    echo "In repository/conf/jndi.properties"
-    cp -f repository/conf/jndi.properties repository/conf/jndi.properties.orig
-    cat repository/conf/jndi.properties.orig | sed -e "s@MB_HOSTNAME:MB_LISTEN_PORT@$mb_hostname:$sm_mb_listen_port@g" > repository/conf/jndi.properties
-
-    echo "In repository/conf/cartridge-config.properties" >> $LOG
-    cp -f repository/conf/cartridge-config.properties repository/conf/cartridge-config.properties.orig
-    cat repository/conf/cartridge-config.properties.orig | sed -e "s@CC_HOSTNAME:CC_HTTPS_PORT@$cc_hostname:$sm_cc_https_port@g" > repository/conf/cartridge-config.properties
-
-    cp -f repository/conf/cartridge-config.properties repository/conf/cartridge-config.properties.orig
-    cat repository/conf/cartridge-config.properties.orig | sed -e "s@AS_HOSTNAME:AS_HTTPS_PORT@$as_hostname:$sm_as_https_port@g" > repository/conf/cartridge-config.properties
-
-    cp -f repository/conf/cartridge-config.properties repository/conf/cartridge-config.properties.orig
-    cat repository/conf/cartridge-config.properties.orig | sed -e "s@PUPPET_IP@$sm_puppet_ip@g" > repository/conf/cartridge-config.properties
-
-    cp -f repository/conf/cartridge-config.properties repository/conf/cartridge-config.properties.orig
-    cat repository/conf/cartridge-config.properties.orig | sed -e "s@PUPPET_HOSTNAME@$sm_puppet_hostname@g" > repository/conf/cartridge-config.properties
-
-    cp -f repository/conf/cartridge-config.properties repository/conf/cartridge-config.properties.orig
-    cat repository/conf/cartridge-config.properties.orig | sed -e "s@PUPPET_ENV@$sm_puppet_environment@g" > repository/conf/cartridge-config.properties
-
-    echo "In repository/conf/datasources/master-datasources.xml" >> $LOG
-    cp -f repository/conf/datasources/master-datasources.xml repository/conf/datasources/master-datasources.xml.orig
-    cat repository/conf/datasources/master-datasources.xml.orig | sed -e "s@USERSTORE_DB_HOSTNAME@$userstore_db_hostname@g" > repository/conf/datasources/master-datasources.xml
-
-    cp -f repository/conf/datasources/master-datasources.xml repository/conf/datasources/master-datasources.xml.orig
-    cat repository/conf/datasources/master-datasources.xml.orig | sed -e "s@USERSTORE_DB_PORT@$userstore_db_port@g" > repository/conf/datasources/master-datasources.xml
-
-    cp -f repository/conf/datasources/master-datasources.xml repository/conf/datasources/master-datasources.xml.orig
-    cat repository/conf/datasources/master-datasources.xml.orig | sed -e "s@USERSTORE_DB_SCHEMA@$userstore_db_schema@g" > repository/conf/datasources/master-datasources.xml
-
-    cp -f repository/conf/datasources/master-datasources.xml repository/conf/datasources/master-datasources.xml.orig
-    cat repository/conf/datasources/master-datasources.xml.orig | sed -e "s@USERSTORE_DB_USER@$userstore_db_user@g" > repository/conf/datasources/master-datasources.xml
-
-    cp -f repository/conf/datasources/master-datasources.xml repository/conf/datasources/master-datasources.xml.orig
-    cat repository/conf/datasources/master-datasources.xml.orig | sed -e "s@USERSTORE_DB_PASS@$userstore_db_pass@g" > repository/conf/datasources/master-datasources.xml
-
-    popd # sm_path
-
+# Make sure the user is running as root.
+if [ "$UID" -ne "0" ]; then
+	echo ; echo "  You must be root to run $0.  (Try running 'sudo bash' first.)" ; echo 
+	exit 69
+fi
 
-    # Database Configuration
-    # -----------------------------------------------
-    echo "Create and configure MySql Databases" >> $LOG 
+general_conf_validate
+if [[ $profile = "cc" ]]; then
+    cc_conf_validate
+elif [[ $profile = "as" ]]; then
+    as_conf_validate
+elif [[ $profile = "sm" ]]; then
+    sm_conf_validate
+else
+    echo "In default profile CEP will be configured."
+    activemq_validate
+    cc_conf_validate
+    as_conf_validate
+    sm_conf_validate 
+fi
 
-    echo "Creating userstore database"
+if [[ ! -d $log_path ]]; then
+    mkdir -p $log_path
+fi
 
-    pushd $resource_path
-    cp -f mysql.sql mysql.sql.orig
-    cat mysql.sql.orig | sed -e "s@USERSTORE_DB_SCHEMA@$userstore_db_schema@g" > mysql.sql
 
-    popd # resource_path
+echo ""
+echo "For all the questions asked while during executing the script please just press the enter button"
+echo ""
 
-    mysql -u$userstore_db_user -p$userstore_db_pass < $resource_path/mysql.sql
-    
-    #Copy https://svn.wso2.org/repos/wso2/scratch/hosting/build/tropos/resources/append_zone_file.sh into /opt/scripts folder
-    if [[ ! -d $stratos_path/scripts ]]; then
-        mkdir -p $stratos_path/scripts
-    fi
-    cp -f ./scripts/add_entry_zone_file.sh $stratos_path/scripts/add_entry_zone_file.sh
-    cp -f ./scripts/remove_entry_zone_file.sh $stratos_path/scripts/remove_entry_zone_file.sh
 
+# Extract stratos zip file
+if [[ !(-d $stratos_extract_path) ]]; then
+    echo "Extracting Apache Stratos"
+    unzip -q $stratos_pack_zip -d $stratos_path
+    mv -f $stratos_path/apache-stratos-4.0.0-SNAPSHOT $stratos_extract_path
+fi
 
-    echo "End configuring the SM"
-}
+if [[ ($profile = "default" && $config_mb = "true") ]]; then
+    echo "Extracting ActiveMQ"
+    tar -xzf $activemq_pack -C $stratos_path
+fi
 
-if [[ $sm = "true" ]]; then
+general_setup
+if [[ $profile = "cc" ]]; then
+    cc_setup
+elif [[ $profile = "as" ]]; then
+    as_setup
+elif [[ $profile = "sm" ]]; then
+    sm_setup
+else
+    cc_setup
+    as_setup
     sm_setup
+    cep_setup   
 fi
 
- 
 # ------------------------------------------------
 # Mapping domain/host names 
 # ------------------------------------------------
 
 cp -f /etc/hosts hosts.tmp
 
-
-echo "$mb_ip $mb_hostname	# message broker hostname"	>> hosts.tmp
-
-if [[ $sm = "true" || $as = "true" ]]; then
+echo "$host_ip $sm_hostname	# stratos domain"	>> hosts.tmp
+ 
+if [[ $profile = "sm" || $profile = "as" ]]; then
     echo "$sm_ip $sm_hostname	# stratos domain"	>> hosts.tmp
     echo "$cc_ip $cc_hostname	# cloud controller hostname"	>> hosts.tmp
 fi
 
-if [[ $sm = "true" ]]; then
+if [[ $profile = "sm" ]]; then
     echo "$as_ip $as_hostname	# auto scalar hostname"	>> hosts.tmp
 fi
 
@@ -659,9 +571,11 @@ chown $host_user:$host_user $stratos_path -R
 
 echo "Apache Stratos setup has successfully completed"
 
-read -p "Do you want to start the servers [y/n]? " answer
-if [[ $answer != y ]] ; then
-   exit 1
+if [[ $auto_start_servers != "true" ]]; then
+    read -p "Do you want to start the servers [y/n]? " answer
+    if [[ $answer != y ]] ; then
+        exit 1
+    fi
 fi
 
 echo "Starting the servers" >> $LOG
@@ -672,14 +586,11 @@ chown -R $host_user.$host_user $log_path
 chmod -R 777 $log_path
 
 export setup_dir=$PWD
-su - $host_user -c "source $setup_dir/conf/setup.conf;$setup_dir/start-servers.sh -p\"$product_list\" >> $LOG"
+su - $host_user -c "source $setup_path/conf/setup.conf;$setup_path/start-servers.sh -p\"$profile\" >> $LOG"
 
 echo "Servers started. Please look at $LOG file for server startup details"
-if [[ $sm == "true" ]]; then
+if [[ $profile == "default" || $profile == "sm" ]]; then
     echo "**************************************************************"
     echo "Management Console : https://$stratos_domain:$sm_https_port/console"
     echo "**************************************************************"
 fi
-
-
-

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7e4b3aee/tools/stratos-installer/start-servers.sh
----------------------------------------------------------------------
diff --git a/tools/stratos-installer/start-servers.sh b/tools/stratos-installer/start-servers.sh
index c22eeea..78edf65 100755
--- a/tools/stratos-installer/start-servers.sh
+++ b/tools/stratos-installer/start-servers.sh
@@ -29,18 +29,22 @@ product_list=$1
 export LOG=$log_path/stratos.log
 SLEEP=40
 
+profile="default"
+
 if [[ -f ./conf/setup.conf ]]; then
     source "./conf/setup.conf"
+    echo "source it"
 fi
 
+
 function help {
     echo ""
     echo "Give one or more of the servers to start on this machine. The available servers are"
-    echo "mb, cc, as, sm, cep, all. 'all' means you need to start all servers."
+    echo "cc, as, sm, default. 'default' means you need to start all servers."
     echo "usage:"
-    echo "start-servers.sh -p\"<product list>\""
+    echo "start-servers.sh -p\"<profile>\""
     echo "eg."
-    echo "start-servers.sh -p\"cc sm\""
+    echo "start-servers.sh -p\"cc\""
     echo ""
 }
 
@@ -48,96 +52,45 @@ while getopts p: opts
 do
   case $opts in
     p)
-        product_list=${OPTARG}
-        echo $product_list
+        profile_list=${OPTARG}
         ;;
-    *)
+    \?)
         help
         exit 1
         ;;
   esac
 done
-arr=$(echo $product_list | tr ";" "\n")
+
+
+arr=$(echo $profile_list | tr " " "\n")
 
 for x in $arr
 do
-    if [[ $x = "mb" ]]; then
-        mb="true"
-    fi
-    if [[ $x = "cep" ]]; then
-        cep="true"
-    fi
     if [[ $x = "cc" ]]; then
-        cc="true"
-    fi
-    if [[ $x = "as" ]]; then
-        as="true"
-    fi
-    if [[ $x = "sm" ]]; then
-        sm="true"
-    fi
-    if [[ $x = "all" ]]; then
-	mb="true"
-        cc="true"
-        as="true"
-        sm="true"
-        cep="true"
+        profile="cc"
+    elif [[ $x = "as" ]]; then
+        profile="as"
+    elif [[ $x = "sm" ]]; then
+        profile="sm"
+    else
+        echo "Inavlid profile : 'default' profile will be selected."
+        profile="default"
     fi
 done
-product_list=`echo $product_list | sed 's/^ *//g' | sed 's/ *$//g'`
-if [[ -z $product_list || $product_list = "" ]]; then
-    help
-    exit 1
-fi
-
-if [[ $mb = "true" ]]; then
-    echo ${mb_path}
-
-    echo "Starting MB server ..." >> $LOG
-    nohup ${mb_path}/bin/wso2server.sh &
-    echo "MB server started" >> $LOG
-    sleep $SLEEP
-    sleep $SLEEP
-fi
 
-if [[ $cep = "true" ]]; then
-    echo ${cep_path}
-
-    echo "Starting CEP server ..." >> $LOG
-    nohup ${cep_path}/bin/wso2server.sh &
-    echo "CEP server started" >> $LOG
-    sleep $SLEEP
-    sleep $SLEEP
-fi
-
-if [[ $cc = "true" ]]; then
-    echo ${cc_path}
-
-    echo "Starting CC server ..." >> $LOG
-    nohup ${cc_path}/bin/stratos.sh &
-    echo "CC server started" >> $LOG
+if [[ $profile = "default" ]]; then
+    echo "Starting ActiveMQ server ..." >> $LOG
+    $activemq_path/bin/activemq start
+    echo "ActiveMQ server started" >> $LOG
     sleep $SLEEP
     sleep $SLEEP
 fi
 
-if [[ $as = "true" ]]; then
-    echo ${as_path}
-
-    echo "Starting Auto Scalar server ..." >> $LOG
-    nohup ${as_path}/bin/stratos.sh &
-    echo "Auto Scalar server started" >> $LOG
-    sleep $SLEEP
-fi
-
-
-if [[ $sm = "true" ]]; then  
-    echo ${sm_path}
-
-    echo "Starting SM server ..." >> $LOG
-    nohup ${sm_path}/bin/stratos.sh &
-    echo "SM server started" >> $LOG
-    sleep $SLEEP
-
-fi
+echo "Starting Stratos server ..." >> $LOG
+echo "$stratos_extract_path/bin/stratos.sh -Dprofile=$profile start"
+$stratos_extract_path/bin/stratos.sh -Dprofile=$profile start
+echo "Stratos server started" >> $LOG
+sleep $SLEEP
+sleep $SLEEP
 
 

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7e4b3aee/tools/stratos-installer/stratos-clean.sh
----------------------------------------------------------------------
diff --git a/tools/stratos-installer/stratos-clean.sh b/tools/stratos-installer/stratos-clean.sh
deleted file mode 100755
index 261dee7..0000000
--- a/tools/stratos-installer/stratos-clean.sh
+++ /dev/null
@@ -1,104 +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 is for cleaning the host machine where one or more of the Stratos servers are run.
-# ----------------------------------------------------------------------------
-
-source "./conf/stratos-setup.conf"
-
-if [ "$UID" -ne "0" ]; then
-	echo ; echo "  You must be root to run $0.  (Try running 'sudo bash' first.)" ; echo 
-	exit 69
-fi
-
-function help {
-    echo ""
-    echo "Clean the host machine where one or more of the Stratos2 servers are run."
-    echo "usage:"
-    echo "stratos-clean.sh -u <mysql username> -p <mysql password>"
-    echo ""
-}
-
-while getopts u:p: opts
-do
-  case $opts in
-    u)
-        mysql_user=${OPTARG}
-        ;;
-    p)
-        mysql_pass=${OPTARG}
-        ;;
-    *)
-        help
-        #exit 1
-        ;;
-  esac
-done
-
-function helpclean {
-    echo ""
-    echo "Enter DB credentials if you need to clear Stratos DB"
-    echo "usage:"
-    echo "clean.sh -u <mysql username> -p <mysql password>"
-    echo ""
-}
-
-function clean_validate {
-    if [ -z $stratos_path ]; then
-        echo "stratos_path is not set"
-        exit 1
-    fi
-    if [ -z $log_path ]; then
-        echo "log_path is not set"
-        exit 1
-    fi
-}
-
-clean_validate
-if [[ ( -n $mysql_user && -n $mysql_pass ) ]]; then
-	read -p "Please confirm that you want to remove stratos databases, servers and logs [y/n] " answer
-	if [[ $answer != y ]] ; then
-    		exit 1
-	fi
-fi
-echo 'Stopping all java processes'
-killall java
-echo 'Waiting for applications to exit'
-sleep 15
-
-if [[ ( -n $mysql_user && -n $mysql_pass ) ]]; then
-   echo 'Removing userstore database'
-   mysql -u $mysql_user -p$mysql_pass -e "DROP DATABASE IF EXISTS $userstore_db_schema;"
-fi
-
-if [[ -d $stratos_path/scripts ]]; then
-   echo 'Removing scripts'
-   rm -rf $stratos_path/scripts
-fi
-
-if [[ -d $stratos_path ]]; then
-   echo 'Removing Stratos'
-   rm -rf $stratos_path/*
-fi
-
-echo 'Removing logs'
-rm -rf $log_path/*

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7e4b3aee/tools/stratos-installer/stratos-db-clean.sh
----------------------------------------------------------------------
diff --git a/tools/stratos-installer/stratos-db-clean.sh b/tools/stratos-installer/stratos-db-clean.sh
deleted file mode 100755
index 74fec29..0000000
--- a/tools/stratos-installer/stratos-db-clean.sh
+++ /dev/null
@@ -1,24 +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.
-#
-#
-# cleans up databases
-mysql -uroot -proot -e "DROP DATABASE IF EXISTS stratos_foundation;"
-mysql -uroot -proot -e "DROP DATABASE IF EXISTS userstore;"
-

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7e4b3aee/tools/stratos-installer/stratos-ec2.sh
----------------------------------------------------------------------
diff --git a/tools/stratos-installer/stratos-ec2.sh b/tools/stratos-installer/stratos-ec2.sh
deleted file mode 100755
index 7e39a80..0000000
--- a/tools/stratos-installer/stratos-ec2.sh
+++ /dev/null
@@ -1,56 +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 is invoked by setup.sh for configuring Amazon EC2 IaaS information.
-# ----------------------------------------------------------------------------
-
-# Die on any error:
-set -e
-
-SLEEP=60
-export LOG=$log_path/stratos-ec2.log
-
-source "./conf/stratos-setup.conf"
-
-if [[ ! -d $log_path ]]; then
-    mkdir -p $log_path
-fi
-
-pushd $stratos_extract_path
-
-echo "Set EC2 provider specific info in repository/conf/cloud-controller.xml" >> $LOG
-
-sed -i "s@EC2_PROVIDER_START@@g"  repository/conf/cloud-controller.xml
-sed -i "s@EC2_IDENTITY@$ec2_identity@g" repository/conf/cloud-controller.xml
-sed -i "s@EC2_CREDENTIAL@$ec2_credential@g" repository/conf/cloud-controller.xml
-sed -i "s@EC2_OWNER_ID@$ec2_owner_id@g" repository/conf/cloud-controller.xml
-sed -i "s@EC2_AVAILABILITY_ZONE@$ec2_availability_zone@g" repository/conf/cloud-controller.xml
-sed -i "s@EC2_SECURITY_GROUPS@$ec2_security_groups@g" repository/conf/cloud-controller.xml
-sed -i "s@EC2_KEYPAIR@$ec2_keypair_name@g" repository/conf/cloud-controller.xml
-sed -i "s@EC2_PROVIDER_END@@g" repository/conf/cloud-controller.xml
-sed -i "s@OPENSTACK_PROVIDER_START@!--@g" repository/conf/cloud-controller.xml
-sed -i "s@OPENSTACK_PROVIDER_END@--@g" repository/conf/cloud-controller.xml
-sed -i "s@VCLOUD_PROVIDER_START@!--@g" repository/conf/cloud-controller.xml
-sed -i "s@VCLOUD_PROVIDER_END@--@g" repository/conf/cloud-controller.xml
-
-popd
-

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7e4b3aee/tools/stratos-installer/stratos-openstack.sh
----------------------------------------------------------------------
diff --git a/tools/stratos-installer/stratos-openstack.sh b/tools/stratos-installer/stratos-openstack.sh
deleted file mode 100755
index 925333c..0000000
--- a/tools/stratos-installer/stratos-openstack.sh
+++ /dev/null
@@ -1,52 +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 is invoked by setup.sh for configuring OpenStack IaaS information.
-# ----------------------------------------------------------------------------
-
-# Die on any error:
-set -e
-
-SLEEP=60
-export LOG=$log_path/stratos-openstack.log
-
-source "./conf/stratos-setup.conf"
-
-if [[ ! -d $log_path ]]; then
-    mkdir -p $log_path
-fi
-
-pushd $stratos_extract_path
-
-echo "Set OpenStack provider specific info in repository/conf/cloud-controller.xml" >> $LOG
-
-sed -i "s@OPENSTACK_PROVIDER_START@@g" repository/conf/cloud-controller.xml
-sed -i "s@OPENSTACK_IDENTITY@$openstack_identity@g"  repository/conf/cloud-controller.xml
-sed -i "s@OPENSTACK_CREDENTIAL@$openstack_credential@g"  repository/conf/cloud-controller.xml
-sed -i "s@OPENSTACK_ENDPOINT@$openstack_jclouds_endpoint@g"  repository/conf/cloud-controller.xml
-sed -i "s@OPENSTACK_PROVIDER_END@@g"  repository/conf/cloud-controller.xml
-sed -i "s@EC2_PROVIDER_START@!--@g"  repository/conf/cloud-controller.xml
-sed -i "s@EC2_PROVIDER_END@--@g"  repository/conf/cloud-controller.xml
-sed -i "s@VCLOUD_PROVIDER_START@!--@g"  repository/conf/cloud-controller.xml
-sed -i "s@VCLOUD_PROVIDER_END@--@g"  repository/conf/cloud-controller.xml
-
-popd