chapter nine

9 Deploying Aspire apps to production

 

This chapter covers

  • Scaling out individual services in .NET Aspire
  • Generating .NET Aspire manifest for distributed application deployment.
  • Deploying Aspire applications to Azure Container Apps.
  • Using Aspire8 to deploy Aspire apps to a Kubernetes cluster on any cloud environment.

So far, we looked at how .NET Aspire apps can be orchestrated while being built and debugged on a development machine. However, eventually, we will need to deploy the app to production.

Aspire has some built-in mechanisms for doing this. We will look at them in this chapter. The code samples we will use are available via the following address:

Before we jump into deploying Aspire apps, let us delve into some modifications of our .NET Aspire setup that would make it easier for us to manage the application once it's been deployed.

9.1 Pre-deployment modifications of Aspire-hosted systems

Why would we need to modify our system further before deploying it? Well, there may be multiple reasons to do so. For example, we may anticipate that, for certain types of services, we will always run multiple replicas. Perhaps, we are expected to deal with high user throughput, and a single replica just won’t cut it. In .NET Aspire, this can be configured in the host, as we shall see shortly.

9.1.1 Running multiple instances of a service

9.1.2 Running environment-specific services

9.1.3 Managing database migrations

9.1.4 Modifying the dashboard

9.2 Preparing .NET Aspire for deployment

9.3 Deploying to Azure Container Apps

9.3.1 Using the Azure Developer CLI

9.3.2 Deploying From Visual Studio

9.3.3 Obtaining the deployment files

9.3.4 Converting Aspire manifest to Terraform

9.4 Converting .NET Aspire manifest to Kubernetes

9.4.1 Using Aspir8

9.4.2 Deploying to a Kubernetes cluster

9.5 Summary