You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by im...@apache.org on 2013/12/02 13:18:00 UTC

git commit: Update Stratos Installer to support Message Broker

Updated Branches:
  refs/heads/master cb38cc92d -> 1945514c2


Update Stratos Installer to support Message Broker

Signed-off-by: Imesh Gunaratne <im...@apache.org>


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

Branch: refs/heads/master
Commit: 1945514c2cb4fabcc21115bad8a9fac9e75c160d
Parents: cb38cc9
Author: Dinesh Bandara <di...@wso2.com>
Authored: Mon Dec 2 17:24:28 2013 +0530
Committer: Imesh Gunaratne <im...@apache.org>
Committed: Mon Dec 2 17:47:37 2013 +0530

----------------------------------------------------------------------
 tools/stratos-installer/conf/setup.conf  |  7 ++-
 tools/stratos-installer/setup.sh         | 65 ++++++++++++++++++++-------
 tools/stratos-installer/start-servers.sh | 27 ++++++-----
 3 files changed, 69 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/1945514c/tools/stratos-installer/conf/setup.conf
----------------------------------------------------------------------
diff --git a/tools/stratos-installer/conf/setup.conf b/tools/stratos-installer/conf/setup.conf
index 000dc87..0315940 100644
--- a/tools/stratos-installer/conf/setup.conf
+++ b/tools/stratos-installer/conf/setup.conf
@@ -49,8 +49,13 @@ export script_path=$setup_path/scripts
 
 # MB configuration
 # ----------------------------------------------------------------------------
+export mb_path=$stratos_path/"wso2mb-2.1.0"
+export mb_pack=$stratos_pack_path/"wso2mb-2.1.0.zip"
+
 export mb_hostname=mb.$stratos_domain
-export mb_listen_port="5677"
+export mb_port_offset=5
+export mb_listen_port=$((5672 + $mb_port_offset))
+export mb_ip="mb-ip" # Machine ip on which mb run
 
 
 # SC configuration

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/1945514c/tools/stratos-installer/setup.sh
----------------------------------------------------------------------
diff --git a/tools/stratos-installer/setup.sh b/tools/stratos-installer/setup.sh
index 08df083..6b2b494 100755
--- a/tools/stratos-installer/setup.sh
+++ b/tools/stratos-installer/setup.sh
@@ -31,20 +31,22 @@ SLEEP=60
 source "./conf/setup.conf"
 export LOG=$log_path/stratos-setup.log
 
+mb="false"
 cc="false"
 elb="false"
 agent="false"
 sc="false"
 #bam="false"
-product_list="cc;elb;agent;sc"
+product_list="mb;cc;elb;agent;sc"
 enable_internal_git=false
 
 function help {
     echo ""
     echo "Usage:"
     echo "setup.sh -u <host username> -p \"<product list>\""
+    echo "product list : [mb, cc, lb, as, sm, cep]"
     echo "Example:"
-    echo "sudo ./setup.sh -p \"cc elb\""
+    echo "sudo ./setup.sh -p \"cc llb\""
     echo "sudo ./setup.sh -p \"all\""
     echo ""
     echo "-u: <host username> The login user of the host."
@@ -54,7 +56,7 @@ function help {
     echo ""
 }
 
-while getopts p:g: opts
+while getopts u:p:g: opts
 do
   case $opts in
     p)
@@ -63,7 +65,7 @@ do
     g)
         enable_internal_git=${OPTARG}
         ;;
-    *)
+    \?)
         help
         exit 1
         ;;
@@ -75,6 +77,9 @@ 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
@@ -87,15 +92,12 @@ do
     if [[ $x = "sc" ]]; then
         sc="true"
     fi
-#   if [[ $x = "bam" ]]; then
-#       bam="true"
-#   fi
     if [[ $x = "all" ]]; then
+        mb="true"
         cc="true"
         elb="true"
         agent="true"
         sc="true"
-#       bam="true"
     fi
 done
 product_list=`echo $product_list | sed 's/^ *//g' | sed 's/ *$//g'`
@@ -135,6 +137,9 @@ function setup_validate {
         exit 1
     fi
 
+    if [[ -z $mb_hostname ]]; then
+        mb_hostname=$hostname
+    fi
     if [[ -z $userstore_db_hostname ]]; then
         userstore_db_hostname=""
     fi
@@ -171,6 +176,14 @@ function setup_validate {
         fi
     fi
 
+    if [[ ( -z $mb_ip ) ]]; then
+        mb_ip=$(ifconfig eth0| sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p')
+        if [[ ( -z mb_ip ) ]]; then
+            helpsetup
+            exit 1
+        fi
+    fi
+
     if [[ ( -z $elb_ip ) ]]; then
         elb_ip=$(ifconfig eth0| sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p')
         if [[ ( -z elb_ip ) ]]; then
@@ -192,6 +205,13 @@ function setup_validate {
         git_ip=$hostip
     fi
 
+    if [[ $mb = "true" ]]; then
+        if [[ ( -z $hostname || -z $mb_path ) ]]; then
+            helpsetup
+            exit 1
+        fi
+    fi
+
     if [[ $sc = "true" ]]; then
         if [[ $enable_internal_git = "true" ]]; then
             if [[ -z $git_user ]]; then
@@ -278,7 +298,11 @@ echo ""
 echo "For all the questions asked while during executing the script please just press the enter button"
 echo ""
 
-
+if [[ $mb = "true" ]]; then
+    if [[ ! -d $mb_path ]]; then
+        unzip $mb_pack -d $stratos_path
+    fi
+fi
 if [[ $sc = "true" ]]; then
     if [[ ! -d $resource_path ]]; then
         cp -rf ./resources $stratos_path
@@ -291,9 +315,6 @@ if [[ $sc = "true" ]]; then
     if [[ ! -d $sc_path ]]; then
         unzip $sc_pack -d $stratos_path
     fi
-    #if [[ ! -d $axis2c_path ]]; then
-      #  unzip $axis2c_pack -d $stratos_path
-    #fi
 fi
 if [[ $elb = "true" ]]; then
     if [[ ! -d $elb_path ]]; then
@@ -311,12 +332,22 @@ if [[ $agent = "true" ]]; then
     fi
 fi
 
-if [[ $bam = "true" ]]; then
-    if [[ ! -d $bam_path ]]; then
-        unzip $bam_pack -d $stratos_path
-    fi
-fi
+# ------------------------------------------------
+# Setup MB
+# ------------------------------------------------
+if [[ $mb = "true" ]]; then
+    echo "Setup MB" >> $LOG
+    echo "Configuring the Message Broker"
+
+    pushd $mb_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>${mb_port_offset}</Offset>@g" > repository/conf/carbon.xml
 
+    echo "End configuring the Message Broker"
+    popd #mb_path
+fi
 
 if [[ $sc = "true" ]]; then
     ##

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/1945514c/tools/stratos-installer/start-servers.sh
----------------------------------------------------------------------
diff --git a/tools/stratos-installer/start-servers.sh b/tools/stratos-installer/start-servers.sh
index 287f327..9fa4c45 100755
--- a/tools/stratos-installer/start-servers.sh
+++ b/tools/stratos-installer/start-servers.sh
@@ -36,11 +36,11 @@ fi
 function help {
     echo ""
     echo "Give one or more of the servers to start on this machine. The available servers are"
-    echo "cc, elb, agent, sc, all. 'all' means you need to start all servers."
+    echo "mb, cc, lb, as, sc, cep, all. 'all' means you need to start all servers."
     echo "usage:"
     echo "setup.sh -p\"<product list>\""
     echo "eg."
-    echo "setup.sh -p\"cc elb\""
+    echo "setup.sh -p\"cc lb\""
     echo ""
 }
 
@@ -61,6 +61,9 @@ 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
@@ -74,6 +77,7 @@ do
         sc="true"
     fi
     if [[ $x = "all" ]]; then
+	mb="true"
         cc="true"
         elb="true"
         agent="true"
@@ -95,16 +99,15 @@ if [[ -z $product_list || $product_list = "" ]]; then
     exit 1
 fi
 
-#if [[ $bam = "true" ]]; then
-#
-#    echo ${bam_path}
-#
-#    echo "Starting BAM server ..." >> $LOG
-#    nohup ${bam_path}/bin/stratos.sh -DportOffset=$bam_port_offset &
-#    echo "BAM server started" >> $LOG
-#    sleep $SLEEP
-#
-#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 [[ $cc = "true" ]]; then
     echo ${cc_path}