Running a Subversion Server off your Windows Home Server
Disclaimer - People have been injured and emotionally scarred listening to my technical tips. This may violate your terms of service. If your ISP calls your house and is mean to you, or if you lose all your personal data because of my tips, know that we never spoke. I don't know you. Seriously, who is this?! Stop calling!
I put most of my docs in Live Mesh, and I host must of my Open Source projects at CodePlex, but I have a bunch of code and presentations that usually just float around. Tweet Sandwich is a good example.
I decided I'd try to host a Subversion Server. I don't want to use the machine I host my blog on, as I want the data in my house. Since I already have this lovely Windows Home Server that's saved my marriage, I figured why not host it there?
1. Logging into your Home Server
If you want to install software on your Home Server (and they are headless usually - no monitor) you have to use Remote Desktop. From inside my house, I run "mstsc /console" or "mstsc /admin" from the Start | Run dialog, the connect to my machine called "Server."
2. Install Visual SVN Server
I usually download software to the desktop, ignore the "holy crap don't do this" warning (although be aware) then open an administrator command prompt and run the MSI from there. I downloaded and installed VisualSVN Server, which is the absolute easiest way that I know of to get Subversion (SVN) on Windows. I installed it on the machine on port 8443. That's not 443, but rather 8443. It's kind of like the secondary SSL port. I could put it anywhere, of course, but 8080 is to 80 as 8443 is to 443. It's easy to remember and less likely that your ISP would block it outgoing from your house. You can test if you have open ports with this online tool.
3. Chose Storage and Back It Up
Windows Home Server is a different beast as it supports a RAID-like storage system. You are NEVER supposed to put anything on the D: (Data) drive directly. Always access data through shares like \\server\svnwhatever.
Here's the only/most wonky part of this whole thing. If you have a better idea or you work for the Home Server team, let me know if this is dangerous and I'll update this part of the post.
I made a folder on the D: drive (against recommendations) called D:\repos and I told Subversion that was the place to put stuff. Then I made a new Share called \\SERVER\SVNBackup and set duplicate to true. Then, I installed the Windows 2003 Resource Kit in order to get the RoboCopy tool, and I copied RoboCopy to C:\windows so it's in the path.
Finally, I made a batch file that looked like this:
robocopy /mir d:\repos \\server\svnbackup
This "mirrors" the D:\repos folder to the \\server\svnbackup. I then used the "Add Schedule Task" wizard and made this run every night at 2am. This way I get backup and duplication in a nightly snapshot.
Alternatively, I probably could have mapped a permanent local Z:\ drive on the Home Server to \\server\svn or some share, and told VisualSVN Server to use that. However, that itself seemed wonky? My way seems to work. Thoughts?
4. Forward Port
I then logged into my local router and set up a port-forwarding rule to make sure that 8443 was accessible from the outside. Check your router or visit http://192.168.1.1 (usually) to figure it out.
5. Get an External DNS name (Optional)
You can certainly just visit http://www.whatismyipaddress.com and remember your address if you like. You can also hard-code it in your hosts file on the machine that will be your client.
You might consider using a service like DynDNS and get a custom domain like yourname.dyndns.org. There are applets that will run in the tray on your Windows Home Server and keep that IP address in sync if it changes.
Windows Home Server also includes options to get your own Home Server-provided domain under the "Settings" dialog in the Home Server Console. You can be http://foofoo.homeserver.com or a number of choices. This domain name is associated with your Windows Live ID and the IP is automatically updated by the Home Server.
Note, you can also log into your Home Server remotely, if you've enabled it. Here's me logging into my Home Server from elsewhere. Notice you can see what machines are online at home in the background there. I can RDP (Remote Desktop Protocol) into those machines if I like, and I can also remote into my Home Server itself.
Incidentally you can also view and download files from your shares, so choose strong passwords.
When you connect to your new Visual SVN Server instance over another port, your browser will likely complain that the certificate isn't trusted and it'll turn your Address Bar red and scary. Bummer, but be aware.
Now I can SVN Checkout https://mymagicdomain.homeserver.com:8443/svn/presentations/trunk as I please.
About Scott
Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.
About Newsletter
You also have to do the same mapping on the account you use to install VisualSVN.
I just wanted to point out that OpenDNS.com is a lot better than DynDNS all while being completely free.
Seth
There's a little trick to using VisualSVN Server with Home Server. During the install of VisualSVN Server you have to pick a local path for the repositories - leave it as the default C:\Repositories. Once it's installed, open the VisualSVN Server Manager, go to the properties of the server, and change the path to a share you've created on the Home Server like \\homeserver\svn.
The only catch I've found so far is that you need to allow guest read/write access to the share. Not sure if it would be possible to create a local user on the Home Server and run VisualSVN Server as that user.
This way you can enable duplication on the share for extra redundancy!
John
Uh, why not host the SVN Server on another machine on your LAN and just make sure that it's being backed up to the Home Server?
PS: I bought a Home Server based largely on your advice but I refuse to make it the accessibly server from outside my home. If I really need to get to it, I can remote onto my Vista box and then pull up the Home Server desktop or control interface. Don't see the need to make my Home Server directly hackable, I mean, accessible to the world.
Regarding the backing up of the svn repository.
As I understand it, you should not copy the repository directly, but instead you should you use
svnadmin hotcopy OLD_REPOS_PATH NEW_REPOS_PATH
(svnadmin should be in the directory where you installed VisualSVN)
Nadav
It gets even better. Visual SVN has hidden on their web site instructions for integrating a Trac server with VisualSVN Serverhere. I've set this up myself, and it makes an awesome integrated system with SVN and defect tracking.
Steve
I reckoned on a reverse proxy (implemented as a httphandler in asp.net) however all the ones I found (e.g. the simple one on the codeproject site) did not handle the OPTIONS verb or pass on the useragent which is used heavily by Tortoise. Got to a state where tortoise hangs on an update and I think it was a header that was missing but ran into skillset issues (ahem... miine).
Is there a simpler / exisintg solution?
Thanks for the hotcopy solutions, guys/gals!
For an impossibly cheap price, you could create an account at a place like dreamhost and let them host the svn server for you. You also get web, mail, even a shell ... great uptime, updates, backups, etc, all taken care of for you.
I used to host my own Exchange at home and all that, then finally gave it up when I realized for that for almost no money I could use a hosted server with up-to-date spam stuff and entirely no administration load for me.
Hosted services are a much better option in my view.
http://www.pchenry.com/Home/tabid/36/EntryID/94/Default.aspx
I'm currently thinking about migrating all my SVN repository "stuff" to CodePlex, but until I get some spare cycles, the code will stay on my box.
Great read, thanks.
You should send us the link for readonly access and share your presentations for the world to see.
Regards,
Roberto.
But as I wasn't using the VisualSVN 'goodness' I didn't have it secured using SSL - was just using svn:// on the default port...
Guess who will now be migrating to VisualSVN ;-)
..KJ
Save yourself the horrors of setting up a Server and just have your central repository be on a network share.
Also you don't need to expose that home server repository to the web since you can clone the repository and work with it offline.
I made the move from SVN to mercurial some time ago and never regretted it:
http://www.tigraine.at/2009/05/30/moving-to-mercurial/
greetings Daniel
Great writeup. I have been running SVN on a Windows 2003 server, but after reading this I might just give it a try on Windows Home Server.
The hosting company that I use provides a SVN repository, have you tried hosted SVN?
-Steve
SVNReverseProxy at my Codeplex Project
Comments are closed.
Perhaps a service could be made that runs as the same user as the SVN service and maps the drive letter before SVN starts. The SVN service could then be edited so that it depends on the drive mapping service.
Seems like it could work:
news group posting about services mapping drives
KB article about service dependencies