# djschnei21/multi-product-integration-demo architecture

> Architecture diagram of the GitHub repository djschnei21/multi-product-integration-demo, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/djschnei21/multi-product-integration-demo
- Repository: https://github.com/djschnei21/multi-product-integration-demo

## Overview

##### Main Components
- Control Workspace: Represented by the “0_control-workspace” directory. This is the orchestration hub that triggers and manages downstream workspaces.
- Networking: From the “1_networking” directory. This sets up the AWS VPC, subnets, HCP HVN, and the peering connection.
- HCP Clusters: Under “2_hcp-clusters” you have components creating:
- HCP Vault cluster
- HCP Boundary cluster
- HCP Consul cluster
- Vault Auth Config: (“3_vault-auth-config”) – Establishes Vault JWT Auth for Terraform Cloud, integrating Vault with TFC dynamic operations.
- Boundary Config: (“4_boundary-config”) – Configures Boundary, sets up dynamic host catalogs, and integrates with Vault for SSH certificate injection.
- Nomad Cluster: (“5_nomad-cluster”) – Provisions a three-node Nomad server cluster with bootstrapping of ACLs; note the associated Nomad policy template.
- Nomad Nodes: (“6_nomad-nodes”) – Provisions additional worker nodes in two groups (x86 and ARM) for Nomad workloads.
- Workload Deployment: The “workload” directory includes Nomad job definitions for frontend and MongoDB deployments.
- Packer: The “packer” directory handles creation of Nomad server and client AMIs using HCP Packer integrated with Terraform.
- Doormat Prereqs: The “doormat-prereqs” directory is used to set up required AWS sandbox account elements.

##### Relationships and Data Flows
- Vault Auth Config (for bootstrapping and JWT integration) and
- Boundary Config (using Vault for credential injection).
- That the Nomad Cluster (Nomad servers in an Auto Scaling Group) communicates with:
- Nomad Nodes (the worker nodes) in addition to
- The workload deployments that run Nomad jobs.
- That Packer is used to build AMIs for Nomad’s server and client nodes, interfacing with the Nomad components.

##### Architectural Patterns
- Modular/multi-workspace design in which each directory corresponds to a separate Terraform workspace – demonstrating separation of concerns.
- “better together” integration pattern where each component (Vault, Boundary, Consul, Nomad) communicates with the others to form the complete demonstrative environment.
- Bootstrapping pattern whereby output from HCP Clusters (for example, the Vault bootstrap token) is used by downstream modules (vault-auth-config, nomad-cluster).

##### Relevant Technologies and Tools
- Terraform & Terraform Cloud (for orchestration and multi-workspace management)
- AWS networking (VPC, subnets, ASGs)
- HCP Services: Vault, Consul, Boundary, and Packer Registry
- Nomad Enterprise (for scheduling workloads)
- Packer (for building machine images)
- Doormat provider for provisioning the AWS sandbox

##### Final Reminder
- Every component is clearly marked and documented with labels.
- The goal is to capture all key architectural elements since the environment is modular and each component is tightly coupled to a specific role in the integration story.

## Diagram (Mermaid)

```mermaid
graph TD
    %% Orchestration Layer
    subgraph "Orchestration Layer"
        A["Control Workspace"]:::orchestration
    end

    %% Infrastructure/Networking Layer
    subgraph "Infrastructure/Networking Layer"
        B["Networking"]:::infrastructure
        C["Doormat Prereqs"]:::infrastructure
    end

    %% Service Clusters Layer
    subgraph "Service Clusters Layer"
        D["HCP Clusters (Vault/Consul/Boundary)"]:::service
        E["Vault Auth Config"]:::service
        F["Boundary Config"]:::service
    end

    %% Compute Layer
    subgraph "Compute Layer"
        G["Nomad Cluster"]:::compute
        H["Nomad Nodes"]:::compute
        I["Packer"]:::compute
    end

    %% Application/Workload Layer
    subgraph "Application/Workload Layer"
        J["Workload Deployment"]:::application
    end

    %% Control Workspace triggers all modules
    A -->|"triggers"| B
    A -->|"triggers"| C
    A -->|"triggers"| D
    A -->|"triggers"| E
    A -->|"triggers"| F
    A -->|"triggers"| G
    A -->|"triggers"| H
    A -->|"triggers"| I
    A -->|"triggers"| J

    %% Networking dependencies to Service Clusters and Compute Layer
    B -->|"network_setup"| D
    B -->|"network_setup"| G
    B -->|"network_setup"| H

    %% HCP Clusters dependencies to configuration modules
    D -->|"bootstrap_token"| E
    D -->|"credential_injection"| F

    %% Packer builds AMIs for Nomad Cluster
    I -->|"AMI_creation"| G

    %% Nomad Cluster communicates with nodes and dispatches jobs
    G -->|"communication"| H
    G -->|"job_dispatch"| J

    %% Click Events
    click A "https://github.com/djschnei21/multi-product-integration-demo/tree/main/0_control-workspace"
    click B "https://github.com/djschnei21/multi-product-integration-demo/tree/main/1_networking"
    click D "https://github.com/djschnei21/multi-product-integration-demo/tree/main/2_hcp-clusters"
    click E "https://github.com/djschnei21/multi-product-integration-demo/tree/main/3_vault-auth-config"
    click F "https://github.com/djschnei21/multi-product-integration-demo/tree/main/4_boundary-config"
    click G "https://github.com/djschnei21/multi-product-integration-demo/tree/main/5_nomad-cluster"
    click H "https://github.com/djschnei21/multi-product-integration-demo/tree/main/6_nomad-nodes"
    click I "https://github.com/djschnei21/multi-product-integration-demo/tree/main/packer"
    click J "https://github.com/djschnei21/multi-product-integration-demo/tree/main/workload"
    click C "https://github.com/djschnei21/multi-product-integration-demo/tree/main/doormat-prereqs"

    %% Styles
    classDef orchestration fill:#cce5ff,stroke:#003366,stroke-width:2px;
    classDef infrastructure fill:#d1e7dd,stroke:#0f5132,stroke-width:2px;
    classDef service fill:#f8d7da,stroke:#842029,stroke-width:2px;
    classDef compute fill:#fff3cd,stroke:#856404,stroke-width:2px;
    classDef application fill:#d1c4e9,stroke:#4a148c,stroke-width:2px;
```
