Skip to content

Deployment

This guide shows you how to create the necessary resources on Azure to deploy the system.

There are 4 resources that need to be created:

  1. Resource Group
  2. Container Registry
  3. Container App
  4. Static Web App

Resource Group

The resource group is a logical container for all the resources that will be created. It stores metadata about the resources and simplifies management of resources as a group.

THis is important when deploying the system on an account that manages other projects as it allows you to easily identify and manage resources related to this project. It also allows us to manage their costs separately from other projects.

It can be created easily in the Azure Portal.

Container Registry

The container registry is a private registry for storing Docker images. It allows you to store and manage Docker images for your applications.

The images in it will be populated automatically by the CI/CD pipeline.

It can be created in the Azure Portal. Ensure that you are using the Basic plan to minimize costs and its connected to the resource group created in the previous step.

Important Note

The CI/CD pipeline pushes new versions of the image to the registery, but it does not delete old images. It is helpful to keep one or two previous version in case of a faulty deployment, but if the total image size exceeds the basic tier limit (10 GB), you will be charged extra.

In the Azure Portal, ou can delete old images manually by going to the Container Registry, then to the Repositories tab, selecting the repository, selecting the old image tags, clicking on the three dots, and selecting Delete.

Container App

The container app is the resource that will run the backend of the system. It will pull the Docker image from the container registry and run it.

When setting it up, ensure that:

  • It is connected to the resource group created in the first step.
  • It is connected to the container registry created in the second step.
  • The CPU and memory are set to 1 vCPU and 2 GB respectively.
  • The region is the same as the container registry to minimize latency.

Another important setting is the min-instance. By default, it is set to 0, which means that the app will scale down to 0 instances when not in use.This is great for savings and should be used most of the time. Its only drawback is that the user's first request will take longer as the app needs to pull the image and start the container. If this is a concern, you can set it to 1 to ensure that there is always one instance running. Note that this will incur costs even when the app is not in use.

Static Web App

The static web app is the resource that will host the frontend of the system. It will serve the static files generated by the frontend build process.

When setting it up, ensure that:

  • It is connected to the resource group created in the first step.
  • You're using the Free plan to minimize costs.

The url of the static web app will appear in the overview tab of the static web app resource. This is the url that users will use to access the system.