Thomas,

Sorry it took so long. Have been using this for a little while now but  
took a while to tear it out. Very interested in feedback.

1) put http:://github.com/kbrock/iorn_gate into plugins directory
2) add near the TOP of environment.rb
MAINTENANCE =(ENV['MAINTENANCE']=='true')

3) add to my application_controller:
   if MAINTENANCE
     acts_as_gated :template => 'shared/gate_closed', :gate_name =>  
'testing123
   end

4) create 'maintenance' page to app/views/shared/gate_closed.html.erb


heroku keys:add MAINTENANCE true
git push heroku
heroku rake db:migrate
heroku open
do url:  /testing123/open
... test...
heroku keys:remove MAINTENANCE


--Keenan


On Sep 10, 2009, at 6:45 AM, Thomas Balthazar wrote:

>
> Hi Keenan,
>
> Thanks for the suggestion!
>
> Thomas.
>
>
>
> On Thu, Sep 3, 2009 at 8:59 PM, 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to