1
Loggerhead: A web viewer for ``bzr`` branches
2
==============================================
4
Loggerhead is a web viewer for projects in Breezy. It can be used to navigate
5
a branch history, annotate files, view patches, perform searches, etc.
6
Loggerhead is heavily based on `bazaar-webserve
7
<https://launchpad.net/bzr-webserve>`_, which was, in turn, loosely
8
based on `hgweb <http://mercurial.selenic.com/wiki/HgWebDirStepByStep>`_.
14
Loggerhead depends on the following Python libraries.:
16
- Chameleon for templating.
18
- Paste for the server. (You need version 1.2 or newer of Paste).
20
- PasteDeploy (optional, needed when proxying through Apache).
22
- flup (optional, needed to use FastCGI, SCGI or AJP).
25
Installing Dependencies Using Ubuntu Packages
26
#############################################
30
$ sudo apt-get install python-chameleon
31
$ sudo apt-get install python-paste
32
$ sudo apt-get install python-pastedeploy
33
$ sudo apt-get install python-flup
35
Installing Dependencies Using :command:`pip`
36
############################################
38
You should normally create and activate a virtual environment first.
42
# Basic installation only
43
$ pip install loggerhead
44
# Installation for proxying through Apache
45
$ pip install 'loggerhead[proxied]'
46
# Installation for FastCGI, SCGI or AJP
47
$ pip install 'loggerhead[flup]'
50
Running the Standalone Loggerhead Server
51
----------------------------------------
53
After installing all the dependencies, you should be able to run
54
:command:`loggerhead-serve` with the branch you want to serve on the
59
./loggerhead-serve ~/path/to/branch
61
By default, the script listens on port 8080, so head to
62
http://localhost:8080/ in your browser to see the branch.
64
You can also pass a directory that contains branches to the script,
65
and it will serve a very simple directory listing at other pages.
67
You may update the Bazaar branches being viewed at any time.
68
Loggerhead will notice and refresh, and Bazaar uses its own branch
69
locking to prevent corruption.
71
See :doc:`loggerhead-serve` for all command line options.
73
Running Loggerhead as a Daemon
74
------------------------------
76
To run Loggerhead as a linux daemon:
78
1) Copy the ``loggerheadd`` scipt to ``/etc/init.d``
82
$ sudo cp ./loggerheadd /etc/init.d
84
2) Edit the file to configure where your Loggerhead is installed, and which
85
loggerhead-serve options you would like.
89
$ sudo vim /etc/init.d/loggerheadd
91
3) Register the service
95
# on upstart based systems like Ubuntu run:
96
$ sudo update-rc.d loggerheadd defaults
98
# on Sysvinit based systems like Centos or SuSE run:
99
$ sudo chkconfig --add loggerheadd
102
Using Loggerhead as a Breezy Plugin
103
-----------------------------------
105
This branch contains experimental support for using Loggerhead as a Breezy
106
plugin. To use it, place the top-level Loggerhead directory (the one
107
containing COPYING.txt) at ``~/.config/breezy/plugins/loggerhead``. E.g.:
111
$ bzr branch lp:loggerhead ~/.config/breezy/plugins/loggerhead
119
To hide branches from being displayed, add to ``~/.config/breezy/locations.conf``,
120
under the branch's section:
127
More configuration options to come soon.
130
Serving Loggerhead behind Apache
131
--------------------------------
133
If you want to view Breezy branches from your existing Apache
134
installation, you'll need to configure Apache to proxy certain
135
requests to Loggerhead. Adding lines like this to your Apache
136
configuration is one way to do this:
138
.. code-block:: apache
140
<Location "/branches/">
141
ProxyPass http://127.0.0.1:8080/branches/
142
ProxyPassReverse http://127.0.0.1:8080/branches/
145
If Paste Deploy is installed, the :command:`loggerhead-serve` script can be
146
run behind a proxy at the root of a site, but if you're running it at
147
some path into the site, you'll need to specify it using
148
``--prefix=/some_path``.
150
Serving Loggerhead with mod_wsgi
151
--------------------------------
153
A second method for using Loggerhead with apache is to have apache itself
154
execute Loggerhead via mod_wsgi. You need to add configuration for apache and
155
for breezy to make this work. Example config files are in the Loggerhead doc
156
directory as apache-loggerhead.conf and breezy.conf. You can copy them into
157
place and use them as a starting point following these directions:
159
1) Install mod_wsgi. On Ubuntu and other Debian derived distros::
161
sudo apt-get install libapache2-mod-wsgi
163
On Fedora-derived distros::
165
su -c yum install mod_wsgi
167
2) Copy the breezy.conf file where apache will find it (May be done for you if
168
you installed Loggerhead from a distribution package)::
170
# install -d -o apache -g apache -m 0755 /etc/loggerhead
171
# cp -p /usr/share/doc/loggerhead*/breezy.conf /etc/loggerhead/
172
# mkdir -p /var/www/.config
173
# ln -s /etc/loggerhead /var/www/.config/breezy
175
3) Create the cache directory (May be done for you if you installed Loggerhead
176
from a distribution package)::
178
# install -d -o apache -g apache -m 0700 /var/cache/loggerhead/
180
4) Edit /etc/loggerhead/breezy.conf. You need to set http_root_dir to the filesystem
181
path that you will find your bzr branches under. Note that normal
182
directories under that path will also be visible in Loggerhead.
184
5) Install the apache conf file::
186
# cp -p /usr/share/doc/loggerhead*/apache-loggerhead.conf /etc/httpd/conf.d/loggerhead.conf
188
6) Edit /etc/httpd/conf.d/loggerhead.conf to point to the url you desire to
189
serve Loggerhead on. This should match with the setting for
190
http_user_prefix in breezy.conf
192
7) Restart apache and you should be able to start browsing
194
.. note:: If you have SELinux enabled on your system you may need to allow
195
apache to execute files in temporary directories. You will get a
196
MemoryError traceback from python if this is the case. This is because of
197
the way that python ctypes interacts with libffi. To rectify this, you may
198
have to do several things, such as mounting tmpdirs so programs can be
199
executed on them and setting this SELinux boolean::
201
setsebool httpd_tmp_exec on
203
This bug has information about how python and/or Linux distros might solve
204
this issue permanently and links to bugs which diagnose the root cause.
205
https://bugzilla.redhat.com/show_bug.cgi?id=582009
210
Search is currently supported by using the bzr-search plugin (available
211
at: https://launchpad.net/bzr-search ).
213
You need to have the plugin installed and each branch indexed to allow
214
searching on branches.
216
Command-Line Reference
217
----------------------
228
Discussion should take place on the bazaar-dev mailing list at
229
mailto:bazaar@lists.canonical.com. You can join the list at
230
<https://lists.ubuntu.com/mailman/listinfo/bazaar>. You don't need to
231
subscribe to post, but your first post will be held briefly for manual
234
Bugs, support questions and merge proposals are tracked on Launchpad, e.g:
236
https://bugs.launchpad.net/loggerhead
242
To run Loggerhead tests, you will need to install the package ``python-nose``,
243
and run its :command:`nosetests` script in the Loggerhead directory:
258
https://launchpad.net/loggerhead