views:

183

answers:

3

I have a svn server on our lan locally its on windows. The developers use and check in/out from that. Just to be on the safer side we have took up a server from rackspace a linux one. Is it possible to do an automatic weekly synchronise from the local svn server to the remote one. The remote one will be mainly used as a remote backup but just in case if somebody wants to access then they can do as there is no static or external IP for our lan.

A: 

As long as the backup server is used read-only, something basic like rsync should work. But you might want to implement a retry loop that keeps syncing until there is nothing to sync, so that you don't sync a state exactly while someone is committing something.

If you need read/write access on both sites, it might be safer and easier to use something like git and use git-svn on the client side as "backward compatibility".

Another option is to use SVK, a distributed version control system built on top of SVK. But that will also not be completely transparent to the clients.

Peter Eisentraut
+2  A: 

I would suggest to to use svnsync for this. When triggered from the post-commit hook, this tool (part of the svn distribution) allows for a live synchronization between 2 (or more) svn servers.

jeroenh
If you go this direction (recommended), make sure you read the gotchas on getting out of sync if the post-commit hook fails. You might want to look at a periodic sync in addition to the post-commit hook.An example can be found herehttp://blogs.atlassian.com/developer/2008/11/subversion_replication_at_atla.html
Dan
A: 

You can use svnadmin dump to dump a whole repository. You can use a postcommit hook along with the same command to dump the commit in a standalone format that can be later reapplied

Combining these and rsync you can effectively replicate your server on any other server. AS long as your backup server is only accessed readonly it can be used. In the case of a failure, a simple svn switch will allow your developpers to use the backup server.

I would recommand you setup acls to forbid writing to the backup server unless it becomes the master.

Another solution as mentionned by peter could be svk, but that cannot be used for a complete automatic sync : what happens if there are conflicting changes made on both servers ? the script will fail or mangle this. Anything like distributed merge must be reviewed by a human.

Yet another solution would be the svn --mirror way

You should try to read this for more detailed information on keeping repos in sync: How to synchronize two Subversion repositories? :)

Jean