Automating Migrations On Heroku

Hey guys, I’ve been struggling recently with how to make sure my migrations get run at the right time as I push to the remote webserver (I’m using Heroku). I finally came up with the solution, which I’ll describe briefly in case it helps anyone else out.

You first have to set up a Procfile the defines the boot script as a copy of the standard boot script (something like web-boot.sh). Then you need to add to that boot script


bin/php www/protected/yiic.php migrate --interactive=0

. Now, every time you push code to Heroku, it will execute your migrations before your new code goes live. You can read the full post here: aaronfrancis.com/blog/2013/5/2/automate-yii-migrations-in-heroku and feel free to ask any questions, I’ll do what I can to help.

I’m currently hosting a web app on rackspace.com that is using yii.

I’m considering switching to Heroku to offload the server admin stuff. I don’t have the time to dedicate to it.

How much of a problem was it to get yii working on Heroku?

How do you like Heroku? How many concurrent users do you have? We have a social app that auth against Facebook. If the app goes viral, we are going to need lots of capacity fast. Have you scaled your capacity up or down? Was this done without interruption to your users?

Thanks, Mike