It's a nice idea. One small fly in the ointment is that you can't individually set heroku configuraiton variables (unless this is fixed now?)
Certainly last time I tried it, I found that any env var not set explicitly on the same config:add statement was removed. IE config:add is not additive. This means that to implement the suggestion above, you would have to ensure that each time you turn on and off MAINTAIN you will have to be setting all the other vars as well. A royal PITA. GaJ On Sep 4, 3:59 am, Keenan Brock <[email protected]> wrote: > Hi Thomas, > > For passenger, there is a way to say if a file is present, then > display a maintenance page. (using mod rewrite) > This got me thinking. > > Heroku has environmental variables. So why not use an environmental > variable to trigger a maintenance page? > > Maybe you can add a maintenance page to your site. > e.g.: > > setup the blocker: > > config/routes.rb: (below Routes.draw but above the other entries) > if ENV['MAINTAIN']=='true' > map.maintain '*path', :controller => 'application', :action => > 'show500' > end > > -or- > application_controller.rb > if ENV['MAINTAIN']=='true' > before_filter :show500 > end > > and setup the renderer: > > app/controllers/application_controller.rb > def show500 > render :file => 'shared/maintain', :status => 500 > false > end > > To turn it on: > > heroku config:add MAINTAIN true > The site will say "we'll be back soon" > rake db:migrate > other stuff > heroku config:remove MAINTAIN > > Hope this meets your needs. > > I'll throw together a plugin when I get the chance. But long weekend > suggests I'll have other things on my plate. > --Keenan > > On Sep 1, 2009, at 2:25 PM, geolev wrote: > > > > > I think this would be great. Does anyone know how to do this? > > > On Aug 28, 2:52 am, Thomas Balthazar <[email protected]> wrote: > >> Hello, > > >> I'd like to know what would be the best way to put an application > >> into > >> maintenance state. > > >> I want to deploy a major update (code + db structure + data > >> migration) > >> on a Production app, and I'd like to be sure that users don't use the > >> app while I'm deploying and testing. > > >> As far as I know, as soon as I run 'git push heroku', the app is > >> deployed and the users are able to access it. > >> The problem is that I haven't run 'heroku rake db:migrate' yet, so > >> the > >> app that is online right now doesn't work. > >> Also, once I've run 'heroku rake db:migrate', I'd like to be able to > >> test the app to be really sure everything is ok. > >> But the users are already using the app and if I made a mistake and I > >> want to rollback, I can't, since users are already using the new DB > >> structure. > > >> I know I have to test the app so it doesn't happen, I also have a > >> Staging app to test everything, but, you know, sometimes things still > >> go wrong. > > >> So, what would be the best approach to achieve an application > >> 'maintenance' state? > > >> Thanks for your suggestions. > > >> Best, > >> Thomas. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Heroku" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/heroku?hl=en -~----------~----~----~----~------~----~------~--~---
