User:Aslingwa/Vagrants

{{Infobox software }}
 * name                  = Vagrant
 * logo                  = Vagrant.png
 * screenshot            = Vagrantup.jpg
 * caption               = Vagrant starting a virtual machine using
 * founders              =
 * author                = Mitchell Hashimoto
 * developer             = Mitchell Hashimoto and John Bender
 * released              = {{start date and age|2010|03|08}}
 * frequently updated    = yes
 * programming language  = Ruby
 * operating system      = Linux, FreeBSD, OS X, and Microsoft Windows
 * language              = English
 * status                = Active
 * genre                 = Configuration management
 * license               = Mixed open-source and proprietary
 * website               = {{URL|http://vagrantup.com/}}
 * latest release version = 1.7.4
 * latest release date   = {{start date and age|2015|07|17}}}
 * alexa                 =

Vagrant is a computer software that creates and configures virtual development environments. It can be seen as a higher-level wrapper around virtualization software such as VirtualBox, VMware, KVM and Linux Containers (LXC), and around configuration management software such as Ansible, Chef, Salt and Puppet.

Since version 1.1, Vagrant is no longer tied to VirtualBox and also works with other virtualization software such as VMware and KVM, and supports server environments like Amazon EC2. Although written in Ruby, it is usable in projects written in other programming languages such as PHP, Python, Java, C# and JavaScript.

Since version 1.6, Vagrant natively supports Docker containers, which serve as a substitute for a fully virtualized operating system. This reduces overhead as Docker uses lightweight Linux Containers.

Vagrant plugins also exist, including vagrant-libvirt that adds support for libvirt, vagrant-lxc that adds support for lxc, and vagrant-vsphere that adds support for VMware's ESXi.

History
The idea behind Vagrant started in 2009. Mitchell Hashimoto was frustrated building similar development environments for different projects when he was employed by Ruby development shops. He wanted a solution that would enable him to easily set up development environments for new projects and revert back to stable environment states.

In January 2010, Mitchell approached his colleague, John Bender, who valued his idea and offered to join in on the project. Vagrant began with a project name "hobo". The first working prototype was built by January 31, 2010. This prototype loaded virtual machines and supported SSH commands.

Vagrant 0.1.0 was released in March 8, 2010. Interestingly it was planned to release only supporting a single Ubuntu image but John Bender came up with the idea of "box" system about a week before its public release. Later on, this feature turned out to be one of the most critical pieces to Vagrant. Along with this release, Vagrant also launched its mascot named "Vince Chilling".

After a few months from its first release, Carl Lerche, employee at Engine Yard, discovered Vagrant and proposed to offer sponsorship. On October 14, 2010 Engine Yard announced its sponsorship in an article titled "Mitchell Hashimoto Joins Engine Yard OSS Community Grant Program".

In March 2012, the first stable version of Vagrant (v1.0) was released. But even before the release of Vagrant 1.0, hundreds of companies had already started using it including Mozilla, RackSpace, LivingSocial, Shopify, OpenStack, EventBrite. From the beginning, Vagrant had kept itself open sourced under the MIT license.

In November 2012, Mitchell formed [HashiCorp] to back the development of Vagrant full-time. HashiCorp builds commercial additions and provides professional support and training for Vagrant.

In January 2013, the new Vagrant logo: A simple "V" built with isometric cubes was launched, replacing its old mascot "Vince Chilling".

Architecture


Vagrant architecture consists of two layers: Core layer and Plugin layer.

Core Layer
The core layer consists of the most inner kernel of Vagrant which specifies the core component of the system such as machines. It also represents the interface to the actual virtual machine. The core layer is made up of components like box, vagrantfile, command line interface, provisoner, provider, and plugin.

Box
Box is a packaged format of virtual machine in a Vagrant environment. It is a Vagrant compatible file which can be used by anyone on any system with Vagrant installed in it. Vagrant maintains a set of [predefined boxes] for public use. These boxes can also be customized as per user preference.

Vagrantfile
A vagrantfile is the central configuration of a Vagrant machine for the end-user. In this file all kinds of settings such as the provider and provisioner can be specified. If two users share the same vagrantfile, then the two users will possess the same configured Vagrant environment. . Vagrant is meant to run with one vagrantfile per project and the vagrantfile is supposed to be committed to version control. This allows other developers involved in the project to check out the code and customize the vagrantfile as per the use. Code inside vagrantfile is written in Ruby.

Syncing
Vagrant provides the ability to sync up the Vagrant folder on different host machines. This enables the user to work on different host machines without the need to re-configure it. By default, Vagrant shares the project directory i.e. . It uses NFS, Rsync, SMB, Virtual Box to enable syncing up of folders.

Multi-Machine
Vagrant provides multi-machine feature which enables the user to setup Vagrant environment with multiple virtual machines. This configuration is done in vagrantfile, wherein the user can specify virtual machine instance and assign name to them. Setting up of multiple machines is of great use in following scenarios:
 * 1) To model multi-server architecture such as separate database server and web server.
 * 2) Modeling a distributed system to test the distributed algorithms.

Providers
Providers are used to delegate communication with the virtualized instance. Vagrant, by default, gives support for Virtual Box. It also supports other types of machines such as Docker, Hypervisor, VMWare, etc. In order to use other type of machines, Vagrant has specific plugins developed for this purpose.

Provisioner
Provisioner helps the user to install the software and configure the machine as per the user customization. This helps the user to further customize the boxes as per requirement, as the predefined boxes typically aren't built perfectly for the user requirement.

Plugins
Vagrant implements most of the additional functionality via plugins. Since Vagrant dogfoods its own plugin API, one can be confident that the interface is stable and well supported. One such plugin is called Vagrant-AWS, which allows Vagrant to control and provision Vagrant machines in EC2 and VPC.

Setup
In order to set up Vagrant, we create a vagrantfile. This file serves as a root directory of the project and also contains the specifics of the kind of machine and resources needed to run the project.

Vagrant has a built-in command for initializing a directory.

Create a working directory $ mkdir vagrant_getting_started

Change the directory to the one created above $ cd vagrant_getting_started

Fire the vagrant init command $ vagrant init

Once the vagrantfile is created, Vagrant needs to add the boxes in order to run the virtual machine instance. Vagrant provides a list of [predefined boxes].

This command adds the box named precise32 to the Vagrant environment. $ vagrant box add hashicorp/precise32

After the box has been added to Vagrant, the vagrantfile needs to be changed as shown below. vi vagrantfile

Add the following Ruby code. Press  to insert text and   followed by typing   to save and quit. Vargrant.configure("2") do |config| config.vm.box = "hashicorp/precise32" end

Once the box has been added and mentioned in the vagrantfile, the box can be booted with the following command. $ vagrant up

Since Vagrant doesn't run a UI, the connection to the virtual machine instance is made using SSH protocol. $ vagrant ssh

Developer
Vagrant allows developers to isolate dependencies and their configuration within a single disposable, consistent environment. The vagrantfile consists list of tools that should be installed into the boxes. With the help of the command  everything gets installed and configured for others to work in development environments of same configuration. Vagrant also works on different platforms like Linux, Mac OS X and Windows.

Operations Engineer
Vagrant provides an operations engineer a disposable environment and consistent workflow for developing and testing infrastructure management scripts. It facilitates testing of shell scripts, Chef cookbooks, Puppet modules and more using local virtualization such as VirtualBox or VMWare. Moreover, with the same configuration, testing of scripts on remote clouds such as AWS or RackSpace with the same workflow can also be done.

Useful Commands
Following is the list of popular Vagrant commands