Setting up ReviewBoard

Last week I’ve spent a couple of days setting up reviewboard. It wasn’t as painless a process as I had hoped, but in the end it worked so I’m happy.

Partly the problem with installing it is that I’ve never installed a python-based website before. The closest I ever got to setting up a Web2.0 website was setting up my blogs (this being one of them). But WordPress is written in PHP (which Slackware has support for out of the box) and they’ve put a lot of effort into making the installation as dummy-proof as possible.

I downloaded the ReviewBoard .egg file as the instructions suggested, but apparently that wasn’t needed at all. I also downloaded and installed setuptools, which is a sort of a python package manager that automatically without prompting downloads python modules (or apps?) that are dependencies for what I asked for.

The easy_install app from setuptools isn’t very hard, but it’s scary. It downloaded and installed a dozen things without asking me a thing, stuff like Django which I’d really want to know where it’s installed and for what purpose. I guess if I really wanted to understand what was being done I should have done a manual install, but given my lack of knowledge in the field and my lack of spare time – that would have taken weeks.

Luckily I haven’t done this on littlesvr.ca (my production server) but on a secondary, disposable server. This one is on a DSL like so its upload is pretty poor (50KB/s) but it should work for the experiment. It may even be a good thing that it’s slower than normal since my tablet is pretty old too (at times it’s obvious when you scroll quickly).

The next challenge was the prerequisites that the easy_install didn’t handle. One of them is a choice between mod_fastcgi and mod_python. Slackware didn’t have either installed. I tried fastcgi first guessing it would be easier, but it wasn’t – I couldn’t even figure out what it’s supposed to do, so it was hard to guess how to set it up. So I installed mod_python instead. A manual install, but wasn’t hard.

I brushed up on my MySQL admin knowledge and set up a database and a user with the right permissions. I wish I didn’t have to google this every time. The MySQL manual is really good, but it lacks the first time barebone setup I do once or twice a year.

While messing with the above I had to run rb-site install a couple of times. The second time it didn’t work and I had to delete all the tables it created the first time. There is no command in MySQL to dump all the tables from a database, but I found a handy script that I used successfully.

The most difficult part of the process was the Apache setup. even not counting the failed fastcgi installation attempts it took quite a few tries to get it right. The final solution (not ideal, but it works) was to create /etc/httpd/extra/httpd-vhosts.conf included from httpd.conf with these contents:

NameVirtualHost *:80
<VirtualHost *:80>
ServerName homesvr.littlesvr.ca
DocumentRoot “/home/www/htdocs/rb/htdocs”

# Error handlers
ErrorDocument 500 /errordocs/500.html

# Serve django pages
<Location “/”>
PythonPath “[‘/home/www/htdocs/rb/conf’] + sys.path”
SetEnv DJANGO_SETTINGS_MODULE reviewboard.settings
SetEnv PYTHON_EGG_CACHE “/home/www/htdocs/rb/tmp/egg_cache”
SetHandler mod_python
PythonHandler django.core.handlers.modpython
PythonAutoReload Off
PythonDebug Off
# Used to run multiple mod_python sites in the same apache
PythonInterpreter reviewboard_rb
</Location>

# Serve static media without running it through mod_python
# (overrides the above)
<Location “/media”>
SetHandler None
</Location>
<Location “/errordocs”>
SetHandler None
</Location>

<Directory “/home/www/htdocs/rb/htdocs”>
AllowOverride All
</Directory>

# Alias static media requests to filesystem
Alias /media “/home/www/htdocs/rb/htdocs/media”
Alias /errordocs “/home/www/htdocs/rb/htdocs/errordocs”
</VirtualHost>

This is almost the same as the sample httpd.conf ReviewBoard created for me, except for the first line. It would have been nice if somewhere in the docs it was mentioned that ReviewBoard requires a dedicated host to run on, but that’s ok – I already mentioned this is a disposable server.

After I finally got to see my ReviewBoard setup in a Firefox and changed the default username/password – there was just the matter of posting a patch into it. Again this was strangely difficult to do. It appears that a ReviewBoard instance is intended to work with one and only one source repository. I’m used to svn and have a server set up so I tried to connect it to that. I found (after googling it) that I need pysvn, so I installed it.

Then I was still confused about how I would go about posting a diff. I stumbled through it, and found one combination of “Base Directory” and “Diff” that worked. For this one I had to do a diff (specifically with LANG=en_CA svn diff -rx:y). That’s fine, I can just commit whatever I want reviewed into my homework repo.

Here’s what it looks like: