views:

1723

answers:

7

I'm currently working on a server-side product which is a bit complex to deploy on a new server, which makes it an ideal candidate for testing out in a VM. We are already using Hudson as our CI system, and I would really like to be able to deploy a virtual machine image with the latest and greatest software as a build artifact.

So, how does one go about doing this exactly? What VM software is recommended for this purpose? How much scripting needs to be done to accomplish this? Are there any issues in particular when using Windows 2003 Server as the OS here?

A: 

I'd recommend VirtualBox. It is free and has a well-defined programming interface, although I haven't personally used it in automated build situations.

JesperE
+1  A: 

Regardless of the VM software (I can recommend VirtualBox, too) I think you are looking at the following scenario:

  1. Build is done
  2. CI launches virtual machine (or it is always running)
  3. CI uses scp/sftp to upload build into VM over the network
  4. CI uses the ssh (if available on target OS running in VM) or other remote command execution facility to trigger installation in the VM environment
ADEpt
+1  A: 

VMWare Server is free and a very stable product. It also gives you the ability to create snapshots of the VM slice and rollback to previous version of your virtual machine when needed. It will run fine on Win 2003.

In terms of provisioning new VM slices for your builds, you can simply copy and past the folder that contains the VMWare files, change the SID and IP of the new VM and you have a new machine. Takes 15 minutes depending on the size of your VM slice. No scripting required.

David Robbins
+1  A: 

If you use VirtualBox, you'll want to look into running it headless, since it'll be on your server. Normally, VirtualBox runs as a desktop app, but it's possible to start VMs from the commandline and access the virtual machine over RDP.

VBoxManage startvm "Windows 2003 Server" -type vrdp
seisyll
+4  A: 

Sorry to deny anyone an accepted answer here, but based on further research (thanks to your answers!), I've found a better solution and wanted to summarize what I've found.

First, both VirtualBox and VMWare Server are great products, and since both are free, each is worth evaluating. We've decided to go with VMWare Server, since it is a more established product and we can get support for it should we need. This is especially important since we are also considering distributing our software to clients as a VM instead of a special server installation, assuming that the overhead from the VMWare Player is not too high. Also, there is a VMWare scripting interface called VIX which one can use to directly install files to the VM without needing to install SSH or SFTP, which is a big advantage.

So our solution is basically as follows... first we create a "vanilla" VM image with OS, nothing else, and check it into the repository. Then, we write a script which acts as our installer, putting the artifacts created by Hudson on the VM. This script should have interfaces to copy files directly, over SFTP, and through VIX. This will allow us to continue distributing software directly on the target machine, or through a VM of our choice. This resulting image is then compressed and distributed as an artifact of the CI server.

Nik Reiman
A: 

Choosing VMWare is currently NOT a bad choice.

However, Just like VMWare gives support for VMWare server, SUN gives support for VirtualBOX.

anjanb
I saw that VirtualBox was sponsored by Sun, but when you go to the website, the closest thing that one sees to a support page is the community forum. I don't think that this is exactly the same as VMWare, which is obviously more dedicated to this specific product.
Nik Reiman
A: 

You can also accomplish this task using VMWare Studio, which is also free. The basic workflow is this: 1. Create an XML file that describes your virtual machine 2. Use studio to create the shell. 3. Use VMWare server to provision the virtual machine.

ablarg