|
| 1 | +# Architecture Diagrams |
| 2 | + |
| 3 | +This directory contains [D2](https://d2lang.com/) diagrams that document the Azure infrastructure for the CTK project. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +The diagrams are organized into modular files, each representing a specific component of the architecture: |
| 8 | + |
| 9 | +- **`main.d2`** - The main diagram that imports and connects all components |
| 10 | +- **`shared.d2`** - Shared resources (Container Registry) |
| 11 | +- **`network.d2`** - Virtual Network and subnets |
| 12 | +- **`database.d2`** - Cosmos PostgreSQL database with private endpoint |
| 13 | +- **`container_environment.d2`** - Container App Environment |
| 14 | +- **`container_apps.d2`** - All container applications (webapp, cloai_service, ctk_functions, languagetool) |
| 15 | +- **`supporting_services.d2`** - Supporting services (Key Vault, Storage Account, Log Analytics, Application Insights) |
| 16 | +- **`identity.d2`** - Azure Active Directory authentication |
| 17 | + |
| 18 | +## Building Diagrams |
| 19 | + |
| 20 | +The diagrams are automatically built by the GitHub Actions workflow whenever D2 files are modified. The workflow: |
| 21 | + |
| 22 | +1. Installs the D2 CLI |
| 23 | +2. Compiles `main.d2` to `architecture.svg` |
| 24 | +3. Uploads the SVG as a workflow artifact |
| 25 | +4. Posts the diagram as a comment on pull requests |
| 26 | + |
| 27 | +To build locally, install [D2](https://d2lang.com/) and run: |
| 28 | + |
| 29 | +```bash |
| 30 | +d2 diagrams/main.d2 diagrams/output/architecture.svg |
| 31 | +``` |
| 32 | + |
| 33 | +## Architecture Notes |
| 34 | + |
| 35 | +- These diagrams focus on the **production environment** only |
| 36 | +- Icons are from [Terrastruct Icons](https://icons.terrastruct.com/) |
| 37 | +- Only the most important connections between services are shown for clarity |
| 38 | +- The diagrams provide a high-level overview, not an exhaustive representation |
| 39 | + |
| 40 | +## Updating Diagrams |
| 41 | + |
| 42 | +When making infrastructure changes: |
| 43 | + |
| 44 | +1. Update the relevant D2 file(s) in this directory |
| 45 | +2. Commit and push your changes |
| 46 | +3. The workflow will automatically regenerate the diagram |
| 47 | +4. Review the updated diagram in the PR comment or workflow artifacts |
0 commit comments