Node.js Talk at Klout, 2012
Chris Bumgardner
At "Beyond the Closed Beta, Node.js from code to production (at scale)"
Node.js ++ (Serverside Javascripters) Club SF
• We have 3 environments: 2 dev and 1 production. • Environment is top-level namespace (‘dev’, ‘production’, etc) for everything, including db. Keeps worlds from colliding. • Makes life easy Friday, April 20, 12
the MongoDB transport. • MongoDB logging: fast writes; pass json objs in log msgs; easy ad-hoc queries; easy lru via capped collections. • Client logging from browser: caught and logged to Google Analytics as custom event. Easy monitoring/aggregation. Friday, April 20, 12
to github • Post-Receive service hook. Github POSTs to us after a push. • CI will pull code if it’s the right branch (say ‘staging’), restart, and send SMS. • Easy and low touch. Texts from your node are nice. • Refactoring into a more modular/decoupled hook.io system. Friday, April 20, 12
Watches all files in project and restarts node if anything changes. • Great with persistent sessions, test changes immediately. • In production: use ‘forever’ to start server as daemon. Restarts node automatically if it crashes. Runs in background. Nice CLI. Manages stdout/stderr logs. Tracks multiple processes. Friday, April 20, 12
npm, and dependent module versions. You don’t want to push a change to production and have npm barf. No bueno. • Keep them the same on all machines. • Use npm in development. • In production I recommend bundling/controlling the deps and versions explicitly. Friday, April 20, 12
• Joyent has great video on profiling with dtrace. • ‘nodetime’ module: great in development, but my server got hosed when I tried it in production. Probably user error. Friday, April 20, 12