وبلاگ بلیان

Pro Java Microservices with Quarkus and Kubernetes : A Hands-on Guide

جلد کتاب Pro Java Microservices with Quarkus and Kubernetes : A Hands-on Guide

معرفی کتاب «Pro Java Microservices with Quarkus and Kubernetes : A Hands-on Guide» نوشتهٔ Tracy Wolff و Nebrass Lamouchi (auth.)، منتشرشده توسط نشر Apress : Imprint: Apress در سال 2021. این کتاب در فرمت pdf، زبان انگلیسی ارائه شده است.

Build and design microservices using Java and the Red Hat Quarkus Framework. This book will help you quickly get started with the features and concerns of a microservices architecture. It will introduce Docker and Kubernetes to help you deploy your microservices. You will be guided on how to install the appropriate tools to work properly. For those who are new to enterprise development using Quarkus, you will be introduced to its core principles and main features through a deep step-by-step tutorial. For experts, this book offers some recipes that illustrate how to split monoliths and implement microservices and deploy them as containers to Kubernetes. By the end of reading this book, you will have practical hands-on experience of building microservices using Quarkus and you will master deploying them to Kubernetes. **What You Will Learn** * Work with Quarkus and GraalVM * Split a monolith using the domain-driven design approach * Implement the cloud and microservices patterns * Rethink the deployment process * Introduce containerization, Docker, and Kubernetes to your toolkit * Boost microservices efficiency and performance with Azure * Play with Quarkus and distributed application runtimes **Who This Book Is For** Java developers who want to build microservices using Red Hat Quarkus and who want to deploy them in Kubernetes. Table of Contents 5 About the Author 11 About the Technical Reviewer 12 Acknowledgments 13 Preface 14 Introduction 17 Chapter 1: Getting Started with Containerization 19 Introducing Containerization 19 Introducing Docker 20 The Dockerfile 21 Images and Containers 21 Installing Docker 21 Running Your First Container 22 Understanding the Docker Architecture 24 Docker Objects 25 Images 25 Containers 25 Docker Machine 25 Diving Into Docker Containers 26 Docker Containers in Development Environments 26 Define a Container with Dockerfile 26 Create a Sample Application 27 Run the App 32 Publish Your Image 35 Log In with Your Docker ID 35 Tag the Image 36 Publish the Image 36 Pull and Run the Image from Docker Hub 37 Play with Google Jib 38 Build with Google Jib 39 Meeting the Docker Services 40 Create the First docker-compose.yml File 41 Achieving More with Docker 42 Get the Needed Tools Quickly 42 Get a Dockerized PostgreSQL Instance 42 Get a Dockerized SonarQube Instance 44 Unleash the Requirements Chains 44 Containerization Is Not Docker Only 47 What Are Docker’s Limitations? 47 Meet Podman and Buildah 48 Conclusion 51 Chapter 2: Introduction to the Monolithic Architecture 52 Introduction to an Actual Situation 52 Presenting the Context 53 Solving These Issues 55 Chapter 3: Coding a Monolithic Application 56 Presenting the Domain 56 Use Case Diagram 56 Class Diagram 58 Sequence Diagram 59 Coding the Application 59 Presenting the Technology Stack 60 The PostgreSQL Database 60 Java 11 61 Maven 61 The Quarkus Framework 62 JetBrains IntelliJ IDEA 63 Implementing the QuarkuShop 64 Generating the Project Skull 65 Creating the Persistence Layer 70 Cart 72 CartStatus 76 Address 76 Category 77 Customer 78 Order 80 OrderItem 82 Payment 83 Product 85 ProductStatus 87 Review 87 Creating the Service Layer 92 Typical Service: CartService 93 AddressService 96 CategoryService 98 CustomerService 100 OrderItemService 102 OrderService 104 PaymentService 107 Product Service 110 ReviewService 112 Creating the Web Layer 114 Typical RestController: CartResource 115 CategoryResource 117 CustomerResource 117 OrderItemResource 119 OrderResource 119 PaymentResource 121 ProductResource 122 ReviewResource 123 Automated API Documentation 124 Hello World Swagger! 124 Customize the Quarkus Banner 127 Conclusion 128 Chapter 4: Upgrading a Monolithic Application 129 Implementing QuarkuShop Tests 129 Introducing Tests Libraries in Quarkus 129 Writing the First Tests 135 Discovering SonarQube 143 Building and Running QuarkuShop 151 Building the QuarkuShop 151 Packaging Modes in Quarkus 151 Meeting the Quarkus Native 152 Running the Tests in Native Mode 154 Packaging and Running the Native QuarkuShop 156 Differences Between the JVM and Native Modes 162 The Magic Behind GraalVM’s Power 169 Conclusion 169 Chapter 5: Building and Deploying a Monolithic Application 170 Introduction 170 Importing the Project into Azure DevOps 170 Creating the CI/CD Pipelines 176 Creating the Continuous Integration Pipeline 176 Creating a Maven-Based CI Pipeline 179 Creating a Docker Multistage Based CI Pipeline 180 Making the Continuous Deployment Pipeline 184 Create the Virtual Machine 184 Create the Continuous Deployment Pipeline 191 Conclusion 201 Chapter 6: Adding Anti-Disaster Layers 202 Introduction 202 Implementing the Security Layer 203 Analyzing Security Requirements and Needs 203 Defining Authorization Matrices for REST APIs 205 Implementing the Security Layer 208 Preparing and Configuring Keycloak 209 Implementing the auth2 Java Components in QuarkuShop 227 Java Configuration Side 227 Java Source Code Side 228 Update the Integration Tests to Support auth2 242 Adding Keycloak to the Production Environment 245 Implementing the Monitoring Layer 253 Implementing Health Checks 253 Implementing the Metrics Service 258 Conclusion 266 Chapter 7: Microservices Architecture Pattern 267 Introduction 267 Microservices Architecture 269 Benefits of a Microservices Architecture 269 What Really Is a Microservice? 270 Conclusion: Making the Switch 271 Chapter 8: Splitting the Monolith: Bombarding the Domain 272 Introduction 272 What Is Domain-Driven Design? 272 Context 273 Domain 273 Model 273 Ubiquitous Language 273 Strategic Design 273 Bounded Context 274 Bombarding QuarkuShop 275 Codebase 275 Dependencies and Commons 275 Entities 275 Example: Breaking Foreign Key Relationships 276 Conclusion 277 Chapter 9: Applying DDD to the Code 278 Applying Bounded Contexts to Java Packages 278 The Birth of the Commons Package 279 Locating the Bounded Contexts Relationships 280 Breaking the BC Relationships 282 Conclusion 288 Chapter 10: Meeting the Microservices Concerns and Patterns 289 Cloud Patterns 289 Service Discovery and Registration 290 Context and Problem 290 Solution 290 Externalized Configuration 291 Context and Problem 291 Solution 292 Circuit Breaker 292 Context and Problem 292 Solution 292 Database Per Service 293 Context and Problem 293 Solution 293 API Gateway 294 Context and Problem 294 Solution 295 CQRS 295 Context and Problem 295 Solution 296 Event Sourcing 297 Context and Problem 297 Solution 297 Log Aggregation 298 Context and Problem 298 Solution 298 Distributed Tracing 299 Context and Problem 299 Solution 299 Audit Logging 299 Context and Problem 299 Solution 299 Application Metrics 300 Context and Problem 300 Solution 300 Health Check API 300 Context and Problem 300 Solution 300 Security Between Services: Access Token 301 Context and Problem 301 Solution 301 Conclusion 301 Chapter 11: Getting Started with Kubernetes 302 Introduction 302 What Is Kubernetes? 303 The Kubernetes Architecture 303 Kubernetes Core Concepts 305 Kubectl 305 Cluster 305 Namespace 305 Label 305 Pod 305 ReplicaSet 306 Deployment 307 StatefulSet 308 DaemonSet 309 Service 310 Ingress 311 Volume 311 PersistentVolume 311 PersistentVolumeClaim 312 StorageClass 312 Job 312 CronJob 312 ConfigMap 312 Secret 313 Run Kubernetes Locally 313 Practical Summary and Conclusion 315 Additional Reading 317 Chapter 12: Implementing the Cloud Patterns 319 Introduction 319 Bringing the Monolithic Universe to Kubernetes 319 Deploying PostgreSQL to Kubernetes 319 Deploying Keycloak to Kubernetes 325 Deploying the Monolithic QuarkuShop to Kubernetes 331 Conclusion 342 Chapter 13: Building the Kubernetized Microservices 343 Introduction 343 Creating the Commons Library 344 Implementing the Product Microservice 348 Implementing the Order Microservice 356 Implementing the Customer Microservice 366 Implementing the User Microservice 369 Conclusion 371 Chapter 14: Flying All Over the Sky with Quarkus and Kubernetes 372 Introduction 372 Implementing the Circuit Breaker Pattern 373 Implementing the Log Aggregation Pattern 377 Step 1: Deploying the ELK Stack to Kubernetes 378 Step 2: Configuring the Microservices to Log Into the ELK Stack 384 Step 3: Collecting Logs 385 Implementing the Distributed Tracing Pattern 389 Step 1: Deploying the Jaeger All-in-One to Kubernetes 390 Step 2: Enabling Jaeger Support in Our Microservices 396 Step 3: Collecting Traces 398 Implementing the API Gateway Pattern 400 Step 1: Enabling Ingress Support in Minikube 401 Step 2: Creating the API Gateway Ingress 401 Step 3: Testing Ingress 404 Conclusion 404 Afterword: Final Words and Thoughts 405 Index 406
دانلود کتاب Pro Java Microservices with Quarkus and Kubernetes : A Hands-on Guide