From 359ca8e0be75c7088f9ad8cf3807e39fdfe367ae Mon Sep 17 00:00:00 2001 From: Simon Kurtz Date: Mon, 6 Jan 2025 16:22:24 -0500 Subject: [PATCH 01/11] Add note about dapr-scheduler to snippets --- snippets/dapr-run-backend-api.md | 8 ++++++++ snippets/dapr-run-backend-service.md | 4 ++++ snippets/dapr-run-frontend-webapp.md | 4 ++++ 3 files changed, 16 insertions(+) diff --git a/snippets/dapr-run-backend-api.md b/snippets/dapr-run-backend-api.md index 67d2748a..e9c6ff4d 100644 --- a/snippets/dapr-run-backend-api.md +++ b/snippets/dapr-run-backend-api.md @@ -7,9 +7,13 @@ dapr run ` --app-id tasksmanager-backend-api ` --app-port $API_APP_PORT ` --dapr-http-port 3500 ` +--scheduler-host-address "" ` --app-ssl ` -- dotnet run --launch-profile https ``` + +!!! note + An [issue with dapr-scheduler](https://github.com/Azure/aca-dotnet-workshop/issues/168){target=_blank} presently exists with Dapr 1.4. However, this should not affect the labs negatively. --8<-- [end:basic] @@ -22,7 +26,11 @@ dapr run ` --app-port $API_APP_PORT ` --dapr-http-port 3500 ` --app-ssl ` +--scheduler-host-address "" ` --resources-path "../components" ` -- dotnet run --launch-profile https ``` + +!!! note + An [issue with dapr-scheduler](https://github.com/Azure/aca-dotnet-workshop/issues/168){target=_blank} presently exists with Dapr 1.4. However, this should not affect the labs negatively. --8<-- [end:dapr-components] diff --git a/snippets/dapr-run-backend-service.md b/snippets/dapr-run-backend-service.md index fcb1e091..c8d292e9 100644 --- a/snippets/dapr-run-backend-service.md +++ b/snippets/dapr-run-backend-service.md @@ -7,8 +7,12 @@ dapr run ` --app-id tasksmanager-backend-processor ` --app-port $BACKEND_SERVICE_APP_PORT ` --dapr-http-port 3502 ` +--scheduler-host-address "" ` --app-ssl ` --resources-path "../components" ` -- dotnet run --launch-profile https ``` + +!!! note + An [issue with dapr-scheduler](https://github.com/Azure/aca-dotnet-workshop/issues/168){target=_blank} presently exists with Dapr 1.4. However, this should not affect the labs negatively. --8<-- [end:dapr-components] diff --git a/snippets/dapr-run-frontend-webapp.md b/snippets/dapr-run-frontend-webapp.md index eb7b972f..96fe4202 100644 --- a/snippets/dapr-run-frontend-webapp.md +++ b/snippets/dapr-run-frontend-webapp.md @@ -7,7 +7,11 @@ dapr run ` --app-id tasksmanager-frontend-webapp ` --app-port $UI_APP_PORT ` --dapr-http-port 3501 ` +--scheduler-host-address "" ` --app-ssl ` -- dotnet run --launch-profile https ``` + +!!! note + An [issue with dapr-scheduler](https://github.com/Azure/aca-dotnet-workshop/issues/168){target=_blank} presently exists with Dapr 1.4. However, this should not affect the labs negatively. --8<-- [end:basic] From 1d14616603dea58172232c7c577ae7d1df29a034 Mon Sep 17 00:00:00 2001 From: Simon Kurtz Date: Mon, 6 Jan 2025 16:23:24 -0500 Subject: [PATCH 02/11] Format --- docs/aca/03-aca-dapr-integration/index.md | 2 +- docs/aca/12-optimize-containers/index.md | 1 - docs/aca/30-appendix/01-run-debug-dapr-app-vscode.md | 10 +++++----- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/docs/aca/03-aca-dapr-integration/index.md b/docs/aca/03-aca-dapr-integration/index.md index 65edcfac..3804b95a 100644 --- a/docs/aca/03-aca-dapr-integration/index.md +++ b/docs/aca/03-aca-dapr-integration/index.md @@ -212,7 +212,7 @@ We are ready now to verify the changes on the Frontend Web App and test locally. --8<-- "snippets/dapr-run-backend-api.md:basic" - Notice how we assigned the Dapr App Id “tasksmanager-frontend-webapp” to the Frontend WebApp. + Notice how we assigned the Dapr App Id "tasksmanager-frontend-webapp" to the Frontend WebApp. !!! note If you need to run both microservices together, you need to keep calling `dapr run` manually each time in the terminal. And when you have multiple microservices talking to each other you need to run at the same time to debug the solution. This can be a convoluted process. You can refer to the [debug and launch Dapr applications in VSCode](../30-appendix/01-run-debug-dapr-app-vscode.md) to see how to configure VScode for running and debugging Dapr applications. diff --git a/docs/aca/12-optimize-containers/index.md b/docs/aca/12-optimize-containers/index.md index 31af5d7f..b965ccf3 100644 --- a/docs/aca/12-optimize-containers/index.md +++ b/docs/aca/12-optimize-containers/index.md @@ -139,7 +139,6 @@ This image is comprised of one image, 331 packages, and has five vulnerabilities ![Backend API Status Quo Image Stats](../../assets/images/12-optimize-containers/backend-api-chiseled-image-stats.png) - #### 1.4 Deploying the Updated Images While the image is vastly reduced, what hasn't changed is the functionality of the API. Whether you are executing it locally or deploying to Azure, the Backend API will continue to function as it always has. However, now it has less vulnerabilities, less time to transfer from the registry, less startup time, and less of a memory footprint. Furthermore, 16 MB is the uncompressed image. With compression, we are likely to continue dropping in size. diff --git a/docs/aca/30-appendix/01-run-debug-dapr-app-vscode.md b/docs/aca/30-appendix/01-run-debug-dapr-app-vscode.md index 3f430c49..013fec15 100644 --- a/docs/aca/30-appendix/01-run-debug-dapr-app-vscode.md +++ b/docs/aca/30-appendix/01-run-debug-dapr-app-vscode.md @@ -11,9 +11,9 @@ To accomplish this, open file `launch.json` and add the two configurations shown Make sure you append the configurations below to the existing array instead of replacing what you have. This way you will preserve your existing configuration and simply add two new ones. ??? example "Looking for complete launch.json?" - + === "launch.json" - + ```json --8<-- "https://raw.githubusercontent.com/Azure/aca-dotnet-workshop/main/.vscode/launch.json" ``` @@ -46,9 +46,9 @@ Now we will add 4 tasks, for each application, there will be a task to support t ??? tip "Curious to learn more about the tasks.json file above?" * The tasks with the label `backend-api-dapr-debug` will invoke the `daprd` task. This task is similar to calling dapr run from CLI. - * We are setting the appPort, httpPort, and grpcPort properties (grpcPort is needed in future modules when we start using the state manager building block. + * We are setting the appPort, httpPort, and grpcPort properties (grpcPort is needed in future modules when we start using the state manager building block. If you didn't set it, you might face a similar [issue](https://github.com/dapr/dotnet-sdk/issues/609){target=_blank}) - * We are setting the “componentsPath” property. This is needed when start working with the state manager, pub/sub, etc. + * We are setting the "componentsPath" property. This is needed when start working with the state manager, pub/sub, etc. * We are setting the dependsOn property, so this means this task will fire after the dependsOn tasks complete successfully. We need to add those dependsOn tasks. * The tasks with the label `daprd-down-backend-api` will terminate the Dapr Sidecar process. This will be used for the `postDebug` activity in configuration.json. * For a complete list of available properties please check this [link.](https://docs.dapr.io/developing-applications/ides/vscode/vscode-how-to-debug-multiple-dapr-apps/#daprd-parameter-table){target=_blank} @@ -85,7 +85,7 @@ Next let's add the dependsOn tasks. Open `tasks.json` and add the tasks below: ??? example "Looking for complete tasks.json?" === "tasks.json" - + ```json --8<-- "https://raw.githubusercontent.com/Azure/aca-dotnet-workshop/main/.vscode/tasks.json" ``` From 0de39d78e95cd5077def4c7e2488e40ba98d9bf8 Mon Sep 17 00:00:00 2001 From: Simon Kurtz Date: Mon, 6 Jan 2025 16:23:37 -0500 Subject: [PATCH 03/11] Update .NET 9 to 9.0.101 --- docs/aca/01-deploy-api-to-aca/global-dotnet9.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/aca/01-deploy-api-to-aca/global-dotnet9.json b/docs/aca/01-deploy-api-to-aca/global-dotnet9.json index ef7de70e..3b3c50ad 100644 --- a/docs/aca/01-deploy-api-to-aca/global-dotnet9.json +++ b/docs/aca/01-deploy-api-to-aca/global-dotnet9.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "9.0.100", + "version": "9.0.101", "rollForward": "latestFeature" } } \ No newline at end of file From 571456c6b560d6cb41e97f98f70ec13451ba1225 Mon Sep 17 00:00:00 2001 From: Simon Kurtz Date: Mon, 6 Jan 2025 16:23:50 -0500 Subject: [PATCH 04/11] Minor copy changes --- docs/aca/04-aca-dapr-stateapi/index.md | 8 +++++++- docs/aca/05-aca-dapr-pubsubapi/index.md | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/aca/04-aca-dapr-stateapi/index.md b/docs/aca/04-aca-dapr-stateapi/index.md index 1dd43445..beb05633 100644 --- a/docs/aca/04-aca-dapr-stateapi/index.md +++ b/docs/aca/04-aca-dapr-stateapi/index.md @@ -212,7 +212,7 @@ $result = az cosmosdb check-name-exists ` # Continue if the Cosmos DB account does not yet exist if ($result -eq "false") { - echo "Creating Cosmos DB account..." + echo "Creating Cosmos DB account. This may take a few minutes..." # Create a Cosmos account for SQL API az cosmosdb create ` @@ -321,6 +321,12 @@ If you have been using the dapr cli commands instead of the aforementioned debug !!! note "Deprecation Warning" components-path is being deprecated in favor of --resources-path. At the time of producing this workshop the --resources-path was not supported yet by the VS code extension. Hence, you will notice the use of the property "componentsPath": "./components" in the tasks.json file. Check the extension documentation in case that has changed. +Run the local frontend UI in the other terminal again: + +=== ".NET 8 or above" + + --8<-- "snippets/dapr-run-frontend-webapp.md:basic" + After creating a new record you can navigate to the Data explorer on the [Azure portal](https://portal.azure.com){target=_blank} for the Azure Cosmos DB account. It should look like the image below: ![cosmos-db-dapr-state-store](../../assets/images/04-aca-dapr-stateapi/cosmos-db-dapr-state-store.jpg) diff --git a/docs/aca/05-aca-dapr-pubsubapi/index.md b/docs/aca/05-aca-dapr-pubsubapi/index.md index 62e7f5f7..17a32835 100644 --- a/docs/aca/05-aca-dapr-pubsubapi/index.md +++ b/docs/aca/05-aca-dapr-pubsubapi/index.md @@ -356,7 +356,7 @@ az servicebus namespace authorization-rule keys list ` #### 3.2 Create a local Dapr Component file for Pub/Sub API Using Azure Service Bus -We need to add a new [Dapr Azure Service Bus Topic component](https://docs.dapr.io/reference/components-reference/supported-pubsub/setup-azure-servicebus-topics){target=_blank}. Add a new file in the **components** folder as shown below: +We need to add a new [Dapr Azure Service Bus Topic component](https://docs.dapr.io/reference/components-reference/supported-pubsub/setup-azure-servicebus-topics){target=_blank}. Add a new file in the **components** folder as shown below. Be sure to update the connection string value. ```yaml title="dapr-pubsub-svcbus.yaml" --8<-- "docs/aca/05-aca-dapr-pubsubapi/dapr-pubsub-svcbus.yaml" From e752dd4c84a7e33c2463259582d812ff546d1586 Mon Sep 17 00:00:00 2001 From: Simon Kurtz Date: Tue, 7 Jan 2025 10:25:55 -0500 Subject: [PATCH 05/11] Fix path --- docs/aca/05-aca-dapr-pubsubapi/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/aca/05-aca-dapr-pubsubapi/index.md b/docs/aca/05-aca-dapr-pubsubapi/index.md index 17a32835..f9bc0868 100644 --- a/docs/aca/05-aca-dapr-pubsubapi/index.md +++ b/docs/aca/05-aca-dapr-pubsubapi/index.md @@ -210,7 +210,7 @@ Update below file in **TasksTracker.Processor.Backend.Svc** project. - Let's verify that the Dapr dependency is restored properly and that the project compiles. From VS Code Terminal tab, open developer command prompt or PowerShell terminal and navigate to the parent directory which hosts the `.csproj` project folder and build the project. ```shell - cd ~\TasksTracker.ContainerApps\TasksTracker.TasksManager.Backend.Svc + cd ~\TasksTracker.ContainerApps\TasksTracker.Processor.Backend.Svc dotnet build ``` From eb76ab52cfe0511c0d093828bd12600360df36b8 Mon Sep 17 00:00:00 2001 From: Simon Kurtz Date: Tue, 7 Jan 2025 10:58:11 -0500 Subject: [PATCH 06/11] Add local auth for CosmosDB --- docs/aca/04-aca-dapr-stateapi/index.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/docs/aca/04-aca-dapr-stateapi/index.md b/docs/aca/04-aca-dapr-stateapi/index.md index beb05633..cfed4142 100644 --- a/docs/aca/04-aca-dapr-stateapi/index.md +++ b/docs/aca/04-aca-dapr-stateapi/index.md @@ -217,7 +217,14 @@ if ($result -eq "false") { # Create a Cosmos account for SQL API az cosmosdb create ` --name $COSMOS_DB_ACCOUNT ` - --resource-group $RESOURCE_GROUP + --resource-group $RESOURCE_GROUP ` + + # Enable local authentication to avoid a 401 when running locally. + az resource update ` + --name $COSMOS_DB_ACCOUNT ` + --resource-group $RESOURCE_GROUP ` + --resource-type "Microsoft.DocumentDB/databaseAccounts" ` + --set properties.disableLocalAuth=false # Create a SQL API database az cosmosdb sql database create ` @@ -246,7 +253,7 @@ if ($result -eq "false") { ``` !!! note - The `primaryMasterKey` connection string is only needed for our local testing on the development machine, we'll be using a different approach (**Managed Identities**) when deploying Dapr component to Azure Container Apps Environment. + The `primaryMasterKey` connection string is only needed for our local testing on the development machine, we'll be using a different approach (**Managed Identities**) when deploying Dapr component to Azure Container Apps Environment. For this workshop, we are allowing local authentication with the `az resource update` command above, but this should not be done for production workloads. Once the scripts execution is completed, we need to get the `primaryMasterKey` of the Cosmos DB account next. You can do this using the PowerShell script below. Copy the value of `primaryMasterKey` as we will use it in the next step. From eb6fffe634f82f0854a78a822c8edd7ee31fbc2c Mon Sep 17 00:00:00 2001 From: Simon Kurtz Date: Tue, 7 Jan 2025 12:05:08 -0500 Subject: [PATCH 07/11] Add instruction for storage account name --- docs/aca/06-aca-dapr-bindingsapi/index.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/aca/06-aca-dapr-bindingsapi/index.md b/docs/aca/06-aca-dapr-bindingsapi/index.md index b5d347ea..56937881 100644 --- a/docs/aca/06-aca-dapr-bindingsapi/index.md +++ b/docs/aca/06-aca-dapr-bindingsapi/index.md @@ -378,6 +378,7 @@ Add new files under the **aca-components** use the yaml below: - We are setting the property `secretStoreComponent` value to `secretstoreakv` which is the name of Dapr secret store component. - We are using `secretRef` when setting the metadata `storageAccessKey`. The value `external-azure-storage-key` represents the AKV secret created earlier +Ensure that you replace `` with the value from step 1.1. With those changes in place, we are ready to rebuild the backend background processor container image, update Azure Container Apps Env, and redeploy a new revision. ### 4. Deploy a New Revision of the Backend Background Processor App to ACA From 8d7e22547270ff664b9471373cd46317a3c472e6 Mon Sep 17 00:00:00 2001 From: Simon Kurtz Date: Tue, 7 Jan 2025 12:12:47 -0500 Subject: [PATCH 08/11] Fix naming --- .../AppInsightsTelemetryInitializer-Backend.Svc.cs | 2 +- .../AppInsightsTelemetryInitializer-Frontend.UI.cs | 2 +- docs/aca/08-aca-monitoring/index.md | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/aca/08-aca-monitoring/AppInsightsTelemetryInitializer-Backend.Svc.cs b/docs/aca/08-aca-monitoring/AppInsightsTelemetryInitializer-Backend.Svc.cs index 858e7cb3..fc337150 100644 --- a/docs/aca/08-aca-monitoring/AppInsightsTelemetryInitializer-Backend.Svc.cs +++ b/docs/aca/08-aca-monitoring/AppInsightsTelemetryInitializer-Backend.Svc.cs @@ -1,7 +1,7 @@ using Microsoft.ApplicationInsights.Channel; using Microsoft.ApplicationInsights.Extensibility; -namespace TasksTracker.TasksManager.Backend.Svc +namespace TasksTracker.Processor.Backend.Svc { public class AppInsightsTelemetryInitializer : ITelemetryInitializer { diff --git a/docs/aca/08-aca-monitoring/AppInsightsTelemetryInitializer-Frontend.UI.cs b/docs/aca/08-aca-monitoring/AppInsightsTelemetryInitializer-Frontend.UI.cs index 596d831c..a9927108 100644 --- a/docs/aca/08-aca-monitoring/AppInsightsTelemetryInitializer-Frontend.UI.cs +++ b/docs/aca/08-aca-monitoring/AppInsightsTelemetryInitializer-Frontend.UI.cs @@ -1,7 +1,7 @@ using Microsoft.ApplicationInsights.Channel; using Microsoft.ApplicationInsights.Extensibility; -namespace TasksTracker.TasksManager.Frontend.Ui +namespace TasksTracker.WebPortal.Frontend.Ui { public class AppInsightsTelemetryInitializer : ITelemetryInitializer { diff --git a/docs/aca/08-aca-monitoring/index.md b/docs/aca/08-aca-monitoring/index.md index 828313bd..311aa7a5 100644 --- a/docs/aca/08-aca-monitoring/index.md +++ b/docs/aca/08-aca-monitoring/index.md @@ -59,13 +59,13 @@ To incorporate the SDK, use the NuGet reference below in the `csproj` file of th --8<-- "docs/aca/08-aca-monitoring/Backend.Api-dotnet8.csproj" ``` - === "TasksTracker.TasksManager.Backend.Svc.csproj" + === "TasksTracker.Processor.Backend.Svc.csproj" ```xml hl_lines="12" --8<-- "docs/aca/08-aca-monitoring/Backend.Svc-dotnet8.csproj" ``` - === "TasksTracker.TasksManager.Frontend.Ui.csproj" + === "TasksTracker.WebPortal.Frontend.Ui.csproj" ```xml hl_lines="11" --8<-- "docs/aca/08-aca-monitoring/Frontend.Ui-dotnet8.csproj" @@ -79,13 +79,13 @@ To incorporate the SDK, use the NuGet reference below in the `csproj` file of th --8<-- "docs/aca/08-aca-monitoring/Backend.Api-dotnet9.csproj" ``` - === "TasksTracker.TasksManager.Backend.Svc.csproj" + === "TasksTracker.Processor.Backend.Svc.csproj" ```xml hl_lines="11" --8<-- "docs/aca/08-aca-monitoring/Backend.Svc-dotnet9.csproj" ``` - === "TasksTracker.TasksManager.Frontend.Ui.csproj" + === "TasksTracker.WebPortal.Frontend.Ui.csproj" ```xml hl_lines="11" --8<-- "docs/aca/08-aca-monitoring/Frontend.Ui-dotnet9.csproj" From abcaf68e37f19733288f87009eca884fc8876e2e Mon Sep 17 00:00:00 2001 From: Simon Kurtz Date: Tue, 7 Jan 2025 14:12:02 -0500 Subject: [PATCH 09/11] Fix namespaces --- docs/aca/08-aca-monitoring/Program-Backend.Svc-dotnet8.cs | 2 +- docs/aca/08-aca-monitoring/Program-Backend.Svc-dotnet9.cs | 2 +- docs/aca/08-aca-monitoring/Program-Frontend.UI-dotnet8.cs | 2 +- docs/aca/08-aca-monitoring/Program-Frontend.UI-dotnet9.cs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/aca/08-aca-monitoring/Program-Backend.Svc-dotnet8.cs b/docs/aca/08-aca-monitoring/Program-Backend.Svc-dotnet8.cs index 0831a7f4..b3d36fc6 100644 --- a/docs/aca/08-aca-monitoring/Program-Backend.Svc-dotnet8.cs +++ b/docs/aca/08-aca-monitoring/Program-Backend.Svc-dotnet8.cs @@ -1,5 +1,5 @@ using Microsoft.ApplicationInsights.Extensibility; -using TasksTracker.TasksManager.Backend.Svc; +using TasksTracker.Processor.Backend.Svc; var builder = WebApplication.CreateBuilder(args); diff --git a/docs/aca/08-aca-monitoring/Program-Backend.Svc-dotnet9.cs b/docs/aca/08-aca-monitoring/Program-Backend.Svc-dotnet9.cs index d3137fe7..a4b491dd 100644 --- a/docs/aca/08-aca-monitoring/Program-Backend.Svc-dotnet9.cs +++ b/docs/aca/08-aca-monitoring/Program-Backend.Svc-dotnet9.cs @@ -6,7 +6,7 @@ builder.Services.AddApplicationInsightsTelemetry(); builder.Services.Configure((o) => { - o.TelemetryInitializers.Add(new TasksTracker.TasksManager.Backend.Svc.AppInsightsTelemetryInitializer()); + o.TelemetryInitializers.Add(new TasksTracker.Processor.Backend.Svc.AppInsightsTelemetryInitializer()); }); builder.Services.AddControllers().AddDapr(); diff --git a/docs/aca/08-aca-monitoring/Program-Frontend.UI-dotnet8.cs b/docs/aca/08-aca-monitoring/Program-Frontend.UI-dotnet8.cs index e2829e27..85c37858 100644 --- a/docs/aca/08-aca-monitoring/Program-Frontend.UI-dotnet8.cs +++ b/docs/aca/08-aca-monitoring/Program-Frontend.UI-dotnet8.cs @@ -1,5 +1,5 @@ using Microsoft.ApplicationInsights.Extensibility; -using TasksTracker.TasksManager.Frontend.Ui; +using TasksTracker.WebPortal.Frontend.Ui; var builder = WebApplication.CreateBuilder(args); diff --git a/docs/aca/08-aca-monitoring/Program-Frontend.UI-dotnet9.cs b/docs/aca/08-aca-monitoring/Program-Frontend.UI-dotnet9.cs index 70783743..6daf3eba 100644 --- a/docs/aca/08-aca-monitoring/Program-Frontend.UI-dotnet9.cs +++ b/docs/aca/08-aca-monitoring/Program-Frontend.UI-dotnet9.cs @@ -5,7 +5,7 @@ // Add services to the container. builder.Services.AddApplicationInsightsTelemetry(); builder.Services.Configure((o) => { - o.TelemetryInitializers.Add(new TasksTracker.TasksManager.Frontend.Ui.AppInsightsTelemetryInitializer()); + o.TelemetryInitializers.Add(new TasksTracker.WebPortal.Frontend.Ui.AppInsightsTelemetryInitializer()); }); builder.Services.AddRazorPages(); From 7301c70c49c817855c9d0e1b0f87c96aaa8ec1ad Mon Sep 17 00:00:00 2001 From: Simon Kurtz Date: Tue, 7 Jan 2025 14:12:12 -0500 Subject: [PATCH 10/11] Emphasize copy --- docs/aca/08-aca-monitoring/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/aca/08-aca-monitoring/index.md b/docs/aca/08-aca-monitoring/index.md index 311aa7a5..04f4ec50 100644 --- a/docs/aca/08-aca-monitoring/index.md +++ b/docs/aca/08-aca-monitoring/index.md @@ -183,7 +183,7 @@ Next, we need to register this `AppInsightsTelemetryInitializer` class in **Prog In the previous module, we've used Dapr Secret Store to store connection strings and keys. In this module we will demonstrate how we can use another approach to secrets in Container Apps. -We need to set the Application Insights Instrumentation Key so that the projects are able to send telemetry data to the Application Insights instance. We are going to set this via secrets and environment variables once we redeploy the Container Apps and create new revisions. Locally, we can set it in each appsettings.json file. Obtain the key from the variable: +We need to set the Application Insights Instrumentation Key so that the projects are able to send telemetry data to the Application Insights instance. We are going to set this via secrets and environment variables once we redeploy the Container Apps and create new revisions. Locally, we can **set it in each appsettings.json** file. Obtain the key from the variable: ```shell $APPINSIGHTS_INSTRUMENTATIONKEY From 8eddf2d60479260294e0bdee4843999944ccebab Mon Sep 17 00:00:00 2001 From: Simon Kurtz Date: Tue, 7 Jan 2025 14:36:25 -0500 Subject: [PATCH 11/11] Minor formatting changes --- docs/aca/12-optimize-containers/index.md | 14 ++++++++++---- snippets/persist-state.md | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/docs/aca/12-optimize-containers/index.md b/docs/aca/12-optimize-containers/index.md index b965ccf3..b4161dfe 100644 --- a/docs/aca/12-optimize-containers/index.md +++ b/docs/aca/12-optimize-containers/index.md @@ -55,9 +55,9 @@ Our original `Dockerfile` files look like this: --8<-- "docs/aca/12-optimize-containers/Frontend.Ui.Dockerfile" ``` -```shell -cd ~\TasksTracker.ContainerApps +From the TasksTracker.ContainerApps directory, run the following commands: +```shell docker build -t backend-api-status-quo -f .\TasksTracker.TasksManager.Backend.Api\Dockerfile . docker build -t backend-svc-status-quo -f .\TasksTracker.Processor.Backend.Svc\Dockerfile . docker build -t frontend-ui-status-quo -f .\TasksTracker.WebPortal.Frontend.Ui\Dockerfile . @@ -77,6 +77,8 @@ For example, the Backend API image is comprised of two images, 451 packages, and The VS Code Docker extension produces a Dockerfile that's helpful for development but not as ideal for creation of production containers. We can significantly simplify and streamline the files (note that `publish` builds for `Release` by default, so we don't need to declare the configuration). These changes do not immediately impact image size yet. +Create three new files, `Dockerfile.concise` in each of their respective directories: + === "Concise Backend.API Dockerfile" ```Dockerfile --8<-- "docs/aca/12-optimize-containers/Backend.Api.Dockerfile.concise" @@ -92,7 +94,7 @@ The VS Code Docker extension produces a Dockerfile that's helpful for developmen --8<-- "docs/aca/12-optimize-containers/Frontend.Ui.Dockerfile.concise" ``` -Create three new files, `Dockerfile.concise` in each of their respective directories, then run the following commands from the project root directory to build the concise images. All images will build, but they will continue to essentially be identical to the status quo images. +Run the following commands from the project root directory to build the concise images. All images will build, but they will continue to essentially be identical to the status quo images. ```shell docker build -t backend-api-concise -f .\TasksTracker.TasksManager.Backend.Api\Dockerfile.concise .\TasksTracker.TasksManager.Backend.Api @@ -106,6 +108,8 @@ docker image list Microsoft and Ubuntu's creator, Canonical, collaborated on the concept of a [chiseled image for .NET](https://learn.microsoft.com/dotnet/core/docker/container-images#scenario-based-images){target=_blank}. Take a general-purpose base image and start chiseling away until you are left with an image that contains nothing more than the bare necessities to run your workload. No shell, no package manager, no bloat. +Create three new files, `Dockerfile.chiseled` in each of their respective directories: + === "Chiseled Backend.API Dockerfile" ```Dockerfile --8<-- "docs/aca/12-optimize-containers/Backend.Api.Dockerfile.chiseled" @@ -121,7 +125,7 @@ Microsoft and Ubuntu's creator, Canonical, collaborated on the concept of a [chi --8<-- "docs/aca/12-optimize-containers/Frontend.Ui.Dockerfile.chiseled" ``` -Create three new files, `Dockerfile.chiseled` in each of their respective directories, then run the following commands from the project root directory to build the chiseled images: +Run the following commands from the project root directory to build the chiseled images: ```shell docker build -t backend-api-chiseled -f .\TasksTracker.TasksManager.Backend.Api\Dockerfile.chiseled .\TasksTracker.TasksManager.Backend.Api @@ -207,6 +211,8 @@ The Backend API and the Backend Svc projects are all but identical while the Fro | Backend Svc Concise | 226 MB | 0 MB | | 2 | 451 | 25 | | Backend Svc Chiseled | 119 MB | 107 MB | 56.6% | 1 | 328 | 2 | +--8<-- "snippets/persist-state.md:module12" + ## Review In this module, we have accomplished two objectives: diff --git a/snippets/persist-state.md b/snippets/persist-state.md index 363910db..9248b8e5 100644 --- a/snippets/persist-state.md +++ b/snippets/persist-state.md @@ -99,7 +99,7 @@ --8<-- [start:module12] -- Navigate to the root and persist the module to Git. +Navigate to the root and persist the module to Git. ```shell git add .