Shipping NodeJS with Docker and CoreOS (No Notes)

33
@RossKukulinski Shipping NodeJS with Docker and CoreOS BayNode Talk Night November 20, 2014

description

These are my slides from the November BayNode Talk Night. I spoke about our experience moving our NodeJS architecture to Docker and CoreOS as well as some tips/tricks we've learned along the way.

Transcript of Shipping NodeJS with Docker and CoreOS (No Notes)

Page 1: Shipping NodeJS with Docker and CoreOS (No Notes)

@RossKukulinski

Shipping NodeJS with Docker and CoreOS

BayNode Talk Night November 20, 2014

Page 2: Shipping NodeJS with Docker and CoreOS (No Notes)

@RossKukulinski

@RossKukulinski

SpeakIt.io Founder

BayNode Co-Organizer

Soccer Fanatic

Node-Forward Mentor

Page 3: Shipping NodeJS with Docker and CoreOS (No Notes)

@RossKukulinski

What I’m going to Cover

• Our Story

• Background on Docker & CoreOS

• Tips & Tricks / Lessons Learned

Page 4: Shipping NodeJS with Docker and CoreOS (No Notes)
Page 5: Shipping NodeJS with Docker and CoreOS (No Notes)

@RossKukulinski

The internal tool that wasn’t internal anymore

Page 6: Shipping NodeJS with Docker and CoreOS (No Notes)

@RossKukulinski

Page 7: Shipping NodeJS with Docker and CoreOS (No Notes)

@RossKukulinski

12factor.net

Page 8: Shipping NodeJS with Docker and CoreOS (No Notes)

@RossKukulinski

Our Goals• Reduce application complexity (do one thing well!)

• Scalable

• Fault tolerant

• Support running multiple versions of the same app

• Consistent app from dev → test → staging → prod

• Minimize time spent doing ‘devops’

Page 9: Shipping NodeJS with Docker and CoreOS (No Notes)

@RossKukulinski

Docker

Page 10: Shipping NodeJS with Docker and CoreOS (No Notes)

@RossKukulinski

VM vs Docker

https://docker.com/whatisdocker/

Page 11: Shipping NodeJS with Docker and CoreOS (No Notes)

@RossKukulinski

• Containers start quickly

• Containers have small footprint

• Dockerized applications run anywhere

• Really fast builds via cached images

• Registry for storing images from build pipeline

• Images can be layered

• Abstracts app networking from system networking

Page 12: Shipping NodeJS with Docker and CoreOS (No Notes)

@RossKukulinski

Our Goals• Reduce application complexity (do one thing well!)

• Scalable

• Fault tolerant

• Run multiple versions of the same app

• Consistent app from dev → test → staging → prod

• Minimize time spent doing ‘devops’

Page 13: Shipping NodeJS with Docker and CoreOS (No Notes)

@RossKukulinski

How do you ship docker containers?

Bash scripts (ugh) Ansible / Puppet / Chef

Page 14: Shipping NodeJS with Docker and CoreOS (No Notes)

@RossKukulinski

Linux for Massive Server Deployments

Page 15: Shipping NodeJS with Docker and CoreOS (No Notes)

@RossKukulinski

• Minimal Operating System

• Automated software updates

• Runs docker containers

• Supported by all major cloud providers

• Can also run on bare metal

https://coreos.com/

Page 16: Shipping NodeJS with Docker and CoreOS (No Notes)

@RossKukulinski

Fault Tolerant

• Clustered by default

• Support for multiple HA zones

• Distributed tools like etcd & fleet

• HTTP Key-Value Store

• Service Discovery

• Application Scheduling

https://coreos.com/

Page 17: Shipping NodeJS with Docker and CoreOS (No Notes)

@RossKukulinski

Scalable

https://coreos.com/

Page 18: Shipping NodeJS with Docker and CoreOS (No Notes)

@RossKukulinski

Goals• Reduce application complexity (do one thing well!)

• Scalable

• Fault tolerant

• Run multiple versions of the same app

• Consistent app from dev → test → staging → prod

• Minimize time spent doing ‘devops’

Page 19: Shipping NodeJS with Docker and CoreOS (No Notes)

@RossKukulinski

Now for the good stuffLessons Learned / Tips & Tricks

Page 20: Shipping NodeJS with Docker and CoreOS (No Notes)

@RossKukulinski

Docker Registry• Public Registry

• Private Registry

• Quay.io / DockerHub

• Run your own

• Take advantage of layering docker images

Page 21: Shipping NodeJS with Docker and CoreOS (No Notes)

@RossKukulinski

speakit/nodejs

Page 22: Shipping NodeJS with Docker and CoreOS (No Notes)

@RossKukulinski

Node App Dockerfile

Page 23: Shipping NodeJS with Docker and CoreOS (No Notes)

@RossKukulinski

Private GitHub Repos

Page 24: Shipping NodeJS with Docker and CoreOS (No Notes)

@RossKukulinski

> docker pull image:latest

Page 25: Shipping NodeJS with Docker and CoreOS (No Notes)

@RossKukulinski

Local CoreOS Dev

• Can use Vagrant with a single (or multi) node cluster

• Digital Ocean pretty cheap for small cluster

Page 26: Shipping NodeJS with Docker and CoreOS (No Notes)

@RossKukulinski

Monitoring

• CLI tools (fleetctl via ssh)

• CoreGI (github.com/astilabs/CoreGI)

• cAdvisor (github.com/google/cadvisor)

Page 27: Shipping NodeJS with Docker and CoreOS (No Notes)

@RossKukulinski

Service Discovery• Don’t hardcode the

host port of your container

• Sidekick pattern -> Write to etcd

• Confd (github.com/kelseyhightower/confd)

• Vulcan (vulcanproxy.com)

https://coreos.com/

Page 28: Shipping NodeJS with Docker and CoreOS (No Notes)

@RossKukulinski

Cloud Load Balancers

• How do your users access services in CoreOS?

• Could run Global service with proxy on 80/443

• Or update cloud lbs dynamically based on etcd

• Soon: github.com/astilabs/CoreOS-Cloud-LB

Page 29: Shipping NodeJS with Docker and CoreOS (No Notes)

@RossKukulinski

npm install -g coreos-cluser-cli

Page 30: Shipping NodeJS with Docker and CoreOS (No Notes)

@RossKukulinski

Things to watch• Kubernetes

• Google Container Engine

• Vulcan Proxy

• Paz (paz.sh)

• Panamax (panamax.io)

• Mesosphere (mesosphere.com)

Page 31: Shipping NodeJS with Docker and CoreOS (No Notes)

@RossKukulinski

Resources• Example cloud_config

• https://gist.github.com/rosskukulinski/9ddff8e5f67a24cc7bb7

• Full example of sidekick pattern for Redis • https://gist.github.com/rosskukulinski/

96f7709fa20d7def6b9e

• PXE Booting CoreOS Post coming soon…

Page 32: Shipping NodeJS with Docker and CoreOS (No Notes)

@RossKukulinski

Other Resources• CoreOS Docs: https://coreos.com/docs/

• CoreOS User Google Group

• #coreos & #docker on FreeNode (I’m ‘rossk’)

• SpeakIt GitHub (https://github.com/astilabs)

• SpeakIt Blog (https://blog.speakit.io)

Page 33: Shipping NodeJS with Docker and CoreOS (No Notes)

@RossKukulinski

Thanks!Questions?