Top Banner
Docker at Spotify Rohan Singh @rohansingh
32

Docker at Spotify - Dockercon14

May 11, 2015

Download

Technology

dotCloud

Docker at Spotify by Rohan Singh at dockercon 14
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Docker at Spotify - Dockercon14

Docker at Spotify!

Rohan Singh @rohansingh

Page 2: Docker at Spotify - Dockercon14

Spotify

“Music for every moment” !

40+ million active users !

20+ million songs available (we’re in 55+ countries, differs by market)

!

Live in the US for 2 years

2

Page 3: Docker at Spotify - Dockercon14

What are we working with?

!

100+ distinct backend services !

5000+ production servers in 4 sites worldwide !

Almost 300 servers per ops engineer

3

Page 4: Docker at Spotify - Dockercon14

Deployment at Spotify

4

Page 5: Docker at Spotify - Dockercon14

Build Debian packages !

Requisition new hardware !

Use combination of Puppet and internal tooling (deployify)

5

Page 6: Docker at Spotify - Dockercon14

old way: SSH to a bunch of machines,

apt-get install || upgrade !

deployify: Uses fabric, which just SSH’s, runs apt-get install || upgrade

6

Page 7: Docker at Spotify - Dockercon14

What’s wrong with that?

7

Page 8: Docker at Spotify - Dockercon14

Requisitioning new hardware is slow !

Hardware utilization is low !

We’ve automated and improved, but still too slow

8

Page 9: Docker at Spotify - Dockercon14

Deployments often fail… !

…though usually only partially

9

Page 10: Docker at Spotify - Dockercon14

!

Machines get denormalized easily

10

Page 11: Docker at Spotify - Dockercon14

Debian packaging is its own special hell

So many damn files! !

debhelper !

Distro & version specific !

apt-get update

11

Page 12: Docker at Spotify - Dockercon14

What do we want?

12

Page 13: Docker at Spotify - Dockercon14

Deployments that are: !

Repeatable !

Straightforward !

Fault-tolerant

13

Page 14: Docker at Spotify - Dockercon14

Why Docker?

!

It gives us “repeatable”, right out of the box

!

!

And it’s fairly straightforward, too!

14

Page 15: Docker at Spotify - Dockercon14

Repeatability?

!

!

The code you test isn’t necessarily the code that runs in prod

15

Page 16: Docker at Spotify - Dockercon14

Repeatability — Docker

!

Build an image !

Run tests against the image !

Run the tested image in prod

16

Page 17: Docker at Spotify - Dockercon14

Straightforward

!

Just one Dockerfile !

Pretty simple syntax !

Immutable images — easy to reason about

17

Page 18: Docker at Spotify - Dockercon14

Fault-tolerance?

Even if your code is perfect, deployments might fail

!

Puppet or Debian repos are down !

Network issues !

The machine dies

18

Page 19: Docker at Spotify - Dockercon14

Fault-tolerance — Docker

Just one thing has to work — pulling & running an image

!

If it fails, just try again !

No machines left in weird states* !

!

*(in theory)

19

Page 20: Docker at Spotify - Dockercon14

What more do we need?

20

Page 21: Docker at Spotify - Dockercon14

Deploying Docker containers across our entire fleet of servers

!

Some way to deal with Docker or container failures !

That’s pretty much it

21

Page 22: Docker at Spotify - Dockercon14

Looking around for a Docker platform

Several really feature-full offerings !

Pretty opinionated and all-encompassing !

All we need is reliably deploying containers to a fleet of Docker hosts

22

Page 23: Docker at Spotify - Dockercon14

Helios

23

Page 24: Docker at Spotify - Dockercon14

Makes sure your containers are deployed & running exactly where you want them…

!

…and that’s pretty much it !

!github.com/spotify/helios

24

Page 25: Docker at Spotify - Dockercon14

What’s in the box?

Helios master frontend that you talk to

!

Helios agent runs alongside each Docker instance

!

Zookeeper !

Straightforward CLI

25

Page 26: Docker at Spotify - Dockercon14

How does it work?

Create a job — tell Helios which Docker image to deploy

!

Deploy the job — tell Helios where to run the Docker containers

26

Page 27: Docker at Spotify - Dockercon14

See it in action

27

Page 28: Docker at Spotify - Dockercon14

What’s next?

28

Page 29: Docker at Spotify - Dockercon14

Helios is just the beginning !

Brought up plenty of Helios+Docker agents in our private cloud for our devs

!

Integrated Helios with JUnit — write JUnit tests run against Docker containers

29

Page 30: Docker at Spotify - Dockercon14

Dockerized integration tests

30

Page 31: Docker at Spotify - Dockercon14

This week — first Helios+Docker-based service in production

!

!

In the future — Containerizing more of our infrastructure

31

Page 32: Docker at Spotify - Dockercon14

Give it a go

Open source: github.com/spotify/helios

!

Try it out: git clone https://github.com/spotify/helios.git \

&& cd helios && vagrant up !!!

Come play with us (spotify.com/jobs)

32