# gn-mm/jenkins-101 architecture

> Architecture diagram of the GitHub repository gn-mm/jenkins-101, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/gn-mm/jenkins-101
- Repository: https://github.com/gn-mm/jenkins-101

## Overview

##### Project Type and Purpose
- This is a tutorial/demo DevOps project showcasing how to run Jenkins BlueOcean in Docker, configure a Jenkins pipeline (via Jenkinsfile), and use a Python agent/container to build and test a simple Python app (“myapp”).
- The primary components are:
- Jenkins BlueOcean master (Docker container)
- A Docker socket–forwarder (alpine/socat container)
- Jenkins Python agent (container)
- Sample application code repository (myapp/)
- CI pipeline definitions (Jenkinsfile, Jenkinsfile.template, my_Jenkinsfile)

##### File Structure Analysis
- Top level:
- Dockerfile: builds the custom Jenkins BlueOcean image
- Jenkinsfile / Jenkinsfile.template / my_Jenkinsfile: pipeline definitions
- helloworld.py: standalone demo script
- myapp/hello.py & myapp/requirements.txt: sample Python app
- Jenkinsfile*, readme.md: documentation and pipeline config
- No separate “frontend/backend”; this is purely a CI/CD infrastructure demo.

##### README Insights
- Explains how to build/pull the Jenkins image, create a Docker network (“jenkins”), run the Jenkins container, run the socket-forwarder container, and use the Python agent.
- References volumes (jenkins-data, jenkins-docker-certs), environment variables for Docker TLS, and port mappings (8080, 50000).
- Shows usage of a custom Jenkins Python agent image.

a. Main Components to Represent
1. Git repository (source control) holding Dockerfile, Jenkinsfiles, and myapp code
2. Docker network (“jenkins”)
3. Jenkins BlueOcean master container
– Volume: jenkins-data → /var/jenkins_home
– Volume: jenkins-docker-certs → /certs/client
– Ports: 8080 (web UI), 50000 (agent connections)
4. Alpine/socat socket-forwarder container
– Exposes host Docker socket at TCP 2376 on the network
5. Docker Engine (host machine)
6. Jenkins Python Agent container
– Pulled from devopsjourney1/myjenkinsagents:python
7. myapp build/test job
– Builds/tests hello.py per requirements.txt

b. Relationships and Data Flows

c. Architectural Patterns & Principles
– Containerized CI/CD control plane (Jenkins master + agents)
– Sidecar pattern for socket forwarding (alpine/socat)
– Declarative pipeline (Jenkinsfile) as code
– Volume-based persistence for configuration & credentials

d. Key Technologies/Frameworks
– Docker & Docker network
– Jenkins BlueOcean plugin
– Jenkins pipeline syntax (Jenkinsfile)
– Alpine Linux + socat for socket forwarding
– Python environment in agent container

## Diagram (Mermaid)

```mermaid
flowchart TD
  subgraph "Git Repository"
    direction TB
    Git_Dockerfile["Dockerfile"]
    Git_Jenkinsfile["Jenkinsfile"]
    Git_JenkinsfileTemplate["Jenkinsfile.template"]
    Git_my_Jenkinsfile["my_Jenkinsfile"]
    Git_helloworld["helloworld.py"]
    Git_app_hello["myapp/hello.py"]
    Git_app_req["myapp/requirements.txt"]
    Git_readme["readme.md"]
  end

  subgraph "jenkins Network (jenkins)"
    direction TB
    JM["Jenkins BlueOcean Master"]:::ci
    SF["Socket-Forwarder (alpine/socat)"]:::sidecar
    PA["Python Agent"]:::agent
  end

  DE["Docker Engine"]:::external

  Git_Jenkinsfile -->|"SCM checkout (SSH/Git)"| JM
  JM -->|"TCP 2376"| SF
  JM -->|"Launch Agent (TCP 50000)"| PA
  PA -->|"Docker API"| DE
  PA -->|"Workspace access"| Git_app_hello
  PA -->|"Reports status"| JM

  click Git_Dockerfile "https://github.com/gn-mm/jenkins-101/tree/master/Dockerfile"
  click Git_Jenkinsfile "https://github.com/gn-mm/jenkins-101/tree/master/Jenkinsfile"
  click Git_JenkinsfileTemplate "https://github.com/gn-mm/jenkins-101/blob/master/Jenkinsfile.template"
  click Git_my_Jenkinsfile "https://github.com/gn-mm/jenkins-101/tree/master/my_Jenkinsfile"
  click Git_helloworld "https://github.com/gn-mm/jenkins-101/blob/master/helloworld.py"
  click Git_app_hello "https://github.com/gn-mm/jenkins-101/blob/master/myapp/hello.py"
  click Git_app_req "https://github.com/gn-mm/jenkins-101/blob/master/myapp/requirements.txt"
  click Git_readme "https://github.com/gn-mm/jenkins-101/blob/master/readme.md"

  classDef ci fill:#3182bd,stroke:#000,color:#fff
  classDef sidecar fill:#ff8c00,stroke:#000,color:#000
  classDef agent fill:#31a354,stroke:#000,color:#fff
  classDef external fill:#aaaaaa,stroke:#000,color:#fff
```
