Vagrant is a great tool for ensuring automated software development, as it allows using pre-configured Vagrant Boxes (virtual machine images with required configurations) to provide continuity of operations. This allows the developers to create, adjust and delete the required environments without waiting for Ops engineers. What is Vagrant after all?
Vagrant is a free to use and open-source product from HashiCorp. It is a system for Virtual Machine (VM) management. Vagrant is a simple-to-use command-line client, as well as an interpreter of textual descriptions of environment configurations, called the Vagrantfiles. While virtual machines can be easily created or managed from any virtualization hypervisor, working with Vagrant software provides a common layer, so that the same workflow can be built atop any underlying OS and hypervisor.
Vagrant files allow you to codify your environment specs in simple text format, so they can be versioned and easily adjusted. Another benefit is that instead of storing separate VM images, which can have up to several Gigabytes in volume, the developers have to store, share and adjust only the textual description files, which weigh mere Kilobytes, and build the VMs only once the need arises.
What is Vagrant useful for?
The main reason for Vagrant introduction was the “works well on my machine” — the favorite excuse of many generations of developers. This means that production environments often differ a lot from development and testing environments so that various bugs can pass undetected through the whole software development pipeline and manifest themselves only in production.
By introducing Vagrantfiles it became possible for Ops engineers to get the exact descriptions of the production environments where the bugs occur, so the developers can build exactly the same dev, testing, and staging environments and reproduce bugs easily. This helped speed up the bug fixing significantly.
In addition, using Vagrant Boxes is a great way for UI/UX designers to test their ideas in the wild. Generally speaking, Vagrant virtual machines allow any developer to try using a new framework, language, OS or programming environment without any risk to your existing systems.
What is Vagrant functionality?
There are several key Vagrant features one must learn in order to use Vagrant software efficiently:
- Vagrant Box is a basic Virtual Machine, packaged and ready to be launched
- Vagrant Provider — the environment where the Vagrant machine runs. For most of cases, it is VirtualBox, but for developing microservice application infrastructure and other software development tasks Vagrant and Docker are great.
- Provisioner — a tool used to configure the virtual environment, like Chef, Puppet or Ansible.
How to start working with Vagrant? There are both official install packages on Vagrant site and default distributives in many OSs, so installing Vagrant is as simple as running a single-line command in your terminal. storing only a library of Vagrantfiles allows you to provision any required VM on demand.
Conclusions on what is Vagrant
There, now you must understand what is Vagrant. It is a great tool for providing versatility and reproducibility of software environments, both for bug fixing and exploration. It is a guarantee of app portability and continuity of the software delivery process.
However, Vagrant software is by far not perfect in terms of speed of launch and configuration, scalability of VMs, scopes of instance isolation, levels of inherent security. Docker has offered a different approach — instead of building 1 VM to run a single instance, Docker containers provide envelopes of code that contain all the required runtime to launch the app. This provides 300% more cost-efficient resource consumption, as compared to launching Vagrant Boxes. Thus said, Vagrant is still great for software development, though.