Development Workflow with Vagrant

Whenever any developer creates software within a certain level of complexity, it requires a certain environment required for the application. If you were building a certain Rails app that had Resque on it, you’ll need to install Redis on computer, if it’s using MySQL or a certain flavor of an SQL database, you’d also need to install it. If it has environment files or other 3rd party software needed to run (i.e. ImageMagick, etc.) you’ll also need to install those.

In the long run, your host computer becomes this chaotic hotbed of a development environment you build your apps in. This becomes a pain point for most of the time during application development.

Problems rise up whenever you need to get other developers on board with the project. So you’ll have to set up the same type of environment you’ve set up.

Another problem is fixing bugs found in Production/Staging environments. Deployed from development code and development data, you have no idea whats going to happen when your software is deployed into a Production/Staging environment.

There are many other edge cases we can think of that involves development environments.

“It works on my machine”

This tends to be a thing developers would say. tldr; Vagrant is a good tool for this painful part of the development workflow.

Vagrant

Where I work (AELOGICA) we use this basic Vagrantfile for developing applications privately in our own computers.

Whenever I do vagrant up this basic configuration for a vagrant VM makes my project folder accessible inside that VM. I could do bundle install inside the VM, run ansible playbooks/chef scripts to set the VM up as a development/staging/production environment.

Other developers or devops involved in the project can effectively get the same environment, without messing up their host computer by installing tons of software to recreate a certain environment. It’s knowledge transfer of a project at its finest.

Used in this context, Vagrant is a great tool for creating consistent and stable development environments. It helps lessen the ‘works on my machine’ theory, when solving problems with the code.

Everyone doesn’t need to necessarily do the same workflow for everyone, Vagrant is just a tool at the end of the day.

As Mitchell Hashimoto, creator of Vagrant, would say:

Of course, it isn’t necessary to follow each and every principle of the Tao of Vagrant to use Vagrant. Vagrant is a general purpose tool and can be molded into your environment as you see fit. But it is important to see and understand the larger vision behind Vagrant.