Book Image

Hands-On Docker for Microservices with Python

By : Jaime Buelta
Book Image

Hands-On Docker for Microservices with Python

By: Jaime Buelta

Overview of this book

Microservices architecture helps create complex systems with multiple, interconnected services that can be maintained by independent teams working in parallel. This book guides you on how to develop these complex systems with the help of containers. You’ll start by learning to design an efficient strategy for migrating a legacy monolithic system to microservices. You’ll build a RESTful microservice with Python and learn how to encapsulate the code for the services into a container using Docker. While developing the services, you’ll understand how to use tools such as GitHub and Travis CI to ensure continuous delivery (CD) and continuous integration (CI). As the systems become complex and grow in size, you’ll be introduced to Kubernetes and explore how to orchestrate a system of containers while managing multiple services. Next, you’ll configure Kubernetes clusters for production-ready environments and secure them for reliable deployments. In the concluding chapters, you’ll learn how to detect and debug critical problems with the help of logs and metrics. Finally, you’ll discover a variety of strategies for working with multiple teams dealing with different microservices for effective collaboration. By the end of this book, you’ll be able to build production-grade microservices as well as orchestrate a complex system of services using containers.
Table of Contents (19 chapters)
Free Chapter
1
Section 1: Introduction to Microservices
3
Section 2: Designing and Operating a Single Service – Creating a Docker Container
7
Section 3:Working with Multiple Services – Operating the System through Kubernetes
13
Section 4: Production-Ready System – Making It Work in Real-Life Environments

Preface

The evolution of software means that systems are getting bigger and more complex, making some of the traditional techniques for dealing with them ineffective. The microservice architecture has gained traction in recent years as an effective technique for dealing with complex web services and allowing more people to work on the same system without interfering with one another. In a nutshell, it creates small web services where each one solves a specific problem, and they all coordinate together through well-defined APIs.

In this book, we will explain in detail the microservice architecture and how to successfully run it, enabling you to understand the architecture at a technical level as well as understand the implications of the architecture for teams and their workloads.

For the technical aspects, we will use well-tailored tools, including the following:

  • Python, to implement RESTful web services
  • Git source control, to track the changes in an implementation, and GitHub, to share those changes
  • Docker containers, to standardize the operation of each of the microservices
  • Kubernetes, to coordinate the execution of multiple services
  • Cloud services, such as Travis CI or AWS, to leverage existing commercial solutions to problems

We will also cover practices and techniques for working effectively in a microservice-oriented environment, the most prominent being the following:

  • Continuous integration, to ensure that services are of a high quality and ready to be deployed
  • GitOps, for handling changes in infrastructure
  • Observability practices, to properly understand what is happening in a live system
  • Practices and techniques aimed at improving teamwork, both within a single team and across multiple teams

The book revolves around a single example scenario that involves a traditional monolith that needs to be moved to a microservice architecture. This example is described in Chapter 1, Making the Move – Design, Plan, Execute, and is then continued throughout the rest of the book.