welcome: please sign in

Diff for "MemberManual/WebApplications/Redmine"

Differences between revisions 3 and 14 (spanning 11 versions)
Revision 3 as of 2009-11-06 14:34:04
Size: 3677
Comment:
Revision 14 as of 2018-10-20 18:22:32
Size: 7175
Editor: ClintonEbadi
Comment: placing cgi into public_html considered dangerous
Deletions are marked like this. Additions are marked like this.
Line 2: Line 2:
Line 18: Line 19:
 * DBNAME: is the database name  * '''DBNAME''': is the database name
Line 20: Line 21:
 * DOCROOT: where Redmine will be unpacked
   this walkthrough assumes that Redmine will be installed in: ~/public_html/binaryhelix.org/default
 * '''REDMINEROOT''': where Redmine will be unpacked ('''make sure to place this OUTSIDE Apache's document root''')
   this walkthrough assumes that Redmine will be installed in: ~/webapps/binaryhelix.org/redmine-0.8.6
Line 32: Line 33:
lvillani@mire:~$ cd public_html/binaryhelix.org/default
lvillani@mire:~/public_html/binaryhelix.org/default$ wget http://rubyforge.org/frs/download.php/66633/redmine-0.8.6.tar.gz
lvillani@mire:~/public_html/binaryhelix.org/default$ tar xf redmine-0.8.6.tar.gz
lvillani@mire:~/public_html/binaryhelix.org/default$ ls
redmine-0.8.6 redmine-0.8.6.tar.gz
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
Line 43: Line 45:
Let's update both rake and rails: Start by creating the ~/.gemrc file with the following contents:
Line 45: Line 48:
lvillani@mire:~$ gem install --install-dir $HOME/.gem --no-ri --no-rdoc -y rake
lvillani@mire:~$ gem install --install-dir $HOME/.gem --no-ri --no-rdoc -y rails -v=2.1.2
cat > .gemrc << EOF
gem: --no-ri --no-rdoc
gemhome: $HOME/.gem
gempath:
 - $HOME/.gem
 - /var/lib/gems/1.8
EOF
Line 49: Line 57:
The stuff will be installed inside ~/.gem.

Now, in order to use the ''new'' rake and rails command we need to prepend ~/.gem/bin to the PATH. Assuming that you are using the bash shell, open ~/.bashrc (create it if it doesn't exist) and add:
Now add the following to your ~/.bashrc:
Line 54: Line 59:
export RUBYLIB="$HOME/.gem/lib"
Line 57: Line 63:
We will also need to tell ruby where to find the ruby libraries we've just installed, this is done by exporting the GEM_HOME environment variable. Add the following to your ~/.bashrc:

{{{
export GEM_HOME="$HOME/.gem"
}}}

Now make sure that the new settings are loaded in your current shell:
Make sure that the new settings are loaded in your current shell:
Line 69: Line 68:
Now update rubygems:
{{{
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
}}}

Let's update rake and install the required version of rails:
{{{
lvillani@mire:~$ gem1.8 install rake
lvillani@mire:~$ gem1.8 install rails -v=2.1.2
}}}
Line 70: Line 83:
Line 78: Line 90:
To do some initial setup database please follow instructions at: [[MemberManual/Databases#MySQL]] To do some initial setup database please follow instructions at: [[MemberManual/Databases#MySQL]] ('''''RUN mysql-fixperms or schema creation will NOT work''''')
Line 80: Line 92:
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 database.yml inside DOCROOT/redmine-0.8.6/config with the following contents: 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 '''$REDMINEROOT''' with the following contents where:
 * '''USERNAME''' is your UNIX username, the one appearing before the '@' in every shell prompt
 * '''DATABASE_PASSWORD''' is the password you set with dbtool mysql adduser (or dbtool mysql passwd, if you changed it later)
 * '''DBNAME''' is the database name. It is formed by your account name, an underscore and the actual database name.
Line 85: Line 100:
  database: '''DBNAME'''   database: DBNAME
Line 87: Line 102:
  username: '''USERNAME'''
  password: '''DATABASE_PASSWORD'''
  username: USERNAME
  password: DATABASE_PASSWORD
Line 91: Line 106:
Where:
 * '''USERNAME''' is your UNIX username, the one appearing before the '@' in every shell prompt
 * '''DATABASE_PASSWORD''' is the password you set with dbtool mysql adduser (or dbtool mysql passwd, if you changed it later)
 * '''DBNAME''' is the database name. It is formed by your account name, an underscore and the actual database name
Now we can create the database schema by issuing the following command from '''$REDMINEROOT''':
{{{
lvillani@mire:~/webapps/binaryhelix.org/redmine-0.8.6$ RAILS_ENV=production rake db:migrate
}}}

Now install some default data in the db (you can skip this but it simplifies configuration):
{{{
lvillani@mire:~/webapps/binaryhelix.org/redmine-0.8.6$ RAILS_ENV=production rake redmine:load_default_data
}}}

== Exposing Redmine to the world ==

=== Preparing the PAG ===

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.)

To solve this you have to follow instructions at [[MemberManual/RunningUnattendedCommands]].

Let's summarize what we need to do anyway, remember to replace my username and paths with yours.

{{{
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
}}}

=== Creating the script ===

We'll also need a startup script. Start by creating a directory in your home:
{{{
lvillani@mire:~$ mkdir ~/bin
}}}

Then create a script called, let's say ''binaryhelix-redmine.sh'' with the following contents:
{{{
 #!/bin/sh
 export RUBYLIB=$HOME/.gem/lib
 cd $HOME/webapps/binaryhelix.org/redmine-0.8.6
 ./script/server webrick -e production
}}}

Then make it executable:
{{{
lvillani@mire:~$ chmod +x ~/bin/binaryhelix-redmine.sh
}}}

=== Launching WEBRick ===
We must first launch WEBRick, which is a rails application container, to do so we use the '''run-in-pagsh''' command. We launch it through nohup, this way we can detach our shell without stopping webrick.

{{{
lvillani@mire:~$ nohup run-in-pagsh binaryhelixredmine ~/bin/binaryhelix-redmine.sh 2>&1 > /dev/null &
[1] 22151
}}}

See that ''[1] 22151''? It means that our process has been forked to the background with PID 22151.

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).

=== Configuring reverse proxy with DomTool ===

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 DomTool.
Create a configuration file for your domain: in this case ~/.domtool/binaryhelix.org with the following content:

'''Make sure to match the ports or it would NOT work'''

{{{
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;
}}}

Apply the configuration with:
{{{
lvillani@mire:~$ domtool ~/.domtool/binaryhelix.org
}}}

And you're done!
----
CategoryMemberManual CategoryNeedsWork

What is redmine?

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.

For more information: http://www.redmine.org

Installation

Foreword

In this walkthrough you will see several 'variables', you'll have to substitute them to suit your needs. You can safely "export" them in your shell environment if you wish.

In particular:

  • DBNAME: is the database name

    • this walkthrough assumes you will be using MySQL
  • REDMINEROOT: where Redmine will be unpacked (make sure to place this OUTSIDE Apache's document root)

    • this walkthrough assumes that Redmine will be installed in: ~/webapps/binaryhelix.org/redmine-0.8.6

Retrieving Redmine

At the time of writing, the latest release of Redmine is 0.8.6. Redmine can be retrieved from: http://rubyforge.org/frs/?group_id=1850 In particular we'll be using: http://rubyforge.org/frs/download.php/66633/redmine-0.8.6.tar.gz

So let's get it started:

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

Updating gems

Now we'll need to update some of the "gems" installed on HCoop servers. Please note that we'll be installing those gems inside your home directory thus wasting a little bit of space.

Start by creating the ~/.gemrc file with the following contents:

cat > .gemrc << EOF
gem: --no-ri --no-rdoc
gemhome: $HOME/.gem
gempath:
 - $HOME/.gem
 - /var/lib/gems/1.8
EOF

Now add the following to your ~/.bashrc:

export RUBYLIB="$HOME/.gem/lib"
export PATH="$HOME/.gem/bin:$PATH"

Make sure that the new settings are loaded in your current shell:

lvillani@mire:~$ . ~/.bashrc

Now update rubygems:

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

Let's update rake and install the required version of rails:

lvillani@mire:~$ gem1.8 install rake
lvillani@mire:~$ gem1.8 install rails -v=2.1.2

Verify that you are actually using the latest rake:

lvillani@mire:~$ rake -V
rake, version 0.8.7

Database

To do some initial setup database please follow instructions at: MemberManual/Databases#MySQL (RUN mysql-fixperms or schema creation will NOT work)

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 $REDMINEROOT with the following contents where:

  • USERNAME is your UNIX username, the one appearing before the '@' in every shell prompt

  • DATABASE_PASSWORD is the password you set with dbtool mysql adduser (or dbtool mysql passwd, if you changed it later)

  • DBNAME is the database name. It is formed by your account name, an underscore and the actual database name.

production:
  adapter: mysql
  database: DBNAME
  host: mysql
  username: USERNAME
  password: DATABASE_PASSWORD

Now we can create the database schema by issuing the following command from $REDMINEROOT:

lvillani@mire:~/webapps/binaryhelix.org/redmine-0.8.6$ RAILS_ENV=production rake db:migrate

Now install some default data in the db (you can skip this but it simplifies configuration):

lvillani@mire:~/webapps/binaryhelix.org/redmine-0.8.6$ RAILS_ENV=production rake redmine:load_default_data

Exposing Redmine to the world

Preparing the PAG

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.)

To solve this you have to follow instructions at MemberManual/RunningUnattendedCommands.

Let's summarize what we need to do anyway, remember to replace my username and paths with yours.

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

Creating the script

We'll also need a startup script. Start by creating a directory in your home:

lvillani@mire:~$ mkdir ~/bin

Then create a script called, let's say binaryhelix-redmine.sh with the following contents:

 #!/bin/sh
 export RUBYLIB=$HOME/.gem/lib
 cd $HOME/webapps/binaryhelix.org/redmine-0.8.6
 ./script/server webrick -e production

Then make it executable:

lvillani@mire:~$ chmod +x ~/bin/binaryhelix-redmine.sh

Launching WEBRick

We must first launch WEBRick, which is a rails application container, to do so we use the run-in-pagsh command. We launch it through nohup, this way we can detach our shell without stopping webrick.

lvillani@mire:~$ nohup run-in-pagsh binaryhelixredmine ~/bin/binaryhelix-redmine.sh 2>&1 > /dev/null &
[1] 22151

See that [1] 22151? It means that our process has been forked to the background with PID 22151.

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).

Configuring reverse proxy with DomTool

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 DomTool. Create a configuration file for your domain: in this case ~/.domtool/binaryhelix.org with the following content:

Make sure to match the ports or it would NOT work

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;

Apply the configuration with:

lvillani@mire:~$ domtool ~/.domtool/binaryhelix.org

And you're done!


CategoryMemberManual CategoryNeedsWork

MemberManual/WebApplications/Redmine (last edited 2018-10-20 18:22:32 by ClintonEbadi)