The Tao of Vagrant
Before even installing Vagrant or seeing how it works, it is important to understand the high-level workflow of Vagrant in an actual working environment. These principles are collectively known as the “Tao of Vagrant.” The following is an excerpt from Vagrant: Up and Running.
In a world with Vagrant, developers can check out any repository from version control, run vagrant up, and have a fully running development environment without any human interaction. Developers continue to work on their own machine, in the comfort of their own editors, browsers, and other tools. The existence of Vagrant is transparent and unimportant in the mind of the developer. Vagrant is the workhorse that creates consistent and stable development environments.
System operations engineers work on systems automation scripts, again in their own editors and tools on their machine. When they’re ready to test these scripts, they vagrant up, and have a complete sandbox matching production, ready to test real world scenarios and systems automation.
The automation system operations engineers develop is not only used in production, but also in development. With every vagrant up, developers are getting fully provisioned development environments using the same scripts that are used to setup production. This way, developers work in environments that mimic production as closely as possible.
If something goes wrong, or they just want to start over from a clean slate, developers and operations engineers can run +vagrant destroy+, which removes all traces of that development environment from their machine. Then a vagrant up again will re-create an identical, fully functioning development environment in a snap.
At the end of the day, Vagrant can suspend, halt, or destroy the development environment, keeping the overall system clean. Never again can developers forget to shut down a stray server process and waste precious compute resources. When ready, vagrant up will bring back a ready-to-go development environment in just a few minutes.
The best part of all this is that this knowledge transfers to every project. Whether working on project A, project B, or even at company A or company B, as long as they follow the Tao of Vagrant, the workflow is exactly the same. As a result, productivity abounds and “works on my machine” bugs disappear.
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.