We just migrated from Bamboo (bamboo-ree-1.8.7) to Cedar (calendon rails 3.1 stack) on Heroku. Here are the steps I took to make it work. Note that I didn’t do the code migration, my dev handle that, I do the server and infrastructure part.
Basically this mean moving from Rails 2.x (and ruby 1.8.7) to Rails 3.1 (ruby 1.9.2). Some of the changes require upgrading gem packages. Things such as images, css and js has to be put into an asset bundle.
On the site itself, I left the old site running, e.g. oldsite.heroku.com, and created a new site at newsite.herokuapp.com.
We created a new git dev branch and pushed to newsite, e.g.
git push heroku dev:master
Since we use SSL, I have to make sure custom_domains addon is there. But…
heroku addons:add custom_domains:basic custom_domains:wildcard
I can’t add the ssl addon until I am ready, because Heroku requires that I defined the domains for the app first! Chicken and egg, as it mean I have to take down the currently running production site.
So, make sure everything is running on new site first. Because the next steps mean production site will be down during the changes.
0. Make sure your SSL cert is up-to-date and you have both part, domain.cert and private.key. And most importantly, your key is passphrase-less!
1. Make sure your DNS records are updated and have shortest possible TTL. You are changing them.
2. Wait till DNS changes (TTL) have settle, could be a few hours. Then update your production site CNAME from *.yourdomain.com to newsite.herokuapp.com.
3. Clear out the domains in your old Heroku site:
heroku domains:clear --app oldsite
4. Add domains to new site:
heroku domains:add '*.yourdomain.com' --app newsite
heroku domains:add 'www.yourdomain.com' --app newsite
5. Upload SSL cert to your new app:
heroku ssl:add yourdomain.crt private.key
6. Now you can add the ssl addon.
heroku addons:add ssl:hostname
7. You should get an email from Heroku that has the hostname for your SSL DNS record to point your DNS to. The name should be something like this:
Update your DNS CNAME for www.yourdomain.com to point to this name.
8. Test, test, and test again your spanking new site. Add the New Relic addon if you haven’t (life saver!) and monitor traffic to your new site.
9. Monitor the log of your new site:
heroku logs -t --app newsite
10. Check the processes:
heroku ps --app newsite
11. Wait a week, if everything look good, you can take down the oldsite.