Skip to content

Commit b2f6401

Browse files
committed
chore: improve deployment scripts and guides
1 parent 73d38cc commit b2f6401

File tree

4 files changed

+22
-29
lines changed

4 files changed

+22
-29
lines changed

docs/add-application.md

+20-11
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
* [4. Add initial azure container app definition to infra-as-code bicep](#4-add-initial-azure-container-app-definition-to-infra-as-code-bicep)
77
* [5. Adjust infra-as-code provisioning scripts](#5-adjust-infra-as-code-provisioning-scripts)
88
* [6. Adjust dev deploy script to deploy new azure container app](#6-adjust-dev-deploy-script-to-deploy-new-azure-container-app)
9-
* [7. Add app to the solution's CI/CD pipeline](#7-add-app-to-the-solutions-cicd-pipeline)
10-
* [8. Implement custom domain for the new app](#8-implement-custom-domain-for-the-new-app)
9+
* [7. Update dev setup guide](#7-update-dev-setup-guide)
10+
* [8. Add app to the solution's CI/CD pipeline](#8-add-app-to-the-solutions-cicd-pipeline)
11+
* [9. Implement custom domain for the new app](#9-implement-custom-domain-for-the-new-app)
1112
<!-- TOC -->
1213

1314
# Instructions for adding a new application to the solution
@@ -103,7 +104,7 @@ for "inner-loop" development.
103104
add file named Dockerfile to the root of the new project with the following definition:
104105

105106
```yaml
106-
FROM mcr.microsoft.com/dotnet/aspnet:8.0-noble-chiseled-extra # <- change '8.0' to the version of the .net you are targeting
107+
FROM mcr.microsoft.com/dotnet/aspnet:8.0-noble-chiseled-extra
107108
#EXPOSE 8080 <- this is the default port that a .net 8+ application will be configured to listen on and is the port exposed in the base docker image
108109
109110
WORKDIR /app
@@ -151,11 +152,12 @@ for "inner-loop" development.
151152

152153
```pwsh
153154
$dev = ./tools/infrastructure/get-product-conventions.ps1 -EnvironmentName dev -AsHashtable
155+
$subProductName = 'App'
154156
@{
155-
App = $dev.SubProducts.App
156-
AppAvailabilityTest = $dev.SubProducts.AppAvailabilityTest
157-
AppTrafficManager = $dev.SubProducts.AppTrafficManager
158-
} | ConvertTo-Json
157+
ContainerApp = $dev.SubProducts[$subProductName]
158+
AvailabilityTest = $dev.SubProducts["$($subProductName)AvailabilityTest"]
159+
TrafficManager = $dev.SubProducts["$($subProductName)TrafficManager"]
160+
} | ConvertTo-Json -Depth 100
159161
```
160162

161163

@@ -164,8 +166,8 @@ for "inner-loop" development.
164166
1. Add new parameters to the [main.bicep](../tools/infrastructure/arm-templates/main.bicep) file:
165167

166168
```bicep
167-
param appPrimaryExists bool = true
168169
param appFailoverExists bool = true
170+
param appPrimaryExists bool = true
169171
```
170172

171173
Name these parameters with a prefix to match the new app name. For example if your app was named `Template.Web`, then
@@ -332,9 +334,16 @@ Extend [provision-azure-resources.ps1](../tools/infrastructure/provision-azure-r
332334
333335
* When prompted for build number, enter the same value you provided above when building the solution
334336
335-
3. Test that it worked by browsing to the "App health Url" printed to the console
337+
3. Test that it worked by browsing to the "App Url" printed to the console
338+
339+
## 7. Update dev setup guide
340+
341+
Add a section to the [dev-setup.md](../docs/dev-setup.md) guide to explain how to configure and run new app for local
342+
development.
343+
344+
For an example section to add, see [dev-setup.md](../docs/dev-setup.md#app)
336345
337-
## 7. Add app to the solution's CI/CD pipeline
346+
## 8. Add app to the solution's CI/CD pipeline
338347
339348
1. Modify the 'Map variables' step in the [__Application Deployment](../.github/workflows/__app-deploy.yml) github workflow
340349
to include the variables required for the new app. At minimum this will be:
@@ -382,7 +391,7 @@ Extend [provision-azure-resources.ps1](../tools/infrastructure/provision-azure-r
382391
3. Manually run the [Application CI/CD](../.github/workflows/app-ci-cd.yml) github workflow selecting the PR branch
383392
* This will execute the deployment steps for the new app
384393
385-
## 8. Implement custom domain for the new app
394+
## 9. Implement custom domain for the new app
386395
387396
1. Create DNS records for the new app
388397

docs/deploy-app.md

+1-16
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
* [Troubleshooting `provision-azure-resources.ps1`](#troubleshooting-provision-azure-resourcesps1)
2828
* [Problem deploying SQL server](#problem-deploying-sql-server)
2929
* [Problem deploying one or more Entra-ID app registrations](#problem-deploying-one-or-more-entra-id-app-registrations)
30-
* [Problem Activating initial container app](#problem-activating-initial-container-app)
3130
<!-- TOC -->
3231

3332
## Overview
@@ -490,7 +489,7 @@ In practice the only way to run these scripts from a dev machine is:
490489
./tools/dev-scripts/deploy.ps1 -InfA Continue -Login -SubscriptionId xxxxxxxx-xxxx-xxxxxxxxx-xxxxxxxxxxxx
491490
````
492491
7. Test that it worked:
493-
* browse to the "Api health Url" printed to the console
492+
* browse to the "Api Url" printed to the console
494493
* Import the postman [collection](../tests/postman/api.postman_collection.json) and [environment](../tests/postman/api-dev.postman_environment.json),
495494
change the baseUrl postman variable to the "Api Url" printed to the console. Run the requests in the collection
496495
@@ -560,17 +559,3 @@ To resolve:
560559
* select the "Delete permanently" button
561560
* wait until the application is permanently deleted (might take up to a minute)
562561
5. retry the failing infrastructure workflow run
563-
564-
### Problem Activating initial container app
565-
566-
After successfully running `provision-azure-resources.ps1` for the first time for the environment, but before you have
567-
deployed the application that's hosted by the infrastructure (ie before running [deploy.ps1](../tools/dev-scripts/deploy.ps1)
568-
or the git workflow [Application CI/CD](../.github/workflows/app-ci-cd.yml))), you will see that the container app has
569-
failed to start and in the "Revisions and issues" tab for the container it will show the error "Activation failed".
570-
571-
This is expected behaviour right now due to the initial docker container image that is deployed to the container app
572-
during the initial infrastructure deployment. This initial docker image exposes port 80, but the container app is
573-
configured expected to expose port 8080.
574-
575-
This issue will be resolved when the application docker image is deployed to the container app.
576-

tools/dev-scripts/deploy.ps1

-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ process {
106106
Write-Host '******************* Summary: start ******************************'
107107
Write-Host "Api Url: https://$($apiAca.configuration.ingress.fqdn)" -ForegroundColor Yellow
108108
Write-Host "App Url: https://$($appAca.configuration.ingress.fqdn)" -ForegroundColor Yellow
109-
Write-Host "Api Health Url: https://$($apiAca.configuration.ingress.fqdn)/health" -ForegroundColor Yellow
110109
Write-Host "Function App Url: https://$($funcApp.HostName)" -ForegroundColor Yellow
111110
Write-Host "Azure SQL Public Url: https://$($convention.SubProducts.Sql.Primary.ResourceName).database.windows.net:1433" -ForegroundColor Yellow
112111
Write-Host '******************* Summary: end ********************************'

tools/infrastructure/arm-templates/api.bicep

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ param sharedSettings sharedSettingsType
44

55
var location = instanceSettings.ResourceLocation
66

7-
var initialAppImage = 'mcr.microsoft.com/azuredocs/containerapps-helloworld:latest'
7+
var initialAppImage = 'mcr.microsoft.com/dotnet/samples:aspnetapp'
88
var appImage = exists ? existingApp.properties.template.containers[0].image : initialAppImage
99
// initial image does not define a http health endpoint at the path we want for our image, therefore for a reasonable
1010
// default exerience when creating the container app for the first time fallback to defaults that container-apps will configure

0 commit comments

Comments
 (0)