Monday, August 03, 2009

Getting started with Redmine

For sometime I was looking for a project management software, which can provide an integrated view of most of the project related artifacts/activities. Redmine was the most impressive tool, I came across. It has issue tracking, wiki, forum, documents, integration with third party tools (source repositories, LDAP etc.), plugin to integrate with Hudson and many more features. It has plugin based architecture, so possibilities are almost endless.

Redmine is written in Ruby (Ruby on Rail) and I know nothing about that other than spelling :-) I had to install several packages to get started with it. Redmine stores its data in a database and when it comes to open source DB, PostgreSQL is always my first choice. As a practice I prefer to serve all web applications through Apache and here I found an Apache module called Passenger, which can serve Ruby applications.

Here are my notes, which I took during installing Redmine and supporting applications.

  1. Install PostgreSQL for Linux
          $ ./postgresql-x.x.x-x.bin --mode text

    Follow the installer instructions to complete the installation. Make sure that PostgreSQL accepts connections from other than 'localhost' else you can't connect to DB from any other machine. This can be done by editing 'pg_hba' configuration file.

  2. Install Ruby, Redmine needs ruby 1.8.7-
          $ tar zxvf ruby-1.8.7-p174.zip
          $ cd ruby-1.8.7-p174
          $ ./configure --prefix=/opt/redmine/ruby-1.8.7
          $ make
          $ make install


    Add ruby to your classpath before executing further installation steps.

  3. Install ruby-gems, say rubygems-1.3.4
          $ unzip rubygems-1.3.4.zip
          $ cd rubygems-1.3.4
          $ ruby setup.rb

  4. Install rake
          $ unzip rake-0.8.7.zip
          $ cd rake-0.8.7
          $ ruby install.rb

  5. Install rails (Ruby On Rails) version 2.1.2 (required by Redmine)
          $ gem install rails -v 2.1.2

    The GEM needs internet connectivity to download and install the packages. Though there are ways to install packages locally, after downloading them manually. As I am new to Ruby so preferred the easiest installation method.

  6. Install PostgreSQL adapter for Ruby
    Add PostgreSQL's 'bin' directory in PATH before executing following command-
        $ gem install pg

  7. Install redmine

    • Unzip the downloaded archive
      $ tar zxvf redmine-0.8.4.tar.gz

    • Create 'redmine' database user
      CREATE ROLE redmine LOGIN PASSWORD 'redmine' NOSUPERUSER NOINHERIT CREATEDB NOCREATEROLE;

    • Create 'redmine' database
      CREATE DATABASE redmine WITH ENCODING='UTF8' OWNER=redmine;

    • Define PosgtreSQL DB in '/opt/redmine/redmine-0.8.4/config/database.yml'
             production:
               adapter: postgresql
               database: redmine
               host: localhost
               port: 5432
               username: redmine
               password: "redmine"

    • Create the database structure, by running the following command under the redmine installation directory. It will create tables and an administrator account.
          $ rake db:migrate RAILS_ENV="production"

    • Insert default configuration data in database, by running the following command:
          $ rake redmine:load_default_data RAILS_ENV="production"

  8. Install Passenger module to enable Apache to serve ruby applications
        $ tar zxvf passenger-2.2.4.tar.gz
        $ cd passenger-2.2.4/bin
        $ export APXS2=/opt/redmine/apache-2.2.11/bin/apxs
        $ ./passenger-install-apache2-module

  9. Configure Apache to server redmine or any other ruby application using passenger
    To publish a rubby application under a sub-uri, create a symbolic link to application's public directory under web root directory. Thats the way passenger works, pointing directly to application's public directory will not work here.

        $ ln -s /opt/redmine/redmine-0.8.4/public redmine

    Here is a sample configuration text from Apache's httpd-vhosts.conf file to serve Redmine-

        NameVirtualHost *:80

        LoadModule passenger_module /opt/redmine/passenger-2.2.4/ext/apache2/mod_passenger.so
        PassengerRoot /opt/redmine/passenger-2.2.4
        PassengerRuby /opt/redmine/ruby-1.8.7/bin/ruby

        <VirtualHost *:80>
            ServerAdmin webmaster@mydomain.com
            ServerName redmine

            DocumentRoot "/opt/apache-2.2.11/htdocs"
            RailsEnv production
            RailsBaseURI /redmine

            ErrorLog "logs/error_log"
            CustomLog "logs/access_log" common

            <Directory "/opt/redmine/redmine-0.8.4/public">
                Options FollowSymLinks
                AllowOverride None
                Order deny,allow
                Allow from all
            </Directory>
        </VirtualHost>
Now Redmine is available for action. Next steps could be configuring to integrate with LDAP and few more things or installing some plugins to enhance the functionality. Next I am looking for ways to migrate issue tracker from Bugzilla to Redmine, to have everything under one roof.

2 Comments: