Ship it!

Shipping code is exciting. The moment when technological magic, beautification, and business articulations get released into the wild, for all to see. When it hasn’t shipped, it’s not yet real; only stuck in the minds of the creators, not having stood the true test of the real world. It is one of the most satisfying software development moments. To optimise for this joyous moment, I’ve created a rake task to make shipping code as simple as a 1 line command:

bundle exec rake:shipit[production]

The ease of a 1 line deploy, changes your perception of deployment, making it less of a chore, and more of a celebratory keyboard dance, just as you cross that finish line of your last bit of work. Abstracting away the finicky bits of the deployment process, allows you to focus more on programming and less on administrative tasks. It’s also just satisfying - after finishing a chunky bit of work, to type a command, press Enter, watch the matrix flow, and presto! Deployed! It would be even better to have a big shiny red button…

Underneath this 1 line deploy, our default case is for a project to be merged with a deployment branch such as staging or production, pushed to the remote servers, and then shipped to deployment servers.

We have deployment branches, so that we can track where each deployment is at in the git history. This is useful for figuring out where code changes, between deployment and current work (it also means we can use github’s neat compare view). Another nice side effect is that after deploying, our campfire bot, Marvin sends us an automated message (using the campfire service hooks).

There are much more formalised ways of using git for deployment such as git-flow and github-flow, however, usually these are much too heavy weight for what we need. Especially when the team is made up of only 1 or 2 people.

A master and deployment branch is really all that’s needed most of the time, with feature branches used if necessary. We’ve used this deployment system (or similar) for projects such as Tricklr, Vistazo and the pebblecode.com site, and it’s worked pretty well.

To use the rake task, you’ll need to set up the relevant git branches, fill in the branch names, and fill in your deployment method (there are examples for heroku and capistrano). It is made to be a template, and edited as relevant to your project.

Here is the rake task again: https://gist.github.com/3697640.

Feel free to fork away, and make ship it squirrel proud.

Share your thoughts with us on twitter