# adsblol/infra architecture

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

- Interactive diagram: https://gitdiagram.com/adsblol/infra
- Repository: https://github.com/adsblol/infra

## Overview

##### Main Components

a. External Components:
- User/Aircraft (data source)
- Public Internet Interface

b. Core Services:
- Ingest Service (readsb)
- MLAT Service (mlat-server)
- Hub Service (readsb)
- Planes Service (readsb with tar1090)
- Redis (for data storage)
- HAProxy (load balancer)
- API Service
- History Service

**[External Layer]**
- ↓
**[Ingestion Layer]**
- ↓
**[Processing Layer]**
- ↓
**[Presentation Layer]**

##### Key Relationships to Highlight

Primary Data Flow:
**User → Ingest → Hub → Planes**

Secondary Data Flow:
**Ingest → MLAT → Hub → Planes**

##### Specific Design Elements

- Rectangles: Kubernetes deployments
- Hexagons: External interfaces
- Rounded rectangles: Services

- Blue: Core services (Ingest, Hub, Planes)
- Green: MLAT-related components
- Yellow: Supporting services (Redis, HAProxy)
- Gray: External components

##### Implementation Details

a. Kubernetes Components:
- Namespace boundaries
- Service relationships
- Public-facing services

b. Network Policies:
- Allowed communication paths
- Security boundaries

##### Technical Specifications

Annotations for:
- Service types (readsb, mlat-server)
- Data formats (ADS-B data)
- Public endpoints
- Internal communication paths

**┌─ Public Interface ─────────────┐**
- (HAProxy, Ingress)            │
- Data Ingestion ──────────────┤
- (Ingest Service)              │
- Data Processing ─────────────┤
- (Hub, MLAT)                   │
- Data Presentation ───────────┤
- (Planes Service, API)         │
- ┘

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef external fill:#gray,stroke:#333
    classDef ingestion fill:#blue,stroke:#333
    classDef processing fill:#lightblue,stroke:#333
    classDef presentation fill:#green,stroke:#333
    classDef storage fill:#yellow,stroke:#333
    classDef loadbalancer fill:#orange,stroke:#333
    classDef monitoring fill:#purple,stroke:#333

    %% External Layer
    subgraph External
        Aircraft[Aircraft/Data Source]:::external
        PublicInterface[Public Internet Interface]:::external
    end

    %% Ingestion Layer
    subgraph Ingestion
        IngestService[Ingest Service]:::ingestion
        MLATService[MLAT Service]:::ingestion
    end

    %% Processing Layer
    subgraph Processing
        HubService[Hub Service]:::processing
        Redis[(Redis Storage)]:::storage
        ServiceMonitor[Service Monitor]:::monitoring
    end

    %% Presentation Layer
    subgraph Presentation
        HAProxy[HAProxy Load Balancer]:::loadbalancer
        PlanesService[Planes Service]:::presentation
        APIService[API Service]:::presentation
        HistoryService[History Service]:::presentation
        MLATMap[MLAT Map Interface]:::presentation
    end

    %% Relationships
    Aircraft --> PublicInterface
    PublicInterface --> IngestService
    IngestService --> MLATService
    IngestService --> HubService
    MLATService --> HubService
    HubService --> Redis
    HubService --> PlanesService
    Redis --> APIService
    Redis --> HistoryService
    HAProxy --> PlanesService
    HAProxy --> APIService
    HAProxy --> HistoryService
    HAProxy --> MLATMap
    ServiceMonitor --> HubService
    ServiceMonitor --> IngestService
    ServiceMonitor --> MLATService

    %% Click Events
    click IngestService "https://github.com/adsblol/infra/tree/main/manifests/default/ingest/base/"
    click MLATService "https://github.com/adsblol/infra/tree/main/manifests/default/mlat/base/"
    click HubService "https://github.com/adsblol/infra/tree/main/manifests/default/hub/base/"
    click PlanesService "https://github.com/adsblol/infra/tree/main/manifests/default/planes/base/"
    click Redis "https://github.com/adsblol/infra/blob/main/manifests/default/redis/base/redis.yaml"
    click HAProxy "https://github.com/adsblol/infra/blob/main/manifests/default/haproxy/base/haproxy.yaml"
    click APIService "https://github.com/adsblol/infra/blob/main/manifests/default/api/base/api.yaml"
    click HistoryService "https://github.com/adsblol/infra/blob/main/manifests/default/history/base/history.yaml"
    click MLATMap "https://github.com/adsblol/infra/blob/main/manifests/default/mlat-map/base/mlat-map.yaml"
    click PublicInterface "https://github.com/adsblol/infra/tree/main/manifests/default/external/base/"
    click ServiceMonitor "https://github.com/adsblol/infra/blob/main/bases/readsb/default/config-servicemonitor-matchlabels.yaml"

    %% Legend
    subgraph Legend
        L1[External Components]:::external
        L2[Ingestion Services]:::ingestion
        L3[Processing Services]:::processing
        L4[Presentation Services]:::presentation
        L5[(Storage)]:::storage
        L6[Load Balancer]:::loadbalancer
        L7[Monitoring]:::monitoring
    end
```
