This is for my own benefit as much as is it to share but I hope it helps.
Heroku is by far the easiest platform I've ever used for deploying applications too, if you're familiar with git, deploying an application is as simple as
git push heroku master
Anyhow, the purpose of this post is to act as a reminder to myself on how to work with different environments on Heroku.
Our scenario is that we have a local project that has a master and a staging branch and we want to be able to push either branch to a different application on Heroku.
First up, in the master branch create and push to Heroku
heroku create myapp-production --remote production --stack bamboo-ree-1.8.7
For those unfamilar with Heroku this one line will create an application in my Heroku account named 'myapp-production' it will add the remote destination named production to my .git/config file and it will be on the bamboo 1.8.7 stack.
So at this point to deploy from the master branch to Heroku you would issue;
git push production master
To create a staging environment first create a branch and checkout your new branch
git branch staging
git checkout staging
Now create a new staging application on Heroku
heroku create myapp-staging --remote staging --stack bamboo-ree-1.8.7
This time the remote destination will be added named 'staging' - you can check this in your .git/config
I also want to set my Heroku environment for staging (you would also need to add staging.rb to config/environments and any relevant environment variables)
heroku config:add RACK_ENV=staging --app myapp-staging
When you deal with multiple apps you need to specify the application name - this is due to how the heroku gem works, if not only to be explicit in your instructions to make sure you're not making changes to the wrong app! Especially with db:push and db:pull!!!!
So assuming that you're still in the staging branch to push to the new app to the new staging application
git push staging staging:master
This time we're saying use the remote destination 'staging' and push my local staging branch into the master branch on the remote - this is because Heroku only looks at the master branch in it's own git repo for the project.
And that should be all working for you now.
If you're used to the iPhone you'll be well accustomed to probably charging your handset once a day, that is, if you use it for listening to music, push email, browsing over 3G/Wifi etc. The HTC Desire (as most Android devices are) is no different to the iPhone, it's a hungry little beast when you've got all the stuff it's able to do switched on - but thankfully there are ways to add a little more life.