Why You Shouldn't Use Vagrant: Real talk from a Vagrant burn-out

This was originally published on Chad’s personal blog on 21 Feb 2014.

Hey, kid. Someday, some charmer is going to smooth talk you.

Why would you want MySQL and PostgreSQL both running on your machine all the time? they’ll probably ask. Just run them when you need them.

Then they’ll tell you about some slick way their company allowed all of their developers to click buttons on some website, like ordering a Fatty Meal at a McDougle’s: MySQL, Redis, a custom queue server, and our main app, please. Then BOOM. They get a fully configured VM, just like that! With exactly the things they need and none of that other crap. They spin it up, they get their work done. No fuss, no hassle. No having developers waste time configuring their environments.

And most of all, your charmer will woo you with how you’ll never again have developers saying, it works on my machine! That’ll be their biggest selling point. It will also be their biggest lie.

Don’t you believe them. Don’t you believe their dirty lies!

The thing they leave out, the big giant piece of the story that they always, without fail, gloss over, is that setting up Vagrant is hard. You know what a pain it was the first time you set up MAMP without just downloading some dumbed-down app. You know how difficult it can be to configure servers. You know how the Saving Goddess named DevOps is really just another huge learning curve to crawl up, weeping, pleading that all you want to do is make cool shit, not learn all this crap about setting up machines, please don’t make me learn how to secure Unix and why CentOS is a better choice than Ubuntu or oh Goddess how did we end up here please just let me get back to building, you know coding is already hard enough without needing to figure out how to build native extensions or whatever operating system error I’m getting now.

See kid, it’s not just that you’re leaving a system you presumably already know, like OSX, for one that you don’t yet know (and, let’s be honest, one that’s harder to work with (apt and yum suck so bad compared to homebrew)). No, it’s not just that. It’s also that it’s slow. Also, onions.

Slow. That’s right. Even if you figure out how to link your enormous source code directory with NFS instead of whatever default, you’re still running your app inside a resource-starved VM. Oh, your charmer will tell you, just turn up the RAM on that thing! Just turn up the CPUs! But kid, you know what’s always going to have more RAM and CPUs available than any VM that lives out its miserable life trapped inside your host machine? Do you? Your friggin' host machine! The thing itself! It’s a multi-thousand dollar piece of finely-tuned engineering friggin' masterpiece! Use it!

Onions. You’re a smart kid. You don’t need me to tell you that onions, like parfaits, have layers. I thought I was a smart kid, too. But it didn’t occur to me how many complex, poorly understood layers I was adding to my development environment when I started using Vagrant. Working with all the layers of a normal, right-on-your-host-OS dev environment can already be difficult sometimes. Like, when you’re trying to use RSpec with Capybara’s DSL hooked through Selenium which powers Firefox to poke and prod your app in your test environment without you needing to do it manually each time. That stuff’s hard. I know your pain! Then DatabaseCleaner doesn’t work, but you don’t know the problem is with DatabaseCleaner, and you spend half a day searching through your whole complex stack of testing software, trying to figure out why data you clearly created isn’t showing up in the RSpec-Capybara-Selenium-driven automated Firefox browser!

Now imagine taking all of that complexity, and on top of all of it, shoving it inside a VM that doesn’t even have a GUI. And now your charmer will start getting condescending. Just make Firefox headless with xvfb, they’ll say, or maybe they’ll try to tell you to simply network your guest VM and your host OS together, powering full-GUI Firefox on your host OS through ssh on your VM. They’ll throw the word around a lot: simply. Also, just. Just headless xvfb cucumber steak. Just make it all work like I did it wasn’t even hard I don’t understand why you stupid.

The worst part, kid? No matter how good of a job you do with all of this, the rest of your team isn’t even going to want to use it. You know, because slow and onions. They already see that. And they’ve tried to tell you a few times, but they’ll let you go humor yourself. But they don’t want to be subjected to all that. They’ve already got their whole Rails stack, along with Redis and a few other dependencies, nicely controlled with chruby and foreman. And if you’re the only one using all this crap? If you’re the only one? Remember the chief selling point from your charmer? The no more ‘works on my machine’ thing? You didn’t solve that problem. You made it worse.

Which brings me to the last way that Vagrant is like an onion: it makes you cry.


Now, kid, don’t despair too much. I’ve never met one, but I’ve heard that there are people in this world who enjoy DevOps.

You know how you like building software because thousands or millions of people can use it and improve their lives? Well, there are people who have similar but smaller aspirations. They want to make nice Unix systems with Ansible or Docker or whatever’s trendy these days (Chef? God save their souls). They want to make this stuff for, like, five users. Instead of the thousands or millions that you aspire to. But good news for you! You’re one of the five people they want to help!

These people presumably like watching the output from automated server builds. Oh look at that! they squeal, it’s configuring nginx on all four machines at once! Or something. The black hole of time that is DevOps exhilarates them! I don’t really understand these people. But I’ve heard they’re out there.

So if you work for a company that finds one and hires them, maybe you can make them build your dev environments. Maybe, after they’ve configured your production environment to avoid the catastrophe that’s currently just around the corner, maybe you can set them to configuring your Vagrant, too.

But unless you have someone that actually likes working with all this crap, I’m telling you to stay away from it. Don’t do what I did. The charmer was a DevOps nerd, not an app developer. Stay away.