Replication / Mirroring as Master-master with Subversion using svnsync

by Gabi Solomon

For me it all started when my VPS had an error and all my SVN repos were lost. Plus even though i had purchased a backup system from the hosting company that was suppose to do a full server backup automatic and incrementally, i only had a backup from 20 days earlier because the system failed at that point in time and didnt run since.

But enough with my problems, at that point i decided to make a copy of my repos from the remote server to my local machine.
And i would commit into the local one and it should automaticly sync to the remote one. Plus it would need to do this both ways and in real time since i had some external people commiting in the remote server. Easier said then done i camed to find out.

The reasons why

Well for me there are 3 main reasons:
1. as a backup system ( dont want to be put in the 20 days old backup situation again )
2. for faster commits and updates
3. independent of the internet connection ( it hasnt failed in quite a while, but just in case, or for the times its a bit slow )

The alternatives

It seems that this topic is a bit popular, and there are a few places on the internet where people are interested in this. You can check out this question on stackoverflow for one.

1. Git-SVN
This is one alternative that a lot of people have been recommended. The benefits they are you get the best out of both worlds, you can still use the Subversion in the main repo, but you get the power of GIT for your local copy.
Although this sounds very cool, i am more of a GUI guy and really enjoy the subversion integration in my IDE ( Netbeans ) so i would have to pass this options.

2. SVK

svk is a decentralized version control system built with the robust Subversion filesystem. It supports repository mirroring, disconnected operation, history-sensitive merging, and integrates with other version control systems, as well as popular visual merge tools.

At first i read this article about SVK and it seemed to be what i was looking for. But after playing with it for a while i saw that i would need to have a single repo where all my comits would go and that would be synced to several outside repos. But i was looking for a way to have the exact replica of what it is on the remote server so in the case of a failure i could restore them from my backup.

If you are still interested in this you can also read this and this.

3. svnsync + webdav proxy
I knew about svnsync but it only supports read-only copies of your repo. But after reading a small comment on stackoverflow i started looking and find out you can have read-write copies using svnsync and webdav proxy.
What is basicly happening is that your local copy handles the read operations and it forwards the commits to the main repo.

There are a few tricky parts on this solution, that involve the locks and updating of all the replicas of the main repo. This are done by a series of hooks in the main repo.
If youre interested in this solution you can find information about implementing it in this articles:
Subversion transparent proxy with svnsync + webdav proxy
subversion diy write through proxy
Subversion on-the-fly replication


Honestly i don’t have one yet :( , but i plant to try using svnsnyc and see how that goes.
I hope you got a big picture of what your options are and now you can decide what suits you best.


  • http://www.wandisco.com/ Elaine Murphy

    Have you taken a look at http://www.wandisco.com

  • wilhelmhagg

    Hi Gabi,

    i kind of have the same problem and i also tend to go with your solution 3: svnsync + webdav proxy. Do you have any experience so far with this in the meantime? I have seen a post where somebody claimed that renaming of files does not work on client side.



    • http://www.gabrielsolomon.ro/ gabi solomon

      you might run into problems, since subversion is not really build with replica in mind.
      I eventually gave up on the ideea, but during my research a lot of people keep mentioning using GIT or another decentralized version control system.

      • wilhelmhagg

        Thanks for your comment. I think in the end we will go for GIT as it offers better branching/merging support. We will use git-svn to communicate to our overseas svn repository.

  • http://www.gabrielsolomon.ro/ gabi solomon

    we are not such a big company, so we are looking for a more cheaper soluttion :-p.
    My need is basicly to have the ability to code and commit when i am not at the office.

  • http://www.weprintdiscs.com/ DVD Duplication

    Thank to this article I've found my answer to my problems related to this.

  • http://www.uggaustralia-outletstore.com UGG Australia Outlet

    purchase mailing lists, send unsolicited messages, or share any client information we have access to.