using docker with puppet - puppetconf 2014

47
Docker and Puppet Containerization is the new virtualization

Upload: puppet-labs

Post on 24-Jan-2015

6.186 views

Category:

Technology


0 download

DESCRIPTION

Using Docker with Puppet - James Turnbull, Kickstarter

TRANSCRIPT

Page 1: Using Docker with Puppet - PuppetConf 2014

Docker and PuppetContainerization is the new virtualization

Page 2: Using Docker with Puppet - PuppetConf 2014
Page 3: Using Docker with Puppet - PuppetConf 2014
Page 4: Using Docker with Puppet - PuppetConf 2014
Page 5: Using Docker with Puppet - PuppetConf 2014

What's this allabout?

Page 6: Using Docker with Puppet - PuppetConf 2014

What is Docker?

Page 7: Using Docker with Puppet - PuppetConf 2014

Containervirtualization

Page 8: Using Docker with Puppet - PuppetConf 2014

Build, ship, run

Page 9: Using Docker with Puppet - PuppetConf 2014

Build once.

Page 10: Using Docker with Puppet - PuppetConf 2014

Run in manyplaces.

Page 11: Using Docker with Puppet - PuppetConf 2014

Isolated, layered,standard and

content agnostic

Page 12: Using Docker with Puppet - PuppetConf 2014

But this isn'tnew?!!?

Page 13: Using Docker with Puppet - PuppetConf 2014

So why should I care?Software delivery mechanism - a bit like a package!

Put your application in a container, run it anywhere

A bit like a VM but ...

Page 14: Using Docker with Puppet - PuppetConf 2014

Caring

Containers boot faster

Containers have less overhead

Containers bring native performance

Containers are Cloud & VM-compatible

Page 15: Using Docker with Puppet - PuppetConf 2014

Docker BasicsImage & DockerfileThe Docker HubContainer

Page 16: Using Docker with Puppet - PuppetConf 2014

Building Docker images

FROM ubuntu MAINTAINER James Turnbull "[email protected]"

RUN apt-get -qqy update RUN apt-get install -qqy apache2 ADD index.html /var/www/

ENV APACHE_RUN_USER www-data ENV APACHE_RUN_GROUP www-data ENV APACHE_LOG_DIR /var/log/apache2

EXPOSE 80

ENTRYPOINT ["/usr/sbin/apache2"] CMD ["-D", "FOREGROUND"]

Page 17: Using Docker with Puppet - PuppetConf 2014

Building the image

$ sudo docker build -t="jamtur01/apache2" .

Page 18: Using Docker with Puppet - PuppetConf 2014

Sharing the image

$ sudo docker push jamtur01/apache2

Page 19: Using Docker with Puppet - PuppetConf 2014

Running the container

$ sudo docker run -ti -p 80:80 jamtur01/apache2

Page 20: Using Docker with Puppet - PuppetConf 2014

Docker andPuppet

Page 21: Using Docker with Puppet - PuppetConf 2014

So does theDockerfile solve

all?

Page 22: Using Docker with Puppet - PuppetConf 2014

Well sorta...It depends.

Page 23: Using Docker with Puppet - PuppetConf 2014

Doesn't have to deal with low-level stuffDoesn't have to convergeRebuilds are fast and cachedAllows inheritance and compositionEasy learning curve

Page 24: Using Docker with Puppet - PuppetConf 2014

But...

Page 25: Using Docker with Puppet - PuppetConf 2014

Doesn't deal with low-level stuffDoesn't define resource dependenciesDoesn't define what runs when

Page 26: Using Docker with Puppet - PuppetConf 2014

Dockerfileversus

Shell script

Page 27: Using Docker with Puppet - PuppetConf 2014

Shell scriptsOkay for simple stacksImperativeRarely idempotent

Page 28: Using Docker with Puppet - PuppetConf 2014

Dockerfileversus

ConfigurationManagement

Page 29: Using Docker with Puppet - PuppetConf 2014

The GoodHandles low-level stuffAbstracts detailsEnsures convergence to a known stateLibrary of reusable, composabletemplates

Page 30: Using Docker with Puppet - PuppetConf 2014

The BadSteep learning curveGenerally requires a triggerResource-intensive

Page 31: Using Docker with Puppet - PuppetConf 2014

Digging and fixing,Having so much fun

Working together,They get the job done

Page 32: Using Docker with Puppet - PuppetConf 2014

BeforeUse Puppet to setup hardware,

install packages, deploy code, runservices.

AfterUse Puppet to setup hardware,install Docker, run containers.

Use Dockerfiles to installpackages, deploy code, run

services.

Page 33: Using Docker with Puppet - PuppetConf 2014

Install Dockerwith Puppet

Page 34: Using Docker with Puppet - PuppetConf 2014

Should I runPuppet in mycontainers?

Page 35: Using Docker with Puppet - PuppetConf 2014

Nope!

Page 36: Using Docker with Puppet - PuppetConf 2014

Should I usePuppet to build

my images?

Page 37: Using Docker with Puppet - PuppetConf 2014

Yep!

Page 38: Using Docker with Puppet - PuppetConf 2014

Deploying aPuppet-powered

container

Page 39: Using Docker with Puppet - PuppetConf 2014

Puppet Apply

FROM ubuntu:14.04

MAINTAINER James Turnbull "[email protected]"

RUN apt-get -qqy update RUN apt-get -qqy install rubygems RUN gem install --no-ri --no-rdoc puppet

RUN mkdir /puppet WORKDIR /puppet ADD site.pp /puppet/site.pp

RUN puppet apply site.pp

Page 40: Using Docker with Puppet - PuppetConf 2014

Librarian Puppet

FROM ubuntu:14.04 MAINTAINER James Turnbull "[email protected]"

RUN apt-get -y -q install wget git-core rubygems RUN gem install --no-ri --no-rdoc puppet librarian-puppet

ADD Puppetfile / RUN librarian-puppet install RUN puppet apply --modulepath=/modules -e "class { 'nginx': }" RUN echo "daemon off;" >> /etc/nginx/nginx.conf

EXPOSE 80

CMD ["nginx"]

Page 41: Using Docker with Puppet - PuppetConf 2014

But there's more!

Page 42: Using Docker with Puppet - PuppetConf 2014

What if we could get rid of...SSHd - Access via nsenter or docker execCrond in a containerLogging in a container

Page 43: Using Docker with Puppet - PuppetConf 2014

Creates a newarchitecture

Page 44: Using Docker with Puppet - PuppetConf 2014

Separates orthogonal concernsDon't rebuild your app to change servicesHave different policies in domainsShip lighter apps

Page 45: Using Docker with Puppet - PuppetConf 2014
Page 46: Using Docker with Puppet - PuppetConf 2014
Page 47: Using Docker with Puppet - PuppetConf 2014