Add New Relic performance monitoring to the Ghost blogging platform

I love New Relic. It's one of the best performance monitoring tools I have ever used, so when I saw they added support for node.js I decided I had to see if I could integrate it into my Ghost blog.

This guide assumes that you know how to deploy the Ghost blogging platform by yourself. If you don't there are several guides available, for example this one by Scott Hanselman on how to get it up and running on Windows Azure.

Turns out adding New Relic to Ghost was rather easy.

  1. First of all, sign up for New Relic.
  2. Then go to the root of your Ghost installation and execute npm install newrelic.
  3. Once that is done, execute copy node_modules\newrelic\newrelic.js . or use your preferred method to copy the newrelic.js file to the website root.
  4. Open newrelic.js and fill in the appropriate app_name and license_key values.
  5. If you are not running on Windows Azure, just skip this step. If running on Azure, go to the Azure Management Portal, then go to Websites -> [YourWebSiteName] -> Configure and scroll down to App Settings and add the keys NEW_RELIC_APP_NAME and NEW_RELIC_LICENSE_KEY and add the corresponding values like you entered into the newrelic.js file.
  6. Open your index.js file and add var NewRelic = require('newrelic'); to the very top of the file.

Now commit and publish your changes and you should see performance data flowing into New Relic within minutes.

Hope this helps.