Tuesday, May 14, 2013

Setting up WSO2 Stratos 1.6 in your PC - The most complete, enterprise-grade and open PaaS


WSO2 Stratos is an open source PaaS which is complete, enterprise grade and which includes many services which can empower your businesses. WSO2 Stratos is the backbone behind WSO2 StratosLive, the PaaS operated by WSO2 itself.
With the following guide you can setup Stratos locally in your PC and try the features easily.
Prerequisites:
1.    MySQL Server
In order to run Stratos you will need MySQL server running on your PC.
        You can download it from: http://dev.mysql.com/downloads/mysql/
        In Ubuntu: sudo apt-get install mysql-server
Stratos assumes the password of your MySQL root to be 'root'. If you have not configured it, you can do it by the following command.
    mysqladmin -u root -p 'oldpassword' password root
2.    Download the Stratos Local setup from: http://wso2.com/cloud/stratos/
 After downloading the setup, extract it to a convenient location.
3.    Also you need to have Java on your machine in order to try this.
Steps (We will assume a Ubuntu environment)
1.    You need to modify the /etc/hosts file in order to redirect the Stratos specific URLs to localhost. Add the following entries to the file.    
      127.0.0.1        stratos-local.wso2.com
      127.0.0.1        management.appserver.stratos-local.wso2.com
      127.0.0.1        appserver.stratos-local.wso2.com
      127.0.0.1        management.esb.stratos-local.wso2.com
      127.0.0.1        esb.stratos-local.wso2.com
      127.0.0.1        management.data.stratos-local.wso2.com
      127.0.0.1        data.stratos-local.wso2.com
      127.0.0.1        monitor.stratos-local.wso2.com
      127.0.0.1        management.process.stratos-local.wso2.com
      127.0.0.1        process.stratos-local.wso2.com
      127.0.0.1        governance.stratos-local.wso2.com
      127.0.0.1        identity.stratos-local.wso2.com
      127.0.0.1        storage.stratos-local.wso2.com
      127.0.0.1        cep.stratos-local.wso2.com
      127.0.0.1        task.stratos-local.wso2.com
      127.0.0.1        messaging.stratos-local.wso2.com
      127.0.0.1        management.rule.stratos-local.wso2.com
      127.0.0.1        rule.stratos-local.wso2.com
      127.0.0.1        cloudgateway.stratos-local.wso2.com     

2.    Go inside to the extracted folder and run the initialization script as follows
      ./initialize.sh
      This will initiate the required data tables within the MySQL database.
3.    Then start the ‘elb’ (WSO2 Elastic Load Balancer)  and ‘manager’ (Stratos Manager) services as below
               elb:                     sudo ./stratos start elb
               manager:          ./stratos.sh start manager 
Note: You may need super user privileges to start or stop elb as it runs on standard http and https ports. Also the ports should be free to use.
You may get the following error when you try to start elb as supper user.

               Starting elb
       Error: JAVA_HOME is not defined correctly.
       CARBON cannot execute java


This might be because JAVA_HOME has not been set to the  super user environment. As a workaround you can use 'sudo -E ./stratos start elb' to start elb.              
4.    Then start the services of your preference
You can obtain the available list of services by the following command. Also it will provide details on starting services.
            ./stratos.sh
To start a service (for example WSO2 Appserver Management)
     ./stratos.sh start as_mgt
To stop
     ./stratos.sh stop as_mgt
To start multiple services
     ./stratos.sh start 'service names separated by spaces'
For example WSO2 Appserver Manager and Worker,  WSO2 ESB Manager and Worker
     ./stratos.sh start ‘as_mgt as_worker esb_mgt esb_worker’