If you happen to be weary of the “everything online” approach to handling the security and storage of your projects or data, then welcome aboard to my skepticism ship. I too have a few issues with entrusting all of my data and code to a single entity. While the lure of many free source control hosts is enticing, that subconscious voice murmurs a paranoid chatter to not put all the eggs in one basket. Yes, it is an annoying language with which it speaks to me; however, it has grown strong due to my experience in failure. So, sometimes I listen to it.
I took a look at how I can solve this as a “do-it-myself” project, and found two great free resources that may help others to come up with a similar solution. Now, I need to mention that a holistic solution is not and never will be free. In order to host a source control server you need to have a computer system available to do that and a bit of time to learn the ropes. However, the base requirements for such a system can be minimal, and if it happens to meet some fairly low requirements for virtualization… you may be in luck and put that old computer or laptop to some use. The time to ramp up skills in this area can be consuming; however, it just depends on what you know and how far you wish to take the learning. In this article, I’ll briefly describe what the key is to climbing this hill and what free resources are available to you to help surpass that imaginary boundary to create your very own source control server.
Virtualization is great. I really cannot emphasize how fantastic it is in this article, but anyone involved in any technology infrastructure knows the advantages. The nice thing is that there are a few “hypervisor” solutions in this sector that are just pure awesome. The immediate leaders in that area are Microsoft with their Hyper-V Server and VMware’s’ ESXi. Both products perform their roles as hypervisors quite well, which is to virtualize a computer into a nice and portable image. If you are looking at any sort of server solution for a small team or business, it is a wise choice to thoroughly investigate the advantages of dashing out of the gate towards using a hypervisor.
My focus though today will be with the unlimited, and totally free Microsoft Hyper-V Server 2012 R2 solution. It can be made portable enough to fit on a 16GB USB stick, and will run on any system that supports virtualization. That means any Intel processor that supports their VT capability. For AMD systems, they require processors with AMD-V technology. Check your system, and if your desktop or laptop has one of those listed, you are well on your way to building a versatile solution. Otherwise, you may be out of luck for the remaining goodness to follow. It doesn’t mean you can’t build a solution, it just limits you to dedicate the system for only a single solution to work with at a time. Virtualization can launch you above that barrier and allow you to spin up several systems at once, given enough available resources on the “host” server.
One other recommendation is that the computer system should have at least 4GB of RAM and no less. While you can probably get away with only 2GB, and really 16GB is a preferred minimum… 4GB is my recommended bare minimum to get a hypervisor up with at least one virtual machine running. You might even be able to get two Linux VM’s running on 4GB, say a firewall like Pfsense and a version control system (VCS)…. I’ve done it with little hassle.
Finally, you’ll need some storage on the system for all your stuff as that 16GB USB has plenty for the hypervisor, you’ll need room for your repository and virtual machine. The system I’m setting up today came with a 320GB drive, so that’s what I’ll be sticking with… reusability, yay!
To just outline the baseline:
- An Intel or AMD processor with virtualization capability
- A minimum of 4GB of RAM, more is better
- 16GB is the bare minimum for Hyper-V Server, so try to find a spare drive to experiment on with 60GB or more
If you have limited experience with building computer systems or solutions using any Microsoft platforms then this part of the process is probably the hardest part to overcome. I will not go into the nitty-gritty of platform construction, there are dozens of tutorials available on the Internet and I’ve even posted a few detailed “how-to-do-stuff” myself, but I’ll list a few resources that could help get you started on setting up the base Hyper-V Server.
- Windows Assessment and Deployment Kit for Windows 8.1 (excellent and free tools for building images for operating system installation for Windows 8.1)
- Hyper-V Server 2012 R2 (everything you could possible want to know about the server, setup, drivers, and many more things)
- Windows Server Evaluations (get time limited, as well as the unlimited Hyper-V Server for download… it’s totally free)
- Microsoft Virtual Academy – Virtualization (so much learning, so little time!)
One word, Bitnami. In my opinion, they have one of the best resources for tons of open source and 100% free operating systems to solve many real world problems. In their applications area, they have so many virtual machines already prepared for download, and a few that specifically address source version control. In the area labeled Developer Tools, you can find Subversion, Gitorious and GitLab to name a few, with several other valuable tools ready to be used. I wish they had a version for Mercurial, but they don’t… yet. Also note, they have both installers and virtual machines ready to download; however, the VM’s seem mostly to be built for VMWare’s ESXi… that’s a bummer as we will not be able to directly use them once we got them downloaded. But there’s a fix for that which is superb and I’ll briefly cover next.
The VMWare file format will need to be converted to a format that is compatible with the Microsoft version of a virtual disk, or the VHD file. The tool I’ve used comes from an excellent solution provider called StarWind Software and their totally free product called V2V converter. Install that, and after extracting your virtual machine from the Bitnami download, run it against the VMDK file extracted. It has a few options available, but you will want to target the VHDX file format as a single file for Hyper-V Server 2012 R2.
Figure 1: StarWind V2V Converter
In just a few minutes, you’ll have the disk converted to a version that can be used in Hyper-V Server with very little effort and no need for a running ESXi or a Hyper-V host… it’s a standalone solution. The following image shows the difference between the original VMWare version of Gitorious 3.2 from Bitnami to the single VHDX file for use with Hyper-V.
Figure 2: Before and After Conversion
After the conversion is complete, it is really a matter of adding the virtual machine to Hyper-V, configuring your options for the virtual machine such as memory and network adapter, and in a few short moments… bingo, your very own source control server. In this example, I tested the VM on my workstation just to make sure it was running normally before moving it to my server for further testing.
Figure 3: Bitnami – Gitorious and HyperV
The Fruit of Labor
It was simple, and took barely 15 minutes from download, logon and to connect with SourceTree to begin playing with a sample Git Repository. Seriously Simple.
Figure 4: Gitorious Ready to Go!
Figure 5: Empty Git Repo Sample
After a simple Fetch, and creation of a local repository, it was just as easy to point Visual Studio to work with it; however, I found SourceTree a pretty straight forward way to deal with syncing. I’m not a Git guru, but if I’m able to get the basics working… anyone can! 😀
I know this article is not a step-by-step “how-to-do-stuff” article, but just a real quick view of what is possible… and again, if I’m able to get this stuff to work… anyone can, it really was quite simple. I hope this has given you some ideas on how to create you very own low cost source control server. Good luck!