The key takeaways from this demo are:
- You'll revisit the overview of the application's architecture.
- You'll revisit the various Azure services that this application leverages.
- You'll get a hands-on experience of deploying the application to Azure.
- There are some prerequisites for this demo mentioned in the application deployment guide. After completing all the steps mentioned in that document, the application's infrastructure will be provisioned on Azure, and the latest code will also be deployed.
This section has already been covered in our previous overview document. You can refer to it here.
Open the Azure Portal, and navigate to the resource group that was created for this demo. The resource group name will generally be contoso-traders-rg
.
All the resources related to the application will be provisioned in this resource group. Let's take a look at the various resources that have been provisioned.
-
The front-end is a React JS application that is hosted in an Azure storage account. The storage account has static website hosting enabled, and consequently, the
$web
container hosts the application code. -
Azure CDN is used to cache the static content of the application, and to serve it from the nearest edge location. This helps in reducing the latency and improving the performance of the application. The CDN is configured to use the storage account as its origin.
-
CDN rules are used to:
- manage
cache-control
headers (rules are configured to cache the static content for 2 hours). - enforce http to https redirection.
- manage
-
Another advantage of Azure CDN is that it allows custom domain HTTPS, along with managed TLS certificates.
-
The back-end APIs consist of containerized .NET 6 applications, hosted on AKS (Azure Kubernetes Service), ACA (Azure Container Apps), and Azure App Service.
-
The container images are built by the CI pipeline (github workflows), and pushed to Azure Container Registry.
-
The various APIs then pull these latest/tagged container images from ACR, and deploy them to their respective hosting platforms.
-
The
Carts API
is hosted on ACA where traffic ingress has been enabled. -
We use a
single: active
revision strategy for theCarts API
on ACA. This means that only one revision (i.e. the latest revision) of the application will be running at any given time. New revisions are automatically created whenever a newer docker image gets pushed to ACR. The old revisions will be automatically decommissioned. -
Each revision has a unique (revision-specific) endpoint/URL. However, you can also use the revision-neutral URL to access the application. This URL will always point to the latest revision.
-
The
Products API
is hosted on AKS. We have two deployments in the AKS cluster'sdefault
namespace: one for the API, one for the ingress controller (nginx). -
Pods are deployed in the AKS cluster using a
rollingUpdate
strategy. This means that the new pods will be created first, and then the old pods will be decommissioned. This ensures that there is no downtime during the deployment. ThemaxSurge
andmaxUnavailable
parameters are used to control the number of pods that can be created/decommissioned at any given time. -
Container live-logs are enabled, users can view container & application activity in real-time. Historic logs are also accessible from a tethered Azure LogAnalytics workspace.
-
TLS certificates (from LetsEncrypt) are automatically provisioned for the
Products API
using thecert-manager
addon. This enables HTTPs access to the API.
-
The
Products API
primarily uses a SQL Azure database for storing the product catalog (accessed via the EFCore library) -
The same API also uses an Azure CosmosDB database (SQL Core APIs) for storing the inventory/stock data.
-
The
Carts API
uses Azure CosmosDB (SQL Core API) for storing the cart data. The APIs uses CosmosDB SDK for all CRUD operations.
-
Application Insights is used for monitoring and telemetry. It is enabled on all the API apps, and the front-end application. All traces, metrics, events to an Application Insights instance.
-
Azure Monitor will coalesce the telemetry data from the Application Insights instances, and provide a single pane of glass for monitoring the application (.e.g Application Map, Failures View, Log Queries).
-
All API apps have a user-assigned managed identity enabled on them. This MI has permissions to retrieve secrets (e.g. connection strings to databases) from the Azure KeyVault. This ensures that the secrets are not exposed in the application code.
-
Microsoft Defender for Cloud is enabled on the subscription. A secure score is calculated for the subscription, and recommendations are provided to improve the security posture of the subscription.
This section has already been covered in our previous overview document. You can refer to it here.
In this document, we revisited the application's architecture, and also got a tour of the various Azure services that this application leveraged.
Next, you can understand the application's codebase, and also explore the other demo scripts.