I have been using a work-tracking system that I call WIDI - “Write It Down Idiot!” for a little while now. A WIDI list is a page with three columns, two small and one large. The task details go in the large bit and the others I used as I felt like it - normally one for ticking things off and another for things like the initials of someone who I’d delegated (offloaded, shirked off) a task to. This has been working quite well in helping me to reduce the list of things I was trying to remember which was beginning to cause me a lot of stress.

Given that I’m a geek and that WIDI lists are a pain to keep re-writing I decided I’d maybe write a todo list web app, perhaps to try out some XmlHttpRequest techniques. However, I then noticed a post (who knows where) pointing out that for every language there is an oft-rewritten application. Perl has template languages, C has “Hello World” and Ruby, apparently, has todo applications! A quick search turned up Tracks.

Tracks is a web-based todo list manager that runs on ruby-on-rails. I don’t really know much about ruby or rails, but they both seem to be getting an awful lot of press at the moment. Tracks has a simple but nice user interface with everything I need and not too much more.

Rails and Ruby were relatively easy to get installed on my gentoo server (having synced up portage and rebuilt the world!):

emerge -a ruby emerge -a rails

Installing the app and running with the rails server (WEBrick) would have been reasonably easy but I’m a sucker for punishment and am avoiding running too many things on my box so wanted to serve the pages using Apache.

I extracted Tracks into a directory and pointed Apache at the “public” directory underneath. I wanted to use tracks at a “/todo” url under the main one. It seems there are a few bits in Tracks that need changing for this to work properly.

First I had to edit the .htaccess file to change the main RewriteRule entry to include the path:

RewriteRule ^(.*)$ **/todo**/dispatch.cgi?$1 [QSA,L]

This got me going so that I could sign up to Tracks and setup my login - the main page came up with example tasks and this was good. It seemed a bit slow and I noticed a number of comments to the same effect that recommended using FastCGI to speed up execution (I guess it keeps the ruby interpreter in memory). So, I decided to emerge FastCGI:

emerge mod_fastcgi

Enabling the use of FastCGI involved two steps. Firstly, editing the /etc/conf.d/apache2 file to include -D FASTCGI and secondly, editing the .htaccess file in the public directory of tracks to use the .fcgi file instead of the .cgi file:

RewriteRule ^(.*)$ /todo/dispatch.**fcgi**?$1 [QSA,L]

So I restarted Apache, and went to my tracks page, and the server ground to a halt. It seems that my user-mode linux machine with 64 megs of memory can’t cope with FastCGI spawning ten CGI processes each running Ruby. Just using FastCGI without any extra configuration seemed to plump for ten FastCGI processes being spawned to serve requests. Not great that it killed the server but also complete overkill for the Todo application to be used just by me.

I did a quick bit of googling and found the clever lines I needed for my apache2.conf:

<IfDefine FASTCGI> FastCgiServer /var/www/server/todo/public/dispatch.fcgi -processes 1 -flush -priority 10 </IfDefine>

This restricted FastCGI to a single process which seemed to kill the server less. Tracks is still slow (one of the reasons I’m considering trying Lighttpd) and in fact I’m not sure it’s much faster than without FastCGI but it was an interesting experiment anyway. It would be interesting to have a page load timer on it so that I could easily compare with and without FastCGI.

The final stage in getting Tracks to work fully in a non-root web path was to edit some files with hard-coded paths in them. The checkboxes for marking tasks as done have a hard-coded onclick event and some of the forms have hard-coded action paths. I’m not sure I’ve found all of these references yet, but the ones I changed were in the following files:

tracks/views/todo/_not_done.rhtml tracks/views/context/_not_done.rhtml tracks/views/project/_not_done.rhtml tracks/views/context/edit.rhtml

Hopefully if anyone else is trying to get the same combination working this will help them out, I’ve enjoyed using Tracks today and hope to build a long and meaningful relationship with it!

ps. Ruby scheme for PN2 coming soon!