I was chatting idly the other day with a colleague, as we often do, about our pet projects. The subject of deployment came up. In our day job, we make quite heavy use of Jenkins to build and test our app, and also to (largely) automate deployment. I asked if he used Jenkins or anything for his own projects, and it turns out he’s just like me and doesn’t bother. He just runs all his tests before committing.
Which leads me to neatly, and somewhat sooner than I expected, to answer the question in the title of this post: No. As a solo dev, there really isn’t any need to use CI. Clue’s in the name: what are we integrating? Why do we ever bother with CI? It’s because taking the work of more than one dev, on the same codebase, is a difficult and error-prone task, and it turns out that, much like many unpleasant tasks – such as washing up – it’s actually less painful if we do it more often. I write a bit of code, and the tests all pass locally for me. But I can’t be sure that when my code is merged with Bob’s code, they still will. So we automate the integration and testing of our combined efforts. But if it’s just me, then my local working copy, once checked in, is identical to HEAD, so what’s to integrate? Ok, so our CI build is often more extensively testing things than a local build, but on a small one-man project, I doubt the testing overhead is anything a cup of tea won’t take care of.
So back to our chat. My friend said he’d quite like to have a Hudson or something deployed somewhere, anyways, and I know what he means. I used to do it. I’ve had CruiseControl or Hudson boxes running at home, and I’ve had Hudson deployed on a VPS alongside Readonlytwitter. It was quite fun, being able to do a bit of coding at work during a lunch break, commit the code, and then see that the build had passed. Then I realised I was never getting a broken build, and decided the whole thing was a waste of time.
What I recently remembered, though, was that before I dumped personal CI, I was planning to use Hudson to give me single-click deploys. I still want that. But I’m not going to use a CI app to do it. A week or so ago, I started re-writing my company website as a Rails app, just for shits and giggles, and bunged it onto Heroku. I’m unconvinced Heroku is really for me, at least for that particular app, but I really like their Git-based deployment workflow, which seems absolutely perfect for solo projects. So I’ve set about building such an environment for my own apps. How does it work? I have 2 remote Git repos, one which I do dev on, etc, and another that I push deploy-ready code to, upon which that code gets tested, built, and deployed to my live container. So far, it’s proving fairly easy to achieve, with a bit of Bash scripting and some Git hooks. Once I’ve finished it, and made it easily repeatable, I’ll write part 2 of this post, tentatively titled Pushing A Grails App Live Without Any Tedious Manual Steps.