Wiki Index All Recent Edit Bottom

Loggerhead Server

1.   Installing Loggerhead
1.1   Loggerhead
1.2   Install Logerhead
1.3   Starting and Stopping Loggerhead
1.4   Proxying Loggerhead via Apache
1.5   Proxying Loggerhead via Lighttpd
1.6   Loggerhead Searching

Installing Loggerhead

Loggerhead

Loggerhead is a web viewer for projects in bazaar. It can be used to navigate a branch history, annotate files, view patches, perform searches, etc. It's originally based on bazaar-webserve, which is itself based on hgweb for Mercurial.

There are a few web front ends for Bazaar at the moment, such as Loggerhead, webserve, viewbzr, and bzrweb. Loggerhead is the one with the most active development. Loggerhead shows side-by-side diffs, has RSS feeds, and lets you download specific changes, just like you would expect.

Install Logerhead

Firt install python-configobj, python-simpletal, python-paste, python-pastedploy and python-simplejson.

 aptitude install python-configobj python-simpletal python-paste python-pastedeploy python-simplejson

You can get the latest version of loggerhead by branch the Bazaar repository.

 bzr branch lp:loggerhead

Or you can grab the tarball of the current release, which is recommended since you know what you are getting.

 wget http://launchpad.net/loggerhead/1.17/1.17/+download/loggerhead-1.17.tar.gz
 tar zxvf loggerhead-1.17.tar.gz
 python setup.py install

Then by running 'serve-branches' and point it at your branches you should be up and running with your own web interface running on http://localhost:8080

 ./serve-branches /var/local/bzr/

Starting and Stopping Loggerhead

We want Loggerhead to start automatically at boot and stop automatically at shutdown.

Loggerhead Configuration

Create the Loggerhead configuration file.

 nano /etc/loggerhead.conf

Add the following to the file and save it.

 # use this if you're mapping loggerhead within apache via proxy
 server.webpath = 'http://code.example.org/Loggerhead/'
 
 # the access and debug logs can be set up to roll 'daily', 'weekly', or 'never':
 log.roll = 'daily'
 
 # here's an example of an auto-published folder:
 [bazaar]
    name = 'My Bazaar'
    auto_publish_folder = '/var/local/bzr/'

Init Script

Create the an init.d script for Loggerhead.

 nano /etc/init.d/loggerhead

Add the following to the file and save it.

#!/bin/sh
### BEGIN INIT INFO
# Provides:          loggerhead
# Required-Start:    $local_fs $remote_fs
# Required-Stop:     $local_fs $remote_fs
# Default-Start:     2 3 4 5
# Default-Stop:      S 0 1 6
# Short-Description: Loggerhead initscript
# Description:       This file should be used to construct scripts to be
#                    placed in /etc/init.d.
### END INIT INFO

# Author: Flexion.org

# Do NOT "set -e"

# PATH should only include /usr/* if it runs after the mountnfs.sh script

PATH=/usr/sbin:/usr/bin:/sbin:/bin
DESC="loggerhead"
NAME=loggerhead
DAEMON=/usr/bin/start-$NAME
DAEMON_ARGS="--log-folder=/var/log/loggerhead/ --config-file=/etc/loggerhead.conf"
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME

# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0

case "$1" in
  start)
        start-loggerhead --pidfile=${PIDFILE} ${DAEMON_ARGS}
        ;;
  stop)
        stop-loggerhead  --pidfile=${PIDFILE}
        ;;
  restart)
        stop-loggerhead  --pidfile=${PIDFILE}
        start-loggerhead --pidfile=${PIDFILE} ${DAEMON_ARGS}
        ;;
  *)
        echo "Usage: $SCRIPTNAME {start|stop|restart}" >&2
        exit 3
        ;;
esac

:

Add the the loggerhead init script to the default run levels so that it starts/stops at system boot and shutdown.

 chmod 755 /etc/init.d/loggerhead
 update-rc.d loggerhead defaults

Loggerhead can now be easily stopped/started in the following ways.

 /etc/init.d/loggerhead start
 /etc/init.d/loggerhead stop

Proxying Loggerhead via Apache

We will now proxy Loggerhead via Apache so and we can optionally password protect Loggerhead. First we need to enable 'mod_proxy' for Apache.

 a2enmod proxy 
 a2enmod proxy_connect 
 a2enmod proxy_http 

Now, add a new Apache2 site configuration.

 nano /etc/apache2/sites-available/Loggerhead

Add the following to the file and save it.

 <Location "/Loggerhead/">
        AuthType Basic
        AuthName "Loggerhead"
        AuthUserFile /etc/my-passwd
        Require valid-user
        Order allow,deny
        Allow from all
 </Location>

 ProxyPass /Loggerhead/ http://localhost:8080/
 ProxyPassReverse /Loggerhead/ http://localhost:8080/

Make sure the 'server.webpath' in your Loggerhead.conf file points to the correct path.

 # use this if you're mapping loggerhead within apache via proxy
 server.webpath = 'http://code.example.org/Loggerhead/'

Enable the site and force reload Apache.

 a2ensite Loggerhead
 /etc/init.d/apache force-reload

You should now be able to access loggerhead via http://code.example.org/Loggerhead/

Proxying Loggerhead via Lighttpd

The proxy module for Lighttpd is not as flexible as Apache's. Therefore, in order to proxy Loggerhead via Lighttpd you need to host Loggerhead in a sub-domain.

First we need to enable 'proxy' for Lighty.

 lighty-enable-mod proxy

Add the following to your Lighty configuration.

 $HTTP["host"]  "loggerhead.example.org" {
   proxy.server = ("" => ( "loggerhead" => ( "host" => "127.0.0.1", "port" => 8080 )))
 }

Make sure the 'server.webpath' in your Loggerhead.conf file points to the correct sub-domain.

 # use this if you're mapping loggerhead within lighttpd via proxy
 server.webpath = 'http://loggerhead.example.org'

Restart Loggerhead.

 /etc/init.d/loggerhead restart

Reload Lighttpd.

 /etc/init.d/lighttpd reload

You should now be able to access loggerhead via http://loggerhead.example.org

Loggerhead Searching

Do the following as root.

 mkdir -p ~/.bazaar/plugins
 bzr branch lp:bzr-search ~/.bazaar/plugins/search

Now create a search index for a branch.

 bzr index /var/local/bzr/Project1

Restart Loggerhead so it picks up the changes.

 /etc/init.d/loggerhead restart

References

$Id: LoggerheadServer,v 1.7 2009/08/22 07:29:25 martin Exp www-data $

Wiki Index All Recent Edit Top