# sieunhantanbao/sd2411_azure_infrastructure architecture

> Architecture diagram of the GitHub repository sieunhantanbao/sd2411_azure_infrastructure, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-31). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sieunhantanbao/sd2411_azure_infrastructure
- Repository: https://github.com/sieunhantanbao/sd2411_azure_infrastructure

## Overview

Based on our analysis of both the file tree and the README, this repository is focused on provisioning and managing a cloud-based microservices environment on Azure with strong CI/CD and monitoring integrations. In essence, it is an infrastructure and deployment repository that provides the Terraform scripts to provision Azure resources (AKS clusters, ACR, VMs), Helm chart manifests for deploying a multi-component application (frontend, backend, MongoDB) via ArgoCD, and additional tooling (Argo Rollouts, ArgoCD Image Updater, Istio, Prometheus, Grafana, and Jenkins integration) to support continuous deployment, blue/green strategies, and observability.

##### And lay out the major components
- Infrastructure Layer:
- Azure Kubernetes Service (AKS) that hosts the application workloads.
- Azure Container Registry (ACR) for storing Docker images.
- Virtual Machines (VMs) that support CI/CD (e.g., Jenkins) and other tooling.
- Deployment and CD Tools:
- ArgoCD with Helm support that monitors and deploys application manifests.
- ArgoCD Image Updater which automatically updates image tags.
- Argo Rollouts to implement blue/green or canary deployments.
- Application Layer:
- Microservices Application (referenced from sd2411_msa) with three major components:
- Backend service
- Frontend service
- MongoDB database
- CI Integration:
- Jenkins service running on VMs and linked (as noted in the reference repositories) to a shared library for performing CI tasks.
- Observability & Service Mesh Layer:
- Monitoring tools (Prometheus and Grafana) installed via provided scripts.
- Istio as the service mesh layer for traffic management and policy enforcement.

##### Relationships and Flow
- ArgoCD (and tools like Argo Rollouts and Image Updater) managing Helm chart deployments from the Helm directories (argocd/helm/prod and qa) into the AKS cluster.
- Relationship between the deployed applications (frontend, backend, database) and their dependencies.
- External integrations like Jenkins (from the sd2411_devops_ci repo), which watches for code changes, builds artifacts, and triggers deployments.
- Monitoring components (Prometheus and Grafana) as consuming data from the deployed workloads and relevant infrastructure.
- Optionally, include Istio if it is deployed, to emphasize its role in managing ingress/egress, routing, and traffic policies once the applications are running on AKS.

##### Architectural Patterns and Design Principles
- The design emphasizes Infrastructure as Code (Terraform) and GitOps (ArgoCD-driven deployments).
- Modular separation of environments (prod and qa directories under ArgoCD helm charts) illustrates environment-based configuration.
- Use of CI/CD pipelines (Jenkins, ArgoCD) indicates a continuous deployment strategy and automated infrastructure management.
- Separation between the deployment tooling (ArgoCD, Helm) and runtime components (AKS, microservices) is a key design principle.

##### Relevant Technologies
- Tools showcased include: Azure (AKS, ACR, VMs), Terraform, Kubernetes, Helm, ArgoCD (with Image Updater and Rollouts), Istio, Jenkins, Prometheus, and Grafana.
- That the Helm charts are organized per environment (prod, qa) and broken into subcomponents (backend, frontend, mongo).

## Diagram (Mermaid)

```mermaid
graph TD
    %% Infrastructure Layer
    subgraph "Infrastructure Layer"
        T1["Terraform Provisioning"]:::infra
        ACR["Azure Container Registry (ACR)"]:::infra
        AKS["Azure Kubernetes Service (AKS)"]:::infra
        VMs["Virtual Machines (VMs)"]:::infra
    end

    %% Deployment & CD Tools
    subgraph "Deployment & CD Tools"
        AC["ArgoCD"]:::deploy
        HelmProd["Helm Charts (Prod)"]:::deploy
        HelmQA["Helm Charts (QA)"]:::deploy
        ImgUpd["ArgoCD Image Updater"]:::deploy
        Rollouts["Argo Rollouts"]:::deploy
    end

    %% Application Layer
    subgraph "Application Layer"
        BE["Backend Service"]:::app
        FE["Frontend Service"]:::app
        Mongo["MongoDB Database"]:::app
    end

    %% CI Integration
    subgraph "CI Integration"
        Jenkins["Jenkins CI"]:::ci
    end

    %% Observability & Service Mesh
    subgraph "Observability & Service Mesh"
        Monitoring["Monitoring (Prometheus & Grafana)"]:::monitor
        Istio["Istio Service Mesh"]:::monitor
    end

    %% Relationships - Infrastructure
    T1 -->|"provisions"| ACR
    T1 -->|"provisions"| AKS
    T1 -->|"provisions"| VMs
    ACR -->|"provides images to"| AKS

    %% Relationships - Deployment & CD Tools
    HelmProd -->|"feeds"| AC
    HelmQA -->|"feeds"| AC
    ImgUpd -->|"updates"| AC
    AC -->|"orchestrates"| Rollouts
    Rollouts -->|"deploys to"| AKS
    Jenkins -->|"triggers"| AC
    AC -->|"deploys to"| AKS

    %% Relationships - Application Layer
    AKS -->|"hosts"| BE
    AKS -->|"hosts"| FE
    AKS -->|"hosts"| Mongo

    %% Relationships - Observability & Service Mesh
    Monitoring -->|"monitors"| AKS
    Monitoring -->|"monitors"| VMs
    AKS -->|"managed by"| Istio

    %% Click Events
    click T1 "https://github.com/sieunhantanbao/sd2411_azure_infrastructure/tree/main/iac/terraform"
    click ACR "https://github.com/sieunhantanbao/sd2411_azure_infrastructure/tree/main/iac/terraform/acr"
    click AKS "https://github.com/sieunhantanbao/sd2411_azure_infrastructure/tree/main/iac/terraform/aks"
    click VMs "https://github.com/sieunhantanbao/sd2411_azure_infrastructure/tree/main/iac/terraform/vm"
    click AC "https://github.com/sieunhantanbao/sd2411_azure_infrastructure/tree/main/tools/argocd"
    click HelmProd "https://github.com/sieunhantanbao/sd2411_azure_infrastructure/tree/main/argocd/helm/prod"
    click HelmQA "https://github.com/sieunhantanbao/sd2411_azure_infrastructure/tree/main/argocd/helm/qa"
    click ImgUpd "https://github.com/sieunhantanbao/sd2411_azure_infrastructure/tree/main/tools/argocd-image-updater"
    click Jenkins "https://github.com/sieunhantanbao/sd2411_azure_infrastructure/blob/main/documents/3-PiShapedAssigment-SetupJenkinSharedLibrary.*"
    click Monitoring "https://github.com/sieunhantanbao/sd2411_azure_infrastructure/tree/main/tools/monitoring"

    %% Styles
    classDef infra fill:#f9f,stroke:#333,stroke-width:2px;
    classDef deploy fill:#ccf,stroke:#333,stroke-width:2px;
    classDef app fill:#cfc,stroke:#333,stroke-width:2px;
    classDef ci fill:#fc9,stroke:#333,stroke-width:2px;
    classDef monitor fill:#ff9,stroke:#333,stroke-width:2px;
```
