The DevOps 2.1 Toolkit: Docker Swarm

Book description

Viktor Farcic's latest book, The DevOps 2.1 Toolkit: Docker Swarm, shows you how to successfully integrate Docker Swarm into your DevOps toolset.

About This Book

  • Expand your DevOps Toolkit with the DevOps thought leader, Viktor Farcic
  • Build, test, deploy, and monitor services inside Docker Swarm clusters
  • Translate your understanding to different hosting providers like AWS, Azure, and DigitalOcean
  • Go beyond simple deployment to explore how to create a continuous deployment process
  • Extend the deep understanding you gained from Viktor's DevOps 2.0 Toolkit book

Who This Book Is For

This book is for professionals interested in the full microservices life cycle combined with continuous deployment and containers. Target audience could be architects who want to know how to design their systems around microservices. It could be DevOps wanting to know how to apply modern configuration management practices and continuously deploy applications packed in containers. It is for developers who would like to take the process back into their hands as well as for managers who would like to gain a better understanding of the process used to deliver software from the beginning to the end. This book is for everyone wanting to know more about the software development life cycle starting from requirements and design, through the development and testing all the way until deployment and post-deployment phases. We'll create the processes taking into account the best practices developed by and for some of the biggest companies.

What You Will Learn

  • Learn all aspects of Docker Swarm from building, testing, deploying, and monitoring services inside Docker Swarm clusters, available since Docker 1.12.
  • Master the deeper logic of DevOps with Viktor, so that you can successfully apply that logic across any specific set of tools you're working with.
  • Translate a deep understanding to different hosting providers like AWS, Azure, DigitalOcean, among others.
  • You'll go beyond simple deployment: you will explore with Viktor how to create a continuous deployment process. Accomplish zero-downtime deployments, and what to do in case of a failover.
  • Know how to run services at scale, how to monitor the systems, and how to make it heal itself.

In Detail

Viktor Farcic's latest book, The DevOps 2.1 Toolkit: Docker Swarm, takes you deeper into one of the major subjects of his international best seller, The DevOps 2.0 Toolkit, and shows you how to successfully integrate Docker Swarm into your DevOps toolset.

Viktor shares with you his expert knowledge in all aspects of building, testing, deploying, and monitoring services inside Docker Swarm clusters. You'll go through all the tools required for running a cluster. You'll travel through the whole process with clusters running locally on a laptop. Once you're confident with that outcome, Viktor shows you how to translate your experience to different hosting providers like AWS, Azure, and DigitalOcean.

Viktor has updated his DevOps 2.0 framework in this book to use the latest and greatest features and techniques introduced in Docker. We'll go through many practices and even more tools. While there will be a lot of theory, this is a hands-on book. You won't be able to complete it by reading it on the metro on your way to work. You'll have to read this book while in front of the computer and get your hands dirty.

Style and approach

We'll go through many practices and even more tools. While there will be a lot of theory, this is a hands-on book. You'll have to read this book while in front of the computer and get your hands dirty. The goal is not to master one particular set of tools, but to learn the logic behind them so that you can apply it to your job in various contexts.

Table of contents

  1. Preface
    1. Overview
    2. Audience
  2. Continuous Integration with Docker Containers
    1. Defining a fully Dockerized manual Continuous Integration flow
    2. Running unit tests and building service binary
    3. Building service images
    4. Running staging tests
    5. Pushing images to the registry
  3. Setting Up and Operating a Swarm Cluster
    1. Scalability
    2. Axis scaling
      1. X-axis scaling
      2. Y-axis scaling
      3. Z-axis scaling
    3. Clustering
    4. Docker Swarm Mode
    5. Setting up a Swarm cluster
    6. Deploying services to the Swarm cluster
    7. Scaling services
    8. Failover
    9. What now?
  4. Docker Swarm Networking and Reverse Proxy
    1. Setting up a cluster
    2. Requirements of secured and fault tolerant services running with high availability
    3. Running a database in isolation
    4. Running a service through a reverse proxy
    5. Creating a reverse proxy service in charge of routing requests depending on their base URLs
    6. Load balancing requests across all instances of a service
    7. What now?
  5. Service Discovery inside a Swarm Cluster
    1. What would Docker Swarm look like without?
    2. What does standalone Docker Swarm look like with service discovery?
    3. Service discovery in the Swarm cluster
    4. Do we need service discovery?
    5. Setting up Consul as service registry inside a Swarm cluster
    6. Problems when scaling stateful instances
    7. Using service registry to store the state
    8. Discovering addresses of all instances that form a service
    9. Using service registry or key value store to store service state
    10. What now?
  6. Continuous Delivery and Deployment with Docker Containers
    1. Defining the Continuous Delivery environment
    2. Setting up Continuous Delivery clusters
    3. Using node labels to constrain services
    4. Creating services
    5. Walking through Continuous Delivery steps
    6. Walking the extra mile from Continuous Delivery to Continuous Deployment
    7. What now?
  7. Automating Continuous Deployment Flow with Jenkins
    1. Jenkins architecture
    2. Production environment setup
    3. Jenkins service
    4. Jenkins failover
    5. Jenkins agent
    6. Creating services in production and production-like environments
    7. Automating Continuous Deployment flow with Jenkins
    8. Creating Jenkins Pipeline jobs
      1. Defining Pipeline nodes
      2. Defining Pipeline stages
      3. Defining Pipeline steps
    9. What now?
  8. Exploring Docker Remote API
    1. Setting up the environment
    2. Operating Docker Swarm through the Docker Remote API
    3. Using Docker Remote API to automate proxy configuration
    4. Combining the Swarm listener with the proxy
      1. Automatically reconfiguring the proxy
      2. Removing a service from the proxy
    5. What now?
  9. Using Docker Stack and Compose YAML Files to Deploy Swarm Services
    1. Swarm cluster setup
    2. Creating Swarm services through Docker stack commands
    3. Deploying more stacks
    4. To stack or not to stack
    5. Cleanup
  10. Defining Logging Strategy
    1. The need for centralized logging
    2. Setting up ElasticSearch as the logging database
    3. Setting up LogStash as the logs parser and forwarder
    4. Forwarding logs from all containers running anywhere inside a Swarm cluster
    5. Exploring logs
    6. Discussing other logging solutions
    7. What now?
  11. Collecting Metrics and Monitoring the Cluster
    1. The requirements of a cluster monitoring system
    2. Choosing the right database to store system metrics
    3. Creating the cluster
    4. Prometheus metrics
    5. Exporting system wide metrics
    6. Scraping, querying, and visualizing Prometheus metrics
    7. Using Grafana to create dashboards
    8. Exploring Docker Swarm and container overview dashboard in Grafana
    9. Adjusting services through dashboard metrics
    10. Monitoring best practices
    11. What now?
  12. Embracing Destruction: Pets versus Cattle
    1. What now?
  13. Creating and Managing a Docker Swarm Cluster in Amazon Web Services
    1. Installing AWS CLI and setting up the environment variables
    2. Setting up a Swarm cluster with Docker Machine and AWS CLI
    3. Setting up a Swarm cluster with Docker for AWS
    4. Automatically setting up a Swarm cluster with Docker for AWS
    5. Setting up a Swarm cluster with Packer and Terraform
      1. Using Packer to create Amazon Machine Images
      2. Using Terraform to create a Swarm cluster in AWS
    6. Choosing the right tools to create and manage Swarm clusters in AWS
      1. To Docker Machine or not to Docker Machine?
      2. To Docker for AWS or not to Docker for AWS?
      3. To Terraform or not to Terraform?
      4. The final verdict
  14. Creating and Managing a Docker Swarm Cluster in DigitalOcean
    1. Setting up the environment variables
    2. Setting up a Swarm cluster with Docker Machine and DigitalOcean API
    3. Setting up a Swarm cluster with Packer and Terraform
      1. Using Packer to create DigitalOcean snapshots
      2. Using Terraform to create a Swarm cluster in DigitalOcean
    4. Choosing the right tools to create and manage Swarm clusters in DigitalOcean
      1. To Docker Machine or not to Docker Machine?
      2. To Terraform or not to Terraform?
      3. The final verdict
    5. To DigitalOcean or not to DigitalOcean
  15. Creating and Managing Stateful Services in a Swarm Cluster
    1. Exploring the twelve-factor app methodology
    2. Setting up a Swarm cluster and the proxy
    3. Running stateful services without data persistence
    4. Persisting stateful services on the host
    5. Persisting stateful services on a Network File System
    6. Data volume orchestration
    7. Persisting stateful services with REX-Ray
    8. Choosing the persistence method for stateful services
    9. Adding REX-Ray to packer and terraform
    10. Persisting stateful services without replication
    11. Persisting stateful services with synchronization and replication
    12. Persisting docker flow proxy state
    13. Persisting MongoDB state
    14. Initializing MongoDB replica set through a swarm service
    15. What now?
  16. Managing Secrets in Docker Swarm Clusters
    1. Creating secrets
    2. Consuming secrets
    3. A real-world example of using secrets
    4. Using secrets with Docker Compose
    5. Common ways to use secrets
    6. What now?
  17. Monitor Your GitHub Repos with Docker and Prometheus
    1. Docker, Prometheus, and Grafana
    2. Getting started
    3. Configuration
    4. Post configuration
    5. Install dashboard
    6. Conclusion
    7. About the author

Product information

  • Title: The DevOps 2.1 Toolkit: Docker Swarm
  • Author(s): Viktor Farcic
  • Release date: May 2017
  • Publisher(s): Packt Publishing
  • ISBN: 9781787289703