Using Node.js module with Drupal 7 and Heroku

Drupal, Node, and Heroku

I've recently needed to run a Node.js service alongside a Drupal 7 site to allow for a live-chat style of commenting. None of the current ecosystem of Drupal-integrated chat modules looked good for this particular website, but by greatly simplifying the comments UI and displaying it alongside a live video broadcast, we got something pretty good. Originally, I configured a nodejs service on the main Drupal web head, and while it worked for the first broadcast, I frankly don't have the devops chops to feel comfortable keeping that up and running long term, so it was time to look at running it elsewhere.

Heroku makes this sort of thing pretty easy, I've heard many times, and based on my experience so far, it's true! Amitai Burstein wrote a post detailing how to get this set up with Heroku and Pantheon a few years ago, and his steps still work for the most part. So I'll refer you to his article for the full scoop, with one caveat: his starter project is several years out of date and needed a little love. I'll be sending him a pull request to integrate the latest, but until then you can get a NodeJS and Drupal 7 starter project from me on Github. You can clone it, or just download a copy.

Heroku supports web sockets now (as of the original article, apparently they didn't), and I'll be testing that later, but for now everything seems to work nicely. If you want to see this system in action, check out the Live Training section on PhotoApps.Expert and watch for the next upcoming live broadcast.

Comments are closed on this post to keep spammers at bay. If you want to chime in, please email or send a tweet.