User Friendly Maintenance Pages with Ruby on Rails

20 Oct 2016
0 Comments
User Friendly Maintenance Pages with Ruby on Rails

At some purpose in each Rails application's life, you'll have to perform some reasonably maintenance or code update that may need taking your application offline for a short span of time. There square measure strategies to attain zero-downtime deployments, however typically it's simply easier to require your application offline for five minutes throughout a preparation. If you recognize that no-one is writing information into the info, then you do not need to worry regarding synchronizing information or merging info backups back in once your deployment is finished. It simply makes life less complicated in cases once a number of minutes of time period is appropriate.

But, throughout this "dark period" once your application is offline, you must still offer your users some notice of what's happening, and after they will expect the upkeep amount to finish.

Quick-Start with Turnout

The turnout gem makes it straightforward to quickly place up a friendly maintenance page for your users, and block access to all or any routes at identical time (to forestall writes to your database).

The main edges are:

  • Easy installation
  • Rake commands to show maintenance mode on and off
  • Easily offer a reason for every time period while not writing the upkeep.html file
  • Allow sure information sciences or IP ranges to bypass the upkeep page
  • Allow sure methods to be accessible throughout maintenance
  • Easily override the default maintenance.html file together with your own

Install

In your Gemfile add:

gem "turnout"

then run

bundle install

Activate

rake maintenance:start reason="We're updating our site, please check back in 5 minutes"




Leave a comment: