Site icon R-bloggers

Sharing environments using Vagrant

[This article was first published on Mango Solutions, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Ever thought about what is required to create validated software? At Mango we have as it is fundamental to many of our projects. Software validation is a big topic so I’m going to focus on one aspect: How do we ensure the environment (operating system, software and configuration) that developers use is consistent, reproducible and as similar to the real environment as possible?

Let’s take a step back and consider why we’ve asked this question. When creating or validating software (as we do in ValidR) we always know where the software must run, and as part of creating the software it must be tested and validated. In order to avoid bugs and rework later on (which cost time and money) it is important that everyone involved is using the same environment.

So how do we go about ensuring this consistency? Well we can look to the DevOps community for a solution, certain tools do spring to mind such as Docker and Puppet or Chef, but these don’t quite fulfil the need on their own, so as an alternative that is more developer orientated we would recommend a tool called Vagrant.

Vagrant at its most basic is a set of command-line tools that sit upon existing virtualisation technologies (VirtualBox, VMWare, Amazon Web Services amongst others) allowing you to create, define and share virtual machines. This is great, but why don’t we just use one of the virtualisation technologies? Well coming back to the need for a consistent environment that is easily shared this is the feature where Vagrant shines. Consistency is built into its core ethos; Vagrant provides a consistent way to share virtual machines, a consistent way to configure them, and a consistent way to update them. An added benefit is that it is very easy to adopt and use, two simple commands and you are up and running.

$ vagrant init hashicorp/precise32
$ vagrant up

There is more than just these two commands, but they get you started. Vagrant uses a configuration file that defines the environment, and this configuration is meant to be treated as source code and stored in a repository which makes it easy to share, and since you can share it everyone can use it so you get your consistency. This is truly a revolution in the way you can distribute environments between individuals and teams. We have certainly found that the benefits that Vagrant says you will receive (lowers development environment setup time, increases development/production parity) to be true and has helped us achieve our goal of ensuring that the developers use consistent, reproducible environments as similar to the production environment as possible..

If you are interested in Vagrant then head over to their site https://www.vagrantup.com/ and follow their getting started guide (http://docs.vagrantup.com/v2/getting-started/index.html)

 

To leave a comment for the author, please follow the link and comment on their blog: Mango Solutions.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.