
Vagrant: Create and configure portable development environments - neurostimulant
http://www.vagrantup.com/
======
mitchellh
Vagrant creator here. What a pleasant surprise to see this pop up on HN this
morning (it was unexpected, to be sure). I just want to shamelessly say that
if you're more of a book person, the Vagrant O'Reilly book I wrote was just
released this week, and it is a great way to get started:

[http://shop.oreilly.com/product/0636920026358.do](http://shop.oreilly.com/product/0636920026358.do)

Thanks!

(And, hopefully as you know, as an author I make barely any royalties on any
book sold, so I'm not posting this for financial reasons. I just know some
people really prefer books to online docs.)

~~~
bradgessler
I'm curious, why the focus on development environments? How does it tie into
production and staging environments?

~~~
mitchellh
I'm working on this now. I won't say much more than that until I have
something to really show for it.

Development environments are the primary focus on Vagrant because that was the
pain point it was initially meant to solve, and it does this quite well. The
workflow model Vagrant introduces doesn't translate as well into
staging/production yet. I'm actively investigating the use cases here and how
Vagrant may adapt to it (if at all).

~~~
bradgessler
Cheers for staying focused and honest about the scope of the problem that
vagrant solves!

------
pixelmonkey
We switched from hand-configured boxes and a long, "full stack local" setup
document to chef + vagrant at my current company
([http://parse.ly](http://parse.ly)).

Though it caused some kicking & screaming on the development team, the end
result is that every developer has the same development environment, which
pretty much matches our deployment environment (in Rackspace Cloud). I also
just kicked off our summer intern class, and the interns were able to get
productive with our codebase in 1 day despite not having much experience with
modern Python web development, because pretty much every local setup step was
automated.

I consider the tool invaluable. I don't even install _any_ databases or tools
directly on my laptop any longer. With its handy port forwarding feature, you
can put all your DBs on a VM, yet still connect w/ CLI clients via your host
machine. Then when you do "vagrant halt", all your DBs shut down at once and
you free all those resources / memory / etc.

Also, one suggestion -- look into the debug logging level that you can set
with an environmental variable. The only thing I found frustrating about
Vagrant were situations where it would hang/fail but it wouldn't be clear why.
It turns out their debug logging is quite good.

~~~
spoondan
How are you reloading your Python application on code changes? Are you just
working inside the VM? I've tried VirtualBox shared folders and NFS, and never
had any luck getting file change events to propagate from my host to the VM.

~~~
pixelmonkey
Shared folders work well for me & everyone else on me team. Perhaps you should
file a ticket for your issue?

Also, if you use port forwarding for all your databases etc. then you could
technically just run Python code on your host computer. Indeed, I do this
myself usually -- I treat the Vagrant box more like a "deployment target" that
just happens to also run the DBs I can use for local testing.

------
mapleoin
Vagrant is a nice tool, but I don't like the closed-open source part of it.
There are 289 open issues and 79 open pull requests on github right now. It
feels like there is a huge community out there who want to move this project
forward, but there is the bottleneck of having only one committer who wants to
have too much control over it. It's fine and the author can do what he wants,
but I'm wondering what the project could achieve if it was more open to
contributions and more people could actively work on it.

As a user, looking at those 289 open issues with only one developer, I don't
feel at all encouraged to open a new one or send a pull request, because I
just see a huge pile of things that the committer will have to wade through
before getting to mine.

~~~
mitchellh
Actually, the number of issues/pull requests is higher than usual right now.
You're right that at the moment I'm a bottleneck. I'm looking to change that
(I want to add more committers).

However, historically I think I've been very good about responding to issues
rather quickly. Unfortunately, the past 6 weeks I've been quite bad at it as
I've been focussing on something you'll hopefully see in a few weeks. Again,
this highlights the problem of being a bottleneck.

I'd love to promote more committers.

------
jman1
Its a great little tool. I have been using it for a over a year now and it
simplifies the dev environment issues by sandboxing it. In general, it allows
you to isolate your development servers and other such programs and libraries
in a sandbox. You can use the editors, browsers etc on your local machine
however the servers and other heavy lifting can be done by the vm in the
sandbox env. I think this is still bleeding edge stuff as I dont see very many
developers using this. Would love to hear experiences of fellow hackers.

One question - I use vagrant with VirtualBox as the provider. Has any body
used vagrant with the VMware provider. Wondering if one sees better
performance on vmware than virtualbox. Specially when you are running
everything (host and guest) on the same hdd.

~~~
lstamour
On my Mac, using VMware was rougly 4 times faster than VirtualBox,
particularly when running very long puppet scripts and using memory. I was
very happy to pay for the VMware Fusion support and to buy VMware Fusion in
the first place (it is 10x better than Parallels for the VM client drivers
alone). The tricky bits for me were, at least a few months ago, some of the
commands were different and of course the base OS VMs should be different
given different client drivers. But it is possible to have one Vagrantfile
serve both VirtualBox and VMware Fusion, so devs can choose which environment
works best for them.

------
mark_l_watson
Vagrant looks interesting but I am not sure why I would use it. Almost all of
my work involves using Clojure and I default to using Postgres except in
exceptional circumstances. It is so easy to have the same setup on my OS X and
Linux laptops as my servers. I have never run into any compatibility problems,
at least that I am aware of.

Vagrant looks more useful for systems with lots of moving parts.

I am starting a new project with Node.js, Meteor and MongoDB - also an easy to
set up stack. I will keep Vagrant in mind, but I hope I don't need it.

~~~
phamilton
Vagrant is nice because your environment becomes disposable and version
controlled.

If you mess up your db config while performance tuning, for example, just call
vagrant destroy and vagrant up.

~~~
a3n
The version control aspect is really great.

It's really nice to be able branch, commit, merge, go back, whatever with your
installed infrastructure. This gets even better if you use puppet or chef (or
even the shell) for provisioning of infrastructure in concert with vagrant.

Doing the same thing with snapshots and VM clones with VirtualBox alone is
similar to zipping your project periodically as a backup strategy. Yeah,, it
works, but it has no granularity.

Bottom line though, it feels very liberating at any point to be able to flip
the fuckit bit, do a vagrant destroy and vagrant up and just start over. It
makes for painless experimentation on your VM, among other things. Once you've
got what you want, you can formalize it in your Vagrantfile, puppet manifests
or other versioned artifacts of development.

Is good.

~~~
ibrahima
Huh, so can you "branch" a VM with vagrant? Like say I want to make some
incompatible/lossy changes to my database schema, can I fork my dev
environment, do my migrations to the new schema, and then go back if I don't
like it?

~~~
jacques_chester
Vagrant works by describing a machine or group of machines. It hands off to
Chef or Puppet, which then do the job of bringing the naked machine up to
something nearly identical to your production environment.

You can snapshot to binary blob too, but having code that rebuilds from
scratch is a great way to smoke out certain classes of dependency conflicts.
It also provides assurance that if a hurricane turns some data centre into
lego bricks, you can rebuild an identical setup somewhere else with a single
command.

------
WestCoastJustin
Vagrant is awesome! I use it to test ops changes and puppet deployments. If
anyone is interested, I've created two screencasts about vagrant:

    
    
      Episode #4 - Vagrant [1]
      Episode #5 - Create a Vagrant box with Veewee [2]
    

[1]
[http://sysadmincasts.com/episodes/4-vagrant](http://sysadmincasts.com/episodes/4-vagrant)

[2] [http://sysadmincasts.com/episodes/5-create-a-vagrant-box-
wit...](http://sysadmincasts.com/episodes/5-create-a-vagrant-box-with-veewee)

~~~
daemon13
Thanks for screencasts - your episode 5 is missing audio making it harder to
grock the context, just heads up in case this is unintended so you can fix

~~~
WestCoastJustin
Ouch, this is the first report I have had! What OS/browser are you using?

You can download the raw content via these two files, so you can watch locally
on your computer (both the same, just different formats):

    
    
      http://sysadmincasts.com/static/videos/5-create-a-vagrant-box-with-veewee.mp4
      http://sysadmincasts.com/static/videos/5-create-a-vagrant-box-with-veewee.webm
    

I am using a javascript player, which should send you the correct file, based
on your browsers support for webm and/or mp4/flash. I have verified that both
versions contain audio. So, I suspect there is some browser issue at play
here. Anyone else reading this, and who has watched episode #5, want to
comment on if it has audio?

Thanks, Justin

~~~
daemon13
I am using FF 20.0 on Ubuntu 10.04.

------
neurostimulant
Vagrant is absolutely fantastic. But I have an issue with the default
precise64 box.

If the vm is shut down abnormally (manual power off from virtualbox,
unexpected power outage, etc), next time I run `vagrant up`, the vm would be
stuck on grub. It appear to be a problem with ubuntu and I need to start the
vm in gui mode (as opposed to vagrant's default headless mode) to resolve this
(changed timeout=-1 to timeout=0 in /etc/grub.d/00_header and run update-
grub).

~~~
jcastro
Which exact precise64 box are you using? Ubuntu now publishes regularly
updated Vagrant images, do you have this problem with this box?

\- [http://cloud-images.ubuntu.com/vagrant/precise/current/](http://cloud-
images.ubuntu.com/vagrant/precise/current/)

~~~
neurostimulant
Thanks for the info. I was using the default precise64 box from fresh vagrant
init. I'll try that box see if the problem persist.

------
zeroDivisible
I was first introduced to Vagrant at my current company - where my manager had
prepared a VM + set of Chef recipes for setting up and managing VM hosting our
app.

I had spent few days later setting up few VM's for my personal projects - I
must say that having easily deployable VM's, each one serving specific
purposes, all on my laptop, using just one base box (CentOS in my case) is a
really a time saver - especially when dealing with projects utilising multiple
technologies. But what is most important is the fact, that all those
technologies are not polluting the main machine and creating misc combinations
of them is as easy as branching / cloning my Chef + Librarian + Knife repo.

------
tunesmith
I've used one VM for deploying my several small projects in the past. I'm
definitely curious about separate sandboxes for them when developing locally -
one chef-solo and vagrant instance for each - but it seems like it would be a
lot more expensive to deploy them to separate boxes afterward. Is there an
easy way to "merge" them back into one box when deploying?

... I guess that doesn't make sense. I should have the local vagrant/chef-solo
mirror how I have my production server; all projects combined. But at least
the chef recipes will make it easier to split things apart once I want to
separate projects to different servers for traffic reasons.

------
cabacon
I learned about vagrant from this old HN post:
[https://news.ycombinator.com/item?id=2714149](https://news.ycombinator.com/item?id=2714149)

I wanted to call out the advice from that article to use fabric (if you use
python) to control the vagrant+VM instances. You use chef/puppet to configure
the VM, and then use fabric to, for instance, switch between virtualenvs for
different apps within the virtual host. I used it that summer to work on a web
app while I took my daughter to swim lessons, and it was well worth my while.

------
AlexanderDhoore
It seems the future for this kind of projects is very bright. When I have time
I'll look into vagrant and docker. I also need to learn either puppet or
chef... I've got a busy summer schedule!

(Any other related, interesting technologies I should add to that list?)

------
tlrobinson
Vagrant is great. IMHO every open source project should come with an example
Vagrantfile or Dockerfile to help get users/developers up and running quickly.

------
jonbaer
A noob(ish) question but does anyone here use Vagrant by itself (or w/ chef-
solo). For example can you do multi-VM setups directly to the AWS provider
_and_ local VirtualBox all on the same single Vagrantfile config? And thanks
for the tip on veewee as it looks exactly what I was looking for to build a
company basebox for faster testing. Much appreciated.

------
ifeya
Very nice tool to generate vagrant configs [http://rove.io/](http://rove.io/)

------
Zuph
It looks like Vagrant is designed to help out web developers more than
anything else.

I develop primarily for microcontrollers, and it can be a pain to manage
toolchains for different architectures. Would Vagrant help with that? Does
anyone have an examples of using Vagrant like this?

~~~
indirectlylit
I've been using it for microcontroller development lately and it seems like a
nice way to preserve and share toolchain configuration. You define everything
once (compilers, makefiles, drivers, etc) and then share it with people on
your team, regardless of what OS they're using. VirtualBox allows you to set
up USB port forwarding so you can even program and debug from the command-
line.

------
jherdman
Has anyone had much luck using Chef solo to provision their Vagrant box AND
their production/staging environments? I'm currently attempting this, and it
has been kind of a pain in the ass. Chef-solo seems woefully underpowered.

~~~
fredyr
I've switched to using Ansible for this very reason (after getting frustated
with Puppet) - I like it a lot. Also I just want to join the choir: Vagrant is
awesome!

------
emehrkay
I haven't done much research, but is there a way to share a running instance
with others? Can I configure/setup/tinker-with an instance, suspend it and
share that with someone?

~~~
mitchellh
Yes, you can run `vagrant package` and it'll turn it into a single file format
that can be sent to other people to reuse.

~~~
emehrkay
Nice! Thank you!

------
joelhaasnoot
I use Vagrant for every project now. I used to work with a single VM with all
of my projects, but dependencies were hard. Vagrant makes everything nicely
sandboxed.

One thing I found difficult is that Chef or Puppet are hard to combine with
Vagrant, not having used either before. The quality of instructions and
recipes for simple stacks (PHP, Django, etc) even for Ubuntu require tweaks
here and there. I've now however found recipes I've tweaked for both examples
that work well.

------
ExpiredLink
I have never heard of Vagrant. The home page is, as usual, devoid of
information. This is what Wikipedia says:

> _Vagrant (software)_

> _From Wikipedia, the free encyclopedia_

> _Vagrant is open-source software for creating and configuring virtual
> development environments. It can be considered a wrapper around VirtualBox
> and configuration management software such as Chef, Salt and Puppet.
> Although written in Ruby, it is usable in other programming projects such as
> PHP, Python, Java, and C#._

------
ChikkaChiChi
If you love vagrant, be sure to give the plugin 'Sahara' a try. It allows you
to sandbox vagrant. so you can commit or rollback changes!

[https://github.com/jedi4ever/sahara](https://github.com/jedi4ever/sahara)

~~~
akurtzhs
Why not [https://github.com/dergachev/vagrant-vbox-
snapshot](https://github.com/dergachev/vagrant-vbox-snapshot) ?It provides
full snapshot abilities, so you can have multiple states.

------
jwmoz
We use Vagrant at Virgin Media in London. Great tool.

Ps. please fix the issue where on disconnect, you can't vagrant ssh back, the
only fix I've found is to restart the vm using virtualbox.

------
jemeshsu
Vagrant vs Docker, what are some points to note when evaluating which to use?

~~~
ujeezy
It depends on what you want to do. Vagrant's main use case is to automate
setting up development environments, whereas I see Docker as more a way of
distributing software and its dependencies to production systems.

A key distinction is that since Docker is built on Linux containers
(lightweight Linux systems), it expects to share its host's kernel, and must
thus be executed on a Linux system.

