Blogging for America

Extreme Heroku: A Polyglot PaaS Civic Application!

Code for America fellows are presented with a unique and fun challenge: Create innovative web applications using bleeding edge technologies that cities can eventually host themselves.

The issue there is often the “bleeding edge” part of that equation can be a bit painful for cities and other organizations that don’t have Ruby, Python, Javascript, Amazon Web Services, or similar technology expertise on staff. Platform as a Service (PaaS) solutions like Heroku help make delivering web apps a little simpler because potential worries like server maintenance, deployment schemes, and scaling strategy are eliminated or reduced.

However, PaaS solutions can be, at least at first glance, a bit restrictive. Questions arise about how to run long lived processes, communicate between disparate yet related applications, and share resources such as databases. I started to explore these issues recently on Heroku in a far more critical way than I have before. I decided to attempt to architect a contrived application that:

  • Uses a Python application to capture all tweets in a geo-bounded box (drawn over Chicago)
  • Uses a Node.js application to display all of the tweets the Python application captures, in real time, on a map, to connected browsers with Socket.io
  • Uses redis pub/sub to allow communication between the Python and Node apps
  • Uses TileMill custom tiles and MapBox tile hosting with leaflet/wax to render and display the map
  • Runs worry free on Heroku

I figured this would be a fun way to explore Heroku and, at the very least, a fun visualization. What I ended up with is Civiz!

Civiz

Civiz Application on Heroku

You can learn all about how Civiz was created and how to make your own version and host it for free on Heroku by going to the Civiz github repo. My current opinion is that there are a lot of elegant and creative ways to avoid the limitations of PaaS vendors like Heroku and deploy infinitely scalable, less troublesome applications. PaaS solutions are not a magic bullet – the issues I encountered while working on this project could fill a few more blog posts! But, web apps delivered on PaaS solutions can potentially mean less headaches for clients and, importantly for CfA fellows, less headaches for our city partners! Have fun out there and make awesome things!

Code for America Labs, Inc is a non-partisan, non-political 501(c)(3) organization. Content is licensed through Creative Commons.