Loggerhead question
Matt Nordhoff
mnordhoff at mattnordhoff.com
Fri Oct 23 14:54:43 BST 2009
Russel Winder wrote:
> Matt,
>
> On Fri, 2009-10-23 at 12:59 +0000, Matt Nordhoff wrote:
>> Russel Winder wrote:
>>> Is there a way of setting up Loggerhead with Apache that allows the same
>>> URL to be used for browsing using a browser and branching using bzr or
>>> Bazaar Explorer.
>>>
>>> I have Loggerhead working fine on xxxx:8080/Bazaar/Project and pointing
>>> Epiphany at it does everything required. However doing "bzr info
>>> xxxx:8080/Bazaar/Project" gives the "not a branch" error.
>>>
>>> Thanks.
>> You can configure Apache to handle requests with "/.bzr/" in them itself
>> instead of passing them to Loggerhead.
>
> I am not sure that is going to help -- unless I am missing something
> about Apache/Bazaar/Loggerhead (which is easily possible).
>
> The problem at hand is when the URL http://xxxx/Bazaar/Flob is used from
> a bzr command, e.g. bzr info, bzr branch, then it works as it does now,
> but when the same URL is used from a browser then all the requests are
> forwarded to Loggerhead. This means the switching has to be on the
> accessor not on the URL.
Not true. Bazaar operations rarely* make requests that don't include
"/.bzr/" in the path.
* The examples I can think of are bzr-svn probing for svn servers and
"bzr merge" checking if the URL is a merge directive file. Neither of
those should cause problems when used against Loggerhead.
> The problem being solved here is that currently when people look at
> http://xxxx/Bazaar/Flob with a browser there are no entries because the
> branches have no working trees and the .bzr directory doesn't show. The
> idea is to get Loggerhead to do the needful but without disturbing the
> current branch access.
This is covered, mostly. Loggerhead will show directory listings. It
leaves out files, but that's fine in a directory tree full of bzr
branches. It also leaves out hidden directories (those that start with
"."), but that's okay. It also doesn't list ".bzr" directories, but that
doesn't matter.
See it in action at <http://bzr.mattnordhoff.com/loggerhead/>.
>> Or, Loggerhead supports serving branches over HTTP, over both the dumb
>> and smart servers. Maybe your Loggerhead is too old for that?
>
> I guess this is going to be the easy way of doing things -- always
> forward the URL to Loggerhead and let it deal with the bzr commands as
> well as browser access.
>
> I am using Ubuntu 9.04 Jaunty Jackalope so this is Loggerhead 1.10. It
> has been a shame that 1.17 as is in Karmic hasn't been backported to
> Jaunty.
Ah. Um. Honestly, I don't pay attention to Loggerhead's version number,
since I always run from the trunk.
...
Looks like dumb and smart server support were both added in 1.17, though
they've both broken a couple times, so I don't know if either actually
*worked* at the time.
>> Be aware that, up until very recent revisions of bzr.dev and
>> Loggerhead's trunk, there were problems serving branches in shared repos
>> over the smart server. (Though you'd get a different error message than
>> "not a branch". Something about a "jailbreak" if you're hitting the bzr
>> bug, or IIRC "no repository present" if you're hitting the Loggerhead bug.)
>
> The server is using Loggerhead 1.10 and Bazaar 2.0.0 by default. So I
> guess this is an issue.
Yes, it is an issue.
>> If you can't upgrade to fixed versions, you can work around the bugs by
>> using "nosmart+http" URLs to make bzr only use the dumb server.
>>
>> If you can upgrade Loggerhead but can't upgrade bzr, you can put this
>> monkeypatch in loggerhead/apps/transport.py, courtesy of Andrew Bennetts:
>>
>> # Monkey-patch to work around bug 348308
>> from bzrlib.smart import request
>> def _setup_jail(self):
>> if not self._backing_transport.base.startswith('chroot-'):
>> raise AssertionError('bad monkey! no banana!')
>> request.jail_info.transports = [self._backing_transport.clone('/')]
>> request.SmartServerRequest.setup_jail = _setup_jail
>>
>> Anyway, none of this matters if you don't use shared repos, but pretty
>> much everybody does, so...
>
> Actually the branches being served aren't shared repositories, they are
> branches intended to be read only from the Web.
That isn't mutually exclusive with using shared repos.
But if you aren't using shared repos, you're golden. :-)
>> (See bug #348308 [1] for details on the bug in bzr. I don't think anyone
>> filed a bug for the Loggerhead issue.)
>>
>> [1] <https://bugs.edge.launchpad.net/bzr/+bug/348308>
--
More information about the bazaar
mailing list