2 Jul 2015
Have you ever been excited to tinker with a software project, only to have dependency hell ruin all of the fun? As a software consultant, I face this situation all the time.
Luckily however, technologies like Docker take the pain out of spinning up additional components of your app architecture, like databases or job queues, or installing runtimes like Ruby or Python. By isolating processes from one another with very little overhead, you can sail past dependency hell.
Over the last year, I’ve worked on a number of different projects, encountered lots of of different requirements, and explored all sorts of ways of working through dependency conflicts. This is the story of my search for a solution, the pros and cons of each path I explored, and how I ended up using Docker.
Life as a Consultant, Day 1
When I started working as a consultant, I looked down at my beautiful new laptop and made a promise to treat it right. I wouldn't install a bunch of system extensions. I wouldn't tweak too many esoteric settings. I wouldn't bog it down with databases and other services.
Then came my first client project. Along with it came Python 2.7.6, MySQL 5.1.73, Ruby 1.9.3-p545, Node 0.10.29, Elasticsearch something-dot-something. And as I looked through the 500-line README, my heart sank.
My first reaction was to try to sidestep the dependencies. Occasionally, you can get away without a dependency. Usually, you're just delaying it for a while. Even for an optional dependency, skipping it meant a delicate dance of stubbed-out methods and dark hallways that must not be entered. Before long, this delicate dance turned into a clumsy stumble.
Faced with the reality that ignoring these dependencies was not a long term solution, I started to wonder why this project had so many dependencies in the first place. Certainly it had too many dependencies!
I may have been right about this one, but it's not a solution. Over time, I may be able to steer the project away from some of its dependencies, but that wouldn't do me any good at the moment.
I was ready to bite the bullet, beg forgiveness from my new laptop, and install all of this stuff. But I wasn’t quite ready to give up without a fight. If I took really detailed notes, I thought, maybe I could just uninstall all of this stuff later. Welcome to the world of
Homebrew post-install notes.txt and
List of rbenv files.txt. Now, in addition to a 500-line README file, I had a 600-line UNINSTALL file.
I ended up with a typical developer setup: the base OS, plus all of the services needed to run my application. Or, in a picture, this: