Presentation Prep (sorry, macs
only…)
Follow the instructions here:
https://github.com/pfremm/kube-demo
References:
We will be playing a cloned Facebook React todo application:
https://github.com/williamsbg03/todomvc
https://hub.docker.com/r/williamsbg03/todomvc/
Highly Available Node.js
Bryan Pfremmer / Brad Williams
April 4th, 2016
March 25, 2015
The Goal
Integrate the distinct LearnVest digital client experience with
Northwestern Mutual’s financial planning and products.
• In the cloud, highly available
• Lightweight web runtimes with
latest modern frameworks
• Automated infrastructure
• Application and infrastructure
design built for failure
• Single data center with many
maintenance windows
• Heavy server runtimes for large
batch consumption
• Classic infrastructure builds
• Application and infrastructure
design built to try to prevent
failure
The Key Principle
Be Available
Brett Favre
9/27/1992 - 12/5/2010
100% Availability
http://dailysnark.com/wp-content/uploads/2016/04/131.jpg
• Split your application into small
services that can be reused,
remixed and shared.
• Enables smaller, nimble,
decoupled teams and processes.
• Lightweight runtime, starts in
seconds
• Stateless and backwards
compatible.
Microservices
http://martinfowler.com/articles/microservices.html
http://slides.eightypercent.net/kubernetes-101/kubernetes-101.html#7
• Modules cannot be blocking, we are looking for async I/O
• Module pattern encourages lightweight packages with small footprint
• Seconds to initialize
• Excellent performance
• Express.js, async, bunyan, mysql, body-parser, config, memwatch-
next, underscore, and util
Node.js
• Log important activities and errors (bunyan, winston, log4js)
• Handle SIGTERM for graceful shutdown
• Select and review NPM modules carefully
• Lock down NPM dependencies (shrinkwrap)
• Test, Test, Test (supertest, proxyquire)
• NODE_ENV = production
Node.js Production Considerations
The number of deployable artifacts increase to the point at which
automated testing, building, deploying, and monitoring becomes
essential.
But, they come at a cost…
http://techblog.netflix.com/2013/01/announcing-ribbon-tying-netflix-mid.html
How do we make microservices easier to build and deploy?
Wrap up a piece of software in a complete filesystem that contains
everything it needs to run.
• Guaranteed to always run the same,
regardless of the environment
• Start/stop almost instantly
• Efficient use of system resources
• Portable
• Easy to configure
Containers
https://www.docker.com/what-docker
Provides an implementation of containers that is actively used in the
software community. Docker illustrates how containers differ from the
traditional VM hypervisor.
Docker
https://www.docker.com/what-docker
A sea of containers…
While containers provide us with a stable build and deploy platform, we still
have many artifacts to deploy and maintain.
Kubernetes
An open-source system for automating deployment, operations, and scaling
of containerized applications.
• Ensures containers stay running
• Abstracts port managements away from the developer
• Schedules containers based on cluster health metrics
• Provides lightweight deployment and horizontal scaling
• Stores application configuration and secrets outside the container
• Deploy a set of grouped containers as a single deployable unit
Kubernetes Architecture
http://kubernetes.io
We are ready to run, but where?
With a solid application framework we can scale our application quite easily.
Without the same capability in our infrastructure we are going nowhere fast.
Automated & Immutable Infrastructure
Public cloud providers provide APIs to create infrastructure of all types. By
leveraging infrastructure as code tools we can script our entire environment.
Guidelines to code by:
• No manual changes
• Replace containers, VM’s instead of fixing them
• Rebuilds and re-deploys should take minutes
• Goal is idempotent scripts. Rerun to ensure a known working state.
Demo
Tech Stack
Lessons Learned
• Architect for failure
• Tag your releases for prod, run current development in non-production
• Different purchasing considerations for vendor tools when you need to
orchestrate its install and configuration
• Orchestration can make security easier
Thank You

Highly available nodejs

  • 1.
    Presentation Prep (sorry,macs only…) Follow the instructions here: https://github.com/pfremm/kube-demo References: We will be playing a cloned Facebook React todo application: https://github.com/williamsbg03/todomvc https://hub.docker.com/r/williamsbg03/todomvc/
  • 2.
    Highly Available Node.js BryanPfremmer / Brad Williams April 4th, 2016
  • 3.
  • 4.
    The Goal Integrate thedistinct LearnVest digital client experience with Northwestern Mutual’s financial planning and products.
  • 5.
    • In thecloud, highly available • Lightweight web runtimes with latest modern frameworks • Automated infrastructure • Application and infrastructure design built for failure • Single data center with many maintenance windows • Heavy server runtimes for large batch consumption • Classic infrastructure builds • Application and infrastructure design built to try to prevent failure
  • 6.
    The Key Principle BeAvailable Brett Favre 9/27/1992 - 12/5/2010 100% Availability http://dailysnark.com/wp-content/uploads/2016/04/131.jpg
  • 7.
    • Split yourapplication into small services that can be reused, remixed and shared. • Enables smaller, nimble, decoupled teams and processes. • Lightweight runtime, starts in seconds • Stateless and backwards compatible. Microservices http://martinfowler.com/articles/microservices.html http://slides.eightypercent.net/kubernetes-101/kubernetes-101.html#7
  • 8.
    • Modules cannotbe blocking, we are looking for async I/O • Module pattern encourages lightweight packages with small footprint • Seconds to initialize • Excellent performance • Express.js, async, bunyan, mysql, body-parser, config, memwatch- next, underscore, and util Node.js
  • 9.
    • Log importantactivities and errors (bunyan, winston, log4js) • Handle SIGTERM for graceful shutdown • Select and review NPM modules carefully • Lock down NPM dependencies (shrinkwrap) • Test, Test, Test (supertest, proxyquire) • NODE_ENV = production Node.js Production Considerations
  • 10.
    The number ofdeployable artifacts increase to the point at which automated testing, building, deploying, and monitoring becomes essential. But, they come at a cost… http://techblog.netflix.com/2013/01/announcing-ribbon-tying-netflix-mid.html How do we make microservices easier to build and deploy?
  • 11.
    Wrap up apiece of software in a complete filesystem that contains everything it needs to run. • Guaranteed to always run the same, regardless of the environment • Start/stop almost instantly • Efficient use of system resources • Portable • Easy to configure Containers https://www.docker.com/what-docker
  • 12.
    Provides an implementationof containers that is actively used in the software community. Docker illustrates how containers differ from the traditional VM hypervisor. Docker https://www.docker.com/what-docker
  • 13.
    A sea ofcontainers… While containers provide us with a stable build and deploy platform, we still have many artifacts to deploy and maintain.
  • 14.
    Kubernetes An open-source systemfor automating deployment, operations, and scaling of containerized applications. • Ensures containers stay running • Abstracts port managements away from the developer • Schedules containers based on cluster health metrics • Provides lightweight deployment and horizontal scaling • Stores application configuration and secrets outside the container • Deploy a set of grouped containers as a single deployable unit
  • 15.
  • 16.
    We are readyto run, but where? With a solid application framework we can scale our application quite easily. Without the same capability in our infrastructure we are going nowhere fast.
  • 17.
    Automated & ImmutableInfrastructure Public cloud providers provide APIs to create infrastructure of all types. By leveraging infrastructure as code tools we can script our entire environment. Guidelines to code by: • No manual changes • Replace containers, VM’s instead of fixing them • Rebuilds and re-deploys should take minutes • Goal is idempotent scripts. Rerun to ensure a known working state.
  • 18.
  • 19.
  • 20.
    Lessons Learned • Architectfor failure • Tag your releases for prod, run current development in non-production • Different purchasing considerations for vendor tools when you need to orchestrate its install and configuration • Orchestration can make security easier
  • 21.