# abhi-indra/devops_projects_zero_to_hero architecture

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

- Interactive diagram: https://gitdiagram.com/abhi-indra/devops_projects_zero_to_hero
- Repository: https://github.com/abhi-indra/devops_projects_zero_to_hero

## Overview

##### Project type and purpose
- From the file tree and README we see multiple “DevOps_To_Hero_Projects,” each independent. Among them, Project-6 (“Deployment of a ToDo application on AWS using AWS ECR and ECS Fargate”) is the most end-to-end system: a Dockerized Node.js web app, built by Jenkins, pushed to ECR, and deployed on ECS Fargate in AWS.

##### File structure for Project-6
- Top-level “project-6/” contains a README and a “node-todo-app/” subfolder.
- “node-todo-app/” holds:
- app.js, test.js, views/*.ejs → Node.js + EJS views (web server + UI)
- package.json/lock → dependencies
- Dockerfile & docker-compose.yaml → container build and local compose
- Jenkinsfile → CI/CD pipeline definition
- .gitignore → untracked files

##### Key insights from the README
- Purpose: demonstrate CI/CD pipeline for a web app using Jenkins, containerization with Docker, image storage in AWS ECR, and runtime on AWS ECS Fargate.
- No external DB shown; assume in-memory or file storage.

##### Main components
a. Developer environment
- Local workstation or GitHub repo (source code)
b. CI/CD pipeline
- Jenkins server (freestyle or master/agent)
- Jenkinsfile stages: checkout → build Docker image → run tests → push to AWS ECR
c. Container Registry
- AWS ECR repository holding versioned Docker images
d. AWS Networking & Compute
- VPC with public and private subnets
- Application Load Balancer (ALB) in public subnet
- ECS Cluster with Fargate tasks (Node.js containers) in private subnets
- Security Groups controlling inbound (HTTP) and outbound (internet/ECR pull)
e. (Optional) Monitoring & Logging
- CloudWatch Logs for container stdout/stderr
- CloudWatch alarms on task failures or high latency

##### Relationships & interactions
- Developers commit code → GitHub
- Jenkins polls/triggers on commit → Jenkins pulls code → builds Docker image → runs test.js → on success pushes image to ECR
- ECR stores image → ECS service (Fargate) pulls new image → ALB routes HTTP requests to running tasks
- ALB health-checks tasks → scales tasks based on target tracking or manual configuration

##### Architectural patterns & principles
- CI/CD (continuous integration and delivery) pipeline
- Immutable infrastructure (Docker images versioned in ECR)
- Serverless container runtime (ECS Fargate)
- Micro-VM isolation per task (one container = one Fargate task)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Developer and Source
    Dev["Developer"]:::external
    Repo["Source Code Repository\n(GitHub)"]:::repo
    Doc["Project README\n(Documentation)"]:::repo
    Dev -->|commits code| Repo
    Repo -->|contains README| Doc

    %% Code Components
    subgraph "Node.js Application\n(project-6/node-todo-app)" 
        AppJS["Node.js App Entry Point\napp.js"]:::code
        Views["EJS View Templates\nviews/"]:::code
        Pkg["Dependencies\npackage.json"]:::code
        PkgLock["Locked Dependencies\npackage-lock.json"]:::code
        Test["Test Suite\ntest.js"]:::code
        Dockerfile["Dockerfile"]:::code
        Compose["Local Compose Config\ndocker-compose.yaml"]:::code
        Jenkinsfile["CI/CD Pipeline Definition\nJenkinsfile"]:::ci
        Gitignore[".gitignore"]:::code
        AppReadme["App README\nREADME.md"]:::repo

        Repo --> Jenkinsfile
        Repo --> Dockerfile
        Repo --> Compose
        Repo --> AppJS
        Repo --> Views
        Repo --> Pkg
        Repo --> PkgLock
        Repo --> Test
        Repo --> Gitignore
        Repo --> AppReadme
    end

    %% CI/CD Pipeline
    subgraph "CI/CD Pipeline" 
        Jenkins["Jenkins Server"]:::ci
        Jenkins -->|checks out code| Repo
        Jenkins -->|builds Docker image| Dockerfile
        Jenkins -->|runs tests| Test
        Jenkins -->|pushes image| ECR
    end

    %% Artifact Repository
    ECR["AWS ECR\n(todo-app-repo)"]:::aws

    %% AWS Infrastructure
    subgraph "AWS Cloud"
        subgraph "VPC" 
            ALB["ALB: todo-alb"]:::aws
            subgraph "Private Subnets"
                ECS["ECS Fargate\nCluster & Tasks"]:::runtime
            end
        end
        CW["CloudWatch Logs & Alarms"]:::aws
    end

    %% User Traffic
    User["End Users"]:::external
    User -->|HTTP Requests| ALB
    ALB -->|routes to| ECS
    ALB -->|health checks| ECS
    ECS -->|push logs| CW

    %% ECS pulls from ECR
    ECS -->|docker pull| ECR

    %% Class definitions
    classDef external fill:#cccccc,stroke:#333,stroke-width:1px;
    classDef repo fill:#d3b9ff,stroke:#5d3b8b,stroke-width:1px;
    classDef code fill:#ffe4b5,stroke:#d2691e,stroke-width:1px;
    classDef ci fill:#a0c4ff,stroke:#4361ee,stroke-width:1px;
    classDef aws fill:#ffb703,stroke:#fb8500,stroke-width:1px;
    classDef runtime fill:#8ecae6,stroke:#219ebc,stroke-width:1px;

    %% Click Events
    click Repo "https://github.com/abhi-indra/devops_projects_zero_to_hero/tree/master/project-6/"
    click Doc "https://github.com/abhi-indra/devops_projects_zero_to_hero/blob/master/project-6/README.md"
    click AppJS "https://github.com/abhi-indra/devops_projects_zero_to_hero/blob/master/project-6/node-todo-app/app.js"
    click Views "https://github.com/abhi-indra/devops_projects_zero_to_hero/tree/master/project-6/node-todo-app/views/"
    click Pkg "https://github.com/abhi-indra/devops_projects_zero_to_hero/blob/master/project-6/node-todo-app/package.json"
    click PkgLock "https://github.com/abhi-indra/devops_projects_zero_to_hero/blob/master/project-6/node-todo-app/package-lock.json"
    click Test "https://github.com/abhi-indra/devops_projects_zero_to_hero/blob/master/project-6/node-todo-app/test.js"
    click Dockerfile "https://github.com/abhi-indra/devops_projects_zero_to_hero/tree/master/project-6/node-todo-app/Dockerfile"
    click Compose "https://github.com/abhi-indra/devops_projects_zero_to_hero/blob/master/project-6/node-todo-app/docker-compose.yaml"
    click Jenkinsfile "https://github.com/abhi-indra/devops_projects_zero_to_hero/tree/master/project-6/node-todo-app/Jenkinsfile"
    click Gitignore "https://github.com/abhi-indra/devops_projects_zero_to_hero/blob/master/project-6/node-todo-app/.gitignore"
    click AppReadme "https://github.com/abhi-indra/devops_projects_zero_to_hero/blob/master/project-6/node-todo-app/README.md"
```
