Friday, January 27, 2012

Installing Gitorious using RVM

Installing Gitorious is not straightforward.
As Rodrigo explains here, it can be made easier using Chef/Puppet.

However, I was not in a position to use Chef/Puppet, and I wanted to use rvm.

After installing  the Gitorious Rails app using rvm, you have to make some small changes to the start-up scripts that Gitorious want you to copy in in /etc/init.d/: git-daemon  git-poller  git-ultrasphinx and stomp.

The scripts have RUBY_HOME hard coded as "/opt/ruby-enterprise".
Assuming you've installed Gitorious for the `git' user in  /home/git/gitorious, and configured rvm in this directory, run `rvm info' here, and note the RUBY_HOME and GEM_HOME variables from the output.

We have to change these variables in the /etc/init.d/ scripts.
GEMS_HOME is the same as GEM_HOME.
After this, you have to change the way the script calls the executables.
The /etc/init.d/stomp script for example, calls it like so:

'/bin/su - gitorious -c "$STOMP"'

Change this to:

'/bin/su - gitorious -c "cd ~git/gitorious && $STOMP"'

Make a similar change in all other scripts, and all scripts should now work.

No comments: