I'm not sure of how many of you use Vagrant so this post will be a bit long to describe the basics and the reasoning behind what I've done.

So last year when I got involved in Inkscape development it took way too much time to set up my development environment and all those packages that were needed cluttered up my system. During the fall of 2013 I got suggestions from several other non Inkscape developers to try out Vagrant when I develop PHP/Wordpress applications. This weekend I finally had the time to try out Vagrant and I'm now curious what others think about using Vagrant for easier testing of Inkscape.

### Installation of Virtualbox and Vagrant
Virtualbox 4.3.2_Ubuntu r90405 (from repository in Xubuntu 14.04)
Vagrant 1.4.3 .deb file from http://www.vagrantup.com/downloads.html

### Only three commands needed
After installing Virtualbox and Vagrant this is all you need to do:

bzr branch lp:~inkscape.dev/inkscape/vagrant inkscape-vagrant
cd inkscape-vagrant
vagrant up

The above three commands will first branch the Inkscape branch with the three required Vagrant files and then launch a virtual machine with Inkscape 0.48 from the Ubuntu 12.04 repository pre-installed AND compile the current checked out Inkscape branch. (BE AWARE, download of 2GB vagrant box will be done the first time you run "vagrant up").

### What to expect
When Vagrant has set up the Virtualbox VM it will boot it up and run a custom compile script within the VM. You can login to your VM with "vagrant" as password. In the Unity bar you'll have two Inkscape icons, the first one will launch repository version of Inkscape and the second will launch the dev version currently checked out...though you'll have to wait until the compilation is done before it works.

The following image is what to expect when the compilation is done.
http://www.christofferholmstedt.se/wp-content/uploads/2014/01/ubuntu-vagrant-test.png

### Hint for faster compilation of Inkscape
The default settings in the Vagrantfile is now 1 processor and 512 MiB ram, this is not the best options when you want to compile stuff. The reason for the low default settings is that if someone with really low-spec computer tries it out, it will at least boot up and run and not crash due to demanding more memory than available on the host. Recommended settings are as many processors as you have and at least 2 GiB of ram for the guest system. If you edit the "Vagrantfile" you'll see two lines commented out with recommended settings.

In one line: after branching the Inkscape repository and before running "vagrant up" edit the Vagrantfile to configure the virtual machine to use optimal settings with regard to your host's capabilities. I run with 4 CPUs and 2048 RAM.

### A detailed description of what is going on
When you run "vagrant up" the Vagrantfile in the repository directory of inkscape repository will be read. It will first try to find what is called a "box" in Vagrant terminology...basically an ISO that is specific to the vm provider you're using, in this case Virtualbox. Each box includes a basic OS with all the pre-installed software you need. If you run the above command you'll start by downloading a box I have manually set up during the weekend. This file is 2.0GB so it will probably take some time to download (but you only need to download it ones).

The next step is that Vagrant will make a copy of this "box" to be used as the new virtual machine. After copying the box, Vagrant will start configuring basic settings such as networking and shared folders for the VM. In the supplied Vagrantfile I've configured so the inkscape repository on the host machine will be mapped to /home/vagrant/inkscape.

After that is complete the new virtual machine will start compiling Inkscape and installing it to /home/vagrant/opt/inkscape-dev/inkscape and an icon should already be in place in the unity bar.

When you're done you can shutdown the VM and on your host run "vagrant destroy" to remove all data about the newly created VM, no mess left behind on your host such as build-essential packages.

### Rationale behind a large "golden image"
Most other developers that use Vagrant use it for server environments without desktop packages. Installing "ubuntu-desktop" with apt-get downloads around 1000 packages and installs them, having to do this each time you want to test a new branch is not a viable solution. It's therefore better download a 2.0GB file ones instead of re-installing ubuntu-desktop several times. At least that is the trade-off I've made during my first tries this weekend.

### The possibilities
The main possibility is that it easier for new testers/developers (and existing) to test the latest Inkscape in a specific environment (VM guest) that doesn't mess with their own host system.

The suggestion I present here in this email is with the goal to make GUI testing easier. For those that are mostly concerned with development and just want to make sure Inkscape compiles properly another Vagrant environment could be set up which would be a lot smaller. I did a small test of this which is available on launchpad in a separate branch [1].

### What has to be done.
2.0GB "golden image" is really big, way too big. The process of creating this image was done manually by me during the last weekend, this process should be automated with "Packer" [2] and start with the Ubuntu desktop image instead of the server image. If the Ubuntu ISO can be as small as 800MB so should this "box" be (or can it be that small?).

When the creation of the "golden image" is automated I would look in to the possiblity of creating several different versions of it for different operating systems such as Mac OS X and Windows guests. As Virtualbox is cross-platform testing could with this approach be done in a many-to-many relation. Those with Windows host could test Mac OS version in a VM and Mac OS hosts could test Windows version in VM (with the restriction that I assume everyone would need a separate license key for OS X and Windows). An important point to make is that no matter which OS the guest is running no custom commands must be run on the guest by the user, it's all automated so someone that hasn't used Ubuntu can test Inkscape on that platform anyway.

### Questions
With many possibilities even more questions arise. The main question I have is if this looks like a valid approach to testing new features? Is it worth it? Does it make it easier for anyone else? Are there better/easier approaches to testing new Inkscape versions out there?

### What is Vagrant
I would say that Vagrant is a frontend for several different virtualization technologies and the official one-line is "Create and configure lightweight, reproducible, and portable development environments" [3].

[1] https://code.launchpad.net/~inkscape.dev/inkscape/vagrant-no-desktop
[2] http://www.packer.io/
[3] http://www.vagrantup.com/
--
Christoffer Holmstedt