How to setup growl notifications for Beanstalk Deployments [Updated]

A few months ago I wrote a blog post on How to setup growl notifications for Beanstalk Deployments using boxcar and a small script to call out to the API. Since then I have found boxcar to not be to optimal solution so here is the updated way to setup growl notifications for Beanstalk. There are 3 main components to this project: PusherApp, Heroku, and MacGap. This post will walk you through each step to set this up on your own system. This also provides you with an easy way to send Growl notifications to your computer for any reason. Lets get started!

Step one: Install MacGap on your Mac. MacGap is a lightweight wrapper around webkit that exposes some system functions through its javascript library. To install it just open up Terminal and run the following command:

gem install macgap

Step two: Signup for [Heroku](https://api.heroku.com/signup) (It’s free and very easy) and signup for a free API account with [PusherApp](http://pusher.com/)

Step three: Install the Heroku Toolbelt on your computer

Step four: Login to your PusherApp account and click the “+ Add new App” Button, name your app and leave the 2 checkboxes unchecked, then click “Create App”

Step five: Go into the dashboard for your App and click on “API Access” in the top blue bar. Here you will find all your keys that you will need in later steps

Step six: Clone this repo and this repo down to your computer make sure you clone both of them into the same parent folder to make the rest of this tutorial easier

Step seven: Edit both BSGrowler/index.html and node-beanstalk-pusherapp/server.js to use your application keys/secret keys/app id

Step eight: Open terminal and ‘cd’ to the parent directory you created in step seven

cd /path/to/parent

Step nine: Run the following command to build BSGrowler and once it has run move the BSGrowler.app file into your Applications folder and run it. When it launches it will disappear almost immediately and only be visible in your dock

macgap build BSGrowler

Step ten: Now ‘cd’ into the node-beanstalk-pusherapp folder and run the following commands. After you push the code Heroku should return a URL that you can access your app at. Look for something like this “http://stormy-meadow-XXXX.herokuapp.com deployed to Heroku”

cd node-beanstalk-pusherapp
heroku login
git init
git add .
git commit -m "init"
heroku create --stack cedar
git push heroku master
heroku ps:scale web=1

Step eleven: Visit the URL that Heroku provided in step ten. You should see “Nothing to see here, move along.”, now go to http://YOUR-APP.herokuapp.com/deploy. If you followed all the instructions you should see a growl notification pop up on your screen.

Now all you have to do is add ‘http://YOUR-APP.herokuapp.com/deploy‘ in your beanstalk deployments post-deploy hook and you will get a Growl notification when you code has been deployed to your server.

You can extend this in many ways (Fork me on github – node-beanstalk-pusherapp & BSGrowler) such as actually utilizing the posted JSON data (Read more). This SO question can point you in the right direction for how to build on to our Node.js app to accomplish this. Using the POST data you could change the message so that it told you who pushed the code, when it was pushed, which repo, and more.

I built this because at work I hated having to open up beanstalk in a new tab to check the status on the deployment. This way I just hit commit and wait for the Growl notification. I hope this helps you as well!

Blog at WordPress.com.