Recommendation: Vagrant and Veewee


Note: I’ve decided not to use Veewee due to silly compatibility issues for now.

Quoting from Vagrant’s web site:

Vagrant is a tool for building and distributing virtualized development environments. By providing automated creation and provisioning of virtual machines using Oracle’s VirtualBox, Vagrant provides the tools to create and configure lightweight, reproducible, and portable virtual environments.

A complementary technology called Veewee makes building VirtualBox VMs easier by automating away a lot of manual steps. Marius Ducea has a great blog post on how to use it.

My observations:
1. According to Vagrant’s web site, it should work on Windows. I’ve tried that with unsatisficatory results. I think it works better on Linux and Mac;
2. Vagrant 0.9 was released recently, and is the version that I am using. However, 0.9 broke some backward compatibility such that a lot of examples on Vagrant configuration file in its web site no longer work. But it does provide good enough error message for you to fix and adjust;
3. Just a couple of weeks ago, Veewee was not compatible with Vagrant 0.9, but that has since been fixed. I mention this because things appear to be a bit fluid, and you may need to roll up your sleeves and tweak a few things yourself to get what you want;
4. Using Veewee to build Windows VM is not as smooth as doing the same for Linux VMs. In fact a few of the templates do not have the Cygwin setup file that definition.rb refers to. Another drawback is that the initial VM harddisk size is too small (10 gig I believe). Darn it, I forgot where I changed the setting to make it bigger before building it. Share that with me if you know please 🙂
5. In addition, it seems hard to build a Multi-VM environment with Windows in the mix. It looks possible, though. Once again please share that with me if you know!

Potential use cases:
1. Hacking, learning, and development. It provides a safe environment to play around, build and compile things, learn new technologies, etc. For example, I’ve used it to test and play with Tengine and Nginx. I’ve also built a Multi-VM environment where I tested MariaDB 5.3 and the new Percona Tools, pt-table-checksum and pt-table-sync in particular. I think Vagrant is a great tool to learn Chef, Puppet, and Hadoop;
2. Testing: testing software on different distros, continuous integration testing for server software (web server such as Tengine, database server such as MariaDB and Percona Server). In fact, using a Centos 6.2 VM, I found Percona’s 5.5 RPM packages still haven’t resolved header file conflicts, an old problem.

Sample Multi-VM Vagrant file
It is really convinient to have a Multi-VM environment for development and testing. Vagrant can do that but there is a shortage of good samples, especially for Vagrant 0.9. Here is a sample that worked for me. Note that:
1. The VMs in the environment can be made from the same image. In the sample below, “debian” and “xiaosaier”‘s daddy is “debian6”. No joke intended;
2. Use “vagrant ssh debian”, “vagrant ssh centos”, and “vagrant ssh xiaosaier” to get to each VM. Each VM can talk to one another via the IP address defined. Therefore it can be used for good, realistic testing. After having good Chef recipe or Puppet files, the VMs can be made in a certain way, which can be used for Continuous Integration Testing.
3. The hostonly network IP address works very well. However, the VM takes the name of the image it is based on by default. It will be nice to be able to customize the VMs’ names. Let me know if you know how;

Vagrant::Config.run do |config|

config.vm.define :debian do |debian_config|
debian_config.vm.box = "debian6"
debian_config.vm.network :hostonly, "33.33.33.10"
end

config.vm.define :centos do |centos_config|
centos_config.vm.box = "centos62"
centos_config.vm.network :hostonly, "33.33.33.11"
end

config.vm.define :xiaosaier do |xiaosaier_config|
xiaosaier_config.vm.box = "debian6"
xiaosaier_config.vm.network :hostonly, "33.33.33.12"
end

PS. Note, the combination of colon and letter x turns into an emotion icon above, at least viewed via the web page. Watch out!

, , , ,

One response to “Recommendation: Vagrant and Veewee”

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.