Recording GitHub Repo push as NewRelic Deployment

NewRelic Deployments feature allows you to determine if the a certain change in the codes of your application negatively/positively impacts the actual performance of your web apps

Posted by Darwin Biler on March 22, 2015

NewRelic Deployments feature allows you to determine if the a certain change in the codes of your application negatively/positively impacts the actual performance of your web apps.

For example, when you go to the APM dashboard of NewRelic Admin. It shows a line like the one below that clearly plots the time when a change was been deployed. Screen Shot 2015-03-22 at 9.21.38 PM

You can then easily see in the charts if there is a sudden change in the pattern of memory/CPU/disk usage of the web application -- real time!

In the deployment page, you can also perform comparison of all deployments, so you can figure out the relative performance of the app, before and after the code change was implemented.
Screen Shot 2015-03-22 at 9.20.41 PM

If you are using GitHub to manage your source codes. You can put a webhook in the repository settings, so that each time a developer pushes a change into the repository, it will submit a deployment in the NewRelic.

First, you need to download the script that will be receiving the Github Hook.

via Composer


composer create-project buonzz/github-newrelic-deploy hooks
cd hooks

or direct download in here

edit the config.sample.php and rename it to config.php.
Then to adjust your configuration settings.

$apikey - should be the REST Api key for NewRelic, it is required so that NewRelic api could accept the post from your script. Here is the instruction on how you can get this value in NewRelic Admin.

$app_ids - is an array which associates your GitHub urls to your NewRelic APM AppID.
You can get this by logging into NewRelic. Go to APM. Then click the application. The last number in the url when you are currently viewing the application is the AppID.
example: https://rpm.newrelic.com/accounts//applications/

Once you had added it to the config those information. You can then upload the whole folder to a publicly accessible web server. After you had uploaded it. make sure the logs folder is writable by web server (execute chmod -R 777 logs).

Once all is set, go to the settings of your Github Repository.
In the Webhook and Services settings. Add the url to the script you had uploaded earlier under the Webhooks settings.

Once done, each time someone pushes their commits into that repository, a deployment will be sent to NewRelic.


Did you find this useful?

I'm always happy to help! You can show your support and appreciation by Buying me a coffee (I love coffee!).