Recently, I developed a web application for my friend Alex Miller’s conference, Strange Loop. The app accepted talk submissions and gathered votes on those submissions to rank the top ones. I hosted the application on Heroku’s node.js beta preview and used a free CouchOne instance for the data store. Although I encountered some difficulties, I learned some important lessons that I thought I’d share.

  • Tag your last successful Heroku deployment. While adding one additional feature to the site, the app worked fine on my laptop but failed on Heroku for reasons I couldn’t figure out for quite some time. I had to manually check out the date of the last successful deployment, branch, and push to reset it back. Tagging would have made this easier. This also leads to my next lesson learned.
  • Create a staging Heroku instance. This helps catch errors arising from differences that might exist between your local machine and Heroku. After the mishap mentioned previously, all my deployments included deploying to staging first just to make sure there were no odd inconsistencies before pushing live.
  • Specifying different environments, such as staging and production, is an important part of developing and deploying a web application. By using the NODE_ENV environment variable, you can easily configure your app to use different resources in different environments, catch errors and inconsistencies before deploying to production, and develop, test, and deploy your app more effectively and with greater confidence.
  • Replicate your CouchOne instance. In the 11th hour, my main CouchOne instance crashed. To make matters worse, the person who could fix the instance was on an international flight and wouldn’t be able to help until morning. Although it was a rare case, simply replicating my databases would have made it easy and painless to recover and work around the instance being down. Plus, it only takes one minute.

As an avid user of node.js, I have had the opportunity to try out various hosting platforms. While Heroku is a decent option for hosting node.js applications, I must admit that my experience with Joyent during the Node Knockout was much more enjoyable. That being said, I am willing to give Heroku another chance and see how its support for node.js develops over time. As of right now, I have no major complaints and it continues to be a viable option for hosting my node.js projects.

comments powered by Disqus