NAV
ruby javascript

Introduction

Wrenchmode is the fastest, easiest way to create a beautiful “Down For Maintenance” page for your web app. Following these basic instructions, you will have your Wrenchmode project set up in less than 5 minutes.

Installation As A Heroku Addon

# Install the Heroku Addon via the CLI
heroku addons:create wrenchmode:test

# In your Gemfile
gem 'wrenchmode-rack' 

# For Ruby on Rails, add this to /config/environments/production.rb
config.middleware.insert_before 0, Wrenchmode::Rack

# For a Rack application, add this to your-rack-app.rb
require 'rubygems' 
require 'bundler/setup' 
Bundler.require(:default) 
use Wrenchmode::Rack
// Install the Heroku Addon via the CLI
heroku addons:create wrenchmode:test

// Install the npm package
npm install wrenchmode-express

// In your app.js 
var express = require('express');
var app = express();
var wrenchmodeExpress = require('wrenchmode-express');

app.use(wrenchmodeExpress());

(Be patient with any issues, we’re still in the submission process with our Addon)

Add the Wrenchmode Addon via the Heroku CLI. Then install the middleware layer. For Ruby/Rack, this means a Rubygem. For NodeJS/Express, this means an npm package. Finally, make sure to include the middleware layer in your application.

Once everything is installed, you can go to your Heroku dashboard and click on the Wrenchmode link to log into your Wrenchmode dashboard. From there you can turn Wrenchmode on and off for your project.

Manual Installation (non-Heroku)

# In your Gemfile
gem 'wrenchmode-rack' 

# For Ruby on Rails, add this to /config/environments/production.rb
config.middleware.insert_before 0, Wrenchmode::Rack, jwt: "copy-and-paste-the-JWT-from-your-project-page-it-will-be-long!"

# For a Rack application, add this to your-rack-app.rb
require 'rubygems' 
require 'bundler/setup' 
Bundler.require(:default) 
use Wrenchmode::Rack, jwt: "copy-and-paste-the-JWT-from-your-project-page-it-will-be-long!"
// Install the npm package
npm install wrenchmode-express

// In your app.js 
var express = require('express');
var app = express();
var wrenchmodeExpress = require('wrenchmode-express');

app.use(wrenchmodeExpress({
  jwt: "your-really-long-jwt"
}));

Install the middleware layer. For Ruby/Rack, this means a Rubygem. For NodeJS/Express, this means an npm package. Include the middleware layer in your application and configure it with your JWT, which can be found on your project page in the Wrenchmode dashboard.

Configuration Options

# You can change these settings if necessary, but it's not recommended
use Wrenchmode::Rack,
  jwt: "your-really-long-jwt",
  force_open: false,
  ignore_test_mode: true,
  disable_local_wrench: false,
  check_delay_secs: 5
// You can change these settings if necessary, but it's not recommended
app.use(wrenchmodeExpress({
  jwt: "your-really-long-jwt",
  forceOpen: false,
  ignoreTestMode: true,
  disableLocalWrench: false,
  checkDelaySecs: 5
}));

When instantiating the middleware, you can set the following options:

Option Usage Default
Force Open Set to true to force the middlware layer to allow all requests through, regardless of project status on Wrenchmode.com. Effectively disables the middleware. false
Ignore Test Mode (Coming soon…) Set to false to if you want the middleware to respond to a project that is in Test mode on Wrenchmode.com This can be useful if you want to test Wrenchmode in a development or staging environment prior to deploying to production. true
Disable Local Wrench (Coming soon…) Set to true if you want to disable LocalWrench mode, where the Wrenchmode page is served on your domain. Disabling it will instead force a redirect to the Wrenchmode.com domain. Note: Unless you explicitly want this behavior, it’s best to leave this at the default. false
Check Delay (Seconds) Change this to modify the rate at which the middleware polls Wrenchmode for updates. Unlikely that this needs anything faster than the default. 5