Setting up loggerhead on ubuntu

May 21, 2009

I recently had to set up a web viewer for a bzr branch hosted on my ubuntu server and decided to go with loggerhead as it seems to be the most commonly used one. However, all the instructions I could find have been written before the inclusion of loggerhead in the ubuntu repositories, so here is an updated tutorial on how to install and configure loggerhead on ubuntu.

I make the assumption that you already have a bzr branch or checkout on the same machine, which you want to be able to browse from your web browser.

The first step is to install loggerhead from the ubuntu repository. That's the easy part:

sudo apt-get install loggerhead

You can quickly test it out by running the serve-branches command from the root of a bzr branch. This will make the loggerhead web viewer available at http://example.com:8080 (or http://localhost:8080 if running locally).

The loggerhead package conveniently placed an entry in /etc/init.d/loggerhead, but calling sudo /etc/init.d/loggerhead start just fails silently. Looking at /etc/init.d/loggerhead, you can see that the script is looking for a config file in /etc/loggerhead.conf and passes this file as an argument to the start-loggerhead command.

The /etc/loggerhead.conf file doesn't exist yet, but you can copy the example file:

cp /usr/share/doc/loggerhead/loggerhead.conf.example /etc/loggerhead.conf

Using the example provided, it's pretty easy to update the configuration file to point to your bzr branch. Note that you need to remove the example branches from the configuration file or starting the loggerhead server will fail (again, silently) due to the references to nonexisting branches.

Once your configuration file is ready, you can start loggerhead with:

sudo /etc/init.d/loggerhead start

which should display: Starting Loggerhead Bazaar Branch Browser: loggerhead.. Unless configured otherwise, your branch browser should be at http://example.com:8080.

If you are still having issues, run sudo start-loggerhead -f. This is the command that gets called by /etc/init.d/loggerhead, but calling it with -f (foreground) will display some more information that can help you find the cause of your problems.