Setting up Collaboa
This is a wiki article created by HostingRails users. Please login or signup to make edits.
Collaboa is a project tracking system similar to Trac and Bugzilla with subversion integration, providing changeset and source browsing. Collaboa is very tricky to setup in a shared hosting environment because it depends on the Ruby language bindings for Subversion and SWiG. Thankfully only half of this is missing from the HostingRails server environment, the Ruby bindings, but this half requires a good bit of hoop jumping to get setup right. Hopefully this will help you get setup with Collaboa without the days of effort it took to figure this out.
NOTE: To work with Mongrel you can stop before doing the FastCGI Tweaks and the system will be ready to go.
Setting up the environment
1.) Create a new directory where everything can live, including the source code we'll be downloading:
[~]# mkdir ~/local
[~]# mkdir ~/local/src
2.) Modify your environment variables:[~]# nano ~/.bash_profile
...
export RUBYLIB=/home/<USER>/local/lib/ruby/site_ruby/1.8:/home/<USER>/local/lib/ruby/site_ruby/1.8/i686-linux:$RUBYLIB
export LIBDIR=/home/<USER>/local/lib:$LIBDIR
export LD_LIBRARY_PATH=/home/<USER>/local/lib:$LD_LIBRARY_PATH
export LD_RUN_PATH=/home/<USER>/local/lib:$LD_RUN_PATH
Make sure you exit and relogin to your shell to get these values active.3.) Downloading all the source code we need:
NOTE: You'll probably want to check that the tarballs listed here are the most up to date, a list of sites to check are below.
[~]# cd ~/local/src
[~/local/src]# wget http://subversion.tigris.org/downloads/subversion-1.4.3.tar.gz
[~/local/src]# wget http://mirrors.sirium.net/pub/apache/apr/apr-0.9.13.tar.gz
[~/local/src]# wget http://mirrors.sirium.net/pub/apache/apr/apr-util-0.9.13.tar.gz
[~/local/src]# wget http://www.webdav.org/neon/neon-0.26.3.tar.gz
- Subversion: http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=260&expandFolder=74[/li]
- apr: http://apr.apache.org/download.cgi[/li]
- apr-util: http://apr.apache.org/download.cg[/li]i
- neon: http://www.webdav.org/neon/[/li]
[~/local/src]# tar xzf subversion-1.4.3.tar.gz
[~/local/src]# tar xzf apr-0.9.13.tar.gz
[~/local/src]# tar xzf apr-util-0.9.13.tar.gz
[~/local/src]# tar xzf neon-0.26.3.tar.gz
Finally, copy apr, apr-util and neon into the subversion-1.4.3 directory. This will allow all these items to be built together without doing multiple configure or make steps manually.[~/local/src]# cp -R apr-0.9.13 subversion-1.4.3/apr
[~/local/src]# cp -R apr-util-0.9.13 subversion-1.4.3/apr-util
[~/local/src]# cp -R neon-0.26.3 subversion-1.4.3/neon
Compiling what we needBecause SWiG is already installed we can configure Subversion and it will depend on the installed version in /usr/local, unfortunately we needed to download the apr, apr-util and neon packages because appropriate versions aren't readily available on the servers. Also, we will use the system Ruby install instead of compiling that as well, but we will want to make sure and tell configure about where the custom Ruby SITEDIR should go.
[~/local/src]# cd subversion-1.4.3
[~/local/src/subversion-1.4.3]# ./configure --prefix=/home/<USER>/local --with-ruby-sitedir=/home/<USER>/local/lib/ruby/site_ruby
At the end you will see a complaint about Berkeley DB, you probably shouldn't be using Berkeley DB for your Subversion repository anyways, not to mention I don't think it is an option on HostingRails. Now run the magic build process:[~/local/src/subversion-1.4.3]# make && make install && make swig-rb && make install-swig-rb
Hopefully you get through this error free, otherwise you'll need to troubleshoot and figure out what went wrong.QUICK TEST
Exit and re-enter your shell.
[~]# irb
...
require 'svn/core'
If you get anything other than 'true' or 'false' something is wrong.
Move the installed binaries
We don't want these custom binaries interferring with the stack HostingRails provides. No telling what kind of problems our versions of this stuff might do. So, if this is the first time you have put anything in ~/local you can just call this command:
[~]# mv ~/local/bin ~/local/bin-inactive
Or you can move or rename all these files:~/local/bin/apr-config
~/local/bin/apu-config
~/local/bin/svn
~/local/bin/svnadmin
~/local/bin/svndumpfilter
~/local/bin/svnlook
~/local/bin/svnserve
~/local/bin/svnsync
~/local/bin/svnversion
I don't like deleting them but I suppose you could.Setup Collaboa
1.) Unpack and setup the database
Go into your cPanel and setup a database and any add-on or sub domain you might want to use. I will assume you are installing to the collaboa.yoursite.com subdomain with a folder at ~/public_html/collaboa. I like installing all my apps under ~/apps so you may want to tweak your methods based on how you like to keep things organized.
[~]# mkdir ~/apps
[~]# cd apps
[~/apps]# wget http://collaboa.org/releases/collaboa-0.6.1.tar.gz
[~/apps]# tar xzf collaboa-0.6.1.tar.gz
[~/apps]# mv collaboa-0.6.1 collaboa
[~/apps]# cd collaboa
[~/apps/collaboa]# cp config/database.yml.sample config/database.yml
[~/apps/collaboa]# nano config/database.yml
Edit to match your database config.Now setup the initial database stuff
[~/apps/collaboa]# RAILS_ENV="production" rake db:schema:load
[~/apps/collaboa]# RAILS_ENV="production" ruby db/default_content.rb
2.) Tweak config/environment.rb[~/apps/collaboa]# nano config/environment.rb
Uncomment this line near the top of the file:ENV['RAILS_ENV'] = 'production
3.) Freeze your gemsI like to freeze all the gems that are needed, especially Rails, so run the following:
[~/apps/collaboa]# rake rails:freeze:edge TAG=rel_1-2-1
[~/apps/collaboa]# cd vendor
[~/apps/collaboa/vendor]# gem unpack xhtmldiff -v 1.0.0
[~/apps/collaboa/vendor]# mv xhtmldiff-1.0.0 xhtmldiff
[~/apps/collaboa/vendor]# cd ..
If RedCloth and Syntax aren't in the vendor directory already you may want to unpack them as well.4.) Setup your symlink
[~/apps/collaboa]# mv /home/<USER>/public_html/collaboa /home/<USER>/public_html/collaboa-old
[~/apps/collaboa]# ln -s /home/<USER>/public_html/collaboa /home/<USER>/apps/collaboa/public
Tweak FastCGIIf you want to run Collaboa in Mongrel then you are done, get with HostingRails' support team and be on your way. But, if you want to use FastCGI then keep on reading.
1.) Tweak config/environment.rb again
[~/apps/collaboa]# nano config/environment.rb
Immediately after the line with the following comment add the listed code:# Include your application configuration below
ActionController::AbstractRequest.relative_url_root = ""
You will want to add "/<SUBDIRECTORY" to that line of code if you will be running it anywhere other than at the root of a domain or sub domain.
2.) Setup public/custom.fcgi
[~/apps/collaboa]# nano public/custom.fcgi
The file should end up looking something like this with the same values you setup in ~/.bash_profile#!/bin/bash
export RUBYLIB=/home/<USER>/local/lib/ruby/site_ruby/1.8:/home/<USER>/local/lib/ruby/site_ruby$
export LIBDIR=/home/<USER>/local/lib:$LIBDIR
export LD_LIBRARY_PATH=/home/<USER>/local/lib:$LD_LIBRARY_PATH
export LD_RUN_PATH=/home/<USER>/local/lib:$LD_RUN_PATH
exec ./dispatch.fcgi
This setups the environment so that mod_fcgid can actually find the Ruby bindings for Subversion.
3.) Tweak public/.htaccess
[~/apps/collaboa]# nano public/.htaccess
Comment out all the AddHandler lines at the top of the file.Change the line that reads as follows:
RewriteRule ^(.*)$ dispatch.cgi [QSA,L]
To the following:RewriteRule ^(.*)$ custom.fcgi [QSA,L]
Final CommentsThis should be all you need to do, you should now be able to go to the URL for your Collaboa installation and login as admin. Then go setup your repositories and before you setup you projects go back to your shell and run the following from the base of your collaboa install.
[~/apps/collaboa]# ./script/repository_syncer
Have fun!
Stewartaa