Reco: Vagrant

You may remember the post that I had before on using VirtualBox as a testing environment. Well, I recently learned about a program that just blows that out of the water.

Vagrant makes creating, destroying, using, customizing, ssh-ing into, etc., of virtual machines so ridiculously easy that I’m now using a VM for every project (which is actually the intended purpose of the program). These aren’t just for testing code periodically, but for every step in the development process. I never run the code on the host computer– It’s always in a VM.

That means that I understand all dependencies that are being used. I don’t need to worry that code that works on my machine won’t work on a DO droplet because of an unknown dependency that I installed on my box two years ago. I also don’t need to worry about filling my box with weird and even conflicting software, because the environments are encapsulated in virtual machines. (Case in point– I’m currently teaching myself C#/ASP.Net, etc., and I haven’t bothered to install Mono on my laptop because I’ve installed it in a Vagrant VM instead.)

Vagrant is essentially a program that extends VirtualBox functionality (though it also works with VMware Workstation and Parallels). Everything that I do with Vagrant is possible using VirtualBox on its own, but Vagrant makes it much faster and easier. In Threadstr, I create and destroy VMs on a whim to make sure that every little change that I’ve made to will work correctly. I rarely even run the node command on the host machine anymore.

Like calculus, Vagrant is hard to learn but easy to use once you’ve learned it. I think it’s well worth the effort, and I’d highly suggest it to any dev that’s working in a compatible project. This means projects that don’t depend on Visual Studio, XCode, or anything else that’s incompatible with Linux, FreeBSD, and other FOSS operating systems. (Piracy laws won’t allow non-free operating systems like Windows, MacOS, etc. to be distributed the way that Vagrant VMs are.)

(If you’re interested in my Vagrant notes, you can find them here, or the original plaintext file here.)