Nexus
Reference for the Nexus singleton runtime that hosts OPC UA, HTTP, MCP, lifecycle, certificates, and tracing.
Nexus is the process-wide runtime for an Aether application. It hosts the embedded OPC UA server, HTTP API, MCP endpoint, startup/shutdown lifecycle, certificates, and observability integration.
Singleton behavior
Nexusis a singleton: repeated construction returns the same instance.- Only the first initialization applies runtime options.
- Treat one process as owning one Nexus instance for its full lifetime.
Common constructor options
opc_ua_url: embedded OPC UA listen endpoint (for exampleopc.tcp://localhost:4840oropc.tcp://0.0.0.0:4840in containers).namespace: namespace URI used for embedded OPC UA nodes.device_id: logical object node underObjectswhere embedded variables are grouped.otlp_endpoint: optional OTLP exporter endpoint for traces.token: optional constructor token source for licensing (alternative to environment variable).aws_iot_endpoint: optional AWS IoT Core endpoint to enable device provisioning/publishing flow.
Licensing
- A valid license JWT is required to run
nexus.start(). - Provide the token through
VEILNET_AETHER_TOKENorNexus(..., token=...). - Token validation happens at startup before services are exposed.
Runtime surfaces
When nexus.start() runs, the application exposes:
- HTTP on
0.0.0.0:8000 GET /healthfor liveness checks./docsfor interactive OpenAPI./nexus/mcpfor MCP over HTTP.- Embedded OPC UA on
opc_ua_url.
Lifecycle and ordering
Use this startup sequence:
- Construct
Nexusfirst. - Define all
Sigilinstances at module scope. - Define all
Weaveinstances at module scope. - Call
nexus.start().
Declaring Sigils and Weaves before startup ensures routes, tools, OPC UA nodes, and loop scheduling are fully registered.
Certificates
Nexus expects certificate material in certs/ (typically cert.pem and key.pem) and can generate self-signed files when missing. In production, mount or manage this directory explicitly.
Optional integrations
- Tracing: use
otlp_endpointto export traces; otherwise Nexus keeps local trace output for inspection. - AWS IoT Core: when configured, Nexus can provision/connect and publish Sigil events.