« Back to home

How to setup growl notifications for Beanstalk Deployments

UPDATE: This post is out of date, please check out How to setup growl notifications for Beanstalk Deployments [Updated]

So recently I started playing around with git and pre/post-deployment hooks on Beanstalk (10% off through that link). I have used Beanstalk in the past through work but never really dove into all of it's features. Beanstalk, for those of you who don't know, is SVN and GIT repository hosting but it also supports deployments which allow you to easily push code to your servers via FTP/SFTP or SSH commands that it will run on your remote server. I used SSH for deployment because I wanted to just run "git pull" on the remote server.

I had everything set up, branches for dev/staging/live and deployments set up for each so that just by pushing to a certain branch my code would get deployed but I still had the problem of not knowing WHEN my code finishes deploying. In the past I had always had a SSH window open that I would run "svn up"/"git pull" on the server whenever I committed code but using Beanstalk's deployments seemed so much more efficient and "clean".

My first thought was Growl. I had used growl in the past before to alert me so that I could allow things to run quietly in the background. Most recently I edited the Titanium Mobile (Cross-platform mobile apps built on JS/CSS/HTML) build scripts so that when the app was deployed to either TestFlight (Must have for iOS developers) or installed on my android test phone via adb it would throw a growl notification. This allowed me to hit "build" and go work on something else instead of watching the output window for Titanium.

So I set off to find something that would work for Beanstalk and Growl. I remembered reading/testing out a global notification "service" that had a mac client that piped the notifications through growl and soon found notify.io. The problem was/is that notify.io seems to be hosted on GAE and it was/is always "Over Quota" (I think it is running on a free tier or something like that). Notify.io had a mac client called NIO but NIO doesn't seem to like my version of Growl (App Store Version) as it keeps asking me to install growl. Also NIO must have the servers it talks to hardcoded so even if I could get a copy of notify.io running (It's open source) I couldn't point NIO to my instance of it. (Yes I understand that I could modify the NIO source as I had access to it but that was more that I really wanted to do to get this working)

I was back to square one. I briefly considered writing a small program that queried one of my servers and just passed messages via "growlnotify" but I wanted more of a "push" than a "pull/polling" setup. I then stumbled on http://notifo.com/. It was targeted for mobile devices but it had a desktop client and an API so I thought I had finally found what I was looking for. Unfortunately their mac client doesn't work with the version of growl I have installed either (App Store Version) so once again I had struck out.

I then saw boxcar, I had used boxcar with varying degrees of success on my iPhone but it did have a mac client, an API, and growl integration. I would suggest that anyone that uses boxcar on their phone (Or anywhere for that matter) create a new account just for Beanstalk so that those updates only get pushed to the mac client and don't clog up your phone. Once I had the client installed I downloaded their PHP API from github and threw it up on my server. NOTE: The api provided by Boxcar (Official API) is outdated and hashes the email address which the current API does not support so I linked to my fork of the project (I have attempted a pull request). Now copy this code into blank php file named beanstalk-hooks.php and edit the needed lines. Lastly go to your beanstalk deployment server and at the bottom you can set the hooks. For the urls: http://your-server.com/path/to/beanstalk-hooks.php?pre AND http://your-server.com/path/to/beanstalk-hooks.php?post. It's that easy.

Now if you have done everything correctly you will see growl notifications when your deployment starts and ends.