Skip to content

roman-franko/rack-maintenance

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rack-maintenance

Rack::Maintenance is a simple Rack middleware to detect the existence of a maintenance.html page and display that instead of incoming requests.

<img src=“https://secure.travis-ci.org/tilsammans/rack-maintenance.png” />

Installation

sudo gem install rack-maintenance

Installation with Bundler

In Gemfile:

gem 'rack-maintenance'

and then run ‘bundle`.

Usage

For Rails web applications

# config/application.rb
config.middleware.use 'Rack::Maintenance',
  :file => Rails.root.join('public', 'maintenance.html'),
  :env  => 'MAINTENANCE',
  :signal_file => Rails.root.join('tmp', 'maintenance.txt')

For Sinatra and Padrino and GRAPE web applications

# config.ru
require 'rack-maintenance'
use Rack::Maintenance,
  :file=>File.join("config", "maintenance.yaml"),
  :env=>nil,
  :format => "json",
  :signal_file => File.join('tmp', 'maintenance.txt')

If :env is specified, all requests will be shown the maintenance page if the environment variable is set.

If :env is not specified, the maintenance page will be shown if it exists.

Note on Patches/Pull Requests

  • Fork the project.

  • Make your feature addition or bug fix.

  • Add tests for it. This is important so I don’t break it in a future version unintentionally.

  • Commit, do not mess with Rakefile or VERSION (do that in a separate commit if you want a local version)

  • Send me a pull request. Bonus points for topic branches.

Copyright © 2009 David Dollar. See LICENSE for details.

About

Detect and show a maintenance page

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 100.0%