Mirroring Archives with Bazaar

This howto covers the mirroring of archives.

There are three primary reasons one may want to mirror an archive. Firstly, performance of remote archives is noticably slower than that of local archives. A local mirror allows one to get the same performance for that archive by having a local copy. archive which is very fast to use. Secondly a local mirror allows one to access the data in that mirror without being connected to the net. Lastly, you need to mirror your local archives publically to make them visible to other people.

In this case, I'll use myself as an example. I tend to get bogged down when I sit at home, so often I'll drag my laptop off to the donut shop or the park. Before I do that, I update my mirror of the archives that I care about. When I get back home, I update the mirror of my laptop archive so that other people can use the work that I performed.

Making local mirrors

First, lets locally mirror a remote archive. As usual, I'll rely on our friend Tux as our target and assume his archive name is tux@penguin.org--tuxpucks, and that his archive is at http://tux.org/tuxpucks. Creating the mirror is a one step process:

$ baz make-archive -m http://tux.org/tuxpucks \
   /home/jdoe/archives/tuxpucks

To make this usable you need to populate it with data:

$ baz archive-mirror tux@penguin.org--tuxpucks

At this point baz is able to use either the official archive at http://tux.org/tuxpucks, or your local copy. Baz will automatically use the most up to date copy that is available, so if you go offline, it will use your local copy, but if you are online it will use the copy at http://tux.org/tuxpucks.

If you want to tell baz to use the local copy all the time, you need to edit ~/.arch-params/archives/tux@penguin.org--tuxpucks and add ` priority=50` to the end of the URL line for http://tux.org/tuxpucks. After doing this, you will need to run the archive-mirror command listed above to update the mirror and make new commits by tux@penguin.org available.

We've now addressed the first two reasons for making mirrors. What about the third ?

Publishing your archive

First, why would we bother? Well, if you're like a lot of other free software developers, you probably don't have a web server running on your local machine that the general public that has access to. That's ok, because in the arch world, we have an answer for you: pushing your local archive remotely.

Lets to assume that your archive name is jdoe@isp.com--tuxpucks, and that you can sftp to a directory that is served by a webserver (say, apache). In the case of apache, user accounts are generally able to serve documents in a /home/$USERNAME/public_html web pages of the form http://webserver.com/~username/. So we'll take advantage of that here.

Step 1: make a mirror of your archive with no data in it, and with 'listing' files turned on. (listing files are needed for non-WebDAV HTTP servers only).

$ baz make-archive -l -m jdoe@isp.com--tuxpucks \
  sftp://jdoe\@webserver.com/home/~jdoe/public_html/jdoe@isp.com--tuxpucks

Step 2: push your current commits to it.

$ baz archive-mirror jdoe@isp.com--tuxpucks

When you are in a source tree, you can just run

$ baz archive-mirror

and baz will determine the archive from the current directory.

Now others can use your archive. Just tell them to baz register-archive http://webserver.com/~jdoe/jdoe@isp.com--tuxpucks. They can also checkout directly from the url: baz get http://webserver.com/~jdoe/jdoe@isp.com--tuxpucks/project--branch--0

As with local mirrors, the one on your webserver won't automatically update. To update it you need to repeat step 2.

title:Mirroring Archives with Bazaar
license:General Public License, V2
copyright:
  1. 2004, 2005 Canonical Ltd.
authors:James Blackwell <jblack@gnuarch.org>, Robert Collins <robert.collins@canonical.com>