This domain and all content is a copy of my old website, for historical purposes only.

This post is over a year old, its content may be outdated.

Matt Wilcox

Web Development

Notes Dec 01st 2014

Portable Development Environments

Why is it still so hard to set up a portable development environment?

This is an idea I've touched on a number of times in the past, an idea I still think has a lot of merit, and an idea I've still not seen done particularly well.

The general problem is this: You have an established work methodology, software set-up, and flow. When a project comes in, you're able to get your starting point 'framework' up and configured in minutes, complete with version control, and get working on the new project in an environment tailored to you.

What happens if a new team member comes on board? How long is it going to take you to set their machine up just like yours? What if your computer dies? How long is it going to take you to get it back up and running?

For me, the latter option – a dead computer – is actually the fastest to recover from. Pop my Time Machine drive in, hit restore, and I'll be back how it was as soon as that's done. Even if it were a new Mac entirely. The former thing; new staff… that's a lot longer. Everyone always assumes it's not going to take too long, they think tools like MAMP help – and they do, to an extent. What will still be missing is all the additional workflow tools; your configurations, the helper applications, any little bash scripts, the myriad tweaks and changes that were made years ago that you don't really remember and won't notice. Until you spend a day wondering why Mcrypt isn't working in PHP, and trying to find out what Apple changed about the config in the last OS update, or whatever.

Which is why I've liked the idea of a VM development environment. There are tools like Puphpet that are supposed to configure that for you – personally I've not had it work too well. The idea is simple enough: a virtual machine is configured with all of that stuff in it; it is your LAMP stack, it has NPM, Gulp, and a bunch of other dev tools all running on it. Every new project you make on your machine is just run through that, by way of some sym-linked or otherwise imported folders. It means that the only things 'on your machine' are the actual project files, and any project-specific configuration files like a Gulp task list to run against the VM. The VM is portable, either as a Vagrant config file to build and instantiate it, or as a literal ISO or disk-image that can be copied from computer to computer. Or a bit of both.

And yet, I've not managed to get that working to an acceptable level. 'Best practice' will inform you that the set-up of the VM should really be done via a utility program like Puppet, Ansible, or Chef; so that you can re-build it and update the packages easily. But now you've got to learn those, and they're not trivial to learn, especially if you're not a Sys Admin. Pragmatism will tell you its easier to just run Debian in a VM, set it up in the normal manner, and burn that as an ISO or disk-image to run in Vagrant. But now you've baked in various software versions – is that a problem? I'm not sure. Need to update it? I'm not entirely sure how that would work and the implications it might have. Even if it does run as you want, the thing is slow to boot up and eats memory. Need to occasionally have two projects on the go at once? Goodbye large chunks of RAM and CPU cycles.

You'll then think to run Docker, because it's more efficient than a VM. Only Docker doesn't run native on Mac, so you need to run it inside a VM… making it a pointless exercise for this use case. And then you also have to learn how Docker works, because it isn't a VM. And there are arguments about how Docker ought to be run that make your head spin unless you're a bonafide Linux Sys Admin expert.

If you go the VM route, do you have one VM where you change the 'linked assets' to get different websites running, or do you have a VM per project? There are pro's and con's to each.

All of which boils down to this: I've still not found a solution to a powerful, flexible, portable development environment. And I want one. Badly.

But really, I want something like what CodeKit is to front-end dev. I want a single app I can pay someone for, download, and just run the bloody thing. In fact, CodeKit does half of the stuff I want anyway (SCSS, JS linting & concat etc); but it needs Gulp integration and a proper configurable LAMP stack to match my requirements.

I don't know of a program answering that description, and I'm pretty sure there's a market out there for it.