# sangharshcs/deploy-jenkins architecture

> Architecture diagram of the GitHub repository sangharshcs/deploy-jenkins, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sangharshcs/deploy-jenkins
- Repository: https://github.com/sangharshcs/deploy-jenkins

## Overview

deploy-jenkins packages a Jenkins controller and elastic worker pool for Docker Swarm. The main workflow is operator configuration → deployment and secret setup → Swarm services → workers discover the controller, download its matching Swarm client, and register as build nodes. Scaling worker replicas changes cluster capacity without manual node setup. The graph follows README-documented relationships; no source excerpts were provided, so implementation details beyond those statements are omitted.

Main entry points: [`worker/start.sh`](https://github.com/sangharshcs/deploy-jenkins/blob/main/worker/start.sh) (Worker startup), [`stack.yml`](https://github.com/sangharshcs/deploy-jenkins/blob/main/stack.yml) (Jenkins controller), [`scripts/deploy.sh`](https://github.com/sangharshcs/deploy-jenkins/blob/main/scripts/deploy.sh) (Deploy script), [`controller/plugins.txt`](https://github.com/sangharshcs/deploy-jenkins/blob/main/controller/plugins.txt) (Swarm plugin)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_deployment["Deployment"]
  node_config["Environment config<br/>[.env.example]"]
  node_deploy["Deploy script<br/>[deploy.sh]"]
  node_stack["Stack services<br/>[stack.yml]"]
  node_swarm["Docker Swarm"]
  node_stop["Stop script<br/>[stop.sh]"]
end

subgraph group_controller["Controller"]
  node_controller_image["Controller image"]
  node_jenkins["Jenkins controller<br/>[stack.yml]"]
  node_security["Security bootstrap<br/>[security.groovy]"]
  node_plugins["Swarm plugin<br/>[plugins.txt]"]
end

subgraph group_workers["Workers"]
  node_worker_image["Worker image"]
  node_worker_start["Worker startup<br/>[start.sh]"]
  node_replicas["Worker replicas<br/>[stack.yml]"]
  node_nodes["Registered build nodes"]
end

subgraph group_credentials["Credentials"]
  node_secrets[("Docker secrets<br/>[stack.yml]")]
end

node_operator(("Operator"))

node_operator -->|"sets values"| node_config
node_operator -->|"runs deploy"| node_deploy
node_deploy -->|"deploys stack"| node_stack
node_deploy -->|"creates secrets"| node_secrets
node_stack -->|"declares services"| node_swarm
node_swarm -->|"runs service"| node_jenkins
node_swarm -->|"scales service"| node_replicas
node_controller_image -->|"provides image"| node_jenkins
node_security -->|"bootstraps security"| node_jenkins
node_plugins -->|"installs plugin"| node_jenkins
node_worker_image -->|"provides image"| node_replicas
node_replicas -->|"starts entrypoint"| node_worker_start
node_worker_start -->|"downloads client"| node_jenkins
node_worker_start -->|"reads credentials"| node_secrets
node_worker_start -->|"connects through"| node_plugins
node_worker_start -->|"registers node"| node_nodes
node_operator -->|"scales workers"| node_replicas
node_operator -->|"tears down"| node_stop

click node_config "https://github.com/sangharshcs/deploy-jenkins/blob/main/.env.example"
click node_deploy "https://github.com/sangharshcs/deploy-jenkins/blob/main/scripts/deploy.sh"
click node_stack "https://github.com/sangharshcs/deploy-jenkins/blob/main/stack.yml"
click node_stop "https://github.com/sangharshcs/deploy-jenkins/blob/main/scripts/stop.sh"
click node_controller_image "https://github.com/sangharshcs/deploy-jenkins/blob/main/controller/Dockerfile"
click node_jenkins "https://github.com/sangharshcs/deploy-jenkins/blob/main/stack.yml"
click node_security "https://github.com/sangharshcs/deploy-jenkins/blob/main/controller/security.groovy"
click node_plugins "https://github.com/sangharshcs/deploy-jenkins/blob/main/controller/plugins.txt"
click node_worker_image "https://github.com/sangharshcs/deploy-jenkins/blob/main/worker/Dockerfile"
click node_worker_start "https://github.com/sangharshcs/deploy-jenkins/blob/main/worker/start.sh"
click node_replicas "https://github.com/sangharshcs/deploy-jenkins/blob/main/stack.yml"
click node_secrets "https://github.com/sangharshcs/deploy-jenkins/blob/main/stack.yml"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_config,node_deploy,node_stack,node_swarm,node_stop toneBlue
class node_controller_image,node_jenkins,node_security,node_plugins toneAmber
class node_worker_image,node_worker_start,node_replicas,node_nodes toneMint
class node_secrets toneRose
class node_operator toneIndigo
```

## Components

### Deployment

- [Environment config](https://github.com/sangharshcs/deploy-jenkins/blob/main/.env.example): `.env.example`
- [Deploy script](https://github.com/sangharshcs/deploy-jenkins/blob/main/scripts/deploy.sh): `scripts/deploy.sh`
- [Stack services](https://github.com/sangharshcs/deploy-jenkins/blob/main/stack.yml): `stack.yml`
- **Docker Swarm**
- [Stop script](https://github.com/sangharshcs/deploy-jenkins/blob/main/scripts/stop.sh): `scripts/stop.sh`

### Controller

- [Controller image](https://github.com/sangharshcs/deploy-jenkins/blob/main/controller/Dockerfile): `controller/Dockerfile`
- [Jenkins controller](https://github.com/sangharshcs/deploy-jenkins/blob/main/stack.yml): `stack.yml`
- [Security bootstrap](https://github.com/sangharshcs/deploy-jenkins/blob/main/controller/security.groovy): `controller/security.groovy`
- [Swarm plugin](https://github.com/sangharshcs/deploy-jenkins/blob/main/controller/plugins.txt): `controller/plugins.txt`

### Workers

- [Worker image](https://github.com/sangharshcs/deploy-jenkins/blob/main/worker/Dockerfile): `worker/Dockerfile`
- [Worker startup](https://github.com/sangharshcs/deploy-jenkins/blob/main/worker/start.sh): `worker/start.sh`
- [Worker replicas](https://github.com/sangharshcs/deploy-jenkins/blob/main/stack.yml): `stack.yml`
- **Registered build nodes**

### Credentials

- [Docker secrets](https://github.com/sangharshcs/deploy-jenkins/blob/main/stack.yml): `stack.yml`

### Other components

- **Operator**

## Connections

- Operator → Environment config: sets values (evidence: `README.md`)
- Operator → Deploy script: runs deploy (evidence: `README.md`)
- Deploy script → Stack services: deploys stack (evidence: `README.md`)
- Deploy script → Docker secrets: creates secrets (evidence: `README.md`)
- Stack services → Docker Swarm: declares services (evidence: `README.md`)
- Docker Swarm → Jenkins controller: runs service (evidence: `README.md`)
- Docker Swarm → Worker replicas: scales service (evidence: `README.md`)
- Controller image → Jenkins controller: provides image (evidence: `README.md`)
- Security bootstrap → Jenkins controller: bootstraps security (evidence: `README.md`)
- Swarm plugin → Jenkins controller: installs plugin (evidence: `README.md`)
- Worker image → Worker replicas: provides image (evidence: `README.md`)
- Worker replicas → Worker startup: starts entrypoint (evidence: `README.md`)
- Worker startup → Jenkins controller: downloads client (evidence: `README.md`)
- Worker startup → Docker secrets: reads credentials (evidence: `README.md`)
- Worker startup → Swarm plugin: connects through (evidence: `README.md`)
- Worker startup → Registered build nodes: registers node (evidence: `README.md`)
- Operator → Worker replicas: scales workers (evidence: `README.md`)
- Operator → Stop script: tears down (evidence: `README.md`)
