# bitpoke/stack architecture

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

- Interactive diagram: https://gitdiagram.com/bitpoke/stack
- Repository: https://github.com/bitpoke/stack

## Overview

**Infrastructure Layer (Bottom)**
- Kubernetes Cluster
- Cloud Provider (GKE/EKS)

**Core Services Layer**
- Cert Manager
- Nginx Controller
- Prometheus Operator

**Operational Layer**
- MySQL Operator
- WordPress Operator

**Application Layer (Top)**
- WordPress Sites

##### Component Relationships

- Double lines: Data flow

##### Specific Implementation Details

- Blue: Core Kubernetes components
- Green: Operators and controllers
- Orange: Application components
- Yellow: Security components
- Purple: Monitoring components

##### Integration Points

Key integration points:
- Cert Manager ↔ Nginx Controller (SSL/TLS termination)
- Git Webhook ↔ WordPress Sites (deployment automation)
- Operators ↔ Kubernetes API
- WordPress ↔ MySQL connections
- WordPress ↔ Memcached connections

##### Configuration Management

Configuration flow:
- Helm Charts (deploy/charts directory)
- Custom Resource Definitions
- Terraform Modules (for infrastructure provisioning)

##### Monitoring & Observability

Include:
- Prometheus Operator connections
- Metrics flow
- Default backend for handling errors

##### Deployment Pipeline

Illustrate:
- Git webhook flow
- Helm deployment process
- Operator reconciliation loops

- All symbols used
- Component grouping

Important Considerations:
##### Backup/restore paths

- Nested grouping
- Layered architecture representation
- Export to standard formats

Recommended tools:
- Lucidchart
- PlantUML

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and Classes
    classDef infrastructure fill:#1E88E5,color:white
    classDef operator fill:#4CAF50,color:white
    classDef application fill:#FF9800,color:white
    classDef security fill:#FFD700,color:black
    classDef monitoring fill:#9C27B0,color:white
    classDef config fill:#90A4AE,color:white

    %% Infrastructure Layer
    subgraph Infrastructure
        K8s[Kubernetes Cluster]
        GKE[GKE]
        EKS[EKS]
        K8s --> GKE
        K8s --> EKS
    end
    class K8s,GKE,EKS infrastructure

    %% Core Services Layer
    subgraph CoreServices
        CertMgr[Cert Manager]
        NginxCtrl[Nginx Controller]
        PromOp[Prometheus Operator]
        DefBack[Default Backend]
    end
    class CertMgr security
    class NginxCtrl infrastructure
    class PromOp monitoring
    class DefBack infrastructure

    %% Operational Layer
    subgraph Operators
        MySQLOp[MySQL Operator]
        WPOp[WordPress Operator]
        GitWebhook[Git Webhook Controller]
        CRDs[Custom Resource Definitions]
    end
    class MySQLOp,WPOp,GitWebhook operator
    class CRDs config

    %% Application Layer
    subgraph Applications
        WPSites[WordPress Sites]
        MySQL[MySQL Instances]
        Memcached[Memcached]
    end
    class WPSites,MySQL,Memcached application

    %% Relationships
    Infrastructure --> CoreServices
    CoreServices --> Operators
    Operators --> Applications
    
    CertMgr -.-> NginxCtrl
    GitWebhook -.-> WPSites
    WPOp --> WPSites
    MySQLOp --> MySQL
    WPSites --> MySQL
    WPSites --> Memcached
    PromOp -.-> WPSites
    PromOp -.-> MySQL
    NginxCtrl --> DefBack
    
    %% Click Events
    click GKE "https://github.com/bitpoke/stack/tree/master/terraform/modules/gke"
    click EKS "https://github.com/bitpoke/stack/tree/master/terraform/modules/eks"
    click GitWebhook "https://github.com/bitpoke/stack/tree/master/git-webhook/"
    click DefBack "https://github.com/bitpoke/stack/tree/master/default-backend/"
    click CRDs "https://github.com/bitpoke/stack/blob/master/deploy/00-crds.yaml"
    click Memcached "https://github.com/bitpoke/stack/blob/master/deploy/charts/wordpress-site/templates/memcached-statefullset.yaml"
    click MySQL "https://github.com/bitpoke/stack/blob/master/deploy/charts/wordpress-site/templates/mysql.yaml"
    click WPSites "https://github.com/bitpoke/stack/blob/master/deploy/charts/wordpress-site/templates/wordpress.yaml"

    %% Legend
    subgraph Legend
        L1[Infrastructure]:::infrastructure
        L2[Operator]:::operator
        L3[Application]:::application
        L4[Security]:::security
        L5[Monitoring]:::monitoring
        L6[Configuration]:::config
    end
```
