[LRUG] Rendering maintenance pages?
Tom Ward
tom at popdog.net
Fri Jun 28 02:40:49 PDT 2013
Hey folks,
I'm working with Joel, and we thought we'd let you know what we've come up
with.
We've created an ErrorsController with actions for all of our error pages.
Requesting /errors/404, for example will render our 404 page using the
standard asset pipeline, layouts, etc (all of which we make use of).
Then, to generate a static version we have a rake task with the following:
session = Rack::Test::Session.new
Rack::MockSession.new(Rails.application)
response = session.get('http//example.com/errors/404')
if response.status == 200
File.write Rails.root + 'public' + '404.html', response.body
else
raise 'Failed to generate 404 page'
end
So far it seems to work well.
Tom
On 27 June 2013 11:01, Paul Robinson <paul at 32moves.com> wrote:
> On 27 Jun 2013, at 10:55, Daniel Barlow <dan at telent.net> wrote:
>
> I think you're actually agreeing with each other here: Joel is talking
> about a rake task and a static page, which presumably would be written to
> this "separate area of disk" to be served directly by nginx/your upstream
> proxy next time the app is brought down, but he wants it to be produced
> using the same layout, styles and general look & feel as the app itself and
> to stay in sync when the app changes. It seems like this is the kind of
> thing the asset precompiler should be able to do, but I've no idea how.
>
>
>
> Ah, got you.
>
> I think this is what we're after then:
>
> http://icelab.com.au/articles/precompiled-rails-static-404-and-500-pages/
>
> It'll need a bit of a tweak to produce a maintenance page, but that looks
> like your starter for 10...
>
> _______________________________________________
> Chat mailing list
> Chat at lists.lrug.org
> http://lists.lrug.org/listinfo.cgi/chat-lrug.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lrug.org/pipermail/chat-lrug.org/attachments/20130628/d6a95992/attachment-0003.html>
More information about the Chat
mailing list