liveBook · Manning

Chapter 9: Deploying Aspire apps to production

What you will learn in chapter 9 of Building Distributed Applications that Work

Introduces the move from local Aspire orchestration to production deployment and previews the chapter’s topics.

After this chapter you will be able to

What it builds on

Section by section

Introduction

Introduces the move from local Aspire orchestration to production deployment and previews the chapter’s topics.

9.1 Predeployment modifications of Aspire-hosted systems

The section explains why an Aspire-hosted system may need changes before deployment: scaling services, choosing environment-specific substitutes, updating database schemas, and handling backed-up message queues.

Key terms: replicas, local substitutes, Aspire host, database migrations, schema, Aspire dashboard, custom command, message queues, message broker

9.1.1 Running multiple instances of a service

This section explains why services run multiple replicas, how to configure them in Aspire, and why those replicas share a dashboard endpoint.

Key terms: scale out, replicas, load balancer, WithReplicas(), AppHost.cs, webfrontend, dashboard, front-facing addresses, logs, HTTP port

9.1.2 Running environment-specific services

Shows how to use a local substitute for an Azure-specific service and keep local-only AppHost configuration out of deployment scripts.

Key terms: Azure SQL Server, standard containerized version of SQL Server, AppHost, ExecutionContext, IsRunMode, IsPublishMode, AddAzureSqlServer(), service discovery, builder.Environment.IsDevelopment(), builder.ExecutionContext.IsRunMode

9.1.3 Managing database migrations

Explains how Entity Framework migrations track schema changes and how an Aspire-hosted API can apply them automatically on deployment.

Key terms: database migrations, schema, migration, Microsoft.EntityFrameworkCore.Design, Entity Framework CLI tools, database context, entity type, Migrations folder, model snapshot, EnsureCreated()

9.1.4 Modifying the dashboard

This section shows how to add a Redis cache-reset command to the Aspire dashboard before deployment.

Key terms: Redis cache, distributed locks, cache invalidated, Redis, FLUSHALL, CommandOptions, WithCommand(), Redis cache resource

9.2 Preparing Aspire for deployment

This section introduces the Aspire manifest as the JSON description of an application used to begin publishing it.

Key terms: manifest files, manifest.json, --output-path, Aspire host project, schema, resources, cache, Redis, Docker image, container.v0

9.3 Deploying to Azure Container Apps

Introduces Azure Container Apps as the deployment target supported by the Aspire manifest alone and identifies the Azure Developer CLI as the tool to install before deploying.

Key terms: cloud-agnostic, Aspire manifest, Azure Container Apps, Azure Developer CLI

9.3.1 Using the Azure Developer CLI

This subsection outlines the prompted Azure Developer CLI workflow for deploying an Aspire application to Azure Container Apps and identifies the files created during setup.

Key terms: Aspire host project folder, Azure Container Apps, Azure environment, azure.yaml, next-steps.md

9.3.2 Deploying from Visual Studio

This subsection shows how to deploy an Aspire app to Azure Container Apps through Visual Studio while still using the Azure Developer CLI.

Key terms: App Host project, Publish, Azure Container Apps, Azure Developer CLI

9.3.3 Obtaining the deployment files

This section shows how to generate editable Aspire deployment files and adjust their Bicep scripts when deployment must be scoped to an Azure resource group.

Key terms: in-memory files, azd infra gen, infra, resource group, Bicep, main.bicep, resources.bicep, rg variable

9.4 Converting Aspire manifest to Terraform

This section introduces Terraform as a cloud-independent alternative to Bicep and outlines how to generate Terraform files from an Aspire manifest.

Key terms: Terraform, Bicep, GCP, AWS, Aspire.Terraform, Aspire manifest, Aspire host project folder, scaffold, verify the outputs

9.5 Converting Aspire manifest to Kubernetes

Introduces Kubernetes as a deployment target for Aspire apps and explains that Aspire manifests must be converted into a Kubernetes-readable format.

Key terms: Kubernetes, pods, scaling, load balancing, self-healing, service discovery, Aspire manifests, Aspir8

9.5.1 Using Aspir8

This section shows how Aspir8 turns an Aspire App Host manifest into Kubernetes deployment files and identifies the generated output.

Key terms: Aspir8, Aspire App Host manifest, aspirate.json, Kubernetes deployment YAML files, aspirate-output, dashboard.yaml, kustomization.yaml, service subfolders

9.5.2 Deploying to a Kubernetes cluster

This section explains how to connect kubectl to a Kubernetes cluster, verify the connection, and deploy the generated Aspire resources.

Key terms: kubectl, Kubernetes cluster, Azure CLI, AWS CLI, gcloud CLI, nodes, apply, YAML files, aspirate-output, kustomization.yaml

9.6 Building CI/CD pipelines for Aspire

This section explains what CI/CD pipelines automate and identifies the Azure Developer CLI steps to take before building an Aspire deployment pipeline.

Key terms: CI/CD pipelines, commit, pull request (PR), prebuild checks, azd init, azd login, azd up, Aspire host project directory, AZD config files

9.6.1 Creating a GitHub Actions pipeline

This section explains how a generated GitHub Actions deployment pipeline can be configured for different environments and improved with tests, provisioning diagnostics, and application settings.

Key terms: GitHub Actions, azure-dev.yml, .github, workflows, environment variables, automated tests, build, pipeline, Bicep, Azure resource group

9.6.2 Creating an Azure DevOps pipeline

This section explains how to scaffold an Azure DevOps pipeline for an Aspire deployment and when the generated YAML needs manual configuration or customization.

Key terms: AZD, Aspire host project directory, .azdo, azure-dev.yml, Azure DevOps, Git repo, CLI, YAML file, YAML, GitHub Actions workflow

9.6.3 Building pipelines for Kubernetes deployment

The section recommends scaffolding a Kubernetes deployment pipeline before manually adapting its YAML.

Key terms: scaffold, boilerplate YAML, Kubernetes

9.7 Summary

Where this is used later

Concepts explained in this chapter

← Chapter 8: Application security in Aspire Chapter 10: Adding legacy apps to Aspire and working with AI agents →

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.