Important Bits

Docker for Metrics, Sails.js @ NodeJS Meetup

December 16, 2014

60+ of us met at One Eleven Richmond for 3 presentations and chatting

Using Docker for Metrics Dashboards during development

Mario from 360 incentives put up a blog post expanding on his presentation here

Story time

One time a cache busting mechanism failed, causing 100s of people to not be angle to finish an online course. Unit tests did not pick this up. How to check business value is being delivered? Use metrics!

Metrics are like a long running acceptance test

Use Metrics in Development

  • Not just production
  • Test that you are capturing the right data for logging
  • Having dashboards in dev speeds up feedback cycles

How to do

  • 360 uses statsd, graphite, grafana
  • Manage dashboards like code

    • Push updated dashboard layouts to version control and have them deploy automatically to wherever they are needed
  • Use Docker to distribute production-like environments to developer machines quickly with metrics software installed.
  • Mario wrote scripts to automate spinning up multiple docker images, destroying them, filling up containers with fake data

Docker makes it easy to run the same operational infrastructure (logging, aggregation, dashboards) in production and on every dev’s machine. Then everyone gets visual feedback in the form of graphs faster

Docker Features

  • Docker repos are very lightweight compared to virtual machines

    • 1 physical machine can run hundreds of docker images
  • Containers can be linked to each other over ports and IP addresses
  • Containers can mount parts of real file systems to themselves, like Vagrant
  • Is Docker missing features compared to Vagrant? Who cares! Docker is waaay faster to share and deploy environments with!

BTW, 360 Incentives is 11th fastest growing tech company in Canada. Neato!

Sails.js intro

Lee from OpenCare introduced sails.js

  • Sails adds a ORM, routing features, and more on top of express.js so you write less boilerplate
  • Sails’ ORM ‘waterline’ is DB agnostic, can link objects between different DB’s (Eg. relate a row in a PostgreSQL DB to a document in MongoDB)
  • Opencare uses Sails.js in production with an AngularJS frontend, they are happy with it


  • Waterline does not support populating nested objects. Objects must be created and saved one layer at a time
  • Poor error handling

    • Sails returns 500 internal server error for too many types of errors, even for input validation
    • OpenCare built their own error handler to get around this

AudienceView transitions to Node.js

I had a hard time keeping up with this presentation. Geoff Wells and Corey discussed how they are transitioning their existing, successful product to Node.js.

  • AudienceView has 1.5 million line C++/ASP codebase that they started building 12 years ago, and is still in use today. Time to try Node.js!
  • How to change platforms without disrupting $2 billion in revenue from international customers (stadiums, concert halls, places that people buy tickets to get into)?

Why Node?

  • Existing ASP codebase is written in JS instead of VB
  • Can integrate with C++ backend via Node addons
  • Node.js has a community

Some things built during the transition

  • Node.js addons for communicating with existing C++ code (the backend stuff)
  • An ASP template parser that runs in Node.js so existing web page templates can reused
  • Replace ASP’s session handling with something custom-built
  • Replace ASP’s multithreading with queues


  • An earlier attempt at moving part of the platform to Java has been mostly replaced with Node.js in surprisingly little time. Success!
  • A significant part of ASP web application replaced with Node.js in 250 man days. Big success!

Helpful things

Some decisions made very early on in developing the backend of the product are proving very helpful during the transition

  • Very simple use of DB – no views, no stored procedures, no direct communication between ASP and DB is making transition easier
  • The C++ part of the backend is portable and can run on OS other than Windows
  • Choosing to use JS instead of VB way back means less boring work translating code today

Check out this Meetup →

Adam Sullovey

Written by Adam Sullovey, powered by Gatsby.
Find me on codepen, github, or at Toronto meetups.

tags: javascript, meetup, nodejs