# yousramsaouri/pipeline-jenkins-docker-ansible-sur-aws architecture

> Architecture diagram of the GitHub repository yousramsaouri/pipeline-jenkins-docker-ansible-sur-aws, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-08-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/yousramsaouri/pipeline-jenkins-docker-ansible-sur-aws
- Repository: https://github.com/yousramsaouri/pipeline-jenkins-docker-ansible-sur-aws

## Overview

##### Project Type and Purpose
- This repository demonstrates a CI/CD pipeline that builds and deploys a simple web application (`index.html`) using Jenkins, Docker, Ansible, and AWS.
- Key indicators:
- Jenkinsfile – defines pipeline stages
- Dockerfile – containerizes the application
- README title – “Pipeline-Jenkins-Docker-Ansible-sur-AWS”

##### File Structure Analysis
- Top‐level files only:
- Dockerfile – instructions to build the web server image
- Jenkinsfile – pipeline definition (checkout, build Docker image, push, deploy)
- index.html – simple web app, source artifact
- README.md – high-level description
- No nested folders; everything lives at root, implying a small demo or PoC pipeline.

##### Architecture Overview from README
1. Source control → Jenkins
2. Build → Docker image
3. Repository → Container registry (e.g., Docker Hub or ECR)
4. Deploy → AWS via Ansible

##### Main Components
a. Developer & Source Control
- Git (e.g., GitHub/GitLab) containing index.html, Dockerfile, Jenkinsfile
b. CI Server
- Jenkins master (reads Jenkinsfile)
- Agents (optional) that run builds and deployments
c. Container Build & Registry
- Docker daemon (builds image from Dockerfile)
- Docker registry (Docker Hub or AWS ECR)
d. Configuration Management & Deployment
- Ansible controller/playbooks (not shown in file tree but implied)
- SSH connection or API calls to AWS
e. Cloud Infrastructure
- AWS account: EC2 instances (or other compute), possibly behind a load balancer
- VPC, security groups, etc.

##### Relationships and Data Flows
1. Developer pushes code to Git → triggers Jenkins webhook.
2. Jenkins checks out code → runs pipeline stages:
- Build stage: Docker build → image
- Push stage: Docker push → registry
- Deploy stage: Ansible playbook runs against AWS inventory
3. Ansible provisions/updates EC2 host(s) → pulls new Docker image → runs container serving index.html.
4. End-user traffic flows via AWS load balancer → EC2 → container → index.html.

##### Architectural Patterns and Principles
- CI/CD pipeline (automated build, test, deploy)
- Infrastructure as Code (Ansible playbooks for provisioning & deployment)
- Immutable infrastructure concept (new Docker image per commit)
- Separation of concerns: CI (Jenkins), packaging (Docker), deployment (Ansible), hosting (AWS).

##### Technologies and Frameworks
- Jenkins (pipeline as code)
- Docker (containerization)
- Ansible (configuration management)
- AWS (compute platform, optional services like ELB, ECR)
- Git (source version control)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Source Layer
    subgraph "Source Layer"
        Dev["Developer"]:::source
        Git["Git Repository (GitHub/GitLab)"]:::source
        README["README.md"]:::source
        AppSource["index.html"]:::source
        Dev -->|"git push"| Git
        Git -->|"webhook"| JenkinsCI
    end

    %% CI/CD Layer
    subgraph "CI/CD Layer"
        JenkinsCI["Jenkins Master"]:::cicd
        JenkinsCI -->|"checkout code"| AppSource
        JenkinsCI -->|"run pipeline stages"| DockerDaemon
        JenkinsCI -->|"run pipeline stages"| Ansible
    end

    %% Containerization Layer
    subgraph "Containerization Layer"
        DockerDaemon["Docker Daemon"]:::container
        DockerfileNode["Dockerfile"]:::container
        DockerDaemon -->|"docker build"| DockerfileNode
        DockerDaemon -->|"docker push"| DockerRegistry
        DockerRegistry["Docker Registry (Docker Hub/ECR)"]:::container
    end

    %% Deployment Layer
    subgraph "Deployment Layer"
        Ansible["Ansible Controller"]:::config
        Ansible -->|"SSH/API calls"| AWSEC2
    end

    %% Cloud Layer
    subgraph "Cloud (AWS)"
        LB["Load Balancer"]:::cloud
        AWSEC2["EC2 Instance"]:::cloud
        LB --> AWSEC2
    end

    %% End Users
    subgraph "End Users"
        Browser["End User Browser"]:::enduser
        Browser -->|"HTTP request"| LB
    end

    %% Connections
    Git --> JenkinsCI
    JenkinsCI --> DockerDaemon
    DockerDaemon --> DockerRegistry
    JenkinsCI --> Ansible
    Browser --> LB
    LB --> AWSEC2

    %% Click Events
    click JenkinsCI "https://github.com/yousramsaouri/pipeline-jenkins-docker-ansible-sur-aws/tree/main/Jenkinsfile"
    click DockerfileNode "https://github.com/yousramsaouri/pipeline-jenkins-docker-ansible-sur-aws/tree/main/Dockerfile"
    click AppSource "https://github.com/yousramsaouri/pipeline-jenkins-docker-ansible-sur-aws/blob/main/index.html"
    click README "https://github.com/yousramsaouri/pipeline-jenkins-docker-ansible-sur-aws/blob/main/README.md"

    %% Styles
    classDef source fill:#cfe2f3,stroke:#2E86C1;
    classDef cicd fill:#9fc5e8,stroke:#0B5345;
    classDef container fill:#f9cb9c,stroke:#D35400;
    classDef config fill:#b6d7a8,stroke:#196F3D;
    classDef cloud fill:#ffe599,stroke:#B7950B;
    classDef enduser fill:#d9d9d9,stroke:#424949;
```
