舉報

會員
Hands-On Docker for Microservices with Python
Microservicesarchitecturehelpscreatecomplexsystemswithmultiple,interconnectedservicesthatcanbemaintainedbyindependentteamsworkinginparallel.Thisbookguidesyouonhowtodevelopthesecomplexsystemswiththehelpofcontainers.You’llstartbylearningtodesignanefficientstrategyformigratingalegacymonolithicsystemtomicroservices.You’llbuildaRESTfulmicroservicewithPythonandlearnhowtoencapsulatethecodefortheservicesintoacontainerusingDocker.Whiledevelopingtheservices,you’llunderstandhowtousetoolssuchasGitHubandTravisCItoensurecontinuousdelivery(CD)andcontinuousintegration(CI).Asthesystemsbecomecomplexandgrowinsize,you’llbeintroducedtoKubernetesandexplorehowtoorchestrateasystemofcontainerswhilemanagingmultipleservices.Next,you’llconfigureKubernetesclustersforproduction-readyenvironmentsandsecurethemforreliabledeployments.Intheconcludingchapters,you’lllearnhowtodetectanddebugcriticalproblemswiththehelpoflogsandmetrics.Finally,you’lldiscoveravarietyofstrategiesforworkingwithmultipleteamsdealingwithdifferentmicroservicesforeffectivecollaboration.Bytheendofthisbook,you’llbeabletobuildproduction-grademicroservicesaswellasorchestrateacomplexsystemofservicesusingcontainers.
最新章節
- Leave a review - let other readers know what you think
- Other Books You May Enjoy
- Chapter 12
- Chapter 11
- Chapter 10
- Chapter 9
品牌:中圖公司
上架時間:2021-06-24 12:06:36
出版社:Packt Publishing
本書數字版權由中圖公司提供,并由其授權上海閱文信息技術有限公司制作發行
- Leave a review - let other readers know what you think 更新時間:2021-06-24 12:36:37
- Other Books You May Enjoy
- Chapter 12
- Chapter 11
- Chapter 10
- Chapter 9
- Chapter 8
- Chapter 7
- Chapter 6
- Chapter 5
- Chapter 4
- Chapter 3
- Chapter 2
- Chapter 1
- Assessments
- Further reading
- Questions
- Summary
- Running post-mortem meetings
- Reflecting on release problems
- Planning in the weekly release meeting
- Designing a broader release process
- Avoiding technical debt
- Continuously addressing technical debt
- Understanding technical debt
- Regular maintenance
- Balancing new features and maintenance
- Structuring teams around a mix
- Structuring teams around customers
- Structuring teams around domains
- Structuring teams around technologies
- Designing working structures
- Dividing the software into different kinds of software units
- Describing Conway's Law
- Dividing the workload and Conway's Law
- Keeping a consistent architectural vision
- Collaborating and Communicating across Teams
- Further reading
- Questions
- Summary
- Checking the version
- The main function
- Required version
- Checking the version
- Implementing the version endpoint
- Storing the version in the image
- Obtaining the version
- Adding a version endpoint
- Semantic versioning
- Versioning the services
- Dealing with service dependencies
- Rolling back the microservices
- Deploying one change at a time
- Defining a new feature affecting multiple services
- Retrieving the secrets by the applications
- Secret deployment configuration
- Storing the secrets in the cluster
- Creating the secrets
- Storing secrets in Kubernetes
- Handling Kubernetes secrets
- Frontend ConfigMap configuration
- Users Backend ConfigMap configuration
- Thoughts Backend ConfigMap configuration
- Adding ConfigMap to the deployment
- Using kubectl commands
- Adding the ConfigMap file
- Understanding shared configurations across microservices
- Technical requirements
- Handling Change Dependencies and Secrets in the System
- Further reading
- Questions
- Summary
- Being prepared
- Alerting
- Being proactive
- Updating dashboards
- Querying Prometheus
- Grafana UI
- Plotting graphs and dashboards
- Collecting the metrics
- Adding custom metrics
- Defining metrics for the Thoughts Backend
- Setting up metrics
- Adding logs while developing
- Logging strategy
- Capturing unexpected errors
- Detecting expected errors
- Detecting problems through logs
- Searching through all the logs
- Logging each request
- Logging a request ID
- Dictionary configuration
- Generating application logs
- Sending logs
- Allowing external access
- The front rail container
- syslog container
- log-volume
- Defining the syslog pod
- Setting up an rsyslog container
- Setting up logs
- Understanding metrics
- Understanding logs
- Observability of a live system
- Technical requirements
- Monitoring Logs and Metrics
- Section 4: Production-Ready System – Making It Work in Real-Life Environments
- Further reading
- Questions
- Summary
- Dealing with database migrations
- Using feature flags
- Releasing frequently and adding feature flags
- Emergency releases
- Defining a clear path for releases
- Understanding that not every approval is the same
- Reviewing and approving is done by the whole team
- Scaling the workflow and making it work
- Setting up multiple environments
- Approving releases
- Reviewing feature code
- Reviewing and approving a new feature
- Implementing a feature
- Features that affect multiple microservices
- Understanding the life cycle of a feature
- Managing Workflows
- Further reading
- Questions
- Summary
- Working with tags
- Using GitHub features
- Creating structure
- Working in production
- Making a Kubernetes cluster change through GitHub
- Syncing Flux
- Adding a deploy key
- Forking the GitHub repo
- Configuring GitHub
- Configuring Flux
- Starting the system
- Setting up Flux to control the Kubernetes cluster
- Defining GitOps
- Understanding DevOps
- Managing configuration
- Understanding the description of GitOps
- Technical requirements
- Using GitOps Principles
- Further reading
- Questions
- Summary
- Designing a winning autoscaling strategy
- Deleting nodes
- Scaling the number of nodes in the cluster
- Creating an HPA
- Configuring the resources in deployments
- Deploying the Kubernetes metrics server
- Creating a Kubernetes Horizontal Pod Autoscaler
- Autoscaling the cluster
- Rolling updates
- The readiness probe
- The liveness probe
- Deploying a new Docker image smoothly
- Running the example
- Being ready for migration to microservices
- Using HTTPS and TLS to secure external access
- Deploying the system
- Configuring the usage of an externally accessible load balancer
- Configuring the AWS image registry
- Configuring the cloud Kubernetes cluster
- Creating the Kubernetes cluster
- Creating the cluster
- Setting up the Docker registry
- Creating an IAM user
- Using Kubernetes in the wild
- Technical requirements
- Configuring and Securing the Production System
- Further reading
- Questions
- Summary
- Adding the Frontend
- Deploying the Users Backend
- Deploying the full system locally
- Configuring the Ingress
- Configuring the service
- Configuring the deployment
- Configuring the services
- Connecting the services
- Describing the Frontend microservice
- Describing the Users Backend microservice
- Implementing multiple services
- Technical requirements
- Local Development with Kubernetes
- Further reading
- Questions
- Summary
- Troubleshooting a running cluster
- Removing an element
- Getting more information
- Defining an element
- Performing basic operations with kubectl
- Kubernetes Objects
- Kubernetes Control Plane
- Nodes
- Understanding the different Kubernetes elements
- Comparing Kubernetes with Docker Swarm
- Defining the Kubernetes orchestrator
- Technical requirements
- Using Kubernetes to Coordinate Microservices
- Section 3:Working with Multiple Services – Operating the System through Kubernetes
- Further reading
- Questions
- Summary
- Tagging and pushing every commit
- Tagging and pushing builds
- Setting the secret variables
- Pushing Docker images from Travis CI
- Configuring GitHub
- Sending notifications
- Working with Travis jobs
- Creating the .travis.yml file
- Adding a repo to Travis CI
- Configuring Travis CI
- Branching merging and ensuring a clear main build
- Leveraging the pipeline concept
- Knowing the advantages of using Docker for builds
- Producing automated builds
- Understanding continuous integration practices
- Technical requirements
- Creating a Pipeline and Workflow
- Further reading
- Questions
- Summary
- Pushing into a registry
- Using tags
- Obtaining public images from Docker Hub
- Pushing your Docker image to a remote registry
- Deploying the Docker service locally
- Configuring your service
- Creating a PostgreSQL database container
- Testing the container
- Operating with an immutable container
- Refreshing Docker commands
- Configuring uWSGI
- Building a web service container
- Understanding the Docker cache
- Executing commands
- Building your service with a Dockerfile
- Technical requirements
- Build Run and Test Your Service Using Docker
- Further reading
- Questions
- Summary
- test_thoughts.py
- Understanding test_token_validation.py
- Defining the pytest fixtures
- Testing the code
- Authenticating the requests
- Performing the action
- Serializing results
- Parsing input parameters
- Handling resources
- Introducing Flask-RESTPlus
- Implementing the service
- Working with SQLAlchemy
- Defining the database schema
- Specifying the API endpoints
- Designing the RESTful API
- Understanding the security layer
- Analyzing the Thoughts Backend microservice
- Technical requirements
- Creating a REST Service with Python
- Section 2: Designing and Operating a Single Service – Creating a Docker Container
- Further reading
- Questions
- Summary
- The final phase – the microservices shop
- The consolidation phase – steady migration to microservices
- The pilot phase – setting up the first couple of microservices
- Keeping the balance between new and old
- Web services' best friend – the load balancer
- Executing the move
- Change and structured approach
- The divide approach
- The replacement approach
- Strategic planning to break the monolith
- Preparing and adapting by measuring usage
- Analyzing the current system
- Challenges and red flags
- Parallel deployment and development speed
- Container orchestration and Kubernetes
- Docker containers
- The characteristics of a microservices approach
- The traditional monolith approach and its problems
- Technical requirements
- Making the Move – Design Plan and Execute
- Section 1: Introduction to Microservices
- Reviews
- Get in touch
- Conventions used
- Code in Action
- Download the color images
- Download the example code files
- To get the most out of this book
- What this book covers
- Who this book is for
- Preface
- Packt is searching for authors like you
- About the reviewer
- About the author
- Contributors
- Why subscribe?
- About Packt
- Dedication
- Hands-On Docker for Microservices with Python
- Copyright and Credits
- Title Page
- coverpage
- coverpage
- Title Page
- Copyright and Credits
- Hands-On Docker for Microservices with Python
- Dedication
- About Packt
- Why subscribe?
- Contributors
- About the author
- About the reviewer
- Packt is searching for authors like you
- Preface
- Who this book is for
- What this book covers
- To get the most out of this book
- Download the example code files
- Download the color images
- Code in Action
- Conventions used
- Get in touch
- Reviews
- Section 1: Introduction to Microservices
- Making the Move – Design Plan and Execute
- Technical requirements
- The traditional monolith approach and its problems
- The characteristics of a microservices approach
- Docker containers
- Container orchestration and Kubernetes
- Parallel deployment and development speed
- Challenges and red flags
- Analyzing the current system
- Preparing and adapting by measuring usage
- Strategic planning to break the monolith
- The replacement approach
- The divide approach
- Change and structured approach
- Executing the move
- Web services' best friend – the load balancer
- Keeping the balance between new and old
- The pilot phase – setting up the first couple of microservices
- The consolidation phase – steady migration to microservices
- The final phase – the microservices shop
- Summary
- Questions
- Further reading
- Section 2: Designing and Operating a Single Service – Creating a Docker Container
- Creating a REST Service with Python
- Technical requirements
- Analyzing the Thoughts Backend microservice
- Understanding the security layer
- Designing the RESTful API
- Specifying the API endpoints
- Defining the database schema
- Working with SQLAlchemy
- Implementing the service
- Introducing Flask-RESTPlus
- Handling resources
- Parsing input parameters
- Serializing results
- Performing the action
- Authenticating the requests
- Testing the code
- Defining the pytest fixtures
- Understanding test_token_validation.py
- test_thoughts.py
- Summary
- Questions
- Further reading
- Build Run and Test Your Service Using Docker
- Technical requirements
- Building your service with a Dockerfile
- Executing commands
- Understanding the Docker cache
- Building a web service container
- Configuring uWSGI
- Refreshing Docker commands
- Operating with an immutable container
- Testing the container
- Creating a PostgreSQL database container
- Configuring your service
- Deploying the Docker service locally
- Pushing your Docker image to a remote registry
- Obtaining public images from Docker Hub
- Using tags
- Pushing into a registry
- Summary
- Questions
- Further reading
- Creating a Pipeline and Workflow
- Technical requirements
- Understanding continuous integration practices
- Producing automated builds
- Knowing the advantages of using Docker for builds
- Leveraging the pipeline concept
- Branching merging and ensuring a clear main build
- Configuring Travis CI
- Adding a repo to Travis CI
- Creating the .travis.yml file
- Working with Travis jobs
- Sending notifications
- Configuring GitHub
- Pushing Docker images from Travis CI
- Setting the secret variables
- Tagging and pushing builds
- Tagging and pushing every commit
- Summary
- Questions
- Further reading
- Section 3:Working with Multiple Services – Operating the System through Kubernetes
- Using Kubernetes to Coordinate Microservices
- Technical requirements
- Defining the Kubernetes orchestrator
- Comparing Kubernetes with Docker Swarm
- Understanding the different Kubernetes elements
- Nodes
- Kubernetes Control Plane
- Kubernetes Objects
- Performing basic operations with kubectl
- Defining an element
- Getting more information
- Removing an element
- Troubleshooting a running cluster
- Summary
- Questions
- Further reading
- Local Development with Kubernetes
- Technical requirements
- Implementing multiple services
- Describing the Users Backend microservice
- Describing the Frontend microservice
- Connecting the services
- Configuring the services
- Configuring the deployment
- Configuring the service
- Configuring the Ingress
- Deploying the full system locally
- Deploying the Users Backend
- Adding the Frontend
- Summary
- Questions
- Further reading
- Configuring and Securing the Production System
- Technical requirements
- Using Kubernetes in the wild
- Creating an IAM user
- Setting up the Docker registry
- Creating the cluster
- Creating the Kubernetes cluster
- Configuring the cloud Kubernetes cluster
- Configuring the AWS image registry
- Configuring the usage of an externally accessible load balancer
- Deploying the system
- Using HTTPS and TLS to secure external access
- Being ready for migration to microservices
- Running the example
- Deploying a new Docker image smoothly
- The liveness probe
- The readiness probe
- Rolling updates
- Autoscaling the cluster
- Creating a Kubernetes Horizontal Pod Autoscaler
- Deploying the Kubernetes metrics server
- Configuring the resources in deployments
- Creating an HPA
- Scaling the number of nodes in the cluster
- Deleting nodes
- Designing a winning autoscaling strategy
- Summary
- Questions
- Further reading
- Using GitOps Principles
- Technical requirements
- Understanding the description of GitOps
- Managing configuration
- Understanding DevOps
- Defining GitOps
- Setting up Flux to control the Kubernetes cluster
- Starting the system
- Configuring Flux
- Configuring GitHub
- Forking the GitHub repo
- Adding a deploy key
- Syncing Flux
- Making a Kubernetes cluster change through GitHub
- Working in production
- Creating structure
- Using GitHub features
- Working with tags
- Summary
- Questions
- Further reading
- Managing Workflows
- Understanding the life cycle of a feature
- Features that affect multiple microservices
- Implementing a feature
- Reviewing and approving a new feature
- Reviewing feature code
- Approving releases
- Setting up multiple environments
- Scaling the workflow and making it work
- Reviewing and approving is done by the whole team
- Understanding that not every approval is the same
- Defining a clear path for releases
- Emergency releases
- Releasing frequently and adding feature flags
- Using feature flags
- Dealing with database migrations
- Summary
- Questions
- Further reading
- Section 4: Production-Ready System – Making It Work in Real-Life Environments
- Monitoring Logs and Metrics
- Technical requirements
- Observability of a live system
- Understanding logs
- Understanding metrics
- Setting up logs
- Setting up an rsyslog container
- Defining the syslog pod
- log-volume
- syslog container
- The front rail container
- Allowing external access
- Sending logs
- Generating application logs
- Dictionary configuration
- Logging a request ID
- Logging each request
- Searching through all the logs
- Detecting problems through logs
- Detecting expected errors
- Capturing unexpected errors
- Logging strategy
- Adding logs while developing
- Setting up metrics
- Defining metrics for the Thoughts Backend
- Adding custom metrics
- Collecting the metrics
- Plotting graphs and dashboards
- Grafana UI
- Querying Prometheus
- Updating dashboards
- Being proactive
- Alerting
- Being prepared
- Summary
- Questions
- Further reading
- Handling Change Dependencies and Secrets in the System
- Technical requirements
- Understanding shared configurations across microservices
- Adding the ConfigMap file
- Using kubectl commands
- Adding ConfigMap to the deployment
- Thoughts Backend ConfigMap configuration
- Users Backend ConfigMap configuration
- Frontend ConfigMap configuration
- Handling Kubernetes secrets
- Storing secrets in Kubernetes
- Creating the secrets
- Storing the secrets in the cluster
- Secret deployment configuration
- Retrieving the secrets by the applications
- Defining a new feature affecting multiple services
- Deploying one change at a time
- Rolling back the microservices
- Dealing with service dependencies
- Versioning the services
- Semantic versioning
- Adding a version endpoint
- Obtaining the version
- Storing the version in the image
- Implementing the version endpoint
- Checking the version
- Required version
- The main function
- Checking the version
- Summary
- Questions
- Further reading
- Collaborating and Communicating across Teams
- Keeping a consistent architectural vision
- Dividing the workload and Conway's Law
- Describing Conway's Law
- Dividing the software into different kinds of software units
- Designing working structures
- Structuring teams around technologies
- Structuring teams around domains
- Structuring teams around customers
- Structuring teams around a mix
- Balancing new features and maintenance
- Regular maintenance
- Understanding technical debt
- Continuously addressing technical debt
- Avoiding technical debt
- Designing a broader release process
- Planning in the weekly release meeting
- Reflecting on release problems
- Running post-mortem meetings
- Summary
- Questions
- Further reading
- Assessments
- Chapter 1
- Chapter 2
- Chapter 3
- Chapter 4
- Chapter 5
- Chapter 6
- Chapter 7
- Chapter 8
- Chapter 9
- Chapter 10
- Chapter 11
- Chapter 12
- Other Books You May Enjoy
- Leave a review - let other readers know what you think 更新時間:2021-06-24 12:36:37