Hi Dan,

Depends on the needs/functionality of your app, but the two things I
usually incorporate in my web apps to address production environment
upgrades/maintenance are:

1) the ability to render a real-time system-wide message to all
current users of the app; and

2) the ability to toggle on/off read-only mode for the app in real-
time.

To do this I'll usually have a couple of before_filters in ./app/
controllers/application.rb: one that looks for a tmp text file that
contains the particular sys_wide msg that you want to display to all
current users of the app; and another tmp text file that indicates
whether the app should be put into read-only mode.

If the app sees that there's a sys_wide msg to be displayed, then it
reads the contents of that sys_wide msg and renders it (via a partial
called from the app's layouts, displayed prominently at the top of
every screen of the app).  Similarly, if the app sees that the app
should be put into read-only mode, then the app displays another
sys_wide msg about the app being in read_only mode, and disallows all
requests other than GETs (usually redirecting POSTs, PUTs, ... to the
prev refer'd GET req with a warning msg about being in read-only
mode).

So, my typical prod env upgrade/maintenance process is: put up a
sys_wide msg ahead of time to let current users know about the
upcoming/planned update (usually with the time that it's planned to
occur and the est time that it should take to complete); then just
before the update, I'll put the app in read-only mode (to disallow
data mods to the app during the update); then once the update is
completed, whether it required an app restart or not, I turn off read-
only mode, and put up a sys_wide msg about the update having been
completed (which is itself taken down after a brief period of time).

Jeff

On Jan 28, 11:52 am, Dan Paul <akadanp...@gmail.com> wrote:
> Hello,
>
> So I am a running a few shopping carts using spree (open source rails
> cart) and some of my clients site traffic is starting to rise.
> Normally I do deploy updates late at night but some times I have to
> deploy the asap, while customers are still on the site in the process
> of ordering.  Obviously when I deploy updates it takes the site
> offline for about 15 seconds, which will cause all customers to leave
> and never return.  Is there a way to deploy an update without having
> the site go offline?
>
> I am running nginx and thin, and I deploy with just a simple bash
> script.  The only thing I was thinking of doing is to have multiple
> instances of the app running and shut down each instance one at a
> time, would that work?
>
> Any advice in the right direction would be greatly appreciated

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to