Skip to content

Architecture

Apex is a manifest-driven deployment orchestrator for TDengine All-in-One. This page explains its architecture, design decisions, and how components work together.

flowchart TB
    accTitle: Apex deployment architecture
    accDescr: Deployment YAML and component manifests feed the Apex CLI workflow through check, validate, prepare, and apply. Local or SSH transport deploys components to target nodes.
    config["Deployment YAML + Component Manifests"]
    subgraph cli["Apex CLI (Controller)"]
        direction LR
        check --> validate --> prepare --> apply
    end
    subgraph transport["Transport Layer"]
        direction LR
        local["Local"]
        ssh["SSH"]
    end
    subgraph targets["Target Nodes"]
        direction LR
        tsdb["TSDB"]
        idmp["IDMP"]
        tdgpt["TDgpt"]
        cls["CLS"]
    end
    config --> cli
    cli --> transport
    transport --> targets

The Apex CLI (cmd/apex) provides the user interface and orchestrates the deployment workflow. It follows a stage-based approach:

  1. Check: Validates YAML syntax and tests node connectivity
  2. Validate: Loads manifests, resolves versions, checks dependencies
  3. Prepare: Downloads and verifies artifacts (SHA256)
  4. Apply: Distributes artifacts and executes lifecycle commands

Each stage can run independently, allowing operators to pause, inspect, and resume. The deploy command chains all four stages.

Deployment YAML (kind: Deployment):

  • Defines topology: nodes, platforms, transports
  • Specifies component roles and versions
  • Configures SSH credentials and paths
  • Sets release profile and channel

Component Manifests:

  • Published by component teams
  • Declare supported platforms and dependencies
  • Provide installers, resources, checksums
  • Define lifecycle commands (pre-install, install, post-install)

User Configuration (~/.apex/config.yaml):

  • Sets apex_home, base_url, telemetry preferences
  • Shared across all deployments

Apex supports two transport modes:

Local Transport (transport: local):

  • Executes commands directly on the Apex host
  • No SSH server required
  • Ideal for single-node installations
  • Uses filesystem operations for artifact placement

SSH Transport (transport: ssh):

  • Connects to remote nodes via SSH
  • Uploads artifacts through SFTP/SCP
  • Executes commands remotely
  • Supports key-based and password authentication
  • Merges global and node-level SSH settings
flowchart TB
    accTitle: Artifact resolution and distribution
    accDescr: Read artifact definitions from component manifests, download or import into the cache, verify SHA256, and distribute to nodes.
    manifest["Component Manifest"] --> definition["Artifact Definition (URL, filename, SHA256)"]
    definition --> download["Download / Import"]
    download --> cache["Cache (~/.apex/cache)"]
    cache --> verify["SHA256 Verification"]
    verify --> distribute["Distribute to Nodes"]

Artifact Sources:

  • Online: Downloaded from CDN (default: downloads.tdengine.com)
  • Offline: Imported from local bundles
  • Cached: Reused from previous preparations

Verification:

  • Every artifact must match its manifest SHA256
  • Required artifacts block deployment if missing
  • Optional resources emit warnings when unavailable

Apex executes deployment in dependency order:

  1. Dependency Resolution: Build execution graph from component dependencies
  2. Platform Selection: Choose platform-specific steps (linux-x64, windows-x64, etc.)
  3. Sequential Execution: Run lifecycle stages per component
  4. Transport Abstraction: Same commands work via local or SSH transport

Lifecycle Stages:

  • pre-install: Preparation steps (stop services, check dependencies)
  • install: Main installation commands
  • post-install: Configuration and service startup
  • uninstall: Removal steps
  • purge: Complete cleanup including data

Concurrency:

  • Components deploy sequentially to honor dependencies
  • Multiple nodes can receive artifacts in parallel
  • Limited parallelism prevents resource contention
~/.apex/ # Apex home (configurable)
├── config.yaml # User configuration
├── cache/ # Downloaded artifacts
│ ├── artifacts/ # Component packages
│ └── artifact-index.yaml # Verification index
├── manifests/ # Component manifests
│ ├── tsdb-manifest.yaml
│ ├── idmp-manifest.yaml
│ └── ...
├── scripts/ # Lifecycle scripts
│ ├── apex-util.sh
│ └── apex-util.ps1
├── logs/ # Operation logs
│ └── deploy-20250115-123456/
│ ├── apex.log # Main operation log
│ └── node1-tsdb-install/ # Command evidence
└── reports/ # Deployment reports
└── deploy-20250115-123456/
└── report.yaml
/opt/apex/artifacts/ # Target node artifacts (Linux)
C:\ProgramData\TDengine\Apex\ # Target node base (Windows)

Static Versions:

roles:
- component: tsdb
version: "3.3.5.0"

Dynamic Versions:

spec:
release:
profile: all-in-one
channel: stable
roles:
- component: tsdb
version: auto

Dynamic resolution:

  1. validate queries the Version Catalog
  2. Resolves auto to specific versions per profile/channel
  3. Emits a resolved Deployment YAML
  4. prepare and apply use the resolved versions

This prevents version drift between stages.

Authentication:

  • SSH key-based authentication (recommended)
  • SSH password authentication (less secure)
  • Local transport requires appropriate user privileges

Artifact Integrity:

  • All artifacts verified with SHA256 checksums
  • Manifests digitally signed by component teams
  • Download failures block deployment

Privilege Separation:

  • Apex runs with user privileges on control host
  • Target nodes may require root/administrator for installation
  • Component services run under dedicated service accounts

Secrets Management:

  • SSH credentials in Deployment YAML or config
  • Passwords not logged or included in reports
  • Private keys referenced by path, never embedded

Apex includes best-effort telemetry to improve reliability:

  • Anonymous usage data: deployment stages, durations, outcomes
  • No sensitive data: no credentials, hostnames, or configuration
  • Respects privacy: disabled with telemetry_enabled: false
  • Never blocks: telemetry failures don’t affect deployment

Event flow:

flowchart TB
    accTitle: Telemetry event flow
    accDescr: One installation or deployment generates a shared runId, passes through bootstrap, prepare, apply, and validation stages, and sends events to the telemetry endpoint on a best-effort basis.
    installer["Installer / Deploy"] --> runId["Generate runId"]
    runId --> bootstrap["Stage 0 (bootstrap)"]
    bootstrap --> prepare["Stage 1 (prepare)"]
    prepare --> apply["Stage 2 (apply)"]
    apply --> validation["Stage 3 (validation)"]
    validation --> endpoint["Telemetry Endpoint (best-effort)"]

Why: Separates topology (what to deploy) from mechanics (how to install). Users maintain simple Deployment files; component teams own installation details.

Trade-off: Requires manifest distribution and version coordination.

Why: Allows inspection between stages. Operators can review plans, verify artifacts, and pause before changes.

Trade-off: More commands for simple deployments (mitigated by deploy).

Why: Single-node installations don’t need SSH complexity. Multi-node and remote deployments need proper remote execution.

Trade-off: Two code paths to maintain and test.

Why: Honors dependencies cleanly. Simpler failure recovery.

Trade-off: Longer deployment time vs. full parallelism (acceptable for typical scales).

Why: Prevents corrupted or tampered packages. Essential for production safety.

Trade-off: Cannot proceed with missing or invalid artifacts.

While Apex is primarily a deployment tool, it provides hooks for customization:

Custom Scripts:

  • Pre/post-install steps can call custom scripts
  • Scripts deployed to target nodes via artifacts

Resource Management:

  • Custom resources with install commands
  • Platform-specific resource handling

Configuration Templates:

  • Component configuration from templates
  • Variable substitution in deployment