The DevOps 2.1 Toolkit: Docker Swarm


This book is no longer available for sale.

The DevOps 2.1 Toolkit: Docker Swarm

Building, testing, deploying, and monitoring services inside Docker Swarm clusters

About the Book

The book envelops all aspects of building, testing, deploying, and monitoring services inside Docker Swarm clusters. We'll go through all the tools required for running a cluster. We'll go through the whole process with clusters running locally on a laptop. Once we are confident with the outcome, we'll translate the experience to different hosting providers like AWS, Azure, DigitalOcean, and so on.

The book goes deeper into one of the subjects explored in The DevOps 2.0 Toolkit. It is updated to use the latest and greatest features and techniques introduced in Docker 1.12.

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 in a metro on a way to work. You'll have to read this book while in front of the computer and get your hands dirty.

  • Share this book

  • Categories

    • Computers and Programming
    • DevOps
    • AWS
    • Docker
    • Software
    • Software Architecture
    • Software Engineering
  • Feedback

    Email the Author(s)

About the Author

Viktor Farcic
Viktor Farcic

Viktor Farcic is a lead rapscallion at Upbound, a member of the CNCF AmbassadorsGoogle Developer Experts, CDF Ambassadors, and GitHub Stars groups, and a published author.

He is a host of the YouTube channel DevOps Toolkit and a co-host of DevOps Paradox.

Table of Contents

  • Preface
  • Overview
  • Audience
  • About the Author
  • Continuous Integration With Docker Containers
    • Defining a Fully Dockerized Manual Continuous Integration Flow
    • Running Unit Tests And Building Service Binary
    • Building Service Images
    • Running Staging Tests
    • Pushing Images To The Registry
  • Setting Up And Operating a Swarm Cluster
    • Scalability
    • Axis Scaling
    • Clustering
    • Docker Swarm Mode
    • Setting Up a Swarm Cluster
    • Deploying Services To The Swarm Cluster
    • Scaling Services
    • Failover
    • What Now?
  • Docker Swarm Networking And Reverse Proxy
    • Setting Up a Cluster
    • Requirements Of Secured And Fault Tolerant Services Running With High Availability
    • Running a Database In Isolation
    • Running a Service Through a Reverse Proxy
    • Creating a Reverse Proxy Service In Charge Of Routing Requests Depending On Their Base URLs
    • Load Balancing Requests Across All Instances Of A Service
    • What Now?
  • Service Discovery Inside A Swarm Cluster
    • What Would Docker Swarm Look Like Without Service Discovery?
    • What Does Standalone Docker Swarm Look Like With Service Discovery?
    • Service Discovery In The Swarm Cluster
    • Do We Need Service Discovery?
    • Setting Up Consul As Service Registry Inside a Swarm Cluster
    • Problems When Scaling Stateful Instances
    • What Now?
  • Continuous Delivery and Deployment With Docker Containers
    • Defining The Continuous Delivery Environment
    • Setting Up Continuous Delivery Clusters
    • Using Node Labels To Constrain Services
    • Creating Services
    • Walking Through Continuous Delivery Steps
    • Reverting A Failed Deployment
    • Walking The Extra Mile From Continuous Delivery To Continuous Deployment
    • What Now?
  • Automating Continuous Deployment Flow With Jenkins
    • Jenkins Architecture
    • Production Environment Setup
    • Jenkins Service
    • Jenkins Failover
    • Jenkins Agent
    • Creating Services in Production and Production-Like Environments
    • Automating Continuous Deployment Flow With Jenkins
    • Creating Jenkins Pipeline Jobs
    • What Now?
  • Exploring Docker Remote API
    • Setting Up The Environment
    • Operating Docker Swarm Through The Docker Remote API
    • Using Docker Remote API to Automate Proxy Configuration
    • Combining The Swarm Listener With The Proxy
    • What Now?
  • Using Docker Stack And Compose YAML Files To Deploy Swarm Services
    • Swarm Cluster Setup
    • Creating Swarm Services Through Docker Stack Commands
    • Deploying More Stacks
    • To Stack Or Not To Stack
    • Cleanup
  • Defining Logging Strategy
    • The Need for Centralized Logging
    • Setting Up ElasticSearch As The Logging Database
    • Setting Up LogStash As The Logs Parser And Forwarder
    • Forwarding Logs From All Containers Running Anywhere Inside A Swarm Cluster
    • Exploring Logs
    • Discussing Other Logging Solutions
    • What Now?
  • Collecting Metrics and Monitoring The Cluster
    • The Requirements Of a Cluster Monitoring System
    • Choosing The Right Database To Store System Metrics
    • Creating The Cluster
    • Prometheus Metrics
    • Exporting System Wide Metrics
    • Scraping, Querying, and Visualizing Prometheus Metrics
    • Using Grafana To Create Dashboards
    • Exploring Docker Swarm & Container Overview Dashboard In Grafana
    • Adjusting Services Through Dashboard Metrics
    • Monitoring Best Practices
    • What Now?
  • Embracing Destruction: Pets vs Cattle
    • What Now?
  • Creating And Managing A Docker Swarm Cluster in Amazon Web Services (AWS)
    • Installing AWS CLI and Setting Up The Environment Variables
    • Setting Up A Swarm Cluster With Docker Machine and AWS CLI
    • Setting Up A Swarm Cluster With Docker For AWS
    • Automatically Setting Up A Swarm Cluster With Docker For AWS
    • Setting Up A Swarm Cluster With Packer And Terraform
    • Choosing The Right Tools To Create And Manage Swarm Clusters In AWS
  • Creating And Managing A Docker Swarm Cluster in DigitalOcean
    • Setting Up The Environment Variables
    • Setting Up A Swarm Cluster With Docker Machine and DigitalOcean API
    • Setting Up A Swarm Cluster With Packer And Terraform
    • Choosing The Right Tools To Create And Manage Swarm Clusters In DigitalOcean
    • To DigitalOcean Or Not To DigitalOcean
  • Creating and Managing Stateful Services In a Swarm Cluster
    • Exploring The Twelve-Factor App Methodology
    • Setting Up A Swarm Cluster And The Proxy
    • Running Stateful Services Without Data Persistence
    • Persisting Stateful Services On The Host
    • Persisting Stateful Services On A Network File System (NFS)
    • Data Volume Orchestration
    • Persisting Stateful Services With REX-Ray
    • Choosing The Persistence Method For Stateful Services
    • Persisting Stateful Services Without Replication
    • Persisting Stateful Services With Synchronization And Replication
    • Persisting Docker Flow Proxy State
    • Persisting Mongo DB State
    • What Now?
  • Managing Secrets In Docker Swarm Clusters
    • Creating Secrets
    • Consuming Secrets
    • A Real-World Example of Using Secrets
    • Using Secrets With Docker Compose
    • Common Ways to Use Secrets
    • What Now?
  • Appendix A: Monitor Your GitHub Repos With Docker And Prometheus
    • Docker, Prometheus, and Grafana
    • Getting Started
    • Configuration
    • Post Configuration
    • Install Dashboard
    • Conclusion
    • About The Author Of The Appendix
  • Farewell
  • Contributions
  • Is This The End?

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

So, there's no reason not to click the Add to Cart button, is there?

See full terms...

80% Royalties. Earn $16 on a $20 book.

We pay 80% royalties. That's not a typo: you earn $16 on a $20 sale. If we sell 5000 non-refunded copies of your book or course for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earnedover $13 millionwriting, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub