# aravind1314/cloud-resume architecture

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

- Interactive diagram: https://gitdiagram.com/aravind1314/cloud-resume
- Repository: https://github.com/aravind1314/cloud-resume

## Overview

##### Main Components
- Code Repository & CI/CD Pipeline: Represent the GitHub repository as the source of truth that contains the application code, Terraform configurations, Dockerfile, docker-compose file, and Jenkinsfile. Also, include GitHub Actions (as well as a reference to the Jenkinsfile if needed) as the orchestrator for the CI/CD pipeline.
- Website Application: Show the “app” directory as the web application component that includes Node.js with Express, HTML, CSS, and client-side JavaScript. Indicate that “server.js” serves the application on port 3000.
- Deployment Environment: Detail the AWS EC2 instance where the Dockerized website is deployed. Show that after provisioning, the deployment process (via SSH and execution of the “script-cmnds.sh”) installs and runs the container.
- Reverse Proxy & SSL: Represent Nginx running on the EC2 instance as the reverse proxy that forwards requests from port 80/443 to port 3000 where the Node.js app is running. Also, include Certbot for SSL certificate management.
- Optional: Infrastructure Automation Tools – also mention supporting tools like Docker Compose (indicated by the docker-compose.yaml file) used for container orchestration on the EC2 instance, and additional scripts (e.g., script.groovy, terraform/script.sh) that support automation.

##### Relationships and Data Flow
- From the CI/CD pipeline, branch out to two main processes:
- Finally, illustrate that the Docker container running the Node.js application is accessible via the EC2 instance and is reverse proxied through Nginx. Nginx is further configured to use Certbot for managing SSL certificates, ensuring HTTPS traffic is supported.

##### Architectural Patterns and Design Principles
- Infrastructure as Code (IaC): Mark the Terraform component as the “IaC” segment that ensures reproducible and reliable AWS resource provisioning.
- Containerization: Highlight the role of Docker in encapsulating the application runtime.
- Reverse Proxy & Security: Show the separation between the application server (Node.js) and the public-facing gateway (Nginx with Certbot for SSL).

##### Technologies & Frameworks
- Frontend & Backend: Node.js, Express, HTML/CSS/JS
- CI/CD: GitHub Actions (with reference to Jenkinsfile as an alternative branch/tool if necessary)
- Containerization: Docker, Docker Compose
- Infrastructure: Terraform alongside AWS components (EC2, VPC, etc.), with state management via S3
- Web Server & SSL: Nginx and Certbot

##### Instructing the Principal Software Engineer
- Clearly demarcate the phases: code commit → CI/CD workflow initiates → Infrastructure Provisioning with Terraform on AWS → Docker image build/push to Docker Hub → SSH into EC2 and deployment → Nginx configuration and SSL setup.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Top Level - Source Control
    Repo["GitHub Repository"]:::source
    Repo -->|"push_triggers"| CI["CI/CD Pipeline (GitHub Actions)"]:::ci
    Repo -->|"alternative"| Jenkins["Jenkins Pipeline (Jenkinsfile)"]:::ci

    %% CI/CD branching
    CI -->|"invokes_IaC"| TF["Terraform (IaC)"]:::iac
    CI -->|"invokes_DockerBuild"| DockerBuild["Docker Build & Push"]:::docker
    CI -->|"executes"| DeployScript["Deployment Script (script-cmnds.sh)"]:::automation

    %% Infrastructure Provisioning and Deployment
    TF -->|"provisions"| AWS["AWS Environment<br/>(VPC, Subnets, EC2, etc.)"]:::aws
    AWS -->|"hosts"| EC2["EC2 Instance"]:::aws
    DeployScript -->|"deploys"| EC2

    %% Containerization and Application Deployment
    DockerBuild -->|"pushes_image"| DockerHub["Docker Hub"]:::docker
    EC2 -->|"runs"| Container["Docker Container (Node.js App)"]:::app
    Container -->|"hosts"| Server["Server (server.js)"]:::app

    %% Website Application details (inside the container)
    subgraph "Website Application"
        direction TB
        Server
        Frontend["Frontend (index.html)"]:::app
        Assets["Public Assets (app/public/)"]:::app
        Server -->|"serves"| Frontend
        Server -->|"serves"| Assets
    end

    %% Reverse Proxy and SSL termination
    Container -->|"exposes_via"| Nginx["Nginx Reverse Proxy"]:::nginx
    Nginx -->|"manages_ssl_with"| Certbot["SSL (Certbot)"]:::ssl

    %% Configuration Files Subgraph (peripheral)
    subgraph "Configuration Files"
        direction TB
        CI_File["cloud-resume-ci.yaml"]:::ci
        Jenkins_File["Jenkinsfile"]:::ci
        App_Server["server.js"]:::app
        App_Frontend["index.html"]:::app
        PublicAssets["app/public/"]:::app
        Docker_File["Dockerfile"]:::docker
        DockerCompose["docker-compose.yaml"]:::docker
        Terraform_Main["terraform/main.tf"]:::iac
        Terraform_Variables["terraform/variables.tf"]:::iac
        Terraform_Script["terraform/script.sh"]:::iac
        Deploy_Script["script-cmnds.sh"]:::automation
        Automation_Script["script.groovy"]:::automation
    end

    %% Linking main components to their configuration files (dashed connectors)
    CI -- "config" --> CI_File
    Jenkins -- "config" --> Jenkins_File
    Server -- "config" --> App_Server
    Frontend -- "config" --> App_Frontend
    Assets -- "config" --> PublicAssets
    DockerBuild -- "config" --> Docker_File
    DockerBuild -- "config" --> DockerCompose
    TF -- "config" --> Terraform_Main
    TF -- "config" --> Terraform_Variables
    TF -- "config" --> Terraform_Script
    DeployScript -- "config" --> Deploy_Script
    Repo -- "automation" --> Automation_Script

    %% Styles
    classDef source fill:#ffd9b3,stroke:#cc6600,stroke-width:2px;
    classDef ci fill:#cce6ff,stroke:#3366cc,stroke-width:2px;
    classDef iac fill:#e6ffe6,stroke:#33cc33,stroke-width:2px;
    classDef docker fill:#e6f7ff,stroke:#3399ff,stroke-width:2px;
    classDef aws fill:#ffe6e6,stroke:#ff3333,stroke-width:2px;
    classDef app fill:#f9e6ff,stroke:#9933ff,stroke-width:2px;
    classDef nginx fill:#ffffcc,stroke:#cccc00,stroke-width:2px;
    classDef ssl fill:#e6ffff,stroke:#33cccc,stroke-width:2px;
    classDef automation fill:#ffe6f2,stroke:#cc3399,stroke-width:2px;

    %% Click Events
    click Repo "https://github.com/aravind1314/cloud-resume/tree/main/.github/"
    click CI "https://github.com/aravind1314/cloud-resume/blob/main/.github/workflows/cloud-resume-ci.yaml"
    click Jenkins "https://github.com/aravind1314/cloud-resume/tree/main/Jenkinsfile"
    click Server "https://github.com/aravind1314/cloud-resume/blob/main/app/server.js"
    click Frontend "https://github.com/aravind1314/cloud-resume/blob/main/app/index.html"
    click Assets "https://github.com/aravind1314/cloud-resume/tree/main/app/public/"
    click Docker_File "https://github.com/aravind1314/cloud-resume/tree/main/Dockerfile"
    click DockerCompose "https://github.com/aravind1314/cloud-resume/blob/main/docker-compose.yaml"
    click TF "https://github.com/aravind1314/cloud-resume/tree/main/terraform/"
    click DeployScript "https://github.com/aravind1314/cloud-resume/blob/main/script-cmnds.sh"
    click Automation_Script "https://github.com/aravind1314/cloud-resume/blob/main/script.groovy"
```
