Trackman for Rails 3.1 to 4.0 beta - SynApps/trackman GitHub Wiki
Conventions
We assume your maintenance page is located at:
public/503.html
And the page to display if your app breaks during initialization:
public/503-error.html
Getting started
Step 1 - Install the addon, add the gem and run bundle install
heroku addons:add trackman
gem 'trackman'
bundle install
###Enable heroku config at build-time
By default, Heroku does not load the configuration variables at build-time.
Since we run after assets:precompile, we need to tell heroku to load them by doing:
heroku labs:enable user-env-compile -a myapp
Step 2 - Setup
rake trackman:setup
This sets your initial heroku configurations and ensures that when your app is down or in maintenance your pages will be requested by heroku. If you already have maintenance or error pages configs for heroku, Trackman will copy with .bkp extensions before he overwrites them.
Step 3 (optional) - Scaffold your static pages
rails generate trackman:controller [name]
This will generate a special controller that, when on development, will create your maintenance pages for you when you execute its actions. Because Rails (>= 3.1) can handle 500 and 404 pages dynamically, the controller also adds the required route to handle them.
The controller has class methods to filter the response output.
You can find examples on how to use them within the controller itself.
Step 4 - Deploy
Now that you have your maintenance pages, you can commit and push to Heroku.
Trackman will look for changes to your pages and linked assets and sync them on application boot.