# alphagov/paas-cf architecture

> Architecture diagram of the GitHub repository alphagov/paas-cf, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/alphagov/paas-cf
- Repository: https://github.com/alphagov/paas-cf

## Overview

##### Main Components and Their Roles
- Concourse Pipelines: Under the “concourse” directory are many YAML pipeline definitions and scripts that drive the deployment tasks (e.g. “create-cloudfoundry.yml”, various tasks, and supporting scripts). These pipelines handle the orchestration of deployments and various operational jobs.
- Terraform Configurations: The “terraform” directory contains configurations for provisioning AWS infrastructure (networks, load balancers, databases, security groups, and VPC peering, among others). This is a key component that interacts with AWS services.
- BOSH Manifests and CF Deployment: The “manifests” directory holds different pieces of the Cloud Foundry deployment – notably “cf-manifest” for BOSH manifest generation (including custom operations) and “prometheus” manifests for monitoring setup.
- Configuration Files and Templates: The “config” directories (for billing, logit, etc.) provide configuration templates and scripts for dynamic configuration generation.
- Tools and Tests: The “tools”, “common-go”, and “platform-tests” directories include supporting tools (for buildpack emails, metrics exporters, etc.) and a suite of automated tests to validate deployments.
- Utility Scripts: There is an abundance of scripts for managing secrets, updating buildpacks, and handling other operational tasks found in the “scripts” directory.

##### Relationships and Interactions Between Components
- The Concourse pipelines are the “orchestrator” that invoke tasks in other components. For instance:
– A pipeline (found in concourse/pipelines) can trigger Terraform runs for provisioning AWS resources.
– After infrastructure provisioning, pipelines run BOSH deployment jobs and then interact with the “manifests” that define the Cloud Foundry deployment.
- Concourse jobs also run utility scripts and tests (found under “platform-tests”, “tools”, and “scripts”) to validate configuration, perform health checks, and update auxiliary services.
- Terraform is responsible for managing the AWS environment (networks, load balancers, RDS, etc.), which is then used by the BOSH and CF deployment processes.
- The configuration directories (like “config/billing” or “config/logit”) feed into manifest generation steps, often executed by Concourse tasks to produce environment-specific configuration.
- In addition, integration with external tools (e.g., GDS CLI, CredHub, cf CLI) enables secure access and secret management, which in turn influence pipeline operations.

##### Architectural Patterns and Design Principles
- Separation of Concerns: Different directories are clearly responsible for distinct areas such as infrastructure provisioning (Terraform), deployment configuration (manifests), orchestration (Concourse pipelines), and testing (platform-tests and specs).
- Infrastructure as Code: The heavy use of Terraform and declarative manifest templates shows adherence to immutable, reproducible configurations.
- Pipeline-driven Automation: Modular Concourse pipelines are used to tie together provisioning, configuration, and testing.
- Extensibility: The “tools” and “scripts” directories provide smaller, targeted utilities that can be extended as needed.

##### Specific Elements
- Concourse (pipeline definitions, tasks, scripts)
- Terraform (infrastructure provisioning to AWS resources: VPC, Load Balancers, Databases, IAM, DNS)
- BOSH/Manifests (CF-manifest for Cloud Foundry deployment, including operations customizations)
- Tools & Utility Scripts (e.g., billing configuration generator, metrics exporter, buildpacks updater)
- External Systems (AWS services, CredHub, Github authentication, cf CLI, and GDS CLI)
- From Concourse to Terraform (to trigger provisioning) and then from Terraform to AWS.
- From Concourse to BOSH, indicating that after infrastructure is provisioned the manifest generated from “manifests” is pushed to the BOSH director.
- From Concourse to utility scripts/tests to indicate running of tests and updates.
- External integrations to the Concourse system (authentication, CLI commands, etc.).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Systems
    subgraph "External Systems"
        AWS["AWS Services"]:::external
        CFCLI["cf CLI"]:::external
        GDS["GDS CLI"]:::external
        CredHub["CredHub"]:::external
        Github["Github Auth"]:::external
    end

    %% Orchestration Layer
    subgraph "Orchestration Layer"
        Concourse["Concourse Pipelines"]:::orchestration
        ConcTasks["Concourse Tasks"]:::orchestration
        ConcScripts["Concourse Scripts"]:::orchestration
    end

    %% Infrastructure/Configuration Layer
    subgraph "Infrastructure/Configuration Layer"
        Terraform["Terraform Configurations"]:::infra
        BOSH["BOSH/CF Manifests"]:::configuration
        Prometheus["Prometheus Monitoring"]:::configuration
    end

    %% Configuration Files
    subgraph "Configuration Files"
        Billing["Billing Config"]:::configuration
        Logit["Logit Config"]:::configuration
    end

    %% Tools and Tests
    subgraph "Tools and Tests"
        ToolsUtil["Tools & Utilities"]:::tools
        CommonGo["Common Go"]:::tools
        PlatformTests["Platform Tests"]:::tools
        UtilityScripts["Utility Scripts"]:::tools
    end

    %% Relationships - External systems integrating with Orchestration Layer
    CFCLI ---|"authenticates"| Concourse
    GDS ---|"integrates"| Concourse
    CredHub ---|"secures"| Concourse
    Github ---|"authenticates"| Concourse

    %% Orchestration triggers infrastructure provisioning and deployment
    Concourse -->|"triggers"| Terraform
    Terraform -->|"provisions"| AWS
    Concourse -->|"deploys"| BOSH
    Billing -->|"configures"| BOSH
    Logit -->|"configures"| BOSH
    Prometheus -->|"monitors"| BOSH
    Concourse -->|"executes"| UtilityScripts

    %% Tools and Tests supporting orchestration
    ToolsUtil -->|"supports"| Concourse
    PlatformTests -->|"feedback"| Concourse
    CommonGo -->|"supports"| ToolsUtil

    %% Additional internal orchestration components
    Concourse --- ConcTasks
    Concourse --- ConcScripts

    %% Styles
    classDef orchestration fill:#c2f0fc,stroke:#333,stroke-width:2px;
    classDef infra fill:#f9e79f,stroke:#333,stroke-width:2px;
    classDef configuration fill:#fadbd8,stroke:#333,stroke-width:2px;
    classDef tools fill:#d5f5e3,stroke:#333,stroke-width:2px;
    classDef external fill:#e8daef,stroke:#333,stroke-width:2px,stroke-dasharray: 5 5;

    %% Click Events
    click Concourse "https://github.com/alphagov/paas-cf/tree/main/concourse/pipelines"
    click ConcTasks "https://github.com/alphagov/paas-cf/tree/main/concourse/tasks"
    click ConcScripts "https://github.com/alphagov/paas-cf/tree/main/concourse/scripts"
    click Terraform "https://github.com/alphagov/paas-cf/tree/main/terraform/cloudfoundry"
    click BOSH "https://github.com/alphagov/paas-cf/tree/main/manifests/cf-manifest"
    click Prometheus "https://github.com/alphagov/paas-cf/tree/main/manifests/prometheus"
    click Billing "https://github.com/alphagov/paas-cf/tree/main/config/billing"
    click Logit "https://github.com/alphagov/paas-cf/tree/main/config/logit"
    click ToolsUtil "https://github.com/alphagov/paas-cf/tree/main/tools"
    click CommonGo "https://github.com/alphagov/paas-cf/tree/main/common-go"
    click PlatformTests "https://github.com/alphagov/paas-cf/tree/main/platform-tests"
    click UtilityScripts "https://github.com/alphagov/paas-cf/tree/main/scripts"
```
