interconnecting containers at scale #dockercon

41
Interconnecting containers at scale with NGINX

Upload: sarahnovotny

Post on 06-Aug-2015

743 views

Category:

Technology


2 download

TRANSCRIPT

Page 1: Interconnecting containers at scale #Dockercon

Interconnecting containers at scale with NGINX

Page 2: Interconnecting containers at scale #Dockercon

@sarahnovotny

#dockercon

Page 3: Interconnecting containers at scale #Dockercon

Building a great applicationis only half the battle, delivering the application is the other half.

Page 4: Interconnecting containers at scale #Dockercon

MORE INFORMATION AT NGINX.COM

Microservices

Page 5: Interconnecting containers at scale #Dockercon

1)

The good things

Page 6: Interconnecting containers at scale #Dockercon

MORE INFORMATION AT NGINX.COM

Microservices + containers

Page 7: Interconnecting containers at scale #Dockercon

The Microservices Architecture:Enables continuous delivery,rapid deployment and elasticity

Page 8: Interconnecting containers at scale #Dockercon

MORE INFORMATION AT NGINX.COM

The Microservices Architecture:To scale, you can scale each service independently

Page 9: Interconnecting containers at scale #Dockercon

MORE INFORMATION AT NGINX.COM

The Microservices Architecture:Services can be written in different languages using different frameworks

Page 10: Interconnecting containers at scale #Dockercon

MORE INFORMATION AT NGINX.COM

Making Changes:Each service can be changed, tested and built independently

Page 11: Interconnecting containers at scale #Dockercon

MORE INFORMATION AT NGINX.COM

Making Changes:Release cycles can be dramatically shortened

Page 12: Interconnecting containers at scale #Dockercon

MORE INFORMATION AT NGINX.COM

Deploying Microservices:To unlock the potential of microservices you must embrace containers, cloud and DevOps

Page 13: Interconnecting containers at scale #Dockercon

2)

The bad things

Page 14: Interconnecting containers at scale #Dockercon

The Microservices Architecture:Services can be written in different languages using different frameworks

Page 15: Interconnecting containers at scale #Dockercon

Making Changes:Release cycles can be dramatically shortened

Page 16: Interconnecting containers at scale #Dockercon

Complexity:To unlock the potential of microservices you must embrace containers, cloud and DevOps

Page 17: Interconnecting containers at scale #Dockercon

MORE INFORMATION AT NGINX.COM

Here be dragons

Page 18: Interconnecting containers at scale #Dockercon

3)How can NGINX help?

Page 19: Interconnecting containers at scale #Dockercon

Performance is user experience.

Page 20: Interconnecting containers at scale #Dockercon

Our users are our community of developers, devops, sysadmins, cloud engineers & network admins

Page 21: Interconnecting containers at scale #Dockercon

NGINX as your stevedores:Acts as a HTTP router inspecting requests and deciding how each one should be satisfied

Page 22: Interconnecting containers at scale #Dockercon

ste·ve·doreˈstēvəˌdôr/nounnoun: stevedore; plural noun: stevedoresa person employed, or a contractor engaged, at a dock to load and unload cargo from ships.

Page 23: Interconnecting containers at scale #Dockercon

The Microservices Architecture

Page 24: Interconnecting containers at scale #Dockercon

The Microservices Architecture

Page 25: Interconnecting containers at scale #Dockercon

Docker orchestrationmany options vying(and then there’s service discovery)

Page 26: Interconnecting containers at scale #Dockercon

2013 --bloody edge2014 --roll your own2015 --lots of options2016 --convergence?

Page 27: Interconnecting containers at scale #Dockercon

MORE INFORMATION AT NGINX.COM

docker-compose

Page 28: Interconnecting containers at scale #Dockercon

MORE INFORMATION AT NGINX.COM

This .yml file builds –

Consul for service discovery

Registrator

tutum/hello-world

Google/golang-hello

& NGINX Plus

Page 29: Interconnecting containers at scale #Dockercon

MORE INFORMATION AT NGINX.COM

$ sarah@ubuntu:~/service-discovery$ more docker-compose.ymlnginx: build: ./nginxplus links: - consul ports: - "9050:80" - "8080:8080"

consul: command: -server -bootstrap -advertise 10.0.2.15 image: progrium/consul:latest ports: - "8300:8300" - "8400:8400" - "8500:8500" - "8600:53/udp”

Page 30: Interconnecting containers at scale #Dockercon

MORE INFORMATION AT NGINX.COM

registrator: command: consul://consul:8500 image: progrium/registrator:latest links: - consul volumes: - "/var/run/docker.sock:/tmp/docker.sock"

service1: image: tutum/hello-world:latest environment: SERVICE_80_NAME: http SERVICE_NAME: service1 SERVICE_TAGS: production ports: - "80"

Page 31: Interconnecting containers at scale #Dockercon

MORE INFORMATION AT NGINX.COM

service2: image: google/golang-hello:latest environment: SERVICE_80_NAME: http SERVICE_NAME: service2 SERVICE_TAGS: production ports: - "8080"sarah@ubuntu:~/service-discovery$

Page 32: Interconnecting containers at scale #Dockercon

MORE INFORMATION AT NGINX.COM

sarah@ubuntu:~/service-discovery$ docker-compose buildconsul uses an image, skippingBuilding nginx...Step 0 : FROM ubuntu:14.04 ---> 6d4946999d4fStep 1 : MAINTAINER NGINX Docker Maintainers "[email protected]" ---> Using cache ---> 339d0f20dc6e

…sarah@ubuntu:~/service-discovery$ docker-compose up -dRecreating servicediscovery_consul_1...Recreating servicediscovery_nginx_1...Recreating servicediscovery_registrator_1...Recreating servicediscovery_service1_6...Recreating servicediscovery_service2_1...sarah@ubuntu:~/service-discovery$

Page 33: Interconnecting containers at scale #Dockercon

MORE INFORMATION AT NGINX.COM

Page 34: Interconnecting containers at scale #Dockercon

MORE INFORMATION AT NGINX.COM

Page 35: Interconnecting containers at scale #Dockercon

MORE INFORMATION AT NGINX.COM

sarah@ubuntu:~/service-discovery/nginxplus$ more nginx.conf{{range services}} {{$name := .Name}} {{range $tag, $service := service .Name | byTag}} {{if eq $tag "production"}}upstream {{$name}} { zone upstream-{{$name}} 64k; least_conn; {{range $service}}server {{.Address}}:{{.Port}} max_fails=3 fail_timeout=60 weight=1 slow_start=60; {{else}}server 127.0.0.1:65535; # force a 502{{end}}} {{end}} {{end}} {{end}}

<snip>

Page 36: Interconnecting containers at scale #Dockercon

MORE INFORMATION AT NGINX.COM

sarah@ubuntu:~/service-discovery$ docker-compose scale service1=5Creating servicediscovery_service1_2...Creating servicediscovery_service1_3...Creating servicediscovery_service1_4...Creating servicediscovery_service1_5...Starting servicediscovery_service1_2...Starting servicediscovery_service1_3...Starting servicediscovery_service1_4...Starting servicediscovery_service1_5...

Page 37: Interconnecting containers at scale #Dockercon

MORE INFORMATION AT NGINX.COM

Page 38: Interconnecting containers at scale #Dockercon

MORE INFORMATION AT NGINX.COM

Page 39: Interconnecting containers at scale #Dockercon

The Microservices Architecture

Page 40: Interconnecting containers at scale #Dockercon

MORE INFORMATION AT NGINX.COM

Visit our kiosk tomorrow to go through this demoIt was based on a blog post for bellycard by @shanesveller

And built by @fymemon

Page 41: Interconnecting containers at scale #Dockercon

Thank you@sarahnovotny

#dockercon