Saturday, August 19, 2006

rtags

I just submitted a patch for rtags.

rtags overwrites the existing TAGS file by default.
This patch adds an option "-a" or "--append"
so that rtags will append to the TAGS file instead of overwriting it.

This will allow rtags to index an entire directory (e.g. rails app)
find rails_app_dir -name '*.rb' -print -exec rtags -a {} \;

I just ran rtags on /usr/lib/ruby. Took a while to finish. Let's see how useful
it is going to be.

Using Capistrano for deployment

So I wanted to get started with capistrano and getting the rails app deployed to the main server (CentOS 4)
I ran into the lighttpd hang issue where the capistrano task to start the lighttpd process on the remote server hangs and doesn't return. The lighttpd process starts up fine though.
The following command solved the issue for me:

nohup sudo /usr/local/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf > /dev/null 2>&1

Another issue was starting backgroundrb processes on the remote servers. Capsitrano would invoke the command 'rake backgroundrb:start' and I could see the output, but doing a ps auxf on the remote server would show no backgroundrb process.
The following shell script works for me :

#!/bin/sh

echo "Starting the backgroundrb server"
echo "cd /var/www/xxx/current; rake backgroundrb:start"
cd /var/www/xxx/current
log="/tmp/backgroundrb.`date +%s`"
echo "Writing to $log"
nohup rake backgroundrb:start > $log 2>&1
cat $log
rm -f $log

Hopefully it will be useful to others.