Hands-On Microservices with Django Build Cloud-Native and Reactive Applications with Python Using Django 5
Are you a Django developer looking to leverage microservices to create optimized and scalable web applications? If yes, then this book is for you. With microservices, you can split an application into self-contained services, each with a specific scope running asynchronously while collectively execu...
Otros Autores: | |
---|---|
Formato: | Libro electrónico |
Idioma: | Inglés |
Publicado: |
Birmingham, England :
Packt Publishing
[2024]
|
Edición: | First edition |
Materias: | |
Ver en Biblioteca Universitat Ramon Llull: | https://discovery.url.edu/permalink/34CSUC_URL/1im36ta/alma991009819037406719 |
Tabla de Contenidos:
- Cover
- Title Page
- Copyright and Credits
- Dedication
- Contributors
- Table of Contents
- Preface
- Part 1: Introducing Microservices and Getting Started
- Chapter 1: What Is a Microservice?
- Comparing monolithic web applications and microservices
- A monolithic version of a Discount Claim app
- A microservices version of the Discount Claim app
- Characteristics of microservices
- Exploring the microservices architecture and its components
- An analogy to deepen our understanding of microservices
- Listing the benefits of microservices
- The drawbacks of microservices
- Distinguishing types of microservice
- Cloud-native microservices
- Reactive microservices
- Designing microservices
- Analyzing the user story
- Split the user story into use cases
- Summary
- Chapter 2: Introducing the Django Microservices Architecture
- Technical requirements
- Exploring Django's native components for microservices web applications
- DRF
- Django's Cache Framework
- Traversing the external components for Django microservices web applications
- Task and message queue brokers
- Container software
- The complete Django microservices architecture
- Creating a sample microservice
- Implementation 1: Offloading a task with a RabbitMQ microservice
- Implementation 2: Offloading a task with a Celery microservice
- Summary
- Chapter 3: Setting Up the Development and Runtime Environment
- Technical requirements
- Setting up the development environment
- Extra setup for Windows developers
- Installing the required Python packages
- Setting up the runtime environment
- Installing Docker Desktop
- Installing RabbitMQ as a Docker container
- Installing Redis as a Docker container
- Signing up for MongoDB and working from VS Code
- Analyzing the sample microservices application
- Matching an address.
- The app's requirements as user stories
- Splitting the requirements into use cases
- Phasing the development of the sample application
- Summary
- Part 2: Building the Microservices Foundation
- Chapter 4: Cloud-native Data Processing with MongoDB
- Technical requirements
- Introducing MongoDB and cloud-native databases
- What are cloud-native databases?
- MongoDB is a NoSQL database
- Setting up MongoDB
- Optional: creating a paid cluster for production databases
- Creating a database user
- Setting up our MongoDB cluster for Django
- Creating a Database
- Creating documents inside a collection
- Updating documents
- Deleting documents and collections
- Mapping CRUD operations to HTTP methods
- CRUD operations on MongoDB with Django ORM
- CRUD operations on MongoDB with pymongo
- Cleaning up
- Summary
- Chapter 5: Creating RESTful APIs for Microservices
- Technical requirements
- Introducing RESTful APIs
- Benefits of RESTful APIs
- The RESTful API architecture
- Building RESTful APIs with DRF
- Setting up DRF
- Creating a model and a serializer
- Creating a view and the URL endpoints
- Browsing a DRF RESTful API
- Error handling
- Handling wrong-formatted requests
- Handling validation errors
- Summary
- Chapter 6: Orchestrating Microservices with Celery and RabbitMQ
- Technical requirements
- Introducing task queues
- Implementing the work queue scenario
- Implementing the Publish-Subscribe scenario
- Implementing the Request-Response scenario
- Exploring Celery and RabbitMQ
- Celery
- RabbitMQ
- Creating and running asynchronous tasks
- Creating and running a Celery-based task
- Creating and running a RabbitMQ-based task
- Monitoring tasks and task queues
- Monitoring Celery tasks with Flower
- Monitoring RabbitMQ tasks
- Summary
- Chapter 7: Testing Microservices
- Technical requirements.
- Introducing testing microservices
- Unit testing microservices
- Creating and running happy path tests
- Creating and running boundary tests
- End-to-end testing microservices
- Automated testing with Selenium
- Summary
- Chapter 8: Deploying Microservices with Docker
- Technical requirements
- Introducing Docker
- Benefits of Docker (containers)
- Containerizing microservices
- Applying multi-container deployment with Docker Compose
- Deploying a Django microservices application
- Showing a list of the images we created
- Showing a list of created and running containers
- Inspecting the console output of a container
- Stopping a container
- Starting a container
- Removing a container
- Removing an image
- Deploying a new microservices version
- Scaling microservices
- Vertical and horizontal scaling
- Docker Swarm
- Kubernetes
- Summary
- Part 3: Taking Microservices to the Production Level
- Chapter 9: Securing Microservices
- Technical requirements
- Introducing microservices security
- North-south security for microservices
- East-west security for microservices
- Token-based security with JWT
- User-based security with OAuth 2.0
- Controlling access to microservices
- Securing data communication between microservices
- Summary
- Chapter 10: Improving Microservices Performance with Caching
- Technical requirements
- Introducing caching
- Applying Django's cache framework
- Caching a web page
- Caching page data
- Using Redis for caching
- Redis as a backend cache for Django's cache framework
- Redis as a standalone cache
- Summary
- Chapter 11: Best Practices for Microservices
- Technical requirements
- Organizing code
- Apply the singe task principle
- Separate responsibilities
- Standardize the communication protocols
- Containerize microservices
- Apply version control.
- Document the code
- Conduct code reviews
- Documenting microservices
- Provide code comments
- Create a README file for the microservices application
- Document RESTful APIs
- Logging and monitoring
- Apply integrated logging
- Implement log levels
- Log context information
- Alert anomalies
- Error handling
- Catch and log errors
- Other error handling options
- Versioning microservices
- Apply semantic versioning
- Utilize RESTful API versioning
- Summary
- Further reading
- Chapter 12: Transforming a Monolithic Web Application into a Microservices Version
- Introducing the transformation approach
- Implementing the approach step by step
- Determining requirements
- Decomposing the monolith
- Designing the microservices
- Selecting the technology
- Creating the data foundation
- Developing the microservices
- Testing and deploying
- Summary
- Index
- Other Books You May Enjoy.