Jump to content

User:Rutvij Mehta/sandbox

From Wikipedia, the free encyclopedia

Overview

[edit]

Vagrant is an Open-source software product for building and maintaining portable virtual development environments.The core idea behind its creation lies in the fact that the environment maintenance becomes increasingly difficult in a large project with multiple technical stacks. Vagrant manages all the necessary configurations for the developers in order to avoid the unnecessary maintenance, setup time and increase development productivity.Vagrant is written in Ruby language but its ecosystem supports development in almost all major languages.

History

[edit]

Vagrant was first started as a personal side-project by Mitchell Hashimoto in January 2010. The first version of Vagrant was released in March 2010. In the October month of the same year, Engine Yard declared that they were going to sponsor the Vagrant project. It started getting lot of attention since then and many people started talking about it. The first stable version, Vagrant 1.0 was released in March 2012, exactly 2 years after the original version was released. There were already many companies who had installed Vagrant 1.0 and had vouched for its stability. In November 2012, Mitchell formed an organization called “HashiCorp” to support the full-time development of Vagrant. Still, Vagrant remained a liberally licensed open-source software which was contributed by a strong community of developers. Now, HashiCorp works on creating commercial additions and provides professional support and training for Vagrant.

Architecture

[edit]

Vagrant uses "Provisioners" and "Providers" as building blocks to manage the development environments. Provisioners are tools that allow users to configure virtual environment in a custom manner. Puppet and Chef are two most widely used provisioners in the Vagrant ecosystem. Providers are the services that Vagrant uses to setup and create virtual environments. Some of the widely used Providers are VirtualBox, Amazon AWS, VMWare and Docker.

Vagrant sits on top of virtualization software as a wrapper and helps the developer interact easily with the providers. It automates the configuration of virtual environments using Chef or Puppet and the user does not have to directly use any other virtualization software. Machine and software requirements are written in a file called "Vagrantfile" to execute necessary steps in order to create a development ready Box. Box is a format and an extension ( .box) for Vagrant environments that is copied to another machine in order to replicate the same environment.

Providers

[edit]

Since Vagrant itself is not a pure virtualization tool by itself, it makes use of providers to do the virtualization. These are the third-party providers supported by Vagrant:

For a comprehensive list of providers you can refer to this page. Currently, VirtualBox, Hyper-V and Docker are directly shipped with Vagrant. For using any other provider, it has to be first installed via Vagrant’s plugin system.

Provisioning

[edit]

Provisioning can be done using modern tools like Puppet or Chef. These tools have started becoming popular ever since DevOps development paradigm has taken momentum.Vagrant ships with default support for automated provisioning. Using this feature, a box will be pre-loaded with the configured software's every time it is booted up using vagrant up. In order to pre-load the software, a shell script can be written and added in the vagrant file so that it runs whenever the vagrant box boots up. Vagrant will run the provisioners only on the first boot-up. Hence vagrant reload --provision needs to be fired in order to instruct vagrant to reload the provisioners. For complex provisioning scripts, it may be more efficient to package a custom Vagrant box with those packages pre-installed instead of building them each time. This topic is not covered by the getting started guide, but can be found in the packaging custom boxes documentation.[1]

Installation

[edit]

The installation procedure of Vagrant is very straight-forward and simple. Vagrant downloads page has the links to download Vagrant for various operating system's like MAC OS X, Windows, Debian, Centos. You can also download the older versions of Vagrant from the archives.Vagrant 1.1+ provides full backwards compatibility for valid Vagrant 1.0.x Vagrantfiles which do not use plugins.Backwards compatibility between 1.x is not promised, and Vagrantfile syntax stability is not promised until 2.0 final. Vagrant 2.0 final will have a stable Vagrantfile format that will remain backwards compatible, just as 1.0 is considered stable[2].

Usage

[edit]

Vagrant has a very strong development ecosystem. The usage of vagrant has been made so simple and user-friendly thinking about the everyday difficulties faced by developers and testers during software development. Following are the major components of Vagrant and their usage:

Setting up your box

[edit]

After installing Vagrant, “vagrant” will be automatically added in the system “path”. In order to set up your box, just run these following lines on the command-line:

$   vagrant init hashicorp/precise64
$   vagrant up

hashiCorp/precise64 is a pre-created box running Ubuntu 12.04 LTS 64-bit. There are many pre-created boxes which can be used directly instead of creating a new box from scratch.

Configuration

[edit]

The configuration of a vagrant box can be managed via the VagrantFile. This file is written in Ruby syntax and hence the scope of customizing the box is as large as the scope of Ruby. Following are the things which can be done:

  • Configure shared folders
  • Change permissions of files
  • Port-forwarding to access the instance from a local server
  • Change the host-name of the machine
  • Setup network configuration to access the guest virtual machine from a computer on the same network
[edit]

References

[edit]
  1. ^ "Provisioning - Getting Started - Vagrant by HashiCorp". www.vagrantup.com. Retrieved 2016-09-14.
  2. ^ "Backwards Compatibility - Vagrant by HashiCorp". www.vagrantup.com. Retrieved 2016-09-14.