Personal tools

Contact Us 24/7 > 1 866.SIX FEET
Sections

Skip to content. | Skip to navigation

Home > Blog > Repeatable Development Environment with Vagrant
12/01/16

EVERYONE.NET SCHEDULED MAINTENANCE 

Everyone.net will be performing maintenance on their databases Friday December 2nd, 2016 between 9:00PM PT to 3:00AM PT / 12:00AM ET to 06:00AM ET. During this time, all services including web mail, POP, IMAP, and SMTP relay may experience degraded performance and inbound mail delivery delays. We apologize for any inconvenience.

Blog

Banner image

Repeatable Development Environment with Vagrant

written by Calvin Hendryx-Parker on Tuesday August 9, 2016

Throughout the course of a day, Six Feet Up developers work on many projects, so they need a quick and painless way to get set up. Vagrant is key in helping us accomplish that.

Reduced Launch Risks

Programmers typically strive to get their development environment to mimic the target production environment so as to avoid code breaking or not working at all when going live. For instance, they try and install the same dependencies onto their local workstation as in the production environment. Since they may be using Windows, Mac, or Linux, it can lead to some trickiness: the package management system the developer has may not have the exact same versions of dependancies as the production environment, or files may be placed in different locations.

Vagrant helps developers get quickly spun up on a new project. It helps provision a new virtual machine on a developer's local desktop and get all the dependencies installed and configured.

Developers' Productivity Boost

Vagrant allows developers to use their own editing tools that are native to their desktop, and run the code inside of their Vagrant virtual machine. For example, a developer might be running Linux as their target environment, but may want to be able to use his/her Textmate, or Sublime Editor on Mac to be able to edit the code, debug, and play with the system. So in this example, using Vagrant allows this developer to mount up the code from their Mac inside of their Linux VM, edit it with their familiar and more comfortable tools, but actually have it run in a more similar environment to Production so s/he can find any issues that might occur when actually deploying into Linux.

The same `Vagrantfile` can be used by developers using different environments, so for example, a native developer on Windows can use the editors s/he loves, and a native developer on Mac can use the tools that s/he loves, but they're both going to end up executing the code on a Linux VM. Once Vagrant is set up on a project, it will keep the same versions of the VMs, code, and everything else, which is nice because you can always get a reproducible environment.

Minimized Environment Compatibility Issues

Vagrant drastically reduces environment compatibility issues: using Vagrant's ability to spin up multiple VMs, developers can actually simulate the production environment with multiple tiers, like a database tier, an application tier, and so on.

Developers can also use the same configuration management tools that would be used in their target environment. For example, at Six Feet Up we use Salt Stack to do our configuration management to make sure the right packages are installed, and to make sure that the configuration files are in a certain state. We use the exact same Salt states in our Vagrant instances that we do in production, so we can actually test run them before we go deploy them.

Time Saver

Vagrant is a huge time saver when bringing new developers on board, even months after the start of a project. Instead of developers wasting half a day trying to get all their computer set up correctly, trying to get the Oracle driver to work with the specific versions of things, fighting with the new version of OS X because it's got SIP, and it's only allowing them to modify binaries that are in certain directories, the Vagrant VMs just boot up and work.

Running Vagrant requires an initial time and effort investment. Usually teams dedicate one developer to get things just right, and, once that's ready to go, all the other developers benefit from running `vagrant up` and having a matching environment as the rest of the team. After they pull up the code, they end up with what should be a running instance of the software without any more commands to run.

Debugging Made Easier

Vagrant is beneficial to a sole developer too as it allows programmers to get a clean environment very quickly. Developers just run `vagrant destroy` and then `vagrant up` to be up and running with everything reset back to a known good state. It makes it easier to experiment, knowing that you can easily wipe out the code and start over.

Beginners' Tips

At Six Feet Up, we have quite a bit of experience using Vagrant. Here are a few tips new Vagrant users might find useful:

  • Check out the port-forwarding. What's nice about it is that you don't have to run a full desktop environment in the VM: you can actually forward the ports from the VM back to your local instance. Basically, you just develop as if you were on your local instance. Just go to http://localhost:8080, if that's where your application is actually running, but do it as if you're on your Mac or your Windows machine: it just forwards it back into the actual Vagrant instance. 
  • With `vagrant push` you can actually do deployment tasks from your local system into target environments such as an FTP/SCP server or Heroku. Streamline your whole deployment process in once simple spot.
  • You can extend Vagrant with your own plugins. Most of the core of Vagrant is implemented as plugins so there are great examples of how to get started.

Vagrant and Cloud Services

The Vagrant community is a very active one and they hold a conference each year. The same company built some a great tool called Terraform for doing at-scale mass deployments across multiple cloud infrastructures. It may be interesting to check them out for those of you who don't want to do strictly AWS, DigitalOcean, or RackSpace Cloud. The company that built Vagrant lets you do a hybrid of those using their tools.

Summary

All in all, users of Vagrant get set up efficiently, and with an active community full of improvements, tips, and developers, we have found it to be a great way to start off a project.

Do you have questions about Vagrant? Do you want to know how it can streamline your set up, or how to use it successfully? Feel free to email me.

 
Add comment

You can add a comment by filling out the form below. Plain text formatting.

puzzle
Calvin Hendryx-Parker
Chief Technology Officer
Calvin's Recent Posts:
Django CMS vs Plone (10/31/2016)

Next Steps


Select a type of support:

Contact our sales team

First name:
Last name:
Email:
Phone Number:
Message:
Fight spam:
What is + ?
 
Call Us 1 866.SIX FEET
Sections