Building A SaaS with CoreOS, Docker, and Etcd

29
@RossKukulinski Building a SaaS with CoreOS and etcd CoreOS Fest May 4, 2015

Transcript of Building A SaaS with CoreOS, Docker, and Etcd

Page 1: Building A SaaS with CoreOS, Docker, and Etcd

@RossKukulinski

Building a SaaS with CoreOS and etcd

CoreOS Fest May 4, 2015

Page 2: Building A SaaS with CoreOS, Docker, and Etcd

@RossKukulinski

Ross Kukulinski Yodlr Founder / CEO

BayNode Co-Organizer

iojs/nodejs Evangelist

Soccer Fanatic

[email protected]

Page 3: Building A SaaS with CoreOS, Docker, and Etcd
Page 4: Building A SaaS with CoreOS, Docker, and Etcd

@RossKukulinski

The internal tool that wasn’t internal anymore

Page 5: Building A SaaS with CoreOS, Docker, and Etcd

@RossKukulinski

Our Goals• Reduce application complexity

• A/B test multiple versions of apps

• Consistent app from dev → test → staging → prod

• Scalable

• Fault tolerant

• Minimize time spent doing ‘devops’

Page 6: Building A SaaS with CoreOS, Docker, and Etcd

@RossKukulinski

Docker

Page 7: Building A SaaS with CoreOS, Docker, and Etcd

@RossKukulinski

Our Goals• Reduce application complexity

• A/B test multiple versions of apps

• Consistent app from dev → test → staging → prod

• Scalable

• Fault tolerant

• Minimize time spent doing ‘devops’

Page 8: Building A SaaS with CoreOS, Docker, and Etcd

@RossKukulinski

How do you ship Docker containers?

Page 9: Building A SaaS with CoreOS, Docker, and Etcd

@RossKukulinski

Linux for Massive Server Deployments

Page 10: Building A SaaS with CoreOS, Docker, and Etcd

@RossKukulinski

Goals• Reduce application complexity

• Run multiple versions of the same app

• Consistent app from dev → test → staging → prod

• Scalable

• Fault tolerant

• Minimize time spent doing ‘devops’

Page 11: Building A SaaS with CoreOS, Docker, and Etcd

@RossKukulinski

After further deliberation, we’re going big and switching to CoreOS/Docker entirely. We feel its the right direction long-term for us and application development in general.

- Me, internal memo September 2014

Page 13: Building A SaaS with CoreOS, Docker, and Etcd

@RossKukulinski

1. etcd is a databaseSo treat it like one

Page 14: Building A SaaS with CoreOS, Docker, and Etcd

@RossKukulinskiImage: CoreOS.com

Give etcd space

Page 15: Building A SaaS with CoreOS, Docker, and Etcd

@RossKukulinski

2. etcd is a databaseFor your real-time infrastructure state

Page 16: Building A SaaS with CoreOS, Docker, and Etcd

@RossKukulinski

Service Availability

REST API microservice Sidekick

Sidekick Pattern: 1. Get ip:port of microservice (docker inspect) 2. Health checks (containerized integration tests) 3. Publish service instance details to etcd

etcd1 & 2 3

Page 17: Building A SaaS with CoreOS, Docker, and Etcd

@RossKukulinski

Service Discovery

haproxy confd

Confd: 1. Query etcd for ip:port of upstream services 2. Update configuration from template 3. Reload load balancer process

etcd

github.com/kelseyhightower/confd

2 & 3 1

Page 18: Building A SaaS with CoreOS, Docker, and Etcd

@RossKukulinski

Dynamic external services

DNS & Cloud Load Balancers

lb-config

lb-config: 1. Query etcd for domain/ip:port of internal lbs 2. Update DNS & external load balancers

etcd12

github.com/yodlr/rax-lb-config

Page 19: Building A SaaS with CoreOS, Docker, and Etcd

@RossKukulinski

3.

Page 20: Building A SaaS with CoreOS, Docker, and Etcd

@RossKukulinski

3. etcd is a databaseWith super important data: Protect it!

PSA: $private_ipv4 is probably not what you think it is

Page 21: Building A SaaS with CoreOS, Docker, and Etcd

@RossKukulinski

4. Sometimes you just need a GUI(Docker & CoreOS do have awesome CLI tools though)

Page 22: Building A SaaS with CoreOS, Docker, and Etcd

github.com/yodlr/CoreGI

Also check out purpleworks/fleet-ui

Page 23: Building A SaaS with CoreOS, Docker, and Etcd

@RossKukulinski

5. Fleet unit templates aren’t enough

[email protected] rest-api@{1..3}.service —> 3 instances of the service

Page 24: Building A SaaS with CoreOS, Docker, and Etcd

@RossKukulinski

rest-api-{{env}}-{{tag}}@.service

github.com/yodlr/fleet-templater

Page 25: Building A SaaS with CoreOS, Docker, and Etcd

@RossKukulinski

[email protected]

github.com/yodlr/fleet-templater

Page 26: Building A SaaS with CoreOS, Docker, and Etcd

@RossKukulinski

App deploys before

Kubernetes

Page 27: Building A SaaS with CoreOS, Docker, and Etcd

@RossKukulinski

Rolling Deploys as a Service

github.com/yodlr/fleet-rolling-deploys

Page 28: Building A SaaS with CoreOS, Docker, and Etcd

@RossKukulinski

Closing thoughts• Containers are awesome

• We <3 CoreOS

• You can get really far with fleet & etcd

• Kubernetes is so close to primetime

• Remember: etcd is a database, treat it like one

Page 29: Building A SaaS with CoreOS, Docker, and Etcd

@RossKukulinski

Thanks!

[email protected]