Monday, September 2, 2013

Getting rid of "it doesn't work on my machine" issues

A very common, yet frustrating situation when developing software in a team is having to debug errors that only happen on a specific machine for a specific developer. These errors are usually caused by differences in libraries or configuration files, and are a real pain to debug.

To make this problem go away, you could force everyone in your team to use the same OS and make sure everyone configures their machine exactly the same, but this is not always feasible, especially if you're developing an open source project that people all over the world might contribute to.

That is why I've decided to include a Vagrantfile and a puppet folder on all my projects.

About Puppet


Puppet is an automation software that helps system administrators manage their infrastructure. You can read a lot more about it on their website, but the main takeaway is this:

If you take any number of blank computers (having nothing but a default OS installation) and run some Puppet scripts on them, all of them will end up having the exact same configuration.

With Puppet, you can automate pretty much anything you could do manually: install apps or libraries, set up databases, create user accounts, modify configuration files, etc.

About Vagrant


Vagrant is a software used for creating and configuring virtual environments. You can think of it as a wrapper for Virtualbox or VMware. Instead of manually creating a virtual machine and setting up the OS to use, ports to forward, files to share, etc, you just write a Vagrantfile and let Vagrant do it for you.

Vagrant + Puppet


When we use these tools together, we have the perfect setup:
  • Thanks to Vagrant we can make sure everyone is using the same OS
  • Thanks to Puppet we can make sure everyone has the exact same configuration on their machine
And by taking advantage of Vagrant's shared folders and port forwarding, developers can still use their favorite text editor, IDE, and browser to do coding and debugging, but you won't have to deal with those "it doesn't work on my machine" issues anymore.

** On this post I provide a specific example: setting up a dev environment for a Node.js/MySQL application
Post a Comment