Tuesday, March 2, 2010

JIRA WAR Tomcat Installation

I have been trying to setup a single Tomcat 6.0.x server to maintain a number of project lifecycle apps. One of these apps is JIRA. I found documentation that described how to setup JIRA as an EAR/WAR. However the method defined involved copying was a number of jar files into the Tomcat server lib directory that I was uncomfortable with. I wanted to keep the number of jars going into the server lib folder to a minimum. After some work, the only jar I had to put in the tomcat/lib folder was the MySQL JDBC driver.

The following instructions describe the steps that I took to achieve this.

Environment:
  • MacOSX (Snow Leopard)
  • JIRA version 4.0.2
  • MySQL

1. Download the EAR/WAR version of JIRA (NOTE if it isn't visible on the downloads page then look for the small link that says "Show All" rather than just recommended.

2. Once downloaded, unpack the archive to a folder. From now on know as $JIRA_INSTALL. According to the Atlassian website there have been reported problems with the Windows extractor not extracting all files and a similar situation with WinRAR. Try using WinZip or another alternative.

3. Download and install mysql. This is beyond the scope of this post but there are plenty of good howto's and tutorials out there on how to do it.

4. Once my sql is installed we need to create a user for our jira database. Run the following commands to create the user replacing the changeme100 with your desired password:

5. Now we need to create the jira db. Log into MySQL as an administrator and run the following commands replacing the changeme100 with your desired password:

CREATE DATABSE jiradb character set utf8;
CREATE USER 'jira'@'localhost' IDENTIFIED BY 'changeme100';
GRANT ALL PRIVILEGES ON jiradb.* TO 'jira'@'localhost' WITH GRANT OPTION;


6. Download the mysql Connector/J JDBC driver and place the jar file in your $CATALINA_HOME/lib folder.

7. Open $JIRA_INSTALL/edit-webapp/WEB-INF/class/entityengine.xml in a text editor and change the

<datasource name="defaultDS" class="org.ofbiz.core.entity.GenericHelperDAO" keys="false" indices="false" start="true">
<jndi-jdbc name="default">
</jndi-jdbc>
</datasource>

to

<datasource name="defaultDS" class="org.ofbiz.core.entity.GenericHelperDAO" keys="false" indices="false" check="" start="true">
<jndi-jdbc name="default">
</jndi-jdbc>
</datasource>


8. Open $JIRA_INSTALL/edit-webapp/WEB-INF/classes/jira-application.properties in a text editor and change the "jira.home" property near the top of the file to an absolute folder. I'm using /usr/share/jira.

10. Download the required Tomcat jars for JIRA to work. Unzip the folder and copy the contents (jar files) into the $JIRA_INSTALL/webapp/WEB-INF/lib folder.

11. Create a new folder called META-INF in the $JIRA_INSTALL/edit-webapp/META-INF folder and then create a new file called context.xml inside it. Open this file up in a text editor and add the following contents:

<context path="/jira">
<resource name="jdbc/JiraDS" auth="Container" type="javax.sql.DataSource" username="jira" password="changeme100" driverclassname="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost/jiradb"/>

<resource name="UserTransaction" auth="Container" type="javax.transaction.UserTransaction" factory="org.objectweb.jotm.UserTransactionFactory" timeout="60">
<manager pathname=""/>
</resource>
</context

12. Now in a command window go to the $JIRA_INSTALL folder and run build.bat (Windows) or ./build.sh (Unix/Linux/Mac).

13. Once the build is complete copy the $JIRA_INSTALL/dist-tomcat/atlassian-jira-4.0.2.war to your $CATALINA_HOME/webapps folder

14. You should now be able to start up your tomcat instance and browse to http://localhost:8080/jira.

Please let me know if you have any issues or problems :)

No comments:

Post a Comment