Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Martin Ahrer on Continuous Delivery Infrastructure With Docker

Martin Ahrer on Continuous Delivery Infrastructure With Docker

More Decks by Enterprise Java User Group Austria

Other Decks in Technology

Transcript

  1. Continuous Delivery
    Infrastructure
    1 . 1
    with Docker

    View Slide

  2. 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

    View Slide

  3. 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 …

    View Slide

  4. Containers
    2 . 1
    why should I care?

    View Slide

  5. Continuous Delivery
    2 . 2

    View Slide

  6. Continuous Delivery
    2 . 3
    testing, staging, production environments

    View Slide

  7. Continuous Delivery
    2 . 4
    act fast …

    View Slide

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

    View Slide

  9. 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

    View Slide

  10. 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

    View Slide

  11. 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

    View Slide

  12. Container versus Hypervisor
    3 . 5

    View Slide

  13. 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

    View Slide

  14. 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

    View Slide

  15. Demo
    4
    gradle build within a container

    View Slide

  16. Continuous Delivery
    Infrastructure
    5 . 1
    Simplified

    View Slide

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

    View Slide

  18. Add Nexus3 Docker Container
    5 . 3
    Docker Registry

    View Slide

  19. 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

    View Slide

  20. Docker techniques used
    6 . 1

    View Slide

  21. 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

    View Slide

  22. 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

    View Slide

  23. 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

    View Slide

  24. 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

    View Slide

  25. Let’s build something
    7
    Demo

    View Slide

  26. Thank you for attending
    8 . 1

    View Slide

  27. 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

    View Slide

  28. Questions?
    9

    View Slide