Tag Archives: Redmine

Redmine with Passenger on Nginx

Thanks to the guys at Dotdeb, we can now run Redmine using Phusion Passenger. My earlier requirements were still in force – software to be installed from a repository, upgradeable using apt-get and no compiling on the server.

To use Passenger with Nginx, the official Phusion docs recommend compiling Nginx from source. Fortunately, Nginx PPA provides this version of Nginx – nginx-passenger. I got around to checking Dotdeb; and they provided one for Debian 6 too! The installation is simple.

sudo apt-get install nginx-passenger ruby-passenger

You will need to tune it for your server, but many  guides are available on the Internet.

##
# /etc/nginx/nginx.conf
# nginx-passenger config
##
# Uncomment it if you installed nginx-passenger
##

passenger_root           /usr/lib/phusion-passenger;
passenger_ruby           /usr/bin/ruby;
passenger_max_pool_size  2;
passenger_pool_idle_time 120;
passenger_pre_start      http://redmine.example.com/;
## site config using passenger
server {
    listen 80;
    server_name redmine.example.com;
    root /usr/share/redmine/public;
    passenger_enabled on;
}

Redmine + Thin + Nginx

Redmine, is by far, the best project management tool I have used. Earlier, I had deployed it using Apache and mod_passenger. This was on Debian 6. It was straight-forward, possible with just apt-get. Now I wanted to deploy it with Nginx, on Ubuntu 12.04.

There are two ways – use Phusion Passenger (similar to Apache’s mod_passenger) with Nginx or use an application server like Mongrel or Thin.

Phusion Passenger requires the user to recompile Nginx, since Nginx doesn’t have loadable modules.

Mongrel was the gold standard for Ruby on Rails deployment until Passenger came along. Development of Mongrel ceased in 2008. Those who still want to use application servers use Unicorn or Thin and put a reverse proxy/load balancer in front.

This is my take-away from four days (I am dumb – sue me!) of googling and reading. My requirements were clear – no compiling, no ruby gems, no installation outside of apt-get. Redmine + Thin met these criteria.

1. Get all the packages.

sudo apt-get install redmine redmine-mysql thin

2. dpkg will configure Redmine for us. We also have to configure the email delivery method. Redmine configuration is standard and well documented. We  now have to configure Thin. This will create two servers on sequential ports, beginning with 3000.

sudo thin config -C /etc/thin1.8/redmine.yml -c /usr/share/redmine/ --servers 2 -e production -a 127.0.0.1 -p 3000

3. This will create the configuration file (redmine.yml) in the correct folder. The file looks like this:

---
timeout: 30
wait: 30
max_persistent_conns: 512
log: log/thin.log
chdir: /usr/share/redmine
servers: 2
require: []

daemonize: true
pid: tmp/pids/thin.pid
address: 127.0.0.1
environment: production
max_conns: 1024
port: 3000

4. Finally, use the Redmine template for Nginx, as explained on the Nginx wiki, to act as a proxy in front of the Thin servers.

Links: