Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I've been studying http://www.vagrantup.com/ for several days and I'd like a feedback by people using it in a professional context or for personal projects. I think I get what positive things can bring Vagrant but I have questions about its drawbacks:

  • I'm a php developer and I work in a small company. I'm wondering if Vagrant could be useful for me and newcomers in my company since it's forcing a total development environment. I mean, people often prefers to work on their OS (Linux/Mac/Windows). How do you deal with that, do you force everyone to use Linux for example?
  • Doesn't it add complexity since you are entirely working on a Virtual Machine?
  • Don't you fear your VM main file get corrupted one day and you wouldn't be able to use it again? I feel nervous about using VM because of that.

Thank you.

share|improve this question
1  
Half the point of vagrant is to get away from the golden vm image many shops are using these days. –  Wyatt Barnett Apr 10 '13 at 9:00
add comment

1 Answer

up vote 10 down vote accepted

The main advantage of working with a virtual machine is that you can quickly get a development environment up and running. A modern, complex application probably uses a number of external dependencies, like various database servers, message queue daemons and whatnot. Installing these on every developer's machine individually for a local development environment can be quite a hassle. Using a virtual machine image, you can distribute a pre-configured environment easily.

This does not mean that you set this image up once and cross your fingers that it'll never corrupt. It also doesn't mean that developers are writing their code inside the virtual machine. To create the virtual machine, you should create scripts which can set up a base OS to the desired state. Look at Ansible, Chef, Puppet, simple shell scripts and similar tools for that. These scripts can be used to set up a virtual machine, your production system, test systems etc all from the same source. Creating and distributing a complete image of a virtual machine is just a time saver, since such scripts could take a while to run. It also allows you to easily reset your environment to a known good state if you have messed things up. The VM image is not your one and only source though; if it corrupts it doesn't matter, since it doesn't hold any data or code and since you can simply recreate it.

Secondly, vagrant maps paths inside the virtual machine to paths on the host machine. Your developers can simply write their code as usual on their regular machine and just execute it inside the VM. Since the paths are shared this can happen immediately without needing to copy any files back and forth.

So:

  1. Maybe vagrant can be useful to you, if your app requires a complex setup.
  2. Not really, since nothing much changes.
  3. See above.
share|improve this answer
2  
Great answer. I didn't understand the fact that you are not actually coding inside Vagrant VM So I better understand the purpose of Vagrant now, Thank you. :) –  phemios Apr 10 '13 at 8:45
    
If you do use the shared folders option, it's perhaps not a great idea to share your source directly, since files modified in the VM will also be changed in the host. (e.g. a bug executed in the VM could possibly delete source files on the host). –  Brendon Apr 14 '13 at 16:23
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.