If you have ever done web development in a team, you know the hassle of ensuring everyone is using the same dev environment.
This is simply impossible when using multiple operating systems in the team: Mac OS vs Windows vs Linux, not to mention all the different Linux distros out there.
As a solution, some people set up a Virtual Machine to try and make sure everyone is using the same environment.
However, then you need to start sharing around the image file of that machine to the entire team, which also means if later on something changes you have to send it, again, to the entire team.
This is of course cumbersome and will most likely take way too much time, not to mention if later on some installed 3rd party module or tool breaks your web application for whatever reason.
You would have to uninstall that module and wish for it to be truly gone from your environment.
Wouldn’t it be great if you could have your development environment described in simple configuration files so you just need to run a single command to set it up?
Wouldn’t it be even better if ,not only you could have config files but also have minimal programmable configurations so you could add logic to your set up?
Well this is where Vagrant really shines and why you want it in your workflow.
Vagrant is a tool that works together with VirtualBox, a piece of free to use VirtualMachine software and which at a minimum only needs a so called VagrantFile.
Just go into the folder where the VagrantFile is located, type vagrant up in the terminal of your choice and enjoy the magic.
It will install a VM with all the tools installed into it which are define in the vagrantfile, it will forward ports if you want it to and by default there is a neat thing called synced folders set up as well.
By default the folder in which your VagrantFile is located is also available on the VM and is auto-synced for as long as the VM is running.
If you want more finetuned or specific configurations you can use Puppet or Chef to define the configuration and installation of your VM.
At appsaloon we opted to use Chef because we were able to find a lot of usefull Chef cookbooks which contain recipes for the tools and modules we most commonly use.
All of those we found on GitHub, free to use and welcome to contribute to them.
The beauty of using plain text files (config, ruby code, etc.) is of course that you can put them under version control.
So whenever we have a new project, we initialize a git repository and add a vragantfile and some cookbooks in it.
They are set up in such a way that our document root of our webserver on the VM is synced to our local machine’s folder containing the repository.
Nextly, all our team members need to do to start working on a project is to clone the repository as they would do anyway and let them run “vagrant up” on the commandline.
When we introduced Vagrant into our workflow it really did bring the house down.
It allowed our team to focus on what they care about most... developing cool web applications and keeping our customers satisfied.