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 full-size 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 full-size 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 full-size slide

  4. Containers
    2 . 1
    why should I care?

    View full-size slide

  5. Continuous Delivery
    2 . 2

    View full-size slide

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

    View full-size slide

  7. Continuous Delivery
    2 . 4
    act fast …

    View full-size slide

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

    View full-size 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 full-size 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 full-size 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 full-size slide

  12. Container versus Hypervisor
    3 . 5

    View full-size 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 full-size 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 full-size slide

  15. Demo
    4
    gradle build within a container

    View full-size slide

  16. Continuous Delivery
    Infrastructure
    5 . 1
    Simplified

    View full-size slide

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

    View full-size slide

  18. Add Nexus3 Docker Container
    5 . 3
    Docker Registry

    View full-size 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 full-size slide

  20. Docker techniques used
    6 . 1

    View full-size 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 full-size 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 full-size 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 full-size 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 full-size slide

  25. Let’s build something
    7
    Demo

    View full-size slide

  26. Thank you for attending
    8 . 1

    View full-size 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 full-size slide