quarta-feira, 13 de julho de 2016

The best feature of Vagrant - Multi-Machine

Vagrant allows to be created a development environment that can be distributed. If you have a team that uses different operating systems, it is possible to assemble a virtual environment standard for all.

Vagrant can run with VirtualBox, VmWare.
It is virtually automate the creation of a virtual machine to the virtual box.

It can be considered a management tool for virtual machines
It is focused to creating environments that are similar or identical as possible to production servers.


Boxes that were possible use: Windows, Ubuntu, Debian, and CentOS

Providers: VirtualBox, VmWare, Amazon web services.


Provisioners:

Tools industry standard provisioning, such as shell scripts, Chef or Puppet, can be used to install and configure the software on the machine automatically.





Here are some reasons I've seen for using Vagrant over just VirtualBox.

1. Set Up Multi-VM Networks with Ease

Most of the Vagrant power-user content I've read has been about setting up multiple VMs at the same time. Vagrant gives you a single config file to set these up, enabling you to launch all of them with one command.

Say you've configured three VMs to network with each other using static IPs on the 192.168.1.* subnet. You find yourself in a location that is already using that subnet to hand out IP addresses, and your VMs now conflict. With Vagrant, you can simply edit the Vagrantfile and reload the VMs, whereas with VirtualBox you'd have to open the settings for each VM, if not boot each VM and change them inside.

2. Source Control

By putting the settings in a text file, it enables the configuration to be put under source control. Made some changes last week and accidentally broke the image? Just revert the changes and reload the VM. You can accomplish this with VirtualBox snapshots, but it will take up much more space than just a Vagrantfile.

3. Various Platforms
There are a large number of boxes available at sites such as http://vagrantbox.es. This enables you to try various OS or distributions, applying the same provisioning to set up similar environments. This can help with testing or adding support to new platforms, and would be time-consuming using just VirtualBox.

Why:

Vagrant allows you to create portable work environments, which can be easily reproduced on any system. It's useful for developers and system administrators who want to mimic a server's configuration on their local machine. It's useful for teams who want to quickly get designers and project managers up and running with a local installation.

Vagrant is a wrapper, which ties together several components including: virtualization software, such as VirtualBox; a server base box, such as Ubuntu provisioning tools for configuration management, such as Chef.

 SETUP

The first step in configuring any Vagrant project is to create a Vagrantfile. The purpose of the Vagrantfile is two folds: 
  •  Mark the root directory of your project. A lot of the configuration of Vagrant is relative to this root directory.
  •  Describe the kind of machine and resources you need to run your project, as well as what software to install and how you want to access it.


The Vagrantfile is meant to be committed to version control with your project, if you use version control. This way, every person working with that project can benefit from Vagrant without any upfront work.

VagrantFile Sample:


Puppet Sample:


Multi-Machine:

Vagrant is able define and control multiple guest machine per VagrantFile.
These machines are generally able to work together or are somehow associate with each other.
Accurately modeling a multi-server production topology, such as separating a web and database server.
Modeling a distributed system and how they interact with each other.
Testing an interface, such as an API to service component.

VagrantFile to multi-machine sample:

 
To access machines: 

1. vagrant up
2. vagrant ssh n1
3. vagrant ssh n2






References:



Nenhum comentário:

Postar um comentário

Observação: somente um membro deste blog pode postar um comentário.