My favorites | Sign in
Project Logo
          
New issue | Search
for
| Advanced search | Search tips
Issue 53: Enable Application Maintenance Mode with Creation of system/maintenance.html
11 people starred this issue and may be notified of changes. Back to list
Status:  Fixed
Owner:  ----
Closed:  Mar 2009
Type-Patch
Priority-Medium
Milestone-2.1.0


Sign in to add a comment
 
Reported by alan.johnson, May 03, 2008
mod_rails should have the ability to only serve a single maintenance.html file if it's created in the 
system folder, as is normally done when deploying with capistrano.

Right now users are warned against using mod_rewrite, but we're not given a good alternative for 
putting our maintenance notice out there.

 
Comment 1 by honglilai, May 05, 2008
You can use mod_rewrite, but you'll have to delete the default .htaccess that Rails
provides (so that your requests don't go through CGI/FastCGI), and you'll have to
make sure that you have no rewrite rules that conflict with Rails.

Does answer this solve your issue?
Comment 2 by alan.johnson, May 05, 2008
That's what I'm doing now, but I was thinking it could be really nice to have maintenance.html handling just built 
into Passenger. Then I wouldn't have to configure apache with rewrite rules at all, or at a minimum I would have 
to add a single item. Probably your best bet, and one that would work okay with the rails community, would be 
to say that if a file was in system/maintenance.html passenger would always serve that rather than the real 
application files. That would be a really nice feature, and would take away my last need for mod_rewrite. And, it's 
something most rails users do in their deployment scenario with capistrano.
Comment 3 by honglilai, May 05, 2008
(No comment was entered for this change.)
Labels: -Type-Defect Type-Enhancement
Comment 4 by alan.johnson, May 26, 2008
I've attached a patch that handles this... I haven't done any extensive benchmarking or anything but I can't see 
any way that it could be much slower than using mod_rewrite with a -f rule.
maintenance_html.patch
582 bytes Download
Comment 5 by alan.johnson, May 26, 2008
Oh, sorry, one clarification on the patch. That patch is against the 1.0.5 codebase, because I couldn't get the 
current git tree to build on my system.
Comment 6 by honglilai, May 27, 2008
(No comment was entered for this change.)
Status: Started
Labels: -Type-Enhancement Type-Patch
Comment 7 by Darcy.Laycock, Jun 16, 2008
Got the current git head & integrated alan.johnson's patch in with it.

Running ab -n 10000 -b 10 w/ a simple rails app showed no noticeable change (e.g. means were the same) in 
request times etc.

Anyone want to volunteer to test this?
maintenance_file_2.patch
1.3 KB Download
Comment 8 by alan.johnson, Jun 18, 2008
With the move to Rack support, would it make more sense to plan on maintenance.html being in the tmp 
directory instead of the public/system directory? A lot of frameworks won't have a public folder to put that into, 
but using the tmp directory, like is done with restart.txt, should make it work for anyone.
Comment 9 by Darcy.Laycock, Jun 18, 2008
alan.johnson: The system folder (esp. for rails) is usually only created when you want to the maintenance page 
isn't it? (ignoring the fact some developers may be using it for their own stuff). Putting it in tmp/ sounds like a 
decent idea but the whole point of it (as far as I can see) is that since system/maintenance.html is a Capistrano-
specific (well, as far as I know) choice and hence it should work with anything (No matter whether it is a rails 
application or not).  Ideally (I don't know enough about apache to do it) it'd be nice to let the user configure the 
location with the default being system/maintenance.html at least for the fact it's *not* Rails specific, it's 
Capistrano specific.

Comment 10 by alan.johnson, Jun 19, 2008
Good call. If I get a chance I'll dig in and see if I can figure out how to add that configuration option.
Comment 11 by aaron.gibralter, Jun 30, 2008
How about adding a check for a maintenance.html page anywhere in the project directory?
Comment 12 by alan.johnson, Jun 30, 2008
I guess we have two options here... add the check in the project folder, or just add a configuration option. I 
guess comment on what you want and I'll try and put it together.

As a side note, when I put this into production at one point, I started getting tons of segfaults. I've got one 
server that never segfaults on it, and one that segfaults every request, but I'm not sure if it's my fault, 
passenger's fault, or the configuration's fault.
Comment 13 by j.e.hahn, Jul 31, 2008
I'd actually prefer not to have this -- we use a different set of Rewrite Rules from
the "standard" to generate our maintenance pages and would be quite upset if the App
Server decided this for us.

Better is just to use Apache's mod_rewrite for this. If mod_rewrite doesn't work,
then that's the real bug. This is exactly the sort of thing it was invented for (and
why some of us want to use apache in the first place...)
Comment 14 by drothlis, Jan 23, 2009
I agree with comment 13 -- Use mod_rewrite to achieve this. What if your
maintenance.html page has an image in it? Would passenger automatically redirect
requests to maintenance.html, except for images?
Comment 15 by r.s.a.va...@nedforce.nl, Mar 05, 2009
Seems to be no longer necessary now that mod_rewrite is fully supported.
Comment 16 by honglilai, Mar 05, 2009
(No comment was entered for this change.)
Status: Fixed
Labels: Milestone-2.1.0
Sign in to add a comment

Hosted by Google Code