TrustGraph configurator is a Python-based tool that generates deployment configurations for TrustGraph AI systems. It supports multiple deployment platforms and provides templated configurations with versioning support.
The configurator uses Jsonnet templates to generate deployment configurations for various platforms including Docker Compose, Podman, and multiple Kubernetes environments. It packages the generated configurations into ZIP files containing all necessary deployment resources.
The configurator is distributed as a Python package. To use it:
export PYTHONPATH=.
# or install the package
pip install -e .
To see all available templates and platforms:
scripts/tg-configurations-list
This will display:
- Available platforms (docker-compose, podman-compose, various Kubernetes options)
- Available templates with versions and stability status
- Latest version and latest stable version
To generate a configuration package:
scripts/tg-configurator --template <template-name> --version <version> \
--input config.json --output output.zip --platform <platform>
Example:
scripts/tg-configurator --template 1.1 --version 1.1.9 \
--input config.json --output deployment.zip --platform docker-compose
To output only the TrustGraph configuration:
scripts/tg-configurator --template 1.1 --latest-stable \
--input config.json -O > trustgraph-config.json
To output only the platform resources (docker-compose.yaml or resources.yaml):
# For Docker Compose
scripts/tg-configurator --template 1.1 --latest-stable \
--input config.json --platform docker-compose -R > docker-compose.yaml
# For Kubernetes
scripts/tg-configurator --template 1.1 --latest-stable \
--input config.json --platform gcp-k8s -R > resources.yaml
You can also run the configurator as a REST API service:
scripts/tg-config-svc
This starts a web service on port 8080 that provides:
- REST API endpoints for configuration generation
- Programmatic access to version information
- Web-based configuration generation
The service provides the same functionality as the command-line tool but through HTTP endpoints (see API Service section below for details).
-i, --input
: Input configuration file (default: config.json)-o, --output
: Output ZIP file (default: output.zip)-t, --template
: Template name (e.g., "1.1", "1.0", "0.23")-v, --version
: Specific version to use-p, --platform
: Target platform (default: docker-compose)--latest
: Use the latest available version--latest-stable
: Use the latest stable version-O, --output-tg-config
: Output only TrustGraph configuration to stdout (no ZIP file)-R, --output-resources
: Output only platform resources (docker-compose.yaml or resources.yaml) to stdout (no ZIP file)
docker-compose
: Local Docker deployment using docker-composepodman-compose
: Local Podman deployment using podman-composeminikube-k8s
: Minikube Kubernetes clustergcp-k8s
: Google Cloud Kubernetes (GKE)aks-k8s
: Azure Kubernetes Service (AKS)eks-k8s
: AWS Elastic Kubernetes Service (EKS)scw-k8s
: Scaleway Kubernetes
- 1.1 (stable): MCP support and agent functionality upgrades
- 1.0 (stable): Production release with Flow API and Librarian
- 0.23 (alpha): Early release with dynamic flow processing
- 0.22 (stable): Dynamic configuration without system restart
- 0.21 (stable): Mistral API, LM Studio, multiple OCR options
The trustgraph_configurator
package consists of several key modules:
-
generator.py (
Generator
class)- Processes Jsonnet templates using the
_jsonnet
library - Evaluates configuration snippets with custom import callbacks
- Returns processed JSON configurations
- Processes Jsonnet templates using the
-
packager.py (
Packager
class)- Main orchestrator for configuration generation
- Handles template and resource file loading
- Generates platform-specific deployment packages
- Creates ZIP archives with all necessary files
- Supports both Docker Compose and Kubernetes outputs
-
index.py (
Index
class)- Manages template and platform metadata
- Reads from
templates/index.json
- Provides version sorting and comparison
- Offers methods to get latest/stable versions
-
api.py (
Api
class)- REST API service for configuration generation
- Endpoints for version information and generation
- Validates input JSON before processing
- Returns generated configurations as binary data
-
service.py
- Simple wrapper to run the API service
- Configures logging and starts the web server on port 8080
-
run.py
- Command-line interface implementation
- Argument parsing and validation
- Reads input configuration and writes output ZIP
-
list.py
- Command-line tool to list available configurations
- Displays platforms, templates, and versions in tabular format
User Input (config.json)
↓
run.py (CLI) or api.py (REST)
↓
Packager (orchestrator)
├─→ Index (metadata/versions)
├─→ Generator (Jsonnet processing)
└─→ Resource files (templates/)
↓
Platform-specific generation
(Docker Compose or Kubernetes)
↓
ZIP archive (output.zip)
-
Template Resolution: The
Packager.fetch()
method implements a sophisticated file resolution system:- Special handling for
trustgraph/config.json
andversion.jsonnet
- Fallback search paths for templates and resources
- Version-specific template directories
- Special handling for
-
Platform Abstraction: Different platforms are handled through:
- Platform-specific Jsonnet templates (e.g.,
config-to-docker-compose.jsonnet
) - Conditional logic in
Packager.generate()
- Unified output format (ZIP archives)
- Platform-specific Jsonnet templates (e.g.,
-
Version Management: The system supports:
- Multiple template versions with different features
- Stability levels (alpha, beta, stable)
- Automatic version selection (latest/latest-stable)
- User provides a JSON configuration file
- Packager validates and loads the appropriate template version
- Generator processes Jsonnet templates with the configuration
- Platform-specific resources are added (Grafana dashboards, Prometheus config)
- Everything is packaged into a ZIP file for deployment
The REST API service (tg-config-svc
) provides programmatic access to the configurator functionality. Start the service with:
scripts/tg-config-svc
The service runs on port 8080 and provides the following endpoints:
POST /api/generate/{platform}/{template} # Generate configuration
GET /api/latest # Get latest version info
GET /api/latest-stable # Get latest stable version info
GET /api/versions # List all available versions
Example usage:
# Generate configuration via API
curl -X POST http://localhost:8080/api/generate/docker-compose/1.1 \
-H "Content-Type: application/json" \
-d @config.json \
--output deployment.zip
The generated ZIP file contains:
docker-compose.yaml # Main deployment file
trustgraph/config.json # TrustGraph configuration
grafana/ # Grafana dashboards and provisioning
prometheus/ # Prometheus configuration
The generated ZIP file contains:
resources.yaml # All Kubernetes resources in a single file
To extend or modify the configurator:
- Templates are in
trustgraph_configurator/templates/<version>/
- Add new platforms by creating appropriate Jsonnet templates
- Update
templates/index.json
for new versions - Resources (dashboards, configs) go in
trustgraph_configurator/resources/<version>/
The configurator includes error handling for:
- Missing or invalid templates
- Malformed input JSON
- File resolution failures
- Platform-specific generation errors
Errors are logged with appropriate context for debugging.