Trac on separate server from subversion

September 11, 2008 by
Filed under: Configuration Management, Windows 

It is possible to have Trac on a different server than the subversion server, albeit a bit convoluted. This is slightly stolen note from

Set up the master subversion server as you would normally. We will get back to this one.

On the trac server, install subversion etc as well. This server will rely on svnsync to become a secondary/mirror subversion server. It must not be used for checking in or working against, it is purely a repository for reading.

Set up trac and all other tools required on the mirror server.

Now, you need to set up user accounts on the mirror server. To start with, create the mirror subversion repository, it will be empty to begin with:

svnadmin create MIRROR_REPOS_PATH

After that, create authz authentication files for the repositories to stop anyone from writing/working against the mirror repository, such as the following:

* = r
svnsync = rw

You could extend this by writing hook scripts blocking anything but the svnsync user.

If the master subversion repository is live while adding the trac database, all of the following must be done during server maintenance window (ie, close it down from any kind of access, except the mirror machine).

Once all that is done, its time to initialize the the mirror server with the master subversion repository (ie, move over the data).

svnsync initialize URL_TO_MIRROR_REPO URL_TO_MASTER_REPO –username=svnsync –password=svnsyncpassword

And once that has successfully been done, do as follows:

svnsync synchronize URL_TO_MIRROR_REPO –username=svnsync –password=svnsyncpassword

The final step is to either add a scheduler (cron.d) script, or a post-commit hook script running the following:

# Example for synchronizing one repository from the post-commit hook
$SVNSYNC synchronize URL_TO_MIRROR_REPO –username=svnsync –password=svnsyncpassword &
exit 0

Preferably run it from post-commit as it gives better refresh rate.

You can now run the trac against the mirrored subversion server.


Tell me what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!

You must be logged in to post a comment.