<?xml version="1.0" encoding="utf-8"?><!DOCTYPE article  PUBLIC '-//OASIS//DTD DocBook XML V4.4//EN'  'http://www.docbook.org/xml/4.4/docbookx.dtd'><article><articleinfo><title>MemberManual/WebApplications/Redmine</title><revhistory><revision><revnumber>14</revnumber><date>2018-10-20 18:22:32</date><authorinitials>ClintonEbadi</authorinitials><revremark>placing cgi into public_html considered dangerous</revremark></revision><revision><revnumber>13</revnumber><date>2013-01-14 07:19:28</date><authorinitials>ClintonEbadi</authorinitials><revremark>cat</revremark></revision><revision><revnumber>12</revnumber><date>2009-11-08 12:28:19</date><authorinitials>151.60.216.56</authorinitials></revision><revision><revnumber>11</revnumber><date>2009-11-07 12:58:46</date><authorinitials>151.60.219.207</authorinitials></revision><revision><revnumber>10</revnumber><date>2009-11-07 12:56:50</date><authorinitials>151.60.219.207</authorinitials></revision><revision><revnumber>9</revnumber><date>2009-11-07 12:55:19</date><authorinitials>151.60.219.207</authorinitials></revision><revision><revnumber>8</revnumber><date>2009-11-07 12:45:15</date><authorinitials>151.60.219.207</authorinitials></revision><revision><revnumber>7</revnumber><date>2009-11-06 17:28:06</date><authorinitials>151.60.219.122</authorinitials></revision><revision><revnumber>6</revnumber><date>2009-11-06 17:25:18</date><authorinitials>151.60.219.122</authorinitials></revision><revision><revnumber>5</revnumber><date>2009-11-06 16:47:24</date><authorinitials>151.60.219.122</authorinitials></revision><revision><revnumber>4</revnumber><date>2009-11-06 16:07:03</date><authorinitials>151.60.219.122</authorinitials></revision><revision><revnumber>3</revnumber><date>2009-11-06 14:34:04</date><authorinitials>151.60.219.122</authorinitials></revision><revision><revnumber>2</revnumber><date>2009-11-06 14:25:35</date><authorinitials>151.60.219.122</authorinitials></revision><revision><revnumber>1</revnumber><date>2009-11-06 13:52:38</date><authorinitials>151.60.219.122</authorinitials></revision></revhistory></articleinfo><section><title>What is redmine?</title><para>Redmine is an open source, web-based project management and bug-tracking tool. It includes calendar and gantt charts to aid visual representation of projects and their deadlines. It supports multiple projects. Redmine is a FOSS solution which provides integrated project management features, issue tracking, and support for multiple version control options. </para><para>For more information: <ulink url="http://www.redmine.org"/> </para></section><section><title>Installation</title><section><title>Foreword</title><para>In this walkthrough you will see several 'variables', you'll have to substitute them to suit your needs. You can safely &quot;export&quot; them in your shell environment if you wish. </para><para>In particular: </para><itemizedlist><listitem><para><emphasis role="strong">DBNAME</emphasis>: is the database name </para><itemizedlist><listitem override="none"><para>this walkthrough assumes you will be using MySQL </para></listitem></itemizedlist></listitem><listitem><para><emphasis role="strong">REDMINEROOT</emphasis>: where Redmine will be unpacked (<emphasis role="strong">make sure to place this OUTSIDE Apache's document root</emphasis>) </para><itemizedlist><listitem override="none"><para>this walkthrough assumes that Redmine will be installed in: ~/webapps/binaryhelix.org/redmine-0.8.6 </para></listitem></itemizedlist></listitem></itemizedlist></section><section><title>Retrieving Redmine</title><para>At the time of writing, the latest release of Redmine is 0.8.6. Redmine can be retrieved from: <ulink url="http://rubyforge.org/frs/?group_id=1850"/> In particular we'll be using:  <ulink url="http://rubyforge.org/frs/download.php/66633/redmine-0.8.6.tar.gz"/> </para><para>So let's get it started: </para><screen><![CDATA[lvillani@mire:~$ mkdir -p webapps/binaryhelix.org
lvillani@mire:~$ cd webapps/binaryhelix.org
lvillani@mire:~/webapps/binaryhelix.org$ wget http://rubyforge.org/frs/download.php/66633/redmine-0.8.6.tar.gz
lvillani@mire:~/webapps/binaryhelix.org$ tar xf redmine-0.8.6.tar.gz
lvillani@mire:~/webapps/binaryhelix.org$ ls
default/  redmine-0.8.6  redmine-0.8.6.tar.gz]]></screen></section><section><title>Updating gems</title><para>Now we'll need to update some of the &quot;gems&quot; installed on HCoop servers. Please note that we'll be installing those gems inside your home directory thus wasting a little bit of space. </para><para>Start by creating the ~/.gemrc file with the following contents: </para><screen><![CDATA[cat > .gemrc << EOF
gem: --no-ri --no-rdoc
gemhome: $HOME/.gem
gempath:
 - $HOME/.gem
 - /var/lib/gems/1.8
EOF]]></screen><para>Now add the following to your ~/.bashrc: </para><screen><![CDATA[export RUBYLIB="$HOME/.gem/lib"
export PATH="$HOME/.gem/bin:$PATH"]]></screen><para>Make sure that the new settings are loaded in your current shell: </para><screen><![CDATA[lvillani@mire:~$ . ~/.bashrc]]></screen><para>Now update rubygems: </para><screen><![CDATA[lvillani@mire:~$ wget http://rubyforge.org/frs/download.php/60718/rubygems-1.3.5.tgz
lvillani@mire:~$ tar xf rubygems-1.3.5.tgz
lvillani@mire:~$ cd rubygems-1.3.5
lvillani@mire:~/rubygems-1.3.5$ ruby setup.rb --prefix=$HOME/.gem]]></screen><para>Let's update rake and install the required version of rails: </para><screen><![CDATA[lvillani@mire:~$ gem1.8 install rake
lvillani@mire:~$ gem1.8 install rails -v=2.1.2]]></screen><para>Verify that you are actually using the latest rake: </para><screen><![CDATA[lvillani@mire:~$ rake -V
rake, version 0.8.7]]></screen></section><section><title>Database</title><para>To do some initial setup database please follow instructions at: <ulink url="https://wiki.hcoop.net/MemberManual/WebApplications/Redmine/MemberManual/Databases#MySQL">MemberManual/Databases#MySQL</ulink> (<emphasis><emphasis role="strong">RUN mysql-fixperms or schema creation will NOT work</emphasis></emphasis>) </para><para>When you have created the database you are ready to configure redmine. The first thing we'll need to do is to tell redmine where to find our database. To do so we create a file called config/database.yml inside <emphasis role="strong">$REDMINEROOT</emphasis> with the following contents where: </para><itemizedlist><listitem><para><emphasis role="strong">USERNAME</emphasis> is your UNIX username, the one appearing before the '@' in every shell prompt </para></listitem><listitem><para><emphasis role="strong">DATABASE_PASSWORD</emphasis> is the password you set with dbtool mysql adduser (or dbtool mysql passwd, if you changed it later) </para></listitem><listitem><para><emphasis role="strong">DBNAME</emphasis> is the database name. It is formed by your account name, an underscore and the actual database name. </para></listitem></itemizedlist><screen><![CDATA[production:
  adapter: mysql
  database: DBNAME
  host: mysql
  username: USERNAME
  password: DATABASE_PASSWORD]]></screen><para>Now we can create the database schema by issuing the following command from <emphasis role="strong">$REDMINEROOT</emphasis>: </para><screen><![CDATA[lvillani@mire:~/webapps/binaryhelix.org/redmine-0.8.6$ RAILS_ENV=production rake db:migrate]]></screen><para>Now install some default data in the db (you can skip this but it simplifies configuration): </para><screen><![CDATA[lvillani@mire:~/webapps/binaryhelix.org/redmine-0.8.6$ RAILS_ENV=production rake redmine:load_default_data]]></screen></section><section><title>Exposing Redmine to the world</title><section><title>Preparing the PAG</title><para>Since the rails application will run as an unattended program, we need a way to avoid losing the Kerberos ticket given to us otherwise, after some time, redmine will answer with a 500 status code at every request (that is: it cannot read/write its files.) </para><para>To solve this you have to follow instructions at <ulink url="https://wiki.hcoop.net/MemberManual/WebApplications/Redmine/MemberManual/RunningUnattendedCommands#">MemberManual/RunningUnattendedCommands</ulink>. </para><para>Let's summarize what we need to do anyway, remember to replace my username and paths with yours. </para><screen><![CDATA[lvillani@mire:~$ mkdir ~/.run
lvillani@mire:~$ fs sa ~/.run system:anyuser rl
lvillani@mire:~$ fs sa ~/.run lvillani.daemon write
lvillani@mire:~$ fsr sa ~/.gem lvillani.daemon read
lvillani@mire:~$ fsr sa ~/.gemrc lvillani.daemon read
lvillani@mire:~$ fsr sa ~/webapps/binaryhelix.org/redmine-0.8.6 lvillani.daemon all]]></screen></section><section><title>Creating the script</title><para>We'll also need a startup script. Start by creating a directory in your home: </para><screen><![CDATA[lvillani@mire:~$ mkdir ~/bin]]></screen><para>Then create a script called, let's say <emphasis>binaryhelix-redmine.sh</emphasis> with the following contents: </para><screen><![CDATA[ #!/bin/sh
 export RUBYLIB=$HOME/.gem/lib
 cd $HOME/webapps/binaryhelix.org/redmine-0.8.6
 ./script/server webrick -e production]]></screen><para>Then make it executable: </para><screen><![CDATA[lvillani@mire:~$ chmod +x ~/bin/binaryhelix-redmine.sh]]></screen></section><section><title>Launching WEBRick</title><para>We must first launch WEBRick, which is a rails application container, to do so we use the <emphasis role="strong">run-in-pagsh</emphasis> command. We launch it through nohup, this way we can detach our shell without stopping webrick. </para><screen><![CDATA[lvillani@mire:~$ nohup run-in-pagsh binaryhelixredmine ~/bin/binaryhelix-redmine.sh 2>&1 > /dev/null &
[1] 22151]]></screen><para>See that <emphasis>[1] 22151</emphasis>? It means that our process has been forked to the background with PID 22151. </para><para>That is, WEBRick will sit on port 3000. Make sure to take an unused port, you can change it with the -p switch (from inside the script we've created before). </para></section><section><title>Configuring reverse proxy with DomTool</title><para>To make sure that redmine can be viewed from people outside HCoop without specifying the listening port of WEBRick we must configure Apache to be a proxy for redmine. This can be done by using <ulink url="https://wiki.hcoop.net/MemberManual/WebApplications/Redmine/DomTool#">DomTool</ulink>. Create a configuration file for your domain: in this case ~/.domtool/binaryhelix.org with the following content: </para><para><emphasis role="strong">Make sure to match the ports or it would NOT work</emphasis> </para><screen><![CDATA[dom "binaryhelix.org" where
  DocumentRoot = home "webapps/binaryhelix.org/default";
  WWW = begin
    unset_options [indexes];
    proxyPass "/" "http://localhost:3000/";
    proxyPassReverse "/" "http://localhost:3000/";
  end;
with
  vhostDefault with
    proxyPass "/" "http://localhost:3000/";
    proxyPassReverse "/" "http://localhost:3000/";
  end;
end;]]></screen><para>Apply the configuration with: </para><screen><![CDATA[lvillani@mire:~$ domtool ~/.domtool/binaryhelix.org]]></screen><para>And you're done! </para><!--rule (<hr>) is not applicable to DocBook--><para> <ulink url="https://wiki.hcoop.net/MemberManual/WebApplications/Redmine/CategoryMemberManual#">CategoryMemberManual</ulink> <ulink url="https://wiki.hcoop.net/MemberManual/WebApplications/Redmine/CategoryNeedsWork#">CategoryNeedsWork</ulink> </para></section></section></section></article>