Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is it better to use Vagrant instead of sharing the VM's Disk itself?

I was searching for the best way to distribute a development environment to my team and found Vagrant. After some reading and testing, here is what I can say about it

Pro: Automates the process of creating a new VirtualBox VM (for a new user).

Con: Nullifies the only pro I found by requiring the new user to learn a new tool.

The learning curve is way more time expensive than actually copying the VDI and configuring a new VirtualBox VM tu use it. (It is not that great as well, but is still higher than learning a new tool.)

I definitely didn't understand why using Vagrant makes the process of distributing a development environment so different than just creating a normal VirtualBox VM and sharing the disk.

Maybe I'm missing a point here, can anyone enlight me?

like image 773
Bruno Cardoso Avatar asked May 04 '12 19:05

Bruno Cardoso


4 Answers

I can only speak from my own experience: the learning curve is well worth it.

As a programmer, I love being able to set up separate isolated environments for development, testing, and deployment.

Sure, you can copy the VDI around and whatever, but it's easier-- in my opinion-- to execute a few command line programs and it's all ready to go. It just seems dirty to me to copy around VDIs or other types of images.

Also, I can make packaged up vagrant boxes that I can send to my coworkers or distribute on the Internet.

like image 198
kevin628 Avatar answered Sep 30 '22 15:09

kevin628


I think the major advantage of Vagrant is that it let's you have one base package that can be re-configured for different purposes covering dev, testing, management, operations, etc. simply by changing the manifest/cookbook. It's just more convenient to share and start up.

Less major, but still nice is that it lets you start over effortlessly. I know you can use snapshots in VirtualBox, but sometimes, it becomes annoying to keep going back and forth between them. With Vagrant, you can start a box, test some things, destroy it. Than you can start again, the same box, test something. You can start twice the same VM easily, and test slightly differently in each, destroy them.

Also check out the answer here: https://superuser.com/questions/584100/why-should-i-use-vagrant-instead-of-just-virtualbox EDIT: In my first answer, I was thinking of Packer, not Vagrant, my mistake.

like image 45
Didier A. Avatar answered Sep 30 '22 16:09

Didier A.


There are a lot more advantages to vagrant than just that:

  • 100% reproducible environments, everywhere the same.
  • Can be stored in source control (git/svn/...) and versioned.
  • Saves diskspace. This can be important on laptops, I right now have 92 Vagrantfiles on my system, not all created. Imagine them all being full blown 20gb vm's...
  • Experimentation becomes trivial. A quick vagrant init precise64, vagrant up, try some stuff, vagrant destroy, vagrant up, retry some stuff, vagrant destroy - and done.

It requires some discipline not to install required packages manually or updating the common Vagrantfile when doing so, but once you have a workflow worked out, it's simply brilliant. I find

like image 39
Bart M. Avatar answered Sep 30 '22 14:09

Bart M.


We are discussing the same question in the office... Right now, btw!

When I first got in touch with vagrant, I was sceptic, but the advantages I could see, beyond personal opinion is:

  1. you can start from a common configuration and automatize many "forks", without a snapshot-chaining (what is a big pain when you need to delete one snapshot or two, I might say);
  2. the process of cloning (packing) a machine is way faster than export appliance;
  3. using vagrant to setup a machine still makes you able to use VBox iface, so no problem to make a start point based on Vagrant's features and let the teammates decide if they will use it or not;
  4. as said, automatization.

We are still making some tests... Now talking about particular opinion, to me the main point is replication and the fact that packing and unpacking is faster than exports.

like image 35
Bruno J. Araujo Avatar answered Sep 30 '22 14:09

Bruno J. Araujo