The Short Version
Deploy the branch you are currently on to Heroku, create a Pull Request, configure DNS and report in PivotalTracker with my Heroku Feature Deployments gem using the following command.
And tear everything down again with:
The Long Version
I often find that one major bottleneck in the process of building and shipping software is testing features. Perhaps 1 feature is pushed to the staging server for testing, and the feature owner is working with the developer to iron out any kinks. While this is happening no other developers can push to staging. Perhaps the other developers don’t realise this, and keep pushing and wiping out each others work before it can be tested. The more things that are being worked on at once, the worse the problem can get.
The (temporary) solution
When we developers use git we create a feature branch where all of our changes go, then create a pull request in GitHub, and then it is merged in after a code review. Why not also use feature deployments? Heroku is perfect for quickly deploying temporary sites as long as your infrastructure is immutable.
My idea for a process is this:
- Developer takes the next story/task/feature from the project managment tool
- Developer does required work
- Developer creates a pull request in GitHub
- Developer creates a new Heroku app and deploys the site there
- Developer sets up the DNS so that the site runs on a subdomain. (http://FEATURE_NAME.mattbeedle.name for example)
- Developer adds this link to the project managment tool and marks the story/task/feature as ready for testing
- Feature Owner tests the functionality on the subdomain and accepts the work (hopefully)
- Developer deletes the Heroku app, DNS settings, etc
- Developer marks the pull request as ready for review in GitHub
- Team reviews the pull request and merges into master
- CI server runs tests and if all passes then deploys to the live site
The only issue with this really is that no-one wants to spend so much time creating Heroku apps, configuring DNS, etc.
In order to automate this we’ve been using a very simple gem which I hacked together in a couple of hours and have been gradually adding stuff to for the past year. This gem will handle the following functionality:
- creating a Heroku app for the current branch
- adding any required Heroku addons (memcached, redis, etc)
- adding collaborators to Heroku app (the rest of the development team in case they also need to work)
- configuring DNS to setup a subdomain
- creating a pull request in GitHub
- adding a link to the story in the PivotalTracker
All handled by 1 rake task:
- Deleting the Heroku app
- Removing DNS settings
This process has worked very well for us so far. The reason it’s a temporary solution is that the gem right now sucks. It’s does not have automated tests and it’s tied to Heroku/DNSimple/PivotalTracker. I’m going to start working soon on a hosted configurable deployment tool which integrates with many other services and has an API so that deployments may be started by a CampFire/HipChat/IRC bot.
Need some extra development power?
I don't have a lot of time at the moment, but I'm always interested to hear about new projects. I'm particularly interested in EmberJS/Elixir projects and refactoring Rails monoliths. Drop me a line at hello [at] mattbeedle [dot] name or using my contact form http://www.mattbeedle.name/#page-contact.Tweet
comments powered by Disqus