In my previous post on How to Keep Heroku Apps Awake with Google Apps Script I detail the steps to creating a simple “ping” mechanism using Google Apps Script to keep your Heroku App Awake.
Since then, I think Heroku might of started to block this method of keeping a Heroku app awake. I’ve been witnessing many failure notices from Google App Scripts notification. So with is in mind I suggest using the New Relic Heroku Standard Plan add-on for your app. The add-on will ping your app every 30 seconds and also provide you performance monitoring. Despite being more complicated than the approach I’ve outlined previously, it is fairly straight forward.
Heroku Web Interface
- After logging into your Heroku Dashboard, select the Resources link of the app you want to add the New Relic Standard Add-on.
- In the Add-ons section, select the Get Add-ons link and search for New Relic. Select the New Relic search result.
- Make sure you select the Standard plan.
- Select the app you want start monitoring and then select the Add Standard for Free button.
- Then New Relic will walk you through the process of signing up if you don’t have a New Relic account.
- After that it’s a pretty straight forward six step process:
- Choose your language
- Generate your license key
gem 'newrelic_rpm'to your Gemfile and from your application directory run
- Download the newrelic.yml into your app’s config directory. Update the app_name value in the newrelic.yml file.
- Deploy your application
- Wait 5 minutes to see data
Heroku Toolbelt CLI
- Go to the root of your application.
heroku addons:add newrelic:standard
- Open the New Relic interface
heroku addons:open newrelic
- Then follow the instructions starting with step 6 of the Heroku Web Interface.
In order to start the pinging, you need to then enable the availability monitoring feature. Select your application and under the Settings -> Availability monitoring tab, enable availability monitoring and enter the URL of your application. Leave everthing else to the defaults and select the Save your changes button. Make sure you also enter your email address for downtime notifications and also select the Save the notification email button.
There you have it, now you have a fully “sanctioned” way to keep your Heroku app awake and you get performance monitoring to boot. Win-Win.