How to put a Ruby on Rails application in Maintenance Mode
Tags: ruby, rails, maintenance, gem
Published: 2019-08-19 07:15:31

---
title: How to put a Ruby on Rails application in Maintenance Mode
published: True
description: Wondering how to put your ruby on rails application in maintenance mode? Here’s a detailed overview of how to do that using a simple gem.
tags: ruby, rails, maintenance, gem
---

![How to put a Ruby on Rails application in Maintenance Mode](https://www.botreetechnologies.com/blog/wp-content/uploads/2019/08/ruby-on-rails-application-in-maintenance-mode.png)

## What is the maintenance mode?

**Maintenance mode** page is the user-friendly message for your site visitors indicating that we are working on something for which the site needs to be down for some time. We require this because we don't want our website to be broken for a specific amount of time while the site maintenance is in progress.

When you [hire Ruby on Rails programmers](https://www.botreetechnologies.com/hire-ruby-on-rails-developers), they can take care of the entire maintenance mode page.

### Why you require the maintenance mode page?

- Performing upgrades (migrate rails version from one to another)
- Performing data migrations in the backend
- Migrating images or files from Amazon S3 to Google Cloud or vice versa
- And many more...

### How to so do for Ruby on Rails applications?

The easiest way to do is by using [Turnout](https://github.com/biola/turnout) gem. Turnout is [Rack](http://rack.rubyforge.org/) middleware with a [Ruby on Rails Development](https://www.botreetechnologies.com/blog/ruby-on-rails-development-obstacles-opportunities) engine that allows you to put your app in maintenance mode easily.

Turnout gem has the following features. 

* Easy installation
* Rake commands to turn maintenance mode on and off
* Easily provide a reason for each downtime without editing the maintenance.html file
* Allow certain IPs or IP ranges to bypass the maintenance page
* Allow certain paths to be accessible during maintenance

You can find them all of them [here](https://github.com/biola/turnout#features).

### Installation

Just add the following gem to your [Gemfile](https://www.botreetechnologies.com/blog/pagy-a-new-pagination-gem-in-the-realm-of-rails-world)

`gem 'turnout'`

and do `bundle install` that's it!

### Activation

`$ rake maintenance: start.`

Tada! It's done. When you do so, you will get the following page.

![Alt Maintenance mode](https://thepracticaldev.s3.amazonaws.com/i/ilayokadff8n43tosi6t.png)

`$ rake maintenance: start reason= "This is the custom reason!"`

![Alt Custom reason](https://thepracticaldev.s3.amazonaws.com/i/6i69vpyzwy9cy4wgebmp.png)

You can find all the commands [here](https://github.com/biola/turnout#activation).

### Deactivation

`$ rake maintenance: end.`


[Default maintenance pages](https://github.com/biola/turnout/blob/master/public/) are provided, but you can create your own `public/maintenance.[html|json|html.erb]` files instead. Reach out to learn more about the [expert web developers in NYC](https://www.botreetechnologies.com/usa/web-development-company-new-york) for the various ways to improve or build the quality of projects and across your company.

A [Ruby on Rails web development company](https://www.botreetechnologies.com/ruby-on-rails-development) will ensure that you activate and deactivate maintenance page at the right time.

That's it!

### Read Also: [Top 3 tips to Boost Performance of your Ruby on Rails Application](http://www.rorexpertsindia.com/blog/top-3-tips-boost-performance-ruby-rails-application/)