Deploy Redmine 2.6 with Unicorn, Supervisor, and NginX

This blog post is about how to deploy Redmine 2.6, the opensourced project management software in a Ubuntu server with unicorn, supervisor and nginx.

A. Install Redmine:

1. Create a mariadb database for redmine:

* database name: redmine
* user: redmineuser
* password: redminepasswd

2. Clone the redmine's git repo:

$ git clone
$ cd redmine
$ git checkout -b 2.6-stable

3. Configure database connection: Copy config/database.yml.example to config/database.yml and edit this file in order to configure your database settings for "production" environment.

  adapter: mysql2
  database: redmine
  host: localhost
  username: redmineuser
  password: redminepasswd

(for ruby 1.9)

4. Install dependencies:

$ gem install bundler
$ bundle install --without development test

5. Session store secret generation:

$ rake generate_secret_token

6. Database schema objects creation:

$ RAILS_ENV=production rake db:migrate

7. Database default data set:

$ RAILS_ENV=production rake redmine:load_default_data

8. File system permissions:

$ mkdir -p tmp tmp/pdf public/plugin_assets
$ sudo chown -R redmine:redmine files log tmp public/plugin_assets
$ sudo chmod -R 755 files log tmp public/plugin_assets

(user here is redmine)

For more details, please read:

B. Configure Unicorn and Supervisord:

0. Install Unicorn Herder: 

"Unicorn Herder is a utility designed to assist in the use of Upstart and similar supervisors with Unicorn. It does this by polling the pidfile written by the Unicorn master process, and automating the sequence of signals that must be sent to the master to do a "hot-reload". If Unicorn quits, so will the Unicorn Herder, meaning that if you supervise the herder (which does not daemonize), you are effectively supervising the Unicorn process."

$ sudo pip install unicornherder

For more information about Unicorn Herder, please read:

1. Install unicorn: In redmine's root folder, create Gemfile.local with the following content:

gem 'unicorn'

Run this:

$ bundle install --without development test

2. Create an unicorn configuration, unicorn.rb, inside the config folder:

3. Create a supervisor configuration for redmine:

$ sudo supervisorctl reload
$ sudo supervisorctl start redmine

C. Configure nginx

Create a nginx configuration for redmine at /etc/nginx/sites-available/redmine:

$ sudo ln -s /etc/nginx/sites-available/redmine /etc/nginx/sites-enable/redmine
$ sudo service nginx restart

D. Appendix:

Using Flatly light redmine theme for Redmine

In the Redmine's root folder, go to public/themes/

$ git  clone

Restart Redmine:

$ sudo supervisord restart redmine

In Redmine, go to Administration, Settings, Display and change display to user Flatly light redmine theme.