Skip to content

Commit e1b94f5

Browse files
author
Wael Kdouh
committed
Added additional refactoring for module 10
1 parent 15f5831 commit e1b94f5

File tree

1 file changed

+16
-19
lines changed

1 file changed

+16
-19
lines changed

docs/aca/10-aca-iac-bicep/index.md

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,12 @@ Within Azure there are two ways to create IaC. We can either use the [JSON ARM t
3030
### Build the Infrastructure as Code Using Bicep
3131

3232
To begin, we need to define the Bicep modules that will be required to generate the Infrastructure code. Our goal for this module is to have a freshly created resource group that encompasses all the necessary resources and configurations - such as connection strings, secrets, environment variables, and Dapr components - which we utilized to construct our solution. By the end, we will have a new resource group that includes the following resources.
33+
3334
![aca-resources](../../assets/images/10-aca-iac-bicep/aca-rescources.jpg)
3435

3536
!!! note
3637
To simplify the execution of the module, we will assume that you have already created latest images of three services and pushed them to a container registry. [This section](#deploy-the-infrastructure-and-create-the-components) below guides you through
3738
different options of getting images pushed to either Azure Container Registry (ACR) or GitHub Container Registry (GHCR).
38-
39-
If we created and deployed container registery as part of the Bicep scripts, then we can't build and push images to the created ACR in an automated way because creating the three ACA container apps is reliant on ACR's images.
40-
41-
In a production setting, a DevOps pipeline would be in place to automate the whole process - commencing with ACR creation, followed by building and pushing docker images, and concluding with executing the
42-
Bicep script to establish the remaining resources. As it is outside the scope of this workshop, we will not delve into the creation of a DevOps pipeline here.
4339

4440
#### 1. Add the Needed Extension to VS Code
4541
To proceed, you must install an extension called [Bicep](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-bicep). This extension will simplify building Bicep files as it offers IntelliSense, Validation, listing all available resource types, etc..
@@ -300,7 +296,7 @@ This will result in creating a file named `main.parameters.json` similar to the
300296

301297
To use this file, you need to edit this generated file and provide values for the parameters. You can use the same values shown above in sample file.
302298

303-
You only need to replace parameter values between the angle brackets `<>` with values related to your container registry and SendGrid. Values for container registry and container images can be dervied by following
299+
You only need to replace parameter values between the angle brackets `<>` with values related to your container registry and SendGrid. Values for container registry and container images can be derived by following
304300
one of the three options in next step.
305301

306302
Next, we will prepare container images for the three container apps and update the values in `main.parameters.json` file. You can do so by any of the three options below:
@@ -311,37 +307,38 @@ Next, we will prepare container images for the three container apps and update t
311307

312308
```Powershell
313309
$CONTAINER_REGISTRY_NAME="<your ACR name>"
310+
314311

315312
az acr create `
316313
--resource-group $RESOURCE_GROUP `
317314
--name $CONTAINER_REGISTRY_NAME `
318315
--sku Basic
319316
```
320317

321-
2. Build and push the images to ACR as guided in [this section](../../aca/08-aca-monitoring/index.md#2-build-new-images-and-push-them-to-acr). Make sure you are at the root project directory when executing the following commands:
318+
2. Build and push the images to ACR. Make sure you are at the root project directory when executing the following commands:
322319

323320
```Powershell
324321

325322
## Build Backend API on ACR and Push to ACR
326323

327324
az acr build --registry $CONTAINER_REGISTRY_NAME `
328-
--image "tasksmanager/$BACKEND_API_NAME" `
325+
--image "tasksmanager/tasksmanager-backend-api" `
329326
--file 'TasksTracker.TasksManager.Backend.Api/Dockerfile' .
330327
331328
## Build Backend Service on ACR and Push to ACR
332329

333330
az acr build --registry $CONTAINER_REGISTRY_NAME `
334-
--image "tasksmanager/$BACKEND_SVC_NAME" `
331+
--image "tasksmanager/tasksmanager-backend-processor" `
335332
--file 'TasksTracker.Processor.Backend.Svc/Dockerfile' .
336333

337334
## Build Frontend Web App on ACR and Push to ACR
338335

339336
az acr build --registry $CONTAINER_REGISTRY_NAME `
340-
--image "tasksmanager/$FRONTEND_WEBAPP_NAME" `
337+
--image "tasksmanager/tasksmanager-frontend-webapp" `
341338
--file 'TasksTracker.WebPortal.Frontend.Ui/Dockerfile' .
342339
```
343340

344-
3. Update the `main.parameters.jsonc` file with the container registry name and the container images names as shown below:
341+
3. Update the `main.parameters.json` file with the container registry name and the container images names as shown below:
345342

346343
```json hl_lines="3 6 9 12"
347344
{
@@ -381,23 +378,23 @@ Next, we will prepare container images for the three container apps and update t
381378
```Powershell
382379

383380
az acr import `
384-
--name $CONTAINER_REGISTRY_NAME `
385-
--image tasksmanager/tasksmanager-backend-api `
381+
--name $CONTAINER_REGISTRY_NAME `
382+
--image tasksmanager/tasksmanager-backend-api `
386383
--source ghcr.io/azure/tasksmanager-backend-api:latest
387384
388385
az acr import `
389-
--name $CONTAINER_REGISTRY_NAME `
390-
--image tasksmanager/tasksmanager-frontend-webapp `
386+
--name $CONTAINER_REGISTRY_NAME `
387+
--image tasksmanager/tasksmanager-frontend-webapp `
391388
--source ghcr.io/azure/tasksmanager-frontend-webapp:latest
392389
393390
az acr import `
394-
--name $CONTAINER_REGISTRY_NAME `
395-
--image tasksmanager/tasksmanager-backend-processor `
391+
--name $CONTAINER_REGISTRY_NAME `
392+
--image tasksmanager/tasksmanager-backend-processor `
396393
--source ghcr.io/azure/tasksmanager-backend-processor:latest
397394

398395
```
399396

400-
3. Update the `main.parameters.jsonc` file with the container registry name and the container images names as shown below:
397+
3. Update the `main.parameters.json` file with the container registry name and the container images names as shown below:
401398

402399
```json hl_lines="3 6 9 12"
403400
{
@@ -420,7 +417,7 @@ Next, we will prepare container images for the three container apps and update t
420417

421418
All the container image are available in a public image repository. If you do not wish to build the container images from code directly, you can use the pre-built images from the public repository as shown below.
422419

423-
The public images can be set directly in the `main.parameters.jsonc` file:
420+
The public images can be set directly in the `main.parameters.json` file:
424421

425422
```json hl_lines="3 6 9 12"
426423
{

0 commit comments

Comments
 (0)