Continuous Delivery with Docker and Jenkins: Create secure applications by building complete CI/CD pipelines

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

Create a complete continuous delivery process using modern DevOps tools such as Docker, Jenkins, Kubernetes, Ansible, Terraform, and many more

Key Features

  • Build reliable and secure applications using Docker containers
  • Create a highly available environment to scale Jenkins and your services using Kubernetes
  • Automate your release process end-to-end

Book Description

This updated third edition of Continuous Delivery with Docker and Jenkins will explain the advantages of combining Jenkins and Docker to improve the continuous integration and delivery process of app development.

You'll start by setting up a Docker server and configuring Jenkins on it. Next, you'll discover steps for building applications and microservices on Dockerfiles and integrating them with Jenkins using continuous delivery processes such as continuous integration, automated acceptance testing, configuration management, and Infrastructure as Code. Moving ahead, you'll learn how to ensure quick application deployment with Docker containers, along with scaling Jenkins using Kubernetes. Later, you'll explore how to deploy applications using Docker images and test them with Jenkins. Toward the concluding chapters, the book will focus on missing parts of the CD pipeline, such as the environments and infrastructure, application versioning, and non-functional testing.

By the end of this continuous integration and continuous delivery book, you'll have gained the skills you need to enhance the DevOps workflow by integrating the functionalities of Docker and Jenkins.

What you will learn

  • Grasp Docker fundamentals and dockerize applications for the CD process
  • Understand how to use Jenkins on-premises and in the cloud
  • Scale a pool of Docker servers using Kubernetes
  • Write acceptance tests using Cucumber
  • Run tests in the Docker ecosystem using Jenkins
  • Provision your servers and infrastructure using Ansible and Terraform
  • Publish a built Docker image to a Docker registry
  • Deploy cycles of Jenkins pipelines using community best practices

Who this book is for

The book is for DevOps engineers, system administrators, Docker professionals, or anyone who wants to explore the power of working with Docker and Jenkins together. No prior knowledge of DevOps is required to get started.

Table of Contents

  1. Introducing Continuous Delivery
  2. Introducing Docker
  3. Configuring Jenkins
  4. Continuous Integration Pipeline
  5. Automated Acceptance Testing
  6. Clustering with Kubernetes
  7. Configuration Management with Ansible
  8. Continuous Delivery Pipeline
  9. Advanced Continuous Delivery

Author(s): Rafal Leszko
Edition: 3
Publisher: Packt Publishing
Year: 2022

Language: English
Pages: 374
Tags: Continuous Delivery; Continuous Integration; Docker; Jenkins; CI/CD; DevOps

Cover
Title page
Copyright and Credits
Dedication
Contributors
Table of Contents
Preface
Section 1 – Setting Up the Environment
Chapter 1: Introducing Continuous Delivery
Understanding CD
The traditional delivery process
The benefits of CD
Success stories
The automated deployment pipeline
Continuous integration
Automated acceptance testing
Configuration management
Prerequisites to CD
Organizational prerequisites
Technical and development prerequisites
Combining CD and microservices
Building the CD process
Introducing tools
Creating a complete CD system
Summary
Questions
Further reading
Chapter 2: Introducing Docker
Technical requirements
What is Docker?
Containerization versus virtualization
The need for Docker
Kittens and cattle
Alternative containerization technologies
Installing Docker
Prerequisites for Docker
Installing on a local machine
Installing on a server
Running Docker hello-world
Docker components
Docker client and server
Docker images and containers
Docker applications
Building Docker images
docker commit
Dockerfile
Complete Docker application
Environment variables
Docker container states
Docker networking
Running services
Container networks
Exposing container ports
Automatic port assignment
Using Docker volumes
Using names in Docker
Naming containers
Tagging images
Docker cleanup
Cleaning up containers
Cleaning up images
Docker commands overview
Summary
Exercises
Questions
Further reading
Chapter 3: Configuring Jenkins
Technical requirements
What is Jenkins?
Installing Jenkins
Installing Jenkins with Docker
Installing Jenkins with dedicated packages
Initial configuration
Installing Jenkins in Kubernetes
Jenkins in the cloud
Jenkins – Hello World
Jenkins architecture
Master and agents
Scalability
Test and production instances
Sample architecture
Configuring agents
Communication protocols
Setting agents
Testing agents
Comparing Docker pipeline builds and Docker agents
Custom Jenkins images
Building the Jenkins agent
Building the Jenkins master
Configuration and management
Plugins
Security
Backup
Jenkins Blue Ocean UI
Summary
Exercises
Questions
Further reading
Section 2 – Architecting and Testing an Application
Chapter 4: Continuous Integration Pipeline
Technical requirements
Introducing pipelines
The pipeline structure
A multi-stage Hello World
The pipeline syntax
The commit pipeline
Checkout
Compile
Unit tests
Jenkinsfile
Code-quality stages
Code coverage
Static code analysis
SonarQube
Triggers and notifications
Triggers
Notifications
Team development strategies
Development workflows
Adopting continuous integration
Jenkins multi-branch
Non-technical requirements
Summary
Exercises
Questions
Further reading
Chapter 5: Automated Acceptance Testing
Technical requirements
Introducing acceptance testing
Installing and using the Docker Registry
The artifact repository
Installing a Docker Registry
Using the Docker Registry
Acceptance tests in the Jenkins pipeline
The Docker build stage
The Docker push stage
The acceptance testing stage
Writing acceptance tests
Writing user-facing tests
Using the acceptance testing framework
Acceptance test-driven development
Summary
Exercises
Questions
Further reading
Chapter 6: Clustering with Kubernetes
Technical requirements
Server clustering
Introducing server clustering
Introducing Kubernetes
Kubernetes features overview
Kubernetes installation
Kubernetes client
Kubernetes server
Verifying the Kubernetes setup
Using Kubernetes
Deploying an application
Deploying a Kubernetes Service
Exposing an application
Advanced Kubernetes
Scaling an application
Updating an application
Rolling updates
Kubernetes objects and workloads
Application dependencies
The Kubernetes DNS resolution
Multiapplication system overview
Multiapplication system implementation
Multiapplication system testing
Alternative cluster management systems
Docker Swarm
Apache Mesos
Comparing features
Summary
Exercises
Questions
Further reading
Section 3 – Deploying an Application
Chapter 7: Configuration Management with Ansible
Technical requirements
Introducing configuration management
Traits of good configuration management
Overview of configuration management tools
Installing Ansible
Ansible server requirements
Ansible installation
Using Ansible
Creating an inventory
Ad hoc commands
Playbooks
Roles
Deployment with Ansible
Installing Hazelcast
Deploying a web service
Running the deployment
Ansible with Docker and Kubernetes
Benefits of Ansible
The Ansible Docker playbook
The Ansible Kubernetes playbook
Introducing IaC
Benefits of IaC
Tools for IaC
Introduction to Terraform
Understanding Terraform
Installing Terraform
Using Terraform
Terraform and Kubernetes
Summary
Exercises
Questions
Further reading
Chapter 8: Continuous Delivery Pipeline
Technical requirements
Environments and infrastructure
Types of environments
Environments in continuous delivery
Securing environments
Non-functional testing
Types of non-functional test
Non-functional challenges
Application versioning
Versioning strategies
Versioning in the Jenkins pipeline
Completing the continuous delivery pipeline
Inventory
Versioning
The remote staging environment
The acceptance testing environment
Release
Smoke testing
Complete Jenkinsfile
Summary
Exercises
Questions
Further reading
Chapter 9: Advanced Continuous Delivery
Technical requirements
Managing database changes
Understanding schema updates
Changing the database in continuous delivery
Avoiding a shared database
Preparing test data
Pipeline patterns
Parallelizing pipelines
Reusing pipeline components
Rolling back deployments
Adding manual steps
Release patterns
Blue-green deployment
Canary release
Working with legacy systems
Automating build and deployment
Automating tests
Refactoring and introducing new features
Understanding the human element
Summary
Exercises
Questions
Further reading
Best Practices
Practice 1 – Own the process within the team!
Practice 2 – Automate everything!
Practice 3 – Version everything!
Practice 4 – Use business language for acceptance tests
Practice 5 – Be ready to roll back
Practice 6 – Don't underestimate the impact of people
Practice 7 – Incorporate traceability
Practice 8 – Integrate often
Practice 9 – Only build binaries once
Practice 10 – Release often
Assessments
Chapter 1: Introducing Continuous Delivery
Chapter 2: Introducing Docker
Chapter 3: Configuring Jenkins
Chapter 4: Continuous Integration Pipeline
Chapter 5: Automated Acceptance Testing
Chapter 6: Clustering with Kubernetes
Chapter 7: Configuration Management with Ansible
Chapter 8: Continuous Delivery Pipeline
Chapter 9: Advanced Continuous Delivery
Index
About Packt
Other Books You May Enjoy