Jan 02 2009
Fighting Review Board
We’ve been talking a bit about code reviews at work, I do a bit of this now by reading commit emails, and have been wondering if there was an easier solution. To that end, I started looking around for software that could help us out.
I ended up beating on Review Board for about six hours before getting it installed. Now that it’s running it looks pretty nice. I think we’ll end up doing more post-commits then pre-commits but hopefully it’ll fit into our workflow.
Anyway, I though I’d put up a quick post on what I needed to do it get it running. The docs do a good job of getting the base install done. So give that a gander but come back here before you start running rb-site install.
We need to setup our MySQL database before running the rb-site. I did this by initializing a reviewboard MySQL database with a reviewboard user. I then granted all priviledges by executing:
GRANT ALL PRIVILEGES ON reviewboard.* TO 'reviewboard'@'localhost'
IDENTIFIED BY 'some_pass' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON reviewboard.* TO 'reviewboard'@'% '
IDENTIFIED BY 'some_pass' WITH GRANT OPTION;
Once rb-site install is run you’ll need to configure your webserver. In my case I ended up using Apache with FastCGI. When I tried to use the mod_python option the webserver would get a Segmentation Violation and terminate. Not so good.
The provided Apache FastCGI configuration script didn’t work for me and I ended up using the following.
AddHandler fastcgi-script fcgi
FastCGIExternalServer "/var/www/reviews/htdocs/reviewboard.fcgi" -host 127.0.0.1:3033 -idle-timeout 60
<VirtualHost *:8888>
ServerName reviews.local
DocumentRoot /var/www/reviews/htdocs
# Alias static media requests to filesystem
Alias /media /var/www/reviews/htdocs/media
Alias /errordocs /var/www/reviews/htdocs/errordocs
# Error handlers
ErrorDocument 500 /errordocs/500.html
# Direct all other requests to the fastcgi server
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^/(.*)$ /reviewboard.fcgi/$1 [QSA,L]
</VirtualHost>
The first parameter to FastCGIExternalServer needs to be the full path to reviewboard.fcgi as if it existed in your DocumentRoot. Nothing else seemed to work for me.
Note, if you’re using VirtualHosts you’ll also need to make sure the NamedVirtualHost option is enabled in your httpd.conf file (or whatever your main Apache config file is named).
Now, this will run, but it won’t work. The reason it won’t work is that it needs an external server to send the FastCGI requests too. You can run this server by executing: rb-site manage /var/www/reviews/ runfcgi method=threaded port=3033 host=127.0.0.1 protocol=fcgi. You’ll notice the host and port match up to those specified in the Apache config file.
I ended up creating a simple shell script to handle starting and stopping the rb-site server.
#! /bin/sh
# chkconfig: 2345 90 90
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DESC="reviewboard daemon"
NAME=reviewboard
case "$1" in
start)
echo -n "Starting $DESC: $NAME"
/usr/bin/rb-site manage /var/www/reviews/ runfcgi method=threaded port=3033 host=127.0.0.1 protocol=fcgi
echo "."
;;
stop)
echo -n "Stopping $DESC: $NAME"
pkill rb-site
echo "."
;;
*)
echo "Usage: NAME {start|stop}" >&2
exit 3
;;
esac
exit 0
With that I was able to login and start playing with Review Board. I ended up doing a bit of extra work to disable registration (which is kind of nasty as I had to edit the base HTML templates and urls.py) but everything seems to be working well now.
We’ve started using
First, a quick note on AMQP terminology, this isn’t complete but should cover us for our purpose. When you publish a message to an AMQP server (I’m just going to use Rabbit from now on) it gets published onto an exchange. A client who wishes to listen to the exchange attaches a queue to the exchange. Queues and exchanges can be set as durable which means they’ll survive a restart of Rabbit. Messages can be marked as persistent which means they’ll sit on the queues attached to the exchange until the consumer picks them up. If a message isn’t persistent it will just disappear from the queue if there is no client listening.