Table of Contents
Production Check tests your app’s configuration against a set of optional—but highly recommended—criteria. It makes it easy to ensure that your app’s configuration lends itself to maximum uptime. Moreover, it ensures that you have tools available for understanding and monitoring the factors that contribute to uptime.
How to Check Your App
To run Production Check, click the “Run Production Check” link in the header for any app in the Heroku Dashboard.
Production Check will run a series of tests on your app recommended for maintaining and monitoring availability. Each check includes useful links to related resources.
Cedar-14 is recommended for all applications and is Heroku’s most performant and robust stack. Cedar is the focus of the majority of the platform engineering and availability efforts.
To determine what stack your application is currently deployed to, use the
heroku stack command.
$ heroku stack -a ha-app === ha-app Available Stacks bamboo-mri-1.9.2 bamboo-ree-1.8.7 cedar * cedar-14
If you are not yet on Cedar-14, consider migrating your application.
Running at least 2 web dynos for any mission-critical app increases the probability that the app will remain available during a catastrophic event. Multiple dynos are also more likely to run on different physical infrastructure (for example, separate AWS Availability Zones), further increasing redundancy.
heroku ps command to determine how many dynos of each type your app is currently running and
heroku ps:scale to increase dyno redundancy.
$ heroku ps -a ha-app === web: web.1: up for 17m $ heroku ps:scale web+2 Scaling web processes... done, now running 3
This applies to
web dynos but also any background or worker dynos as well.
DNS & SSL
Apps on the Cedar stack should have CNAME records pointing to
app-name.herokuapp.com. When SSL is required, provision an SSL Endpoint and point your CNAME records to
endpoint-name.herokussl.com. Any other configuration will result in reduced availability.
Apex domains (otherwise known as bare, root and naked domains) should not be configured using A-records. Properly configure the root domain DNS using CNAME-like functionality or subdomain redirection.
You can quickly determine if your DNS records are properly configured using the
host command-line utility.
$ host www.example.com www.example.com is an alias for nara-1234.herokussl.com. nara-1234.herokussl.com is an alias for elb002776-242519199.us-east-1.elb.amazonaws.com. elb002776-242519199.us-east-1.elb.amazonaws.com has address 126.96.36.199 …
You should see an alias mapping from
www.example.com to either
If you run your business on Heroku, you should use a production-grade Heroku Postgres database.
The Heroku Postgres production tiers are Standard, Premium and Enterprise. Dev and Basic hobby plans are not production databases.
The production tier of service achieves the highest expected uptime and includes automated health checks, data snapshots and advanced features such as fork and follow.
$ heroku pg:info -a ha-app === HEROKU_POSTGRESQL_RED Plan: Ronin Status: available Data Size: 5.9 MB Tables: 0 PG Version: 9.1.4 Fork/Follow: Available Created: 2012-07-13 16:59 UTC Maintenance: not required
If your application requires a non-relational data store, Amazon DynamoDB is another great candidate for highly available data storage.
The Premium and Enterprise tiers of Heroku Postgres databases have additional benefits for application uptime, including High Availability with automatic failover.
Visibility & monitoring
Before improving the availability of your app, you should have excellent awareness of, and reactivity to, the state of your app. This can be accomplished with a variety of tools.
New Relic allows you to monitor, and drill into, the performance of your app over time. There are many cases in which a loss in availability is preceded by a degradation in service.
Over a reasonable period of observation, establish normal operating boundaries for your application and set up alerts to notify you when your system is beginning to deviate.
Use New Relic’s rich graphing and performance analysis capabilities to better understand how your application behaves in certain circumstances and where it is most brittle. These observations can help you diagnose and work around degradations in periods of instability.
The Heroku add-on marketplace includes many services that consume, store and provide instrumention against your application’s log stream. By logging interesting events, like successful credit card signups, you can use these log services to alert you of unusual activity. When problems do arise they also simplify debugging by allowing you to search the history of your log events.
Papertrail is an example of such a service that provides alerting based on patterns in your log data. Setup a search alert for errors & events within your app and integrate with Librato, PagerDuty, and Campfire. The search alert can be for Heroku error codes or interesting events in your app.