9 ms·
Vagrant: Create and configure portable development environments
- neurostimulant 13y agoVagrant 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).
- beagle3 13y agoYes, this is a known problem with precise. The discussion on https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/669481 https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/669481 indicates that a fix has been released, although one wasn't - a 12.04 default server install will STILL happily hang after a boot problem until you press "enter" on your keyboard. Additional reboots will not help. And given that 12.04 is still the LTS version, it makes Ubuntu unusable for long term remote servers unless you have an IPKVM. Of course, after 12.04.03 you can update your /etc/default/grub to include: GRUB_RECORDFAIL_TIMEOUT=0 and then do grub-update (and some people say you should also do: DEBIAN_FRONTEND=noninteractive dpkg-reconfigure grub-pc Although I can't figure out why that would be needed)
- jcastro 13y agoWhich 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 13y agoThanks for the info. I was using the default precise64 box from fresh vagrant init. I'll try that box see if the problem persist.
- jman1 13y agoIts 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.
- mjhea0 13y agoI've used both. Honestly, I don't have any hard stats to back this up but in a Unix environment, VirtualBox is the way to go. I've done a bit of dev on a Windows machine, for training purposes, and I've found that VMware has better performance. Again, this is based solely on subjective, empirical data. And yes, Vagrant is awesome.
- lstamour 13y agoOn 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 13y agoVagrant 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 13y agoVagrant 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 13y agoThe 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 13y agoHuh, 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?
- zeroDivisible 13y agoI 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.
- mitchellh 13y agoVagrant 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.)
- why-el 13y agoThat's interesting. Have you ever considered Leanpub before you went with Oreilly?
- mitchellh 13y agoI was approached by O'Reilly very early. I wasn't even considering writing a book prior to that. However, my experience with O'Reilly has been _fantastic_. I was never writing the book for money, I was writing it for publicity and to help push the project forward. For these reasons, O'Reilly was the clear winner. Additionally, everyone I've ever worked with at O'Reilly has been very professional, and they've been doing a great job helping push the book forward. They even rushed the production process (editing, indexing, proofreading, printing, etc.) from their typical timelines down to only a couple weeks so the book would be fully ready for VelocityConf in a couple weeks. And they did it! I'll be at VelocityConf signing books. :)
- emehrkay 13y agoI 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?
- pixelmonkey 13y agoWe 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.
- pearkes 13y agoHere's how: $ VAGRANT_LOG=[debug, info, warn, or error] vagrant up https://github.com/mitchellh/vagrant/blob/master/lib/vagrant.rb#L31 https://github.com/mitchellh/vagrant/blob/master/lib/vagrant...
- nu2ycombinator 13y agoWhat is chef mate?
- mapleoin 13y agoVagrant 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 13y agoActually, 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.
- AckermanMD 13y agoAnd just to prove how cool @mitchellh is (or at least to prove the fact that he takes HN comments seriously), he has added another committer to Vagrant today. https://twitter.com/mitchellh/status/344231860009828352 https://twitter.com/mitchellh/status/344231860009828352
- Zuph 13y agoIt 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 13y agoI'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.
- cabacon 13y agoI 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.
- WestCoastJustin 13y agoVagrant 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-with-veewee http://sysadmincasts.com/episodes/5-create-a-vagrant-box-wit...
- daemon13 13y agoThanks 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 13y agoOuch, 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 13y agoI am using FF 20.0 on Ubuntu 10.04.
- ChikkaChiChi 13y agoIf 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 13y agoWhy 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.
- jonbaer 13y agoA 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.
- joelhaasnoot 13y agoI 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.
- jherdman 13y agoHas 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.
- joelhaasnoot 13y agoHad the same issue. Puppet is a little better suited, but also a pain.
- fredyr 13y agoI'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!
- ExpiredLink 13y agoI 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#.
- tunesmith 13y agoI'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.
- jwmoz 13y agoWe 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.
- AlexanderDhoore 13y agoIt 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?)
- jemeshsu 13y agoVagrant vs Docker, what are some points to note when evaluating which to use?
- ujeezy 13y agoIt 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.
- tlrobinson 13y agoVagrant is great. IMHO every open source project should come with an example Vagrantfile or Dockerfile to help get users/developers up and running quickly.
- ifeya 13y agoVery nice tool to generate vagrant configs http://rove.io/ http://rove.io/