2 Managing Infrastructure Components With Containers and Integrations

 

This chapter covers

  • The fundamentals of Docker containers.
  • Integrating a Keycloak Docker container with .NET Aspire to enable SSO security.
  • Understanding .NET Aspire integrations and their benefits over raw Docker containers.
  • Adding a pre-built .NET Aspire integration for Redis to an application.
  • Building a custom .NET Aspire integration library from scratch.

In a real-life enterprise-grade application, services need to be connected to various infrastructure components, such as databases, message brokers, etc.. In this chapter, we will discuss two ways infrastructure components can be wired up in a .NET Aspire application:

  1. By using Docker containers
  2. Via the .NET Aspire integration libraries

In order to be able to follow this chapter, you would need to know what Docker containers are. So, this is what we will look at first.

2.1 Docker containers overview

Docker is a technology that allows executable applications to be isolated into so-called containers. This technology is covered in detail in a great book by Jeff Nickoloff called “Docker in Action”. Here is an overview of what this technology is.

2.2 Keycloak overview

2.3 Initial setup

2.4 Adding a Keycloak container to .NET Aspire host

2.4.1 Configuring web front-end app

2.4.2 Configuring API service

2.4.3 Other service types .NET Aspire can host

2.5 How .NET Aspire integration libraries differ from containers

2.6 Configuring .NET Aspire integrations on the host

2.6.1 Connecting to an integration from a hosted service

2.6.2 Viewing integrations in the dashboard

2.7 Building a .NET Aspire integration library

2.7.1 Building an integration component

2.7.2 Launching a custom integration from Aspire Host

2.8 Summary