02.20.09

Migrate from Trac to Lighthouse - Nearly Painless with Trachouse

Posted by ryan in lighthouse, ruby, svn


Lighthouse in Beautiful Holland, MI Lighthouse is an "issue tracker", which falls into the family of applications like Trac and Basecamp. Having just offloaded my svn repos via Beanstalk (hosted svn, it's completely awesome), I wanted to see if I could find a replacement for my VPS-hosted Trac installation. After all, Trac only works with subversion repositories located on the same server. So, in essence, moving my subversion repository to Beanstalk killed my repository-related features in Trac. Fortunately, Beanstalk is awesome enough to integrate easily into a number of different applications, including Lighthouse. So, in my bid to finally rid myself of my expensive VPS (I've always had it for just a few things I need), I decided to jump from Trac to Lighthouse. The results, I'm hoping, are more profit.

Converting your Trac stuff to Lighthouse

Even if you're just a small fry like me, you've probably got quite a few milestones, and tons and tons of tickets associated with your Trac projects. It would be a shame to lose those and a much bigger shame to convert them manually (gross). Fortunately, Lighthouse has a rich API and some smart guy named Shay Arnett programmed a nice little Ruby script to do all of this for you. And while I may be ruby-retarded, I had no problems with this script. In fact, it saved me from a ton of bullshit.

Trachouse - utility to convert Trac to Lighthouse

Trachouse is the script that reads your Trac tickets and adds them to your Lighthouse application. You'll need a few dependencies with this, like the lighthouse api, but if you speak only a little Ruby, you should be able to handle it. If you are a little more ruby-retarded like me, make sure you have activeresource. If you don't know what I'm talking about, try first to get rubygems then install it via sudo gem install activeresource.

To (hopefully) save some time, I've put together an archive of exactly what you'll need (minus some of the more core dependencies that you'll need like activeresource). You can download that archive below:

Download Trachouse... with slight idiot modifications I needed

How to convert: 6 or so easy steps

  1. Signup for Lighthouse
  2. Create your project in Lighthouse
  3. Manually create your milestones in Lighthouse - if you leave some out (that you have in Trac), that's no big deal
  4. Download my trachouse archive above and get all the dependencies
  5. Open up trachouse.rb in an editor and setup the config. There are 2 sections - one for lighthouse and one for trac. For the lighthouse project and milestone ids, just look in the lighthouse url - they're pretty obvious.
  6. From the command line, run ruby doit.rb
  7. Watch and enjoy - this isn't really a step, more just an unnecessary comment

An error that I got

I did get one error during the process:

./trachouse.rb:321:in `+': can't convert nil into Array (TypeError)

This occurs because trachouse is looking for the following type of string in the html code of a certain ticket

<span class="status">(closed enhancement: invalid)</span>

But if finds only this:

<span class="status">(closed: invalid)</span>

This occurs if you've disabled all the "Ticket Types" in Trac Admin. By default, "Ticket Types" include "Enhancement" and "Defect". If you've deleted both of these and saved tickets, you'll get the above error. I'm sure someone more versed in Ruby could fix this - but for me it was just easier to re-eneable "Ticket Types" and resave the few tickets that were lacking.

Getting rid of my VPS!

My VPS was born out of the embarrassing situation of creating an application that absolutely required the curl option CURLOPT_FOLLOWLOCATION to be enabled (I had no idea shared hosts disable this due to a security hole). Over time, my VPS has gotten loaded down with a few other things I depend on like svn (available over webdav) and trac. Thankfully, Beanstalk rescued me from my svn problem yesterday and Lighthouse from my Trac problem today. It's time to put $52.95/month back in my pocket. Thanks Beanstalk + Lighthouse.

Thanks for the shares!
  • StumbleUpon
  • Sphinn
  • del.icio.us
  • Facebook
  • TwitThis
  • Google
  • Reddit
  • Digg
  • MisterWong