Slide 1

Slide 1 text

Continuous Delivery Infrastructure 1 . 1 with Docker

Slide 2

Slide 2 text

About me Co-founder Enterprise Java User Group Austria Partner @ Java Developer with strong focus on continuous delivery and Docker. Member of #dockermentor Software Craftsmen Gmbh & Co KG 1 . 2 Martin Ahrer

Slide 3

Slide 3 text

The goal for this presentation Create a build infrastructure geared for a continuous delivery pipeline and have a walkthrough of the most important techniques used. Setup a build pipeline to build a Spring Boot application, Docker images and run integration tests. Eat your own dog food: this AsciiDoc slides are served from a Docker container running node.js + reveal.js. 1 . 3 just for the buzzwords …

Slide 4

Slide 4 text

Containers 2 . 1 why should I care?

Slide 5

Slide 5 text

Continuous Delivery 2 . 2

Slide 6

Slide 6 text

Continuous Delivery 2 . 3 testing, staging, production environments

Slide 7

Slide 7 text

Continuous Delivery 2 . 4 act fast …

Slide 8

Slide 8 text

Some Docker myths 3 . 1 or I can’t use Docker because … and other excuses

Slide 9

Slide 9 text

Docker replaces virtualization Containers are no virtualization technology, they do not use a hypervisor. Container != Virtual Server Containers and hypervisor virtualization can co-exist 3 . 2

Slide 10

Slide 10 text

Docker is a platform lock-in Runs on any Linux distribution Is supported by Windows Server 2016+ (Windows Containers) Has been integrated into major cloud providers 3 . 3

Slide 11

Slide 11 text

Containers add resource management overhead A docker container is represented by a single process Containers are managed by namespaces and cgroups → Containers run as secure, isolated processes A single Docker host can run hundreds of containers, resources are managed more efficiently 3 . 4

Slide 12

Slide 12 text

Container versus Hypervisor 3 . 5

Slide 13

Slide 13 text

Containers are much faster than virtual machines Modern hypervisors add little execution overhead Containers just provide better resource utilization Containers start up much faster than virtual servers Container provisioning is much faster than virtual server provisioning → Containers scale better with increasing number of builds/hr 3 . 6

Slide 14

Slide 14 text

Summary Docker replaces virtualization Docker is a platform lock-in Containers are much faster than virtual machines Containers add resource management overhead In the context of continuous delivery, container provisioning and startup time is mostly relevant. € 3 . 7

Slide 15

Slide 15 text

Demo 4 gradle build within a container

Slide 16

Slide 16 text

Continuous Delivery Infrastructure 5 . 1 Simplified

Slide 17

Slide 17 text

Add Jenkins Docker Container Who is compiling/building on master? 5 . 2 Master and Build Agent

Slide 18

Slide 18 text

Add Nexus3 Docker Container 5 . 3 Docker Registry

Slide 19

Slide 19 text

Jenkins Build Pipeline The Jenkins master container has been omitted in the above diagram as it is only responsible for scheduling the pipeline instance on a matching agent. 5 . 4

Slide 20

Slide 20 text

Docker techniques used 6 . 1

Slide 21

Slide 21 text

Docker In Docker ( DinD ) Docker image for the agent provides Docker CLI from base image docker-compose CLI Jenkins Swarm Agent CLI for library/docker agent auto- discovery 6 . 2

Slide 22

Slide 22 text

Docker Volumes Persist infrastructure data to survive container updates Provide /var/run/docker.sock to the agent container Provide build workspace filesystem to the agent container Provide gradle build cache volume reusable across builds 6 . 3 for data management

Slide 23

Slide 23 text

Docker Software Defined Networks bridge network separated networks for infrastructure and app port mapping bind exposed container ports to host 6 . 4 a.k.a Docker networks

Slide 24

Slide 24 text

docker-compose Eliminate shell scripting Makes managing multi-container applications simple Isolate environments running on a single host Makes data volumes survive container updates 6 . 5 is optional, just for convenience

Slide 25

Slide 25 text

Let’s build something 7 Demo

Slide 26

Slide 26 text

Thank you for attending 8 . 1

Slide 27

Slide 27 text

Resources, Help, Consulting [email protected] softwarecraftsmen/continuousdelivery docker-jenkins-swarm-agent https://wiki.jenkins-ci.org/display/JENKINS/Swarm+Plugin http://blog.software-craftsmen.at/blog/2017/cd-infrastructure-as-code.html 8 . 2

Slide 28

Slide 28 text

Questions? 9