# usui-tk/ci-cd-manage_materials architecture

> Architecture diagram of the GitHub repository usui-tk/ci-cd-manage_materials, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-04-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/usui-tk/ci-cd-manage_materials
- Repository: https://github.com/usui-tk/ci-cd-manage_materials

## Overview

1. **Repository purpose**
   - This repo is an infrastructure/bootstrap package for deploying a **Red Hat Enterprise Linux “manage-server”** on **AWS CloudFormation**.
   - The README suggests the server is intended to host **CI/CD management services**, not an application workload itself.

2. **Primary architecture shape**
   - The central unit is a **single managed server** provisioned from CloudFormation.
   - The repo is split into three layers: **CloudFormation metadata**, **cloud-init userdata**, and a **shell provisioning script**.

3. **CloudFormation layer**
   - `cloudformation/cloudformation_metadata_for_ci_and_cd_manage-server.json` is the infrastructure definition/metadata artifact.
   - This is the top-level entry point that AWS would use to create the environment and attach bootstrap configuration to the instance.

4. **Instance bootstrap layer**
   - `cloud-init/cloud-init_userdata_for_ci_and_cd_manage-server.sh` is the instance userdata/bootstrap file.
   - This runs during first boot on the RHEL host and acts as the handoff between infrastructure provisioning and OS-level configuration.

5. **Operating-system configuration layer**
   - `shellscript/ci_and_cd_manage-server.sh` is the main shell provisioning script.
   - It likely installs and configures the CI/CD management software stack, performs host setup, and prepares the server for ongoing use.

6. **Execution flow**
   - The likely lifecycle is: **operator launches CloudFormation stack → AWS provisions RHEL host → cloud-init runs userdata at boot → userdata invokes the shell script → management services are configured**.
   - This means the repo is centered on **declarative infrastructure + imperative bootstrap**.

7. **Main boundary**
   - The repo does **not** appear to contain application source code or service logic.
   - Its boundary is the **environment setup and server provisioning boundary**: AWS resource creation, OS bootstrap, and service installation/configuration.

8. **External dependencies**
   - The main external dependency is **AWS CloudFormation** and the underlying **RHEL AMI/instance runtime**.
   - The shell/bootstrap path implies standard Linux tooling and first-boot configuration mechanisms, but no additional platform is visible from the file tree.

9. **Likely deployment target**
   - The output of this repo is a **configured management server** suitable for CI/CD operations.
   - The architecture diagram should show this as an **ops/control-plane node**, not as a user-facing service.

10. **What to emphasize in a diagram**
   - Show **AWS CloudFormation** as the orchestrator.
   - Show a **single EC2/RHEL host** as the managed runtime.
   - Show **cloud-init userdata** as the bootstrap bridge.
   - Show the **shell script** as the final configuration/install step that turns the host into the CI/CD management server.

11. **What is intentionally not present**
   - There are no signs of databases, message queues, web frontends, containers, or multi-service microservices in this repository.
   - The architecture is therefore compact and provisioning-focused rather than distributed.

12. **Repository organization**
   - The file layout supports a clean separation of concerns:
     - `cloudformation/` for AWS-level provisioning metadata
     - `cloud-init/` for first-boot bootstrap
     - `shellscript/` for host configuration logic
   - That separation is useful for diagramming the transition from **infrastructure** to **instance initialization** to **service setup**.

Main entry points: [`cloud-init/cloud-init_userdata_for_ci_and_cd_manage-server.sh`](https://github.com/usui-tk/ci-cd-manage_materials/blob/master/cloud-init/cloud-init_userdata_for_ci_and_cd_manage-server.sh) (cloud-init userdata), [`cloudformation/cloudformation_metadata_for_ci_and_cd_manage-server.json`](https://github.com/usui-tk/ci-cd-manage_materials/blob/master/cloudformation/cloudformation_metadata_for_ci_and_cd_manage-server.json) (Stack metadata), [`shellscript/ci_and_cd_manage-server.sh`](https://github.com/usui-tk/ci-cd-manage_materials/blob/master/shellscript/ci_and_cd_manage-server.sh) (Provisioning script)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_grp_infra["Infrastructure"]
  node_n_cfn_service{{"CloudFormation<br/>AWS service"}}
  node_n_cfn_meta["Stack metadata<br/>template/metadata"]
  node_n_ec2_rhel[("RHEL host<br/>managed instance")]
end

subgraph group_grp_boot["Bootstrap"]
  node_n_cloud_init["cloud-init userdata<br/>bootstrapping script"]
end

subgraph group_grp_host["Host config"]
  node_n_shell_script["Provisioning script<br/>host setup script"]
  node_n_manage_server["Manage server<br/>CI/CD control plane"]
end

node_n_operator(("Operator<br/>external actor"))

node_n_operator -->|"launches"| node_n_cfn_service
node_n_cfn_service -->|"reads"| node_n_cfn_meta
node_n_cfn_service -->|"provisions"| node_n_ec2_rhel
node_n_cfn_meta -->|"attaches"| node_n_cloud_init
node_n_ec2_rhel -->|"boots with"| node_n_cloud_init
node_n_cloud_init -->|"invokes"| node_n_shell_script
node_n_shell_script -->|"configures"| node_n_manage_server
node_n_ec2_rhel -->|"hosts"| node_n_manage_server

click node_n_cfn_meta "https://github.com/usui-tk/ci-cd-manage_materials/blob/master/cloudformation/cloudformation_metadata_for_ci_and_cd_manage-server.json"
click node_n_cloud_init "https://github.com/usui-tk/ci-cd-manage_materials/blob/master/cloud-init/cloud-init_userdata_for_ci_and_cd_manage-server.sh"
click node_n_shell_script "https://github.com/usui-tk/ci-cd-manage_materials/blob/master/shellscript/ci_and_cd_manage-server.sh"

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_n_cfn_service,node_n_cfn_meta,node_n_ec2_rhel toneBlue
class node_n_cloud_init toneAmber
class node_n_shell_script,node_n_manage_server toneMint
class node_n_operator toneNeutral
```

## Components

### Infrastructure

AWS-side provisioning and stack entrypoint

- **CloudFormation**: AWS service · Orchestrates stack creation from the metadata artifact
- [Stack metadata](https://github.com/usui-tk/ci-cd-manage_materials/blob/master/cloudformation/cloudformation_metadata_for_ci_and_cd_manage-server.json): template/metadata · Infrastructure definition for the manage-server deployment · `cloudformation/cloudformation_metadata_for_ci_and_cd_manage-server.json`
- **RHEL host**: managed instance · Single server runtime provisioned by the stack

### Bootstrap

First-boot handoff on the instance

- [cloud-init userdata](https://github.com/usui-tk/ci-cd-manage_materials/blob/master/cloud-init/cloud-init_userdata_for_ci_and_cd_manage-server.sh): bootstrapping script · First-boot handoff executed during instance initialization · `cloud-init/cloud-init_userdata_for_ci_and_cd_manage-server.sh`

### Host config

OS-level provisioning and resulting managed server

- [Provisioning script](https://github.com/usui-tk/ci-cd-manage_materials/blob/master/shellscript/ci_and_cd_manage-server.sh): host setup script · Main imperative setup for the CI/CD management server · `shellscript/ci_and_cd_manage-server.sh`
- **Manage server**: CI/CD control plane · Configured server intended to host CI/CD management services

### Other components

- **Operator**: external actor · Launches the stack and initiates provisioning

## Connections

- Operator → CloudFormation: launches · Operator starts the stack
- CloudFormation → Stack metadata: reads · CloudFormation consumes the stack artifact
- CloudFormation → RHEL host: provisions · Creates the managed RHEL instance
- Stack metadata → cloud-init userdata: attaches · Template supplies bootstrap userdata to the instance
- RHEL host → cloud-init userdata: boots with · cloud-init runs on first boot
- cloud-init userdata → Provisioning script: invokes · Userdata hands off to the shell provisioning logic
- Provisioning script → Manage server: configures · Installs and configures the CI/CD management environment
- RHEL host → Manage server: hosts · Managed server runs on the provisioned instance
