How to build Apache Stratos from source in mac osx

These days Im developing cartridges for Apache Stratos. which is design and developed by WSO2 Inc. This is a PAAS environment lately donated to apache foundation by WSO2. In order to develop a cartridge I need a up and running Stratos instance on top of Openstack. Openstack is a IAAS provider that Im using, you can use Amazon EC2 as well.

This article will covers actual incident that overcome by the author. Lets start off with the normal procedure for starting up with Stratos. In my research I found this site which is official Stratos wiki article about Installation Guide. As per the article After installation of prerequisites developer or the user need to download the stratos binary using this link. Make sure you select the apache-stratos-4.0.0-source-release.zip which is the most stable and newest release of Stratos. After completion extract the zip file and make sure you have folder structure looks like this in it.



Inside of the tools directory you can find stratos installer folder which is going face lot changes in future of this article.

Before moving forward you need to Install and Configure Puppet Master and Single JVM Product Configuration therefore it is in vain repeating these routine stuff here again, please follow this blog up to 
  • Run the stratos-setup.sh file as the root.
$ sudo ./setup.sh -p "default"
Above code will through some errors and this where it differs from mac osx configuration.

Then comes the hard part which differs from mac osx and linux based operating systems. Now you can start Stratos within seconds using $ sudo /opt/stratos/apache-stratos-default/bin/stratos.sh 
Since your using mac osx this process will be fail. 

Now you need to get dirty you hands with some shell script codes or else there is a simple way of doing it.

Simple way of running stratos.sh

Just clone the my version of Apache Stratos using below link :

$ git clone https://github.com/thushara35/stratos.git
after you download it just simply browse stratos>tools>stratos-installer and copy all the stuff in that directory and paste it(replace the exiting files) in /opt/stratos-installer directory.
Make sure you replace all the files in that directory.

Now you have to install a 3rd party application called brew in your mac osx.

How to install gsed in mac osx:
i. Installed homebrew(http://brew.sh/)
$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
ii. Installed gnu-sed
$ brew install gnu-sed

  • Run the stratos-setup.sh file as the root.
$ sudo /opt/stratos-installer/sh setup.sh -p "default"
  • Start ActiveMQ and Apache Stratos servers
$ sudo /opt/stratos/apache-activemq-5.8.0/bin/activemq start
$ sudo /opt/stratos/apache-stratos-default/bin/stratos.sh
  • Once the installation is complete, access the Apache Stratos Console using the following URL:
https://localhost:9443/console
The default username is "admin" and the password is "admin".




thats it :)
let's look into the hard way of doing this.

Hard way of running stratos.sh

Just go through the changes in my pull request and replicate those changes in /opt/stratos-installer directory. 

changes are made in:
stratos / tools / stratos-installer /
demo.sh, ec2.sh,openstack.sh, setup.sh and vcloud.sh
stratos / tools / stratos-installer / scripts /
add_entry_zone_file.sh and remove_entry_zone_file.sh
Other than that this change also include syntax errors which can be found in setup.sh line 605:
-chown -R $host_user.$host_user $log_path
+chown -R $host_user:$host_user $log_path

  • Run the stratos-setup.sh file as the root.
$ sudo /opt/stratos-installer/sh setup.sh -p "default"
  • Start ActiveMQ and Apache Stratos servers
$ sudo /opt/stratos/apache-activemq-5.8.0/bin/activemq start
$ sudo /opt/stratos/apache-stratos-default/bin/stratos.sh
  • Once the installation is complete, access the Apache Stratos Console using the following URL:
https://localhost:9443/console
The default username is "admin" and the password is "admin".

References


Comments