HowTo Install Redmine in Apache Tomcat » History » Version 10

Etienne Massip, 2013-01-08 18:39

1 5 Mischa The Evil
h1. HowTo Install Redmine in Apache Tomcat
2 1 Henning Sprang
3 1 Henning Sprang
As I'm running an Apache Tomcat Server already, I wanted to run redmine in it with Jruby, so I won't have to manage a mongrel/passenger setup.
4 1 Henning Sprang
5 3 Henning Sprang
It was much easier than I though, and works very well with Redmine version 0.8.0 and 0.8.6 on Ubuntu Karmic with the tomcat6 package available there.
6 1 Henning Sprang
7 3 Henning Sprang
*There is a problem on 0.8.7 not resolved yet! see http://www.redmine.org/issues/4276*
8 8 Remco Cats
*Changed warble.rb for a problem on 1.1.1 building the war and running it on tomcat 6.
9 1 Henning Sprang
10 1 Henning Sprang
11 3 Henning Sprang
h2. Prerequisites and assumptions
12 1 Henning Sprang
13 3 Henning Sprang
Assumption is you have a Redmine install that works in plain ruby, meaning it's working with 
14 6 Stefan Ollinger
@./scripts/server -e production@. If not, check the normal installation docs first first!
15 1 Henning Sprang
16 3 Henning Sprang
I'm using a socket connection to a mysql server runing on the same machine as the Tomcat application server.
17 3 Henning Sprang
There might be some extra steps (e.g. configuring jdbc) necessary for a mysql connection via network.
18 1 Henning Sprang
19 3 Henning Sprang
It's also assumed you already have a Tomcat application server installed and running - If you haven't and don't know how to do it, you'll most likely run Redmine the default way with plain ruby.
20 3 Henning Sprang
21 3 Henning Sprang
Still, for Redmine developers  not too familiar with the Java platform but still willing to test Redmine here, I've added section below on how to setup and run a tomcat server.
22 3 Henning Sprang
23 3 Henning Sprang
24 3 Henning Sprang
h2. Install the necessary tools
25 3 Henning Sprang
26 3 Henning Sprang
* The Jruby binary (probably just for testing, not used in the deployment? I did not yet uninstall it and test if things still work, but I think they will)
27 3 Henning Sprang
** aptitude install jruby1.2 
28 3 Henning Sprang
* Go into the redmine directory
29 3 Henning Sprang
** @cd redmine-VERSION@
30 1 Henning Sprang
* Test running Redmine manually outside the Tomcat Servlet container - just to make sure it works(database, etc.) before deploying it in tomcat: 
31 8 Remco Cats
** @jruby ./script/server -e production@
32 1 Henning Sprang
* Install warbler gem - a tool to package rails applications as Java web application .war files:
33 3 Henning Sprang
** @gem install warbler@
34 3 Henning Sprang
35 3 Henning Sprang
36 3 Henning Sprang
h2. Building the .war file
37 3 Henning Sprang
38 3 Henning Sprang
The .war file is a web application package - the standard way of packaging applications to be deployed in a Java servlet container.
39 3 Henning Sprang
40 3 Henning Sprang
* Run warble in configuration mode:
41 3 Henning Sprang
** @warble config@ - or if warble is not in your path like in my setup: @~/.gem/ruby/1.8/bin/warble config@
42 1 Henning Sprang
* Edit the warbler config:
43 3 Henning Sprang
** @vim config/warble.rb@
44 3 Henning Sprang
* change line beginning with @config.dirs...@ to look like this:
45 1 Henning Sprang
** @config.dirs = %w(app config lib log vendor tmp extra files lang)@
46 8 Remco Cats
* uncommend the line and add i18n and rack for packaging
47 8 Remco Cats
** @config.gems += ["activerecord-jdbcmysql-adapter", "jruby-openssl", "i18n", "rack"]@
48 4 Henning Sprang
* Starting with Redmine 0.8.7 (*but not for version before this!*), you also need to create a "session secret":
49 4 Henning Sprang
** @rake config/initializers/session_store.rb@
50 3 Henning Sprang
* Run warble again (without config):
51 3 Henning Sprang
** @warble@ - or if warble is not in your path like in my setup: ~/.gem/ruby/1.8/bin/warble
52 1 Henning Sprang
53 3 Henning Sprang
You should have a file called @redmine-VERSION.war@ in the redmine directory now.
54 1 Henning Sprang
55 3 Henning Sprang
56 3 Henning Sprang
h2. Deploy the web application and Enjoy
57 3 Henning Sprang
58 3 Henning Sprang
Place the redmine war file into your tomcat webapps directory:
59 3 Henning Sprang
60 3 Henning Sprang
* @cp redmine-VERSION.war $TOMCAT_HOME/webapps/redmine.war@
61 3 Henning Sprang
62 3 Henning Sprang
Redmine should be running on http://your-tomcat-host.name:8080/redmine - likely you'll have to adjust hostname and port.
63 3 Henning Sprang
64 1 Henning Sprang
65 3 Henning Sprang
66 3 Henning Sprang
67 3 Henning Sprang
h2. Tomcat setup
68 3 Henning Sprang
69 3 Henning Sprang
As said above, usually you will have a tomcat already running or at least know how to install it if you read this Howto. But for people willing to play with this for other reasons (e.g. Redmine developers trying to reproduce bugs :) ), here some words about installing tomcat:
70 3 Henning Sprang
71 3 Henning Sprang
* Install a Java 6 JDK - download from sun or with a package from you linux distribution, on Ubuntu, that is: 
72 3 Henning Sprang
** @apt-get install openjdk-6-jdk@
73 3 Henning Sprang
* Download Tomcat, for example from a location mentioned at http://tomcat.apache.org/download-60.cg - for example:
74 3 Henning Sprang
** @wget http://apache.autinity.de/tomcat/tomcat-6/v6.0.20/bin/apache-tomcat-6.0.20.tar.gz@
75 3 Henning Sprang
* Unpack the archive
76 3 Henning Sprang
** tar xvfz apache-tomcat-6.0.20.tar.gz
77 1 Henning Sprang
* You'll have a directory (referred to as TOMCAT_HOME in the deployment step above), got into it, and run tomcat:
78 1 Henning Sprang
** @sh bin/startup.sh@
79 1 Henning Sprang
* Test if tomcat is running by checking http://your-tomcat-host.name:8080
80 1 Henning Sprang
81 1 Henning Sprang
That's it, you're ready to deploy redmine in this Tomcat server!
82 4 Henning Sprang
83 4 Henning Sprang
h2. Links that helped me to achieve this:
84 4 Henning Sprang
85 4 Henning Sprang
* http://musingsofaprogrammingaddict.blogspot.com/2008/11/redmine-on-jruby-and-glassfish.html
86 1 Henning Sprang
* http://www.digitalsanctum.com/2007/07/24/jruby-deploying-a-rails-application-on-tomcat/
87 10 Etienne Massip
* message#35426