Skip to content

Compose Generation

For local execution, the generated docker-compose.yaml is the canonical local stack artifact.

It is produced from skeletons/docker-compose.skeleton.yaml.j2 by tools/sigmaxgen/sigmaxgen/generate_compose.py in the runtime repository. The generated file is marked, schema-versioned and treated as an output of the generation pipeline rather than a hand-maintained deployment manifest.

The Compose generator builds a complete local stack around generated components.

Generated areaRuntime repository behavior
Component servicesOne sigmax-<component> service per composant_<name> directory.
Dapr sidecarsOne sigmax-<component>-dapr sidecar per component.
Storage serviceA generic sigmax-storage service built from storage-service/Dockerfile.
Storage sidecarA sigmax-storage-dapr sidecar for service invocation.
PostgreSQLA postgres:16 service with init scripts and persistent volume.
NetworkA shared internal_net bridge network.
Volumepostgres_data for local database persistence.

The generated stack is intentionally local and inspectable. It lets the runtime, WASM components, Dapr sidecars, storage interpreter and database run together without baking business rules into the Rust runtime or Compose generator.

generate_compose.py discovers components by scanning the repository root for directories matching composant_<name>.

RuleCurrent behavior
Component directory patterncomposant_([a-z0-9_-]+)
Component orderingSorted by directory name for deterministic output.
Image namelocalhost/sigmax-<name>:<version>
Version source<component>/Version, falling back to 0.0.
Runtime portStarts at 8080, then increments per component.
Dapr HTTP portFixed at 3500 inside each sidecar.

Local caller

sigmax-

runtime + WASM

sigmax--dapr

sigmax-storage-dapr

sigmax-storage

postgres

generated/storage.yaml

Each generated component service builds from its component Dockerfile, runs the generic sigMAX runtime and exposes the component runtime port.

sigmax-<name>:
image: localhost/sigmax-<name>:<version>
build:
context: .
dockerfile: composant_<name>/Dockerfile
environment:
SIGMAX_ROUTES: /app/generated/routes.yaml
SIGMAX_BIND: 0.0.0.0:<runtime_port>
DAPR_HTTP_ENDPOINT: http://sigmax-<name>-dapr:3500
RUST_LOG: info
FieldMeaning
SIGMAX_ROUTESPoints the runtime to generated route metadata inside the component image.
SIGMAX_BINDBinds the component runtime to its assigned local port.
DAPR_HTTP_ENDPOINTPoints the runtime to its paired Dapr sidecar.
RUST_LOGKeeps local logs visible during generated stack execution.

The service also gets a /healthz healthcheck, joins internal_net, and exposes its runtime port to the host for local testing.

Every component receives a paired Dapr sidecar using docker.io/daprio/daprd:1.17.9-stablecomponents-mariner.

The sidecar is configured with:

  • --app-id sigmax-<name>;
  • --app-port <runtime_port>;
  • --app-protocol http;
  • --app-channel-address sigmax-<name>;
  • --dapr-http-port 3500;
  • --resources-path /components;
  • app health checks against /healthz;
  • read-only ./dapr/components:/components:ro mount.

This keeps service invocation explicit while preserving the component runtime as a normal HTTP process inside Compose.

The Compose skeleton always includes the generic storage path.

ServiceRole
sigmax-storageGeneric storage interpreter for generated/storage.yaml.
sigmax-storage-daprDapr sidecar for storage service invocation.
postgresLocal PostgreSQL backing store.

sigmax-storage receives:

STORAGE_BIND: 0.0.0.0:8090
SIGMAX_STORAGE_SPEC: /app/generated/storage.yaml
DATABASE_URL: postgres://sigmax:sigmax@postgres:5432/sigmax
DAPR_HTTP_ENDPOINT: http://sigmax-storage-dapr:3500

PostgreSQL mounts postgres_data and ./postgres/init:/docker-entrypoint-initdb.d:ro, so generated SQL/init artifacts remain visible and local database state can survive container restarts.

The current skeleton defines a shared x-sigmax-http-env block for generated component services.

SIGMAX_HTTP_ALLOWED_TARGETS: "*"
SIGMAX_HTTP_TARGET_WILDCARD_BASE_URL: "*"
SIGMAX_HTTP_TARGET_WILDCARD_METHODS: GET
SIGMAX_HTTP_TARGET_WILDCARD_PATHS: "*"
SIGMAX_HTTP_TARGET_WILDCARD_TIMEOUT_MS: 3000
SIGMAX_HTTP_TARGET_WILDCARD_MAX_RESPONSE_BYTES: 65536

The generator protects manual files and records what it did.

Safety behaviorCurrent implementation
Generated markerThe output must contain sigMAX generated docker-compose in the first lines.
Schema markerThe skeleton includes schema_version: sigmax.compose/v0.1.
Manual-file protectionA non-marked existing Compose file is not overwritten unless force is used.
Atomic writeOutput is written through a temporary file and then replaced.
Report JSONgenerate-compose writes status, template path, output path, components, services, warnings and errors.
Business neutralityTests reject hardcoded business names such as invoice-specific route or storage names.

The runtime repository README uses normal Docker Compose commands for local execution.

Terminal window
docker compose down --remove-orphans
docker compose up -d --build --force-recreate

Use the generated Compose file as evidence of the local effective stack: which component images are built, which ports are exposed, which sidecars exist, how storage is wired and which generated artifacts are mounted.

Not thisWhy
A hand-maintained operations manifestIt should be regenerated from the skeleton and component inventory.
A production security policyThe current wildcard HTTP defaults and local Postgres credentials are development oriented.
A business behavior fileBusiness behavior belongs in contracts, generated routes, generated storage and WASM artifacts.
A replacement for agreementsAgreements still record what was generated, compiled, packaged and validated.