One of the challenges of developing in the Software + Services/SOA world we now live in is creating a developer environment that mimics a real-world network. This is especially important for ISVs that need to deploy onto a variety of client and server machines.
In the past to build client/server software I would ask my boss for a second machine and a KVM switch or just build the entire solution on one machine and hand it over to QA for proper testing. This worked so-so but had some shortcomings:
- Testing redundancy and failover was nearly impossible. For example testing to make sure SQL Server could fail over to another node and the application would stay healthy.
- Testing against client machines with different patch levels (e.g. does it work the same with SP1 installed?)
- Building software that used Active Directory and other big network services
- Making sure cross-machine security worked. Remember moving something to DCOM and then never having the knobs turned the right direction in dcomcnfg.exe?
With virtualization support in the hardware and OS you can build a sandbox with multiple clients and servers along with your own virtual network and the shortcomings I listed.
Configure Server 2008 As A Workstation
To start, I needed to move my main development workstation from Vista to Windows 2008 Server in order to use Hyper-V. Vijay has a nice post on how to get turn Windows 2008 Server into a workstation. There’s also this entire site dedicated to running Server as a workstation
The requirements for Hyper-V include a x64-based CPU that supports virtualization (this is just about any chip you can buy now), the 64-bit version of Windows 2008 Server, and enough memory to run your virtual machines (VMs). I have 4GB in my older Xeon based workstation and it seems to hold up nicely although I need to enable virtualization in the BIOS before it would work. Hyper-V in a developer scenario seems to be more memory intensive than CPU so go for 4GB or 8GB of RAM if you can swing it.
Once I had Server 2008 humming along nicely, it was time to install Hyper-V the Hyper-V role. One of the cool things about using Server as a workstation is that you can choose which roles and features you want installed and leave off things you don’t want. Hyper-V is a role you install so simply go into the server manager and choose add role
Once you have Hyper-V installed it will show up in the list of installed roles:
Create Virtual Machines
After that it’s time to build some virtual machines. You have quite a few options here. I know there are some free trial ones posted on here or you can opt to build your own. I decided to create my own just to gain the experience of creating virtual machines. The New Virtual Machine wizard lets you choose how to install the OS. If your network has Windows Deployment Services (formerly “RIS”) you can choose that and Hyper-V is smart enough to catch the RIS packets and pass them through to the virtual machine. Or, you can choose an ISO file or DVD and install from there. The nice about virtual machines is that once you go through the trouble of making them, they can be saved off as VHD files for easy reuse.
Create A Virual Network
The other task besides creating VMs is to create a virtual network. Choose the Virtual Network Manager from the Hyper-V Manager. Your choices are:
External – network that can see the real physical network
Internal – network between VMs and the physical computer
Private – network for only the VMs
Typically you will want to start with an external network so you can load software and patches onto the VMs and then convert the network to Internal or Private as needed for your development environment.
To get started, I created two virtual machines that replicate a web server and database server. The web server has IIS7 and ASP.Net installed and the database server has a beta of SQL Server 2008. This uncovers another neat benefit of using virtual machines. I’m not too worried about what the beta might do to the stability of my machine because it’s as easy as creating a new VM if any issues arise.
With my two servers in place I can start to think about clients. I could potentially create an XP client, Vista client, and Linux client. I’m also keen on trying Windows Server 2008 Core (the command-line only version of server).
In part two I’ll explore creating some clients as well as deploying an application from Visual Studio onto the various servers.