Linux Manju

November 19, 2009

Tomcat Name Based Virtual Hosting How to

Filed under: Uncategorized — Tags: , , , , — linuxmanju @ 1:13 am

Confluence :- A feature rich Wiki/ Document Management system from atlassian

Jira:- An Excellent Bug/ Issue Tracking system.

Challenge is to run Both with a single instance of tomcat

Tomcat Name Based Virtual Hosting How to ( For Yellow.ec2.example.com Jira along with Confluence )

Intended Audience:- Sysadmin

Goal:- Is to achive Confluence and Jira parallelly in the same system

Pre-Requisites:- Tomcat, Apache with Mod_jk, DNS entry for 1) support.example.com 2) CNAME/IN for docs.example.com, Latest Stable Build of Confluence and Jira .

Aproaches and Challenges:-

There are two different approaches one can take for this.

a) Run  Two tomcat instances one each for Jira and Confluence ( Built in Tomcat with the applications ) in two different ports, Add proxy pass or configure Mod_jk Redirection with Name Based Virtual Host setup in Apache

Drawback of the above setup:-

Server Overhead as there would be two tomcat instances, Separate Rewrite rules for each Container No system wide defaults.

b) Second approach would be to configure one of the Tomcat instance ( Either Jira or Confluence ) to serve both the Containers ( Jeera as well as Confluence )

The second approach is better as compared to the first one as a) No additonal system over head ( 1 Tomcat Insatnce per server ) 2) Single System wide configuration of Apache/ Mod_jk.

For this document we will go with the second approach.

Server Setup:- Install Ubuntu Jaunty, Install Java, Create user jira, Configure JAVA_HOME pointing to JDK installation root path ( For eg.. /usr/local/java ) in .bashrc

Download Jira and Confluence from Atlassian, Untar it in /mnt/ebs

tar zxvf jira*.tgz -C /mnt/ebs

tar zxvf confluence*.tar.tgz -C /mnt/ebs

Configure jira and mod_jk in apache su - jira ( Will be covered in a different Document )

Run the jira and test the setup.

Create a Directory for confluence data

mkdir -p /mnt/ebs/confluencedata

Change ownership to user jira

chown -R jira  /mnt/ebs/{confluence*,jira*}

Configure Confluence:-

Open /mnt/ebs/confluence*/confluence/WEB-INF/classes/confluence-init.properties

Add a line which reads like below

Configure Name Based Virtual Containers in Tomcat:-

open /mnt/ebs/jira*/conf/server.xml

Locate the line which reads

<engine name=”Catalina” defaultHost=”localhost” >

Change it to

<engine name=”Catalina” defaultHost=”support.example.com”>

Locate the line which reads

<host name=”localhost” appbase=”webapps” unpackWARs=”true” autoDeploy=”true”>

Change it to

<host name=”support.example.com” appbase=”webapps” unpackWARs=”true” autoDeploy=”False”>

Go to the end of </Host> and insert the below lines for Confluence setup

<Host name=”docs.example.com” debug=”0″ appBase=”/mnt/ebs/confluence-3.0.2-std/webapps” unpackWARs=”true” autoDeploy=”False”>

<Context path=”/mnt/ebs/confluence-3.0.2-std/confluence” debug=”1″  >

<Manager pathname=” ” >

</Context>

</Host>

Add additional hostnames in /mnt/ebs/www/conf/000-default ( Optional .. Speeds up performance by eliminating Reverse Lookup for each new request)

Restart tomcat..

su - jira -C  “./ $HOME/.bashrc && /mnt/ebs/jira*/bin/startup.sh

If all is well you should be able to access Jira on http://support.example.com and Confluence at http://docs.example.com

Powered by WordPress