<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet type='text/xsl' href='http://thebentspoon.spaces.live.com/mmm2008-05-17_13.22/rsspretty.aspx?rssquery=en-US;http%3a%2f%2fthebentspoon.spaces.live.com%2fcategory%2fTechnology%2ffeed.rss' version='1.0'?><rss version="2.0" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:msn="http://schemas.microsoft.com/msn/spaces/2005/rss" xmlns:live="http://schemas.microsoft.com/live/spaces/2006/rss" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:cf="http://www.microsoft.com/schemas/rss/core/2005" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Ken's Space: Technology</title><description /><link>http://thebentspoon.spaces.live.com/?_c11_BlogPart_BlogPart=blogview&amp;_c=BlogPart&amp;partqs=catTechnology</link><language>en-US</language><pubDate>Tue, 29 Jan 2008 11:41:22 GMT</pubDate><lastBuildDate>Tue, 29 Jan 2008 11:41:22 GMT</lastBuildDate><generator>Microsoft Spaces v1.1</generator><docs>http://www.rssboard.org/rss-specification</docs><ttl>60</ttl><cf:parentRSS>http://thebentspoon.spaces.live.com/blog/feed.rss</cf:parentRSS><live:type>blogcategory</live:type><live:identity><live:id>-8914716279559115266</live:id><live:alias>thebentspoon</live:alias></live:identity><cf:listinfo><cf:group ns="http://schemas.microsoft.com/live/spaces/2006/rss" element="typelabel" label="Type" /><cf:group ns="http://schemas.microsoft.com/live/spaces/2006/rss" element="tag" label="Tag" /><cf:group element="category" label="Category" /><cf:sort element="pubDate" label="Date" data-type="date" default="true" /><cf:sort element="title" label="Title" data-type="string" /><cf:sort ns="http://purl.org/rss/1.0/modules/slash/" element="comments" label="Comments" data-type="number" /></cf:listinfo><item><title>Federated SVN</title><link>http://thebentspoon.spaces.live.com/Blog/cns!844890C6A37CADFE!149.entry</link><description>One of the many issues we ran into with a distributed development team literally across the globe is sluggish connectivity - it was so painful that a mere check-in will cost you the time to prepare and finish an entire cup of cappuccino - good for the coffee lovers but not for geek heads.&lt;br&gt;&lt;br&gt;So without further ado, here's how we build our in-house federated SVN system.&lt;br&gt;&lt;br&gt;1 Set up SVN servers on both locations.&lt;br&gt;&lt;br&gt;2 Dump the entire SVN repository from the primary US server and load it to the remote China server, this ensures a equal starting point. The following steps should be done on both servers:&lt;br&gt;&lt;br&gt;3 Create a synchronization user account&lt;br&gt;&lt;br&gt;4 Set up password-less SSH for the aforementioned user.&lt;br&gt;&lt;br&gt;5. Create two new directories: svnlocalcommit and svnremotecommit under /tmp&lt;br&gt;&lt;br&gt;6 Edit the post-commit script of SVN to include the following: echo $REV &amp;gt; /tmp/svnlocalcommit/$REV, for every commit, this will create a new file under the directory /tmp/svnlocalcommit&lt;br&gt;&lt;br&gt;7 Load the following &amp;quot;svnpush.sh&amp;quot; script onto the server's /usr/bin directory:&lt;br&gt;&lt;br&gt;##################################################&lt;br&gt;#!/bin/bash&lt;br&gt;&lt;br&gt;VERSION=&amp;quot;$1&amp;quot;&lt;br&gt;DUMPFILE=svndump$VERSION&lt;br&gt;&lt;br&gt;# create a dump file&lt;br&gt;svnadmin dump [svn repo path] -r $VERSION --incremental &amp;gt; $DUMPFILE&lt;br&gt;&lt;br&gt;# push it to remote SVN server&lt;br&gt;scp $DUMPFILE &amp;lt;user&amp;gt;@&amp;lt;server&amp;gt;:/tmp&lt;br&gt;&lt;br&gt;# load commit on remote SVN server&lt;br&gt;ssh &amp;lt;user&amp;gt;@&amp;lt;server&amp;gt; /usr/bin/load_commit.sh $DUMPFILE&lt;br&gt;exit&lt;br&gt;&lt;br&gt;##################################################&lt;br&gt;&lt;br&gt;8 Load the following &amp;quot;load_commit.sh&amp;quot; onto /usr/bin directory:&lt;br&gt;&lt;br&gt;##################################################&lt;br&gt;&lt;br&gt;#!/bin/bash&lt;br&gt;&lt;br&gt;DUMPFILE=&amp;quot;$1&amp;quot;&lt;br&gt;&lt;br&gt;svnadmin load [svn repo path] &amp;lt; /tmp/svnremotecommit/$DUMPFILE&lt;br&gt;&lt;br&gt;##################################################&lt;br&gt;&lt;br&gt;9 Load SvnAgent program as the synchronization user&lt;br&gt;&lt;br&gt;10. Kick off SvnAgent, you're all set.&lt;br&gt;&lt;br&gt;So here's how it works: &lt;br&gt;&lt;br&gt;1. Someone makes a commit, the post-commit script will create an empty file named with the rev # under /tmp/svnlocalcommit directory and return, this will be very fast since it's done locally. &lt;br&gt; 2. SyncAgent scans the svnlocalcommit directory every 5 seconds, once a new file is found it'll invoke the svnpush script &lt;br&gt;3. The svnpush script dumps the local commit (also to /tmp/svnlocalcommit folder but with a &amp;quot;svndump&amp;quot; prefix) &lt;br&gt; 4. The svnpush script then scp the local dump file to the remote server (under remote server's /tmp/svnremotecommit directory) &lt;br&gt; 5. Once scp is successful, the script then commits the uploaded file remotely and returns &lt;br&gt; 6. The SyncAgent daemon receives the return status from the svnpush script &lt;br&gt; 7. If the status was successful, the SyncAgent removes the empty file from svnlocalcommit and sleeps until next scan &lt;br&gt; 8. If the status returns failure, the SyncAgent goes to sleep and try again next time. &lt;br&gt;&lt;span style="font-style:italic"&gt;&lt;/span&gt;&lt;br&gt;Not that hard isn't it?&lt;br&gt;&lt;br&gt;This works well when commits are coming from one way at a time mostly - namely, one teams works actively while the other team isn't. &lt;br&gt;&lt;br&gt;Ah, want a copy of the SvnAgent source code? Email me here: k e n 0 6 2 4 7 0 0 [ a t ] g m a i l . c o m&lt;br&gt;&lt;br&gt;Now get back to work you slacker!&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;span style="font-style:italic"&gt;&lt;/span&gt;&lt;img src="http://www.luxor.nl/Dumb &amp;amp; Dumber.jpg"&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-8914716279559115266&amp;page=RSS%3a+Federated+SVN&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=thebentspoon.spaces.live.com&amp;amp;GT1=thebentspoon"&gt;</description><comments>http://thebentspoon.spaces.live.com/Blog/cns!844890C6A37CADFE!149.entry#comment</comments><guid isPermaLink="true">http://thebentspoon.spaces.live.com/Blog/cns!844890C6A37CADFE!149.entry</guid><pubDate>Tue, 26 Jun 2007 04:12:44 GMT</pubDate><slash:comments>0</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://thebentspoon.spaces.live.com/blog/cns!844890C6A37CADFE!149/comments/feed.rss</wfw:commentRss><wfw:comment>http://thebentspoon.spaces.live.com/Blog/cns!844890C6A37CADFE!149.entry#comment</wfw:comment><dcterms:modified>2007-07-05T14:24:19Z</dcterms:modified></item></channel></rss>