وبلاگ بلیان

Introducing Distributed Application Runtime (Dapr) : simplifying microservices applications through development through proven and reusable patterns and practices

جلد کتاب Introducing Distributed Application Runtime (Dapr) : simplifying microservices applications through development through proven and reusable patterns and practices

معرفی کتاب «Introducing Distributed Application Runtime (Dapr) : simplifying microservices applications through development through proven and reusable patterns and practices» نوشتهٔ Radoslav Gatev، منتشرشده توسط نشر Apress : Imprint: Apress در سال 2021. این کتاب در فرمت pdf، زبان انگلیسی ارائه شده است.

Use this book to learn the Distributed Application Runtime (Dapr), a new event-driven runtime from Microsoft designed to help developers build microservices applications, using a palette of languages and frameworks that run everywhere: on-premises, in any cloud, and even on the edge. One of the most popular architectural patterns for implementing large, complex, distributed solutions is the microservices architectural style. Because solutions are composed of services based on various languages, frameworks, and platforms, the more complex and compartmentalized an application becomes, the more considerations a developer has to keep in mind. Much of the time this proves to be difficult. Introducing Distributed Application Runtime (Dapr) is your guide to achieving more with less through patterns. Part I of the book is about understanding microservices and getting up and running with Dapr, either on your machine or in any Kubernetes cluster. From there you are guided through the concepts of Dapr, how it works, and what it can do for you. You will wrap up with various ways to debug Dapr applications using Visual Studio Code locally, inside a container or Kubernetes. In Part II you will jump into the reusable patterns and practices, the building blocks of Dapr. You will go from service invocation, publish and subscribe, state management, resource bindings, and the Actor model to secrets; each building block is covered in detail in its own dedicated chapter. You will learn what Dapr offers from a functional perspective and also how you can leverage the three pillars of observability (logs, metrics, and traces) in order to gain insight into your applications. In Part III you will explore advanced concepts, including using middleware pipelines, integrating Dapr into web frameworks such as ASP.NET Core, or the runtimes of Azure Logic Apps and Azure Functions. The book features a multi-versed set of examples that cover not only the plain API of Dapr, but also the .NET SDK. Hence, most of the examples are in .NET 5, with a small number in JavaScript to exemplify the use of multiple languages. Examples show you how to securely use Dapr to leverage a variety of services in Microsoft Azure, including Azure Kubernetes Service, Azure Storage, Azure Service Bus, Azure Event Grid, Azure Key Vault, Azure Monitor, and Azure Active Directory among others. What You Will Learn Recognize the challenges and boundaries of microservices architecture Host Dapr inside a Kubernetes cluster or as a standalone process Leverage and use Dapr's ready-to-use patterns and practices Utilize its HTTP/gRPC APIs Use Dapr with ASP.NET Core and in .NET applications (with or without the SDK) Implement observability for Dapr applications Secure Dapr applications Integrate Dapr with the runtime of Azure Logic Apps and Azure Functions Realize the full potential of Visual Studio Code by using the right extensions that will contribute to a better development experience Who This Book Is For Developers and architects who want to utilize a proven set of patterns to help easily implement microservices applications Table of Contents 5 About the Author 13 About the Technical Reviewer 14 Foreword 15 Acknowledgments 16 Introduction 18 Part I: Getting Started 21 Chapter 1: Introduction to Microservices 22 A Brief History of System Design 22 Hardware Progress 23 Software Progress 24 Applications Development 24 Infrastructure and Scalability 24 Monolithic Architecture 25 Benefits of the Monolithic Architecture 26 Drawbacks of the Monolithic Architecture 27 Microservices Architecture 28 Designing Microservices 29 Benefits 30 Downsides 32 Abstract Infrastructure 33 Some Useful Patterns 35 API Gateway 35 Saga 38 Orchestration 38 Choreography 39 Sidecar 40 Adopting Microservices 41 Summary 42 Chapter 2: Introduction to Dapr 43 What Is Dapr? 43 How Was Complex Made Simple? 44 Out-of-the-Box Patterns 45 Dapr Components 46 How Does Dapr Work? 48 Hosting Modes 51 Getting Started with Dapr in Self-Hosted Mode 52 Download Dapr 52 Initialize Dapr 53 Run Applications with Dapr 55 Distributed Hello World Application 55 Implement the Hello Service 56 Implement the World Service 62 Implement the Greeting Service 64 Exploring the Dapr Dashboard 65 Using Dapr SDKs 66 Summary 67 Chapter 3: Getting Up to Speed with Kubernetes 68 Kubernetes: The Big Picture 69 Control Plane Components 70 Node Components 71 Container Images 73 Running a Docker Container 74 Building a Docker Image 75 Optimizing the Size of a Docker Image 76 Pushing to Remote Registry 77 Get Started with Kubernetes 78 Kubernetes Objects 79 Pods 80 Services 81 Deployments 82 Packaging Complex Applications 84 Summary 84 Chapter 4: Running Dapr in Kubernetes Mode 85 Installing Dapr in Kubernetes Mode 85 Exploring the Dapr Control Plane 86 Installing the Dapr Helm Chart 90 Zero-Downtime Upgrades 92 Uninstalling Dapr 93 Dapr Applications in Kubernetes 94 Dapr and Service Meshes 97 Isolation of Components and Configuration 98 Summary 98 Chapter 5: Debugging Dapr Applications 100 Dapr CLI 100 Dapr Extension for Visual Studio Code 101 Development Container 102 Bridge to Kubernetes 104 Summary 107 Part II: Building Blocks Overview 108 Chapter 6: Service Invocation 109 Overview 109 Working with HTTP-Based Services 112 Name Resolution 115 Multicast DNS in Self-Hosted Mode 115 Kubernetes Name Resolution 115 Cross-Namespace Invocation 120 Working with gRPC-Based Services 121 Implementing a gRPC Server 122 Invoking gRPC Service from HTTP 125 Implementing a gRPC Client 126 Securing Service-to-Service Communication 128 Securing Dapr Sidecars and Dapr Applications 131 Summary 132 Chapter 7: Publish and Subscribe 133 What Is Publish/Subscribe? 133 What Are the Benefits of Publish and Subscribe? 134 When Not to Use Publish and Subscribe? 136 How Does Dapr Simplify Publish and Subscribe? 136 Defining the Component 138 Message Format 139 Receiving a Message 141 Subscribing to a Topic 143 Programmatic Subscription 143 Declarative Subscription 144 Controlling Time-to-Live (TTL) 144 Controlling Topic Access 145 What Messaging Systems Are Supported by Dapr? 145 A Temperature Sensor Example 146 Switching Over to Another Messaging System 154 Limitations of the Publish and Subscribe Building Block 157 Summary 158 Chapter 8: State Management 159 Stateful vs. Stateless Services 159 State Management in Dapr 161 Defining the Component 162 Controlling Behavior 163 Concurrency 163 Consistency 164 Metadata 165 Saving State 165 Getting State 167 Getting Individual Items 168 Getting Items in Bulk 168 Deleting State 169 Using State Transactions 170 Supported Stores 171 Summary 172 Chapter 9: Resource Bindings 173 The Need to Communicate with External Services 173 Supported Bindings 174 Generic Components 175 Public Cloud Platform Components 178 Overview of the Building Block 180 Binding Components 180 Input Bindings 181 Output Bindings 183 Implementing an Image Processing Application 185 Overview 185 Creating Resources in Microsoft Azure 188 Creating the Dapr Components 191 Implementing the Service 193 Running the Dapr Application 195 Summary 197 Chapter 10: The Actor Model 198 Overview of the Actor Model 198 Advantages and Disadvantages 201 When to Use It? 203 Actor Implementations 204 Virtual Actors 204 The Actor Model in Dapr 205 Dapr Placement Service 206 The Lifetime of Actor Instances 210 Concurrency 212 Invoking Actors via the API 213 Implementing Actors 214 Defining the Actor Interfaces 215 Implementing the Interfaces 217 Implementing the Client 223 Running the Home Automation System 225 Summary 225 Chapter 11: Secrets 227 The Challenges of Secrets Management 227 Application Challenges and Anti-patterns 228 The Need for a Central Secret Store 229 The Secrets Building Block 230 Supported Secret Stores 230 Reference Secrets from Components 231 Retrieve a Secret from the API 233 Retrieve All Secrets in the Store 234 Using a Secret Store 234 Using a Secret Store in Kubernetes 239 A Few Remarks on Kubernetes Secrets 241 Controlling Access to Secrets 242 Summary 243 Chapter 12: Observability: Logs, Metrics, and Traces 244 The Three Pillars of Observability 244 Logs 244 Dapr Logs 245 Metrics 247 Dapr Metrics 247 Tracing 248 Dapr Distributed Tracing 248 Configuring Tracing 249 Preserving the Trace Context 250 Azure Monitor 254 Metrics and Logs from AKS 254 Metrics and Logs from Any K8s 257 Traces from Any K8s 258 Grafana 260 Installing Prometheus 261 Setting Up Grafana 261 Importing the Dapr Dashboards 262 Summary 263 Part III: Integrations 264 Chapter 13: Plugging Middleware 265 Middleware in Dapr 265 Configuring and Using Middleware 267 Utilizing the OAuth 2.0 Middleware 269 Authorization Code Grant Middleware 271 Client Credentials Grant Middleware 273 Utilizing the OpenID Connect Middleware 276 Open Policy Agent Middleware 279 Summary 280 Chapter 14: Using Dapr in ASP.NET Core 281 Overview 281 Support for ASP.NET Controllers 282 Subscribing to a Topic 283 Retrieving an Item from a State Store 284 Support for ASP.NET Core Endpoint Routing 285 Implementing a gRPC Service 286 Retrieving Secrets 289 Summary 291 Chapter 15: Using Dapr with Azure Functions 292 Azure Functions Overview 292 Dapr Triggers and Bindings 294 Azure Functions Development 295 Ports of Dapr and Azure Functions 295 Implementing an Application 296 Summary 299 Chapter 16: Using Dapr with the Azure Logic Apps Runtime 300 Azure Logic Apps Overview 300 Integration Between Dapr and Logic Apps 301 Designing a Workflow 302 Summary 305 Index 306 Use this book to learn the Distributed Application Runtime (Dapr), a new event-driven runtime from Microsoft designed to help developers build microservices applications, using a palette of languages and frameworks that run everywhere: on-premises, in any cloud, and even on the edge. One of the most popular architectural patterns for implementing large, complex, distributed solutions is the microservices architectural style. Because solutions are composed of services based on various languages, frameworks, and platforms, the more complex and compartmentalized an application becomes, the more considerations a developer has to keep in mind. Much of the time this proves to be difficult. Introducing Distributed Application Runtime (Dapr) is your guide to achieving more with less through patterns. Part I of the book is about understanding microservices and getting up and running with Dapr, either on your machine or in any Kubernetes cluster. From there you are guided through the concepts of Dapr, how it works, and what it can do for you. You will wrap up with various ways to debug Dapr applications using Visual Studio Code locally, inside a container or Kubernetes. In Part II you will jump into the reusable patterns and practices, the building blocks of Dapr. You will go from service invocation, publish and subscribe, state management, resource bindings, and the Actor model to secrets; each building block is covered in detail in its own dedicated chapter. You will learn what Dapr offers from a functional perspective and also how you can leverage the three pillars of observability (logs, metrics, and traces) in order to gain insight into your applications. In Part III you will explore advanced concepts, including using middleware pipelines, integrating Dapr into web frameworks such as ASP.NET Core, or the runtimes of Azure Logic Apps and Azure Functions. The book features a multi-versed set of examples that cover not only the plain API of Dapr, but also the .NET SDK. Hence, most of the examples are in .NET 5, with a small number in JavaScript to exemplify the use of multiple languages. Examples show you how to securely use Dapr to leverage a variety of services in Microsoft Azure, including Azure Kubernetes Service, Azure Storage, Azure Service Bus, Azure Event Grid, Azure Key Vault, Azure Monitor, and Azure Active Directory among others. What You Will Learn Recognize the challenges and boundaries of microservices architecture Host Dapr inside a Kubernetes cluster or as a standalone process Leverage and use Dapr's ready-to-use patterns and practices Utilize its HTTP/gRPC APIs Use Dapr with ASP.NET Core and in .NET applications (with or without the SDK) Implement observability for Dapr applications Secure Dapr applications Integrate Dapr with the runtime of Azure Logic Apps and Azure Functions Realize the full potential of Visual Studio Code by using the right extensions that will contribute to a better development experience This book is for developers and architects who want to utilize a proven set of patterns to help easily implement microservices applications. Radoslav Gatev is a software architect and consultant who specializes in designing and building complex and vast solutions in Microsoft Azure. He helps companies all over the world, ranging from startups to big enterprises, to have high-performant and resilient applications that utilize the cloud in the best and most efficient way possible. Radoslav has been awarded a Microsoft Most Valuable Professional (MVP) for Microsoft Azure for his ongoing contributions to the community in this area. He frequently speaks and presents at various conferences and participates in organizing multiple technical conferences in Bulgaria
دانلود کتاب Introducing Distributed Application Runtime (Dapr) : simplifying microservices applications through development through proven and reusable patterns and practices