Mirroring the varnish-cache repository with svnsync

Quoting the Wikipedia about Varnish cache:

Varnish is a high performance HTTP accelerator designed for content-heavy dynamic web sites.

The main development repository of Varnish is very easy to browse, using Trac. You can see the latest changes through the web interface at:

http://varnish.projects.linpro.no/browser/

If you want to browse the history of Varnish when you are offline, a web interface doesn’t really cut it. You will have to somehow “mirror” the official repository.

Fortunately, Subversion supports read-only mirroring of repositories, using the svnsync utility. The documentation of svnsync is not really very good, but after a bit of Googling, it is easy to locate the svnsync mini-guide of Paul Querna at:

http://journal.paul.querna.org/articles/2006/09/14/using-svnsync/

Adopting this mini-guide to the Varnish repository, here’s a short guide which lists all the steps you will have to perform to create a read-only mirror of the Subversion repository of Varnish.

1. Initialize a new, empty Subversion repository

$ mkdir -p /ws/varnish/svnroot
$ svnadmin create /ws/varnish/svnroot

2. Create an empty ‘pre-revprop-change’ hook

The svnsync utility requires a valid “pre-revprop-change” hook script in the target Subversion repository. It does not really matter if the hook does absolutely nothing. The only requirement is that it exists, and that it is executable:

$ echo '#!/bin/sh' > /ws/varnish/svnroot/hooks/pre-revprop-change
$ chmod 0755 /ws/varnish/svnroot/hooks/pre-revprop-change

3. Set up your environment for the conversion

It gets tedious having to type the same stuff multiple times, so it will be useful to have the source and target repositories available as handy shell variables:

$ export TOREPO='file:///ws/varnish/svnroot'
export FROMREPO='http://varnish.projects.linpro.no/svn'

4. Initialize the target repository of svnsync

$ svnsync init ${TOREPO} ${FROMREPO}
$ svn proplist --revprop -r 0 ${TOREPO}

After this step it should be possible to look at the “svn:sync-from-url” property of the target repository and see the stored URI of the source repository:

$ svn propget svn:sync-from-url --revprop -r 0 ${TOREPO}

http://varnish.projects.linpro.no/svn

5. Start the synchronization of the target repository

svnsync --non-interactive sync ${TOREPO}

This should start pulling changesets over HTTP and committing them in the target repository.

The synchronization process may be interrupted and resumed later. It will keep pulling changes incrementally, from the point where it stopped.

Notes

The whole synchronization thing is not really optimal, as far as speed or time is concerned, because it pulls each Subversion changeset separately. This tends to be a bit slow, if you are behind a congested or slow connection. But it eventually completes. When it does, you can use the read-only local repository mirror quite easily:

$ svn log -r 1314 file:///ws/varnish/svnroot
------------------------------------------------------------------------
r1314 | phk | 2007-04-19 12:34:45 +0300 (Thu, 19 Apr 2007) | 3 lines

Standards compliance: fputs(3) returns non-negative on success.


------------------------------------------------------------------------
About these ads
This entry was posted in Computers, Free software, FreeBSD, Open source, Programming, SCM, Software, Subversion, Varnish-cache and tagged , , , , , , , , , . Bookmark the permalink.

2 Responses to Mirroring the varnish-cache repository with svnsync

  1. pejman says:

    Hi,ineed some information about varnish(what is it?how it work?requirment for install and how install varnish)thanks

  2. keramida says:

    Please have look at http://en.wikipedia.org/wiki/Varnish_cache then. The Wikipedia article is a fairly good description of what Varnish is, what it can do, and it contains pointers to its official web site. You can find the answers you want there.

Comments are closed.