Moving your application to Heroku

Recently, I moved an app from Rack Space to Heroku. Everything went well except for a few hangups.

Migrating your database.

My app currently used MySQL and, as you probably know, Heroku love Postgres. So how do we get this data up to Heroku?

One option would be to use the taps gem to import the MySQL data into Postgres. But that didn’t work so well for me. The gem seemed to fail arbitrarily, leaving me unsure about the fidelity of my data.

Another option, use Heroku’s Amazon RDS addon. It was a little painful to setup but not terrible and there’s plenty of good documentation.

Fixing bad encodings.

Once I got my database migrated, I noticed a new issue. Little �’s were peppered throughout my copy. That’s a bad encoding since, apparently, I’m using a different version of MySQL. So I wrote a little script to replace bad encodings with HTML entities.

It’s not exhaustive, but it’s solid and should be easy to adapt if needed.

Things to watch out for.

  • Does your app use SSL? If so, plan ahead since that can take a few days to work out.
  • If you’re using sendgrid, be sure to choose a plan that won’t cap out and start throwing errors.
  • Don’t forget to set both your MX and A records.
  • Don’t forget to setup New Relic and Hoptoad before switching over. You’ll probably encounter some errors and it’s better to know about them.

Tags: , , ,

Your thoughts?

Preview