Skip to content
This repository has been archived by the owner on Dec 31, 2023. It is now read-only.

4. Infrastructure Design

Nguyễn Xuân Nhân edited this page Oct 2, 2023 · 1 revision

The infrastructure design for our project involves various components and services hosted on different platforms to ensure scalability, reliability, and performance. Here's an overview of our infrastructure setup:

Application Description

The provided Bicep script defines the application components and their configurations for deploying various services within an Azure environment. Here's a description of the key elements and their roles:

image

  1. Parameters:

    • registryName: This parameter represents the name of the container registry. It defaults to a unique hashed ID prefixed with "profio," ensuring a unique and identifiable name for the registry.
    • clusterName: This parameter denotes the name of the AKS (Azure Kubernetes Service) cluster. It defaults to a unique hash prefixed with "profio."
  2. Existing Resources:

    • containerRegistry: This resource references an existing Azure Container Registry based on the provided registryName.
    • aksCluster: This resource references an existing Azure Kubernetes Service (AKS) cluster using the clusterName.
  3. Module Deployments:

    • Several modules are deployed using the Bicep language, each representing a distinct component of the application infrastructure:
      • reverseproxy: Deploys a reverse proxy component, providing routing and load balancing capabilities.
      • api: Deploys an API component responsible for serving application logic.
      • website: Deploys a customer-facing website component.
      • cms: Deploys a Content Management System (CMS) component.
      • ingress: Deploys an Ingress component responsible for managing HTTP application routing.
  4. Module Parameters:

    • Each module receives parameters that are essential for configuration, including the container registry and Kubernetes configuration (kubeConfig). These parameters ensure that the modules are configured correctly to work within the defined Azure environment.

In summary, this Bicep script is used to define and deploy application components necessary for hosting various services in an Azure environment. It leverages existing resources like the Azure Container Registry and Azure Kubernetes Service and deploys modules for specific application components, each with its respective configuration parameters. This script facilitates the setup and management of a complex application infrastructure in a standardized and repeatable manner.

Infrastructure Description

The Bicep script is designed to deploy infrastructure resources in an Azure environment. It utilizes parameters and modules to customize and manage the deployment process based on specific configurations.

image

  1. Parameters:

    • location: This parameter represents the location or region where the infrastructure resources will be deployed. It defaults to the location of the current resource group.

    • mode: This parameter determines the deployment mode, with two allowed values:

      • 'cloud': Deploys all infrastructure resources as needed for production or cloud deployment.
      • 'dev': Deploys only the resources required for local development, optimizing the deployment for a development environment.
  2. Modules:

    • registry: This module deploys Azure Container Registry (ACR) resources. It is named 'registry' and takes the location parameter as input. The ACR is typically used to store Docker container images.

    • aks: This module deploys Azure Kubernetes Service (AKS) resources, but only if the mode is set to 'cloud.' AKS is a managed Kubernetes service for orchestrating containerized applications. It takes the location parameter as input. The conditional deployment ensures that AKS is deployed only when needed for cloud production.

In summary, this Bicep script allows for flexible infrastructure deployment in Azure, with the ability to choose between a full cloud deployment ('cloud' mode) or a streamlined development deployment ('dev' mode). The script leverages Azure modules to define and provision resources based on the specified mode, providing a customizable approach to infrastructure provisioning and management.