Thursday, August 5, 2010

How to deploy WSO2 Gadget Server on tomcat

Applies To: wso2gs-1.1.0.zip ( Carbon 3.0.0)
apache-tomcat-6.0.20

Step 1
Download WSO2 Gadget Server -1.1.0 from http://wso2.org/downloads/gadget-server. Extract the downloaded zip into a directory. And copy repository and resources directories in to a new folder. Here after, we will refer it as gs-repo (eg:- /home/krishatha/gs-repo)

Step 2
Lets refer to your tomacat installation directory as CATALINA_HOME. Go to CATALINA_HOME/webapps directory and create a new folder call wso2gs .Now, copy wso2gs-1.1.0/webapps/ROOT/WEB-INF to
CATALINA_HOME/webapps/wso2gs

Step 3
Now you will need to enable HTTPS on Apache Tomcat since WSO2 Gadget Server runs over HTTPS. To do this, access the server.xml file located at CATALINA_HOME/conf and uncomment the following
and fill as below.


<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
maxThreads="150" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS"
keystoreFile ="/home/krishatha/gs-repo/resources/security/wso2carbon.jks"
keystorePass="wso2carbon"/>



One could find the wso2carbon.jks file inside the CARBON_HOME/repository/resources/security/ directory in WSO2 Gadget Server installation home (CARBON_HOME)

Make sure to give the exact location of wso2carbon.jks
Note: you can use your own keystore file if required.

Step 4
Now we must do the necessary configurations in a set of config files shipped with WSO2 Gadget Server. We will update carbon.xml, axis2.xml, registry.xml, mgt-transports.xml and user-mgt.xml which can be found at gs-repo/repository/conf directory.

(a) Edit the carbon.xml in gs-repo/repository/conf and put /wso2gs as the WebContextRoot


<WebContextRoot>/wso2gs</WebContextRoot>



the WebContextRoot will be the name you used to create war distribution in CATALINA_HOME/webapps

(b) Edit the same carbon.xml and set backend sever URL as below.


<ServerURL>https://your-ip:8443/wso2gs/services/</ServerURL>


It is recommended to use your IP rather than using localhost or hostname.
Note that we have configured Tomcat to run on 8443 port now.

(c)Now open axis2.xml to change the http and https ports in the Transports section of axis2.xml as follows:


<transportReceiver name="http"
class="org.wso2.carbon.core.transports.http.HttpTransportListener">
<parameter name="port">8080</parameter>
</transportReceiver>


<transportReceiver name="https"
class="org.wso2.carbon.core.transports.http.HttpsTransportListener">
<parameter name="port">8443</parameter>
</transportReceiver>

(d) Edit the mgt-transports.xml as follows: https and http ports of the transport section can be changed as follows.


<transport name="http" class="org.wso2.carbon.server.transports.http.HttpTransport">
<parameter name="port">8080</parameter>



<transport name="https" class="org.wso2.carbon.server.transports.http.HttpsTransport">
<parameter name="port">8443</parameter>


(e) Open registry.xml and update DB configurations as follows:


<dbConfig name="wso2registry">
<url>jdbc:h2:/home/krishatha/gs-repo/repository/database/WSO2CARBON_DB</url>
<userName>wso2carbon</userName>
<password>wso2carbon</password>
<driverName>org.h2.Driver</driverName>
<maxActive>50</maxActive>
<maxWait>60000</maxWait>
<minIdle>5</minIdle>
</dbConfig>


Note that you have to use absolute path to the H2 DB.

(f) Open user-mgt.xml and update DB configurations as follows:

<Property name="url">jdbc:h2:/home/krishatha/gs-repo/repository/database/WSO2CARBON_DB</Property>
<Property name="userName">wso2carbon</Property>
<Property name="password">wso2carbon</Property>
<Property name="driverName">org.h2.Driver</Property>
<Property name="maxActive">50</Property>
<Property name="maxWait">60000</Property>
<Property name="minIdle">5</Property>


Note that you have to use the absolute path to the H2 DB.

Step 5
You also need to copy the wso2gs-1.1.0/lib/log4j.properties file into CATALINA_HOME/webapps/wso2gs/WEB-INF/classes

Step 6
Now copy the jar files in wso2gs-1.1.0/lib/endorsed/ into CATALINA_HOME/lib. You need to copy the followig jar files.

1. xalan-2.7.0.wso2v1.jar
2. xercesImpl-2.8.1.wso2v1.jar
3. xml-apis-1.3.04.wso2v1.jar

Step 7
We have completed the required configurations. Now, open a new command window and change the directory to CATALINA_HOME/bin. Define an environment variable called CARBON_HOME and set the path to your gs-repo directory.

In windows; set CARBON_HOME=C:\gs\gs-repo
In linux; export CARBON_HOME=/home/krishatha/gs-repo


Start tomcat server from the same command window/shell.

eg:- catalina.sh run
catalina.bat run

After starting the WSO2 Gadget Server, you can access the management console using below URL

https://your-ip:8443/wso2gs/carbon

No comments: