Notes about devops and web.

Vagrant

• ruby, and vagrant

Vagrant

It seems like I am slowpoke that I write about vagrant at 2015 year, but I want to summarize my experience after two years of using this beautiful instrument.

History

Imagine, that you are in 2009 year. What kind of instrument would you use for collaborative work at same project?

Git, some IDE and browser, yep? It almost normal when you write some README in the repository where some instructions provided about the way to configure the environment. I remember my first collaborative projects. We have README with instruction and often forgot to update it (oh, crap). And, of course, often have problems because of this. Then, we switched to bootstrap.sh, that all of us run in our native OS (Linux) and install a lot of software, configs. The process became better but still was uncomfortable to work with different version of one software. Next step was VirtualBox, and we finally have exhaled with relief. After some time, I have discovered Vagrant. This instrument have changed the world of software. Look at most popular repositories at GitHub and you are probably would find the Vagrant file at the project root. Moreover, if your project does not have this file, it will not become popular. That’s all! As easy your project to start, as the fast growth of popularity it’ll become.

What is Vagrant?

Vagrant - abstract system layer on top of virtualization and containerization software, it also includes cloud-providers.

Providers

According to the official site, Vagrant supports VirtualBox, Hyper-V, VMware, Docker and have API to write your adapter for the custom provider. Due to this, there are a lot of provider adapters for cloud providers: AWS, Google, Rackspace, etc.

Boxes

The Vagrant basic unit is a box. Everything begins from there. Each box should have at least one provider. Vagrant has many types of different boxes: clear OS, box with provisioner, full stack box and much more. Of course, you can easily create your box, and, if you want, it is possible to make it public accessed through atlas.hashicorp.com.

Provisioners

Provisioning - some steps that should be taken to setup box: install software, edit configs and do other stuff for you. So, provisioners - tools that do provisioning. Vagrant support a lot of provisioners by default and using plugins.

Working with Vagrant

You can have very quick start (don’t forget to install Vagrant and VirtualBox). Just type in the terminal:

$ mkdir -p ~/vagranttest
$ cd ~/vagranttest
$ vagrant init ubuntu/trusty64
$ vagrant up

That is all. In few minutes, you will have a full-featured virtual machine with the latest version of Ubuntu. Then just type:

$ vagrant ssh

and you will pass into a virtual machine. If you want more options that provides default box, you can go puphpet.com or phansible.com and choose flexible installation.

comments powered by Disqus