views:

322

answers:

1

A bad side of pushing to Heroku is that I must push the code (and the server restarts automatically) before running my db migrations.

This can obviously cause some 500 errors on users navigating the website having the new code without the new tables/attributes: the solution proposed by Heroku is to use the maintenance mode, but I want a way with no downside letting my webapp running everytime!

Is there a way? For example with Capistrano:

  • I prepare the code to deploy in a new dir
  • I run (backward) migrations and the old code continue to work perfectly
  • I swith mongrel instance to the new dir and restart the server

...and I have no downtime!

A: 

Heroku can't deploy by capistrano. You are block by tool released by heroku.

The no downtime system is impossible in all cases. How change your schema with big change without stop your server. If you don't stop it, you can avoid some change and your database can be inconsistent. SO the using of maintenance page is a normal solution.

If you want a little solution to avoid problem is a balancing in two server. One with only read database during your migration. You can switch to this instance during your migration avoiding the maintenance page. After your migration you come back to your master.

shingara
Hi shingara,I'm sorry but I don't agree with you.I don't want to use load balancing for this: one of the great features of Heroku is the "trasparent" cloud power by necessity and I want to use this feature...To load balance in Heroku I have to mantain two different apps and a read only DB can cause problems to my users.And a no downtime system is not ever impossible. I'm used right the system explained with no downtime. In case of a big change without the possibility of a retro-compatible db schema I can use a maintenance page: but this is the 5% of all my cases...
zetarun