Book Image

Redmine Cookbook

By : Shamasis Bhattacharya
Book Image

Redmine Cookbook

By: Shamasis Bhattacharya

Overview of this book

In a variety of online project management tools, Redmine markets itself as offering flexibility. Choosing the right management tool can mean the difference between the success and failure of a project. Flexible project management tools bend themselves to fit your needs, whether that’s communication regarding a simple project, or collaboration, or more complex project methodology such as SCRUM, or an issue-code relationship, or the need of different methodology for your project. Whether you are project manager or system administrator, this book provides valuable recipes to get the best possible performance out of your team, organization, infrastructure, and Redmine itself. Through a series of carefully crafted recipes covering the nitty-gritty of Redmine, you’ll be guided through the installation of Redmine, as well as how to fine-tune and customize your Redmine installation. Finally, we walk you through integrating Redmine with other softwares and databases like Tortoise SVN and Visual Studio and troubleshooting Redmine.
Table of Contents (17 chapters)
Redmine Cookbook
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

Running Redmine with Phusion Passenger


Phusion Passenger is a Ruby application server that was originally designed to run web applications (such as Redmine) that were built on the Ruby on Rails framework. Nowadays it has evolved, and besides Ruby applications, it supports Python and Node.js, making it a good candidate for various use cases.

This recipe is written for the Ubuntu 14.04 server.

Getting ready

Make sure that you have Apache and passenger installed:

sudo apt-get install apache2 libapache2-mod-passenger

How to do it…

To configure Passenger, perform the following steps:

  1. Open /etc/apache2/mods-available/passenger.conf with your favourite editor, or use nano:

    nano /etc/apache2/mods-available/passenger.conf
    
  2. Add the following line: PassengerDefaultUser www-data.

  3. So, your passenger.com will look something like this:

    <IfModule mod_passenger.c>
      PassengerRoot /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini
      PassengerDefaultRuby /usr/bin/ruby
      PassengerDefaultUser www-data
    </IfModule>

    Tip

    If you are using a different Ruby version installed via RVM, update the paths accordingly. Also replace www-data with your user.

    Please keep in mind that PassengerDefaultUser can be entered in your virtual server's config file, which you may need to edit manually for installations on shared hosting.

  4. Create a symbolic link to the Redmine public folder from a web server's root folder like this:

    sudo ln -s /usr/share/redmine/public /var/www/html/redmine
    
  5. This link assumes that you installed Redmine through apt-get. If this is not the case and you installed it somewhere else such as /home/user/redmine, then you must adjust your links according to your Redmine installation and www root, which may look something like this (for example):

    ln –s /home/user/redmine/public /home/user/public_html/redmine
    
  6. Make sure that passenger is enabled in Apache:

    sudo a2enmod passenger
    
  7. Modify /etc/apache2/sites-available/000-default.conf by typing the following:

    sudo nano  /etc/apache2/sites-available/000-default.conf
    
  8. Add the following content near other Directory sections; if there are none, just make sure it's added before closing the </VirtualHost> line:

    <Directory /var/www/html/redmine>
        RailsBaseURI /redmine
        PassengerResolveSymlinksInDocumentRoot on
    </Directory>
  9. Install bundler by typing the following:

    sudo gem update && sudo gem install bundler
    
  10. Finish the installation and restart Apache:

    sudo touch /usr/share/redmine/Gemfile.lock
    sudo chown www-data:www-data /usr/share/redmine/Gemfile.lock
    sudo service apache2 restart
    

After restarting Apache, your Redmine installation should be ready to access by going to http://your_server/redmine.

How it works…

First, you installed Apache web server and Phusion Passenger as a Ruby application server, which runs as an Apache module. Then you edited Apache's configuration file for Passenger by adding the default user to be www-data. After this, we created a symbolic link from Redmine's public directory to the web server's root directory. Then, we edited the virtual server's config to serve this particular directory with two Redmine-related configs – RailsBaseURI/redmine, —which tells Ruby on Rails to access Redmine via the /redmine subfolder, and PassengerResolveSymlinksInDocumentRoot tells Passenger to follow symlink to find a Rails application through the symlink path. Instead of this, you could have written the following:

PassengerAppRoot /usr/share/redmine/

Redmine would work the same way.

There's more…

The best way to run Redmine or any other web-exposed software is to run it as a restricted user from its home directory and adjust Apache or any other web server to serve data from this directory. Running Redmine as a subdomain such as http://redmine.yoursite.com, is done by creating an ordinary subdomain, and an Apache virtual host file for this subdomain with the settings that are provided in this recipe.

See also

If you stumble upon an error such as 403 (forbidden), error 500, or if you see Ruby code on the screen or the Passenger error screen, but you have followed the preceding steps exactly, refer to Troubleshooting Apache installations section in Chapter 9, Troubleshooting.

If you need to run Redmine as sub-uri, then take a look at http://www.redmine.org/projects/redmine/wiki/HowTo_Install_Redmine_in_a_sub-URI.