Posted on
November 23, 2012 by
danny
Introduction
I recently found myself wanting to work on a programming project at home, using C# and VisualStudio 2010, and like any good developer realised I needed source control. Yes of course I could use Microsoft Sourcesafe, it does integrate nicely with VisualStudio. But lets be honest, it is a pile of crap, I’m used to TFS at work, I can’t be doing with Sourcesafe. Running my own TFS server is probably a bit over the top, I’m not sure I have the spare change in my back pocket for the licencing.
At the same time I was aware I wanted to move my RAID’ed storage / backup solution out of the media system under the telly where it currently lives, to a dedicated NAS device.
Two birds? One stone?
Being a tight arse I went over to Ebuyer and looked up the cheapest unit that supported RAID1 (mirroring) and gigabit transfer rates and found the D-Link DNS320 for £53 inc VAT without disks, it can take up to two 2TB drives. Thinking of my old Linksys router and remembering appliances often run linux under the hood, I had a bit of a google and found this page. Someone had got subversion running on it. Very cool!!
So I ordered one, waited a few days and once it arrived shoved a drive in it. Getting the device up and running was the job of a few minutes work. Getting subversion working – rather longer. Nevertheless – success was ultimately had. For reference, I am not a linux expert – in fact it would be fair to say, I know to next to nothing about it. But I like a challenge…
What will I end up with?
Whilst the DNS-320 ships with its own version of Linux in the firmware, we aren’t going to be able to bolt directly onto that. However there is an undocumented hook (called ‘fun_plug’ which I guess stands for functionality plugin) that is checked on startup and can be used to add additional functionality stored on the hard drive.
To get subversion running on the DNS-320 you need a linux installation that runs alongside the one in the firmware, in this case DebianSqueeze. Installing this does not affect the rest of the NAS and you wont see any impact on the web interface. Once you have DebianSqueeze installed and running, you install and configure the subversion package and away you go.
So what you end up with, is a NAS running linux, that runs DebianSqueeze linux as a plugin that hosts subversion.
Installation
Unfortunately it’s not that simple. To configure DebianSqueeze requires Telnet to be running on the NAS and unfortunately out of the box, this is not the case. Luckily there is a (convoluted) way to get a very thin linux install (ffp) with Telnet onto the box first and then use that to configure DebianSqueeze. Once that is done, the ffp install is not used any further.
This exceptionally well written blog post describes how to install ffp, the “Fonz fun_plug 0.5 for CH3SNAS, CH3MNAS, DNS-323”
Follow it all the way down to the section headed “Logging in using SSH”, but don’t disable Telnet in the last step, as you’re going to need it.
Next, download DebianSqueeze from here
Open the zip file. Inside is a “how to” and two other files. Follow the instructions in the file from Step 2 (you have in effect already done Step 1).
The very last step of renaming fun_plug.debian to fun_plug effectively discards ffp that we installed earlier, it having served it’s purpose.
Now that you have DebianSqueeze running you can install subversion.
This blog post here provides a step by step guide to do this.
Half way down he mentions the command:
# svnadmin create /var/svn/projectalpha
‘projectalpha’ should be replaced by whatever you want to call your repository.
Other than that, follow the blog exactly, all the way down to the point where it starts talking about running an ssh server on a custom port. You probably don’t need to do that so can stop there.
You now have subversion running on your NAS. Excellent!!
Connecting VisualStudio 2010
Although subversion is usually used with an Apache web server this is not actually necessary. The author of the previous post has avoided doing this opting to instead use the ssh server and communication protocol already installed with DebianSqueeze. This makes it more lightweight and conserves the limited RAM available on the box.
To get VisualStudio 2010 to work with subversion you need a plugin. A popular one is AnkhSVN which can be downloaded for free.
Once installed, assuming you don’t have the Tortoise SVN client installed then you need to help the plugin understand the ssh protocol before you can use it in VisualStudio.
This blog post describes how.
NB: The configuration file mentioned in the post is described as being in your My Documents\Application Data\subversion directory, this is in XP. In Windows 7, this folder now maps to here: c:\Users\<USERNAME>\AppData\Roaming\Subversion. You may need to set the Windows Explorer “Folder and Search Options” to “Show hidden files, folders, and drives” to be able to see the AppData folder.
Now restart VisualStudio.
First you need to enable Subversion as the source control plugin for VisualStudio. Go to “Tools->Options” and in the dialog go to the subsection “Source Control” and edit the “Plug-in Selection” to be AnkhSVN.
Now, you can connect to your Subversion repository using “File->Subversion->Open From Subversion.
In the dialog that pops up enter the URL of the subversion repository on your NAS box, which will look like this: svn+ssh://<NASBOX>/var/svn/<SvnRepositoryYouCreatedEarlier>
and you’re in!!!
So now you’ve got it all working. The only thing is this irritating “Plink.exe” window that keeps popping up. It has to go – it just has to.
Download TortoiseSVN from here, install it, find the file tortoiseplink.exe, rename it to plink.exe and replace your plink.exe with it. You can then uninstall TortoiseSVN again.
Hope this has been of help.
Now some thanks and references:
First and foremost Murzal Arsya who made it clear that this project could be done on the DNS-320, outlined the need for DebianSqueeze and provided the step by step instructions for setting up subversion on the NAS.
Next http://nas-tweaks.net which is a great resource for people wanting to use their NAS for more than just NAS and provided the amazing ffp stuff.
Then Shaunc for guidance on svn+ssh, cheers geeza!!
Finally Hao Chen for for the tip to get rid of the plink pop-up window http://haochen.wordpress.com/2011/02/22/hiding-the-plink-pop-up-window-in-netbeans-ide-using-svnssh/