A Better Development Workflow with Vagrant
taylorlapeyre.me
taylorlapeyre.me
Or does the Vagrantfile specify the environment and when you vagrant init develop it recreates it?
I've never used Vagrant but am interested in starting to do something like this.
There's only one box, and you add it to vagrant with "vagrant box add develop path/to/develop.box". After that, you can delete the develop.box file from your computer: it now exists somewhere in the nethers of vagrant's configuration.
I guess the main thing I can't get is say I have custom nginx settings or MySQL settings I need in a project. Do I setup those through Chef?
Thanks for the article, lots to look into.
If it's something specific for a project (i.e., a jekyll website), I just write a quick shell script to install jekyll in the Vagrantfile for that project instead of repackaging the whole box.
As for your second question, yes, you would have a specific Vagrantfile/box for a project where you need a specific enviroment. My "develop" box is a general case.
Here's a (slightly modified) example of a Vagrantfile that I use with a project: https://gist.github.com/taylorlapeyre/5399974
It's common to use something like Chef or Puppet to provision the software that you actually need for each project rather than just put everything in the base box, but the author chose to just make an all-inclusive box instead.
From there, the path of evolution for each box will take place individually. If you have a Vagrantfile that specify for one project to use Ruby2.0beta and another Vagrantfile for another project to use Ruby1.9, you essentially have two boxes, two execution environments, but you still code on the same machine.
For example, just yesterday, a colleague wanted access to Fork the Cookbook's source (he was supposed to be helping out on frontend javascript). But because some bits of the code is written to be Linux specific, he needed a Linux box while working on a non-Linux box.
So I spent 30 mins creating a Vagrantfile, specifying the environment which Fork the Cookbook runs in. He takes it, runs the env, provisions with the existing provisioning script, and tadah, you get an environment where you get to run the code in.
Due to the synced directories, you can code in whatever env you are hosting on: it's like dropbox between your computer and the virtual box. Network pass throughs allow your host (i.e your physical machine) to use networks defined virtually in your virtual computer.
Great for sharing execution env and getting other people started. Not really necessary if you're working alone IMO
Sorry if i have missed this but how do you execute/debug in the IDE through Vagrant? e.g. how would rubymine use vagrant's ruby binary?
EDIT: A quick Google yielded this: http://www.jetbrains.com/ruby/webhelp/configuring-remote-int...
If the files reside on the ext3 partition on the Debian VM, the permissions are fine and even editing the files from Windows, on a Windows IDE does not change the permissions.
When you use etx3, how are you sharing the files? Like a samba share? or does the virtualbox drive mount work in the other direction, somehow?
FWIW, I do all of my virtualization on ESX, but every time one of these vagrant article comes up I'm tempted to try something local (win 8), to take advantage of the shared filesystem that most of vagrant's magic relies on (as I understand).
I'll be re-doing it to use apt-get for everything, but for now PHP is compiled.
I use samba to share files from the VM to my network, and Windows mounts the share as a local drive.
Usually I just use `vagrant suspend`. Seconds vs minutes. Time > organization IMHO.
Basically, by integrating this into your CI tool, you ensure that all your tests / deploys run through a standardized and pristine environment.
NOTE: I'm biased, I created Vagrant + VMware. But go ahead and ask VMware users.
thanks for your Vagrant + VMware work, that was the biggest thing keeping me from vagrant
- Its goal is to install a whole bunch of binaries and development utilities onto my local machine. I want to keep those segregated.
- It only works with Macs. My only computer at the moment is a mac, but it's not always what I use. I use computers at work that are linux based.
- I found that it was buggy. I wasn't very easy to get it actually working. It required a lot of effort and installation.
So, Boxen isn't for me.