Skip to main content
Version: 1.0.7

The Gateway

"The gateway" is the QUBIQ installation as a whole: the supervisor process, the services it manages, and the message bus they share. It is the unit you install, start, stop, back up and upgrade.

The supervisor​

Running the binary with no subcommand starts the supervisor. In order, it:

  1. Provisions .env if absent, generating JWT_SECRET and a 64-hex ENCRYPTION_KEY from a cryptographic RNG.
  2. Starts the embedded message bus, bound to 127.0.0.1 on a random free port, and exports the resulting URL into the environment children inherit.
  3. Migrates the configuration database — once, single-threaded, before any child exists, so services never race on schema.
  4. Creates one hard link per service beside the binary, named QBQ-<Service>, and spawns each.
  5. Supervises: watches heartbeats, restarts a service that exits unexpectedly, and reports status to the interface.

If hard links are not possible (a cross-volume or non-NTFS install), the supervisor falls back to spawning qubiq <subcommand> — still a separate process, just displayed under the generic name.

Why hard links

So that QBQ-OpcWorker shows up in Task Manager, ps and your monitoring agent under its own name. It is the same file on disk; only the invocation name differs.

Secrets are strict​

There are no insecure defaults and no fallbacks:

SecretPurposeRule
JWT_SECRETProtects Platform sign-insRequired. Absent or malformed ⇒ hard startup failure.
ENCRYPTION_KEY64 hex chars; derives the key protecting the configuration database and connection secretsRequired. Absent or malformed ⇒ hard startup failure.
LIVE_JWT_SECRETProtects LiveView sign-insDerived from JWT_SECRET if unset; set it explicitly to reset operator sign-ins on their own.

Startup fails loudly rather than starting insecurely. Moving a data directory to another machine requires bringing that machine's ENCRYPTION_KEY with it.

Service catalog​

ServiceProcessPortRestart impact
CoreServerQBQ-CoreServer8182UI and API unavailable while down; devices keep being polled.
RealtimeGatewayQBQ-RealtimeGateway8183Screens stop updating; values are not lost.
EngineQBQ-Engine—Pipeline execution pauses.
BridgeQBQ-Bridge—Protocol adapters and pipeline runtime restart; subscriptions re-establish.
HistorianQBQ-Historian—Ingestion buffers; nothing is lost while store-and-forward holds.
AlarmQBQ-Alarm—Evaluation pauses; state is restored from storage on restart.
AuditQBQ-Audit—Events stay buffered on the durable stream until it returns.
ConnMonitorQBQ-ConnMonitor—Health indicators go stale; data flow is unaffected.
OpcWorkerQBQ-OpcWorker—OPC-UA subscriptions re-establish on restart.
MqttWorkerQBQ-MqttWorker—Broker sessions reconnect; retained/Sparkplug birth messages resynchronise.
ModbusWorkerQBQ-ModbusWorker—Polling resumes.
EipWorkerQBQ-EipWorker—EtherNet/IP (Allen-Bradley CIP) polling resumes at once if the controller has reclaimed the connection slots the worker held; if it has not, the driver retries on a 500 ms-to-30 s backoff until it does.
S7WorkerQBQ-S7Worker—Siemens S7comm polling resumes the same way, but an S7 CPU releases connection resources slowly, so the retry floor is higher: a 2 s-to-30 s backoff.
SnmpWorkerQBQ-SnmpWorker162/udp (opt-in)Polling resumes; traps sent while down are lost (SNMP is fire-and-forget).
TcpUdpWorkerQBQ-TcpUdpWorker—Sockets reconnect.
DbWorkerQBQ-DbWorker—Queued SQL/Mongo work retries.
RestGatewayQBQ-RestGateway8090Published REST endpoints return errors while down.
ScriptGatewayQBQ-ScriptGateway8091Script execution fails fast.
ImportServiceQBQ-ImportService—Bulk imports queue.
ExpressionQBQ-Expression—Expression tags stop updating; device and internal tags are unaffected.
KnowledgeQBQ-Knowledge—The assistant's knowledge base is unavailable; the assistant and the plant keep running.
AIQBQ-AI—The assistant is unavailable.
PyWorkerQBQ-PyWorker—Python scripts cannot run until it returns. Extra replicas (PYTHON_WORKER_REPLICAS) are named QBQ-PyWorker-2, …

Monitoring and controlling services​

Settings → System Services lists every service with its state and heartbeat.

ActionPermission
View the service listAccess settings
Start / stop / restart a serviceManage services

Stopping a service through the interface tells the supervisor not to restart it, so it stays down until you start it again. That is the safe way to take a protocol worker out of service for maintenance — killing the process merely triggers a restart.

Health and diagnostics​

AuthReturns
noneLiveness — is the gateway process answering?
noneAggregate service health, suitable for a load balancer.
View the status panelResource and throughput counters.
Access settingsTelemetry pipeline and WebSocket fan-out health.
View the status panelHost CPU, memory, disk.
View the status panelPer-connection state.
authenticatedWhat happened during boot — the first thing to read after a failed start.

→ Logs and diagnostics

The message bus​

Services communicate over an embedded publish/subscribe bus with a persistent stream layer. It provides:

  • Subject-based messaging — telemetry, node status, connection state, alarm events, audit events.
  • Durable streams — the store-and-forward buffers and the audit event stream survive a service restart.
  • Key-value buckets — live tag values, internal (memory) tag values, alarm runtime state.
  • Request/reply — e.g. a protocol worker asking CoreServer to resolve and decrypt a connection.

Because the bus is bound to loopback with a random port, there is nothing to expose, authenticate or firewall. It also means every service must run on the same host.

Wire contract​

Telemetry travels as a compact binary message rather than JSON, which is what keeps a busy screen cheap to feed. Three kinds cross the bus: a tag value with its quality and timestamps, a pipeline node's status, and the pipeline payload envelope.

Web assets​

In a production build the compiled frontend is embedded into the binary. There is no static file directory to deploy and no web server to configure; CoreServer serves the interface itself.

Ports summary​

PortBound byPurpose
8182CoreServerHTTP API, web UI, WebSocket upgrade
8183RealtimeGatewayTelemetry WebSocket
8090RestGatewayPipeline-defined REST ingress
8091ScriptGatewayScript execution
162/udpSnmpWorkerTrap listener (opt-in)
random, loopbackSupervisorMessage bus — never exposed

Override with PORT, REALTIME_PORT, REST_GATEWAY_PORT, SCRIPTING_GATEWAY_PORT. → Environment variables

Next​

→ Projects