# suhaib-md/devops-poc-set-1 architecture

> Architecture diagram of the GitHub repository suhaib-md/devops-poc-set-1, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/suhaib-md/devops-poc-set-1
- Repository: https://github.com/suhaib-md/devops-poc-set-1

## Overview

##### Project Type and Purpose
- This is an end‐to‐end DevOps proof‐of‐concept for Azure. It demonstrates:
- Phase 1: Building custom Docker images (Jenkins, Nexus, SonarQube)
- Phase 2: Provisioning Azure infra via Terraform modules
- Phase 3: Packaging deployments as Helm charts (ArgoCD, Jenkins, Nexus, SonarQube)
- Phase 4: Implementing a Jenkins CI/CD pipeline for a Spring Boot app
- Phase 5: Creating Windows golden images with Packer
- Phase 6: Archiving Jenkins logs to Azure Blob for observability

##### Key Architectural Components
a. Azure Cloud Platform
- Azure Container Registry (ACR) for storing Docker images
- Azure Blob Storage for log archival
- Azure Image Gallery for Packer images
b. Infrastructure layer (Terraform)
- Virtual Network, Subnets, NSGs, Route Tables
- NAT Gateway, Load Balancer, Application Gateway
- AKS Cluster (multi‐AZ, 3 nodes)
c. Containerized Services on AKS
- ArgoCD (GitOps controller)
- Jenkins (CI/CD)
- Nexus Repository (artifact store)
- SonarQube (code quality)
- Spring Boot microservice(s)
d. CI/CD Pipeline
- Jenkinsfiles, Maven build of Spring Boot, Sonar analysis, Docker builds
e. Image Automation
- Packer templates and PowerShell provisioning for Windows 10 image
f. Observability & Logging
- Python script to push Jenkins logs to Azure Blob

##### Relationships and Data Flows
- Developers commit code to Git → Jenkins is triggered →
- Runs tests, SonarQube scan → builds Spring Boot JAR → builds Docker image → pushes to ACR
- Packer builds Windows 10 image → publishes to Azure Image Gallery
- Terraform modules deploy networking + AKS cluster + ACR + Blob storage
- Helm charts (ArgoCD or direct Helm) deploy containerized services on AKS
- ArgoCD watches Git repos and syncs Helm releases
- Jenkins logs are periodically backed up to Azure Blob via script

##### Architectural Patterns & Principles
- Immutable infrastructure (Terraform, Packer)
- GitOps deployment (ArgoCD + Helm charts)
- Separation of concerns:
- Infra provisioning (Terraform)
- Image creation (Docker, Packer)
- App deployment (Helm)
- CI/CD orchestration (Jenkins)
- Observability (Azure Blob)
- Reusable modules (Terraform modules, Helm chart templates)
- Security: non‐root Docker users, RBAC, secrets in Kubernetes

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Developer Tools Layer
    subgraph "Developer Tools" 
        Git["Git Repository"]:::ci
        DockerLocal["Local Docker"]:::container
    end

    %% CI/CD Layer
    subgraph "CI/CD (Jenkins)" 
        JenkinsMaster["Jenkins Master"]:::ci
        JenkinsAgent["Jenkins Agent"]:::ci
    end

    %% Phase 1: Container Image Preparation
    subgraph "Phase 1 - Container Image Preparation" 
        JImage["Jenkins Docker Image"]:::container
        NImage["Nexus Docker Image"]:::container
        SImage["SonarQube Docker Image"]:::container
    end

    %% Phase 2: Infrastructure Setup Using Terraform
    subgraph "Phase 2 - Terraform Infra" 
        TFRoot["Terraform Root"]:::infra
        subgraph "Modules"
            VNet["Virtual Network"]:::infra
            Subnets["Subnets"]:::infra
            NSG["Network Security Group"]:::infra
            RouteTable["Route Table"]:::infra
            NAT["NAT Gateway"]:::infra
            LB["Load Balancer"]:::infra
            AppGW["Application Gateway"]:::infra
            AKSModule["AKS Cluster Module"]:::infra
            VMSS["VM Scale Set"]:::infra
        end
    end

    %% Phase 3: Application Deployment via Helm or YAML
    subgraph "Phase 3 - Helm Charts" 
        ArgoChart["ArgoCD Helm Chart"]:::gitops
        JenkinsChart["Jenkins Helm Chart"]:::gitops
        NexusChart["Nexus Helm Chart"]:::gitops
        SonarChart["SonarQube Helm Chart"]:::gitops
    end

    %% Phase 4: CI/CD Automation
    subgraph "Phase 4 - CI/CD Pipeline" 
        Jenkinsfile["Jenkinsfile"]:::ci
        MavenPom["pom.xml"]:::ci
        AppSrc["HelloWorldApplication.java"]:::ci
    end

    %% Phase 5: Image Automation with Packer
    subgraph "Phase 5 - Packer" 
        PackerTemplate["Packer Template"]:::infra
        PSConfigure["configure_system.ps1"]:::infra
        PSInstall["install_apps.ps1"]:::infra
    end

    %% Phase 6: Observability & Logging
    subgraph "Phase 6 - Log Archival" 
        BackupScript["jenkins_log_backup.py"]:::storage
        Requirements["requirements.txt"]:::storage
        SetupScript["setup.sh"]:::storage
    end

    %% Azure Services Layer
    subgraph "Azure Platform" 
        ACR["Azure Container Registry"]:::storage
        Blob["Azure Blob Storage"]:::storage
        ImageGallery["Azure Image Gallery"]:::storage
    end

    %% Kubernetes Layer
    subgraph "AKS Cluster" 
        ArgoCD["ArgoCD"]:::gitops
        JenkinsPod["Jenkins"]:::ci
        NexusPod["Nexus"]:::container
        SonarPod["SonarQube"]:::container
        AppPods["Spring Boot App Pods"]:::container
    end

    %% Connections
    Git -->|push triggers| JenkinsMaster
    JenkinsMaster -->|runs pipeline| JenkinsAgent
    JenkinsAgent -->|build Docker| JImage
    JenkinsAgent -->|build Docker| NImage
    JenkinsAgent -->|build Docker| SImage
    JImage -->|docker push| ACR
    NImage -->|docker push| ACR
    SImage -->|docker push| ACR
    Jenkinsfile --> JenkinsMaster
    MavenPom --> JenkinsMaster
    AppSrc --> JenkinsMaster
    PackerTemplate -->|build image| ImageGallery
    PSConfigure --> PackerTemplate
    PSInstall --> PackerTemplate
    TFRoot --> VNet
    TFRoot --> Subnets
    TFRoot --> NSG
    TFRoot --> RouteTable
    TFRoot --> NAT
    TFRoot --> LB
    TFRoot --> AppGW
    TFRoot --> AKSModule
    TFRoot --> VMSS
    TFRoot -->|provision| AKSModule
    TFRoot -->|provision| ACR
    TFRoot -->|provision| Blob
    ArgoChart -->|helm install| AKSCluster
    JenkinsChart -->|helm install| AKSCluster
    NexusChart -->|helm install| AKSCluster
    SonarChart -->|helm install| AKSCluster
    ArgoCD -->|sync| ArgoChart
    ArgoCD -->|deploy| AKSCluster
    AKSCluster["AKS Cluster"]:::infra
    ACR -->|image pull| AKSCluster
    AKSCluster --> ArgoCD
    AKSCluster --> JenkinsPod
    AKSCluster --> NexusPod
    AKSCluster --> SonarPod
    AKSCluster --> AppPods
    JenkinsPod -->|logs| BackupScript
    BackupScript --> Blob

    %% Click Events
    click JImage "https://github.com/suhaib-md/devops-poc-set-1/tree/main/Phase 1 - Container Image Preparation/jenkins/Dockerfile"
    click NImage "https://github.com/suhaib-md/devops-poc-set-1/tree/main/Phase 1 - Container Image Preparation/nexus/Dockerfile"
    click SImage "https://github.com/suhaib-md/devops-poc-set-1/tree/main/Phase 1 - Container Image Preparation/sonarqube/Dockerfile"
    click AKSModule "https://github.com/suhaib-md/devops-poc-set-1/tree/main/Phase 2 - Infrastructure Setup Using Terraform/modules/aks"
    click AppGW "https://github.com/suhaib-md/devops-poc-set-1/tree/main/Phase 2 - Infrastructure Setup Using Terraform/modules/app_gateway"
    click LB "https://github.com/suhaib-md/devops-poc-set-1/tree/main/Phase 2 - Infrastructure Setup Using Terraform/modules/load_balancer"
    click NAT "https://github.com/suhaib-md/devops-poc-set-1/tree/main/Phase 2 - Infrastructure Setup Using Terraform/modules/nat_gateway"
    click NSG "https://github.com/suhaib-md/devops-poc-set-1/tree/main/Phase 2 - Infrastructure Setup Using Terraform/modules/nsg"
    click RouteTable "https://github.com/suhaib-md/devops-poc-set-1/tree/main/Phase 2 - Infrastructure Setup Using Terraform/modules/route_table"
    click Subnets "https://github.com/suhaib-md/devops-poc-set-1/tree/main/Phase 2 - Infrastructure Setup Using Terraform/modules/subnets"
    click VNet "https://github.com/suhaib-md/devops-poc-set-1/tree/main/Phase 2 - Infrastructure Setup Using Terraform/modules/vnet"
    click VMSS "https://github.com/suhaib-md/devops-poc-set-1/tree/main/Phase 2 - Infrastructure Setup Using Terraform/modules/vmss"
    click TFRoot "https://github.com/suhaib-md/devops-poc-set-1/blob/main/Phase 2 - Infrastructure Setup Using Terraform/main.tf"
    click ArgoChart "https://github.com/suhaib-md/devops-poc-set-1/blob/main/Phase 3 - Application Deployment via Helm or YAML/argocd-chart/Chart.yaml"
    click JenkinsChart "https://github.com/suhaib-md/devops-poc-set-1/blob/main/Phase 3 - Application Deployment via Helm or YAML/jenkins-chart/Chart.yaml"
    click NexusChart "https://github.com/suhaib-md/devops-poc-set-1/blob/main/Phase 3 - Application Deployment via Helm or YAML/nexus-chart/Chart.yaml"
    click SonarChart "https://github.com/suhaib-md/devops-poc-set-1/blob/main/Phase 3 - Application Deployment via Helm or YAML/sonarqube-chart/Chart.yaml"
    click Jenkinsfile "https://github.com/suhaib-md/devops-poc-set-1/tree/main/Phase 4 - CI CD Automation/Jenkinsfile"
    click MavenPom "https://github.com/suhaib-md/devops-poc-set-1/blob/main/Phase 4 - CI CD Automation/pom.xml"
    click AppSrc "https://github.com/suhaib-md/devops-poc-set-1/blob/main/Phase 4 - CI CD Automation/src/main/java/com/example/helloworldspringboot/HelloWorldApplication.java"
    click PackerTemplate "https://github.com/suhaib-md/devops-poc-set-1/blob/main/Phase 5 - Image Automation with Packer - Windows 10 Golden Image/windows.pkr.hcl"
    click PSConfigure "https://github.com/suhaib-md/devops-poc-set-1/blob/main/Phase 5 - Image Automation with Packer - Windows 10 Golden Image/configure_system.ps1"
    click PSInstall "https://github.com/suhaib-md/devops-poc-set-1/blob/main/Phase 5 - Image Automation with Packer - Windows 10 Golden Image/install_apps.ps1"
    click BackupScript "https://github.com/suhaib-md/devops-poc-set-1/blob/main/Phase 6 -  Observability & Logging - Jenkins Build Logs to Azure Blob/jenkins_log_backup.py"
    click Requirements "https://github.com/suhaib-md/devops-poc-set-1/blob/main/Phase 6 -  Observability & Logging - Jenkins Build Logs to Azure Blob/requirements.txt"
    click SetupScript "https://github.com/suhaib-md/devops-poc-set-1/blob/main/Phase 6 -  Observability & Logging - Jenkins Build Logs to Azure Blob/setup.sh"

    %% Styles
    classDef infra fill:#e3f2fd,stroke:#1e88e5,color:#0d47a1;
    classDef ci fill:#fce4ec,stroke:#d81b60,color:#880e4f;
    classDef container fill:#e8f5e9,stroke:#43a047,color:#1b5e20;
    classDef gitops fill:#fff3e0,stroke:#fb8c00,color:#e65100;
    classDef storage fill:#f3e5f5,stroke:#8e24aa,color:#4a148c;
    classDef ci stroke-width:2px;
    classDef container stroke-width:2px;
    classDef infra stroke-width:2px;
    classDef gitops stroke-width:2px;
    classDef storage stroke-width:2px;
```
