Resources

Build a Nilo Appliance sidecar

Send job outcomes and health updates from a process running on the same host as Nilo Appliance. The sidecar writes one JSON event to a Unix domain socket. The Appliance saves it locally and relays it to Nilo Cloud using its own credentials.

This reference covers protocol v1. Use an Appliance build and a Nilo Cloud environment that support process reporting. For Cloud delivery, the Appliance must be linked to an organization.

Raw Markdown · Event fields · Acknowledgements and retries

Host requirements

Run each sidecar under its own OS service account. Give the Appliance and sender accounts access through a dedicated group. The socket directory must have mode 0750 and be owned by the Appliance account and that group. Keep the path short and place the directory outside the Appliance’s private state directory. The Appliance creates the socket and checks the connecting account against its configured process ID.

Setting Value
nilo.appliance.process-events.socket Absolute path where the Appliance creates the socket. Setting this enables reporting.
nilo.appliance.process-events.senders Comma-separated account:process-id pairs. Use 1 to 64 distinct accounts and process IDs.

On Linux, the Appliance runs as nilo-appliance. Its settings file is /etc/nilo-appliance/nilo-appliance.properties. The nilo-appliance.service unit needs the socket directory in ReadWritePaths and the dedicated group in SupplementaryGroups.

On macOS, the Appliance runs as _niloappliance. Its settings file is /Library/Application Support/Nilo Appliance/config/nilo-appliance.properties. Give the Appliance account membership in the socket directory’s group. The launchd service is net.caimito.nilo.appliance.macos.

Restart the Appliance after updating its configuration. Restart the sidecar after changing its group membership.

Wire format

  1. Open an AF_UNIX socket with type SOCK_STREAM.
  2. Write one UTF-8 JSON object on a single line, followed by LF (byte 0x0A). The limit is 16 KiB before LF. The Appliance gives an authorized connection two seconds to submit the frame.
  3. Read one UTF-8 JSON reply followed by LF. The Appliance closes the connection after its reply. Use a new connection for each event.

Use strict JSON with unique property names. Put application-specific fields inside payload.

Event fields

Field Rule
version Required. JSON integer 1.
eventId Required. Canonical lowercase UUID string. Generate it once for each event and preserve it across retries.
processId Required. The ID mapped to the sender’s OS account. Matches [a-z][a-z0-9._-]{0,63}.
occurredAt Required. ISO 8601 instant at or after the Unix epoch and at most five minutes ahead of the Appliance clock. Prefer UTC with a Z suffix.
type Required. Stable event name. Uses the same format as processId.
severity Required. info, warning, or error.
message Required. Nonblank plain text up to 1,024 UTF-8 bytes. Shown in Appliance status and event history.
state Optional. healthy, degraded, or failed. Omit it for ordinary log entries.
payload Optional. JSON object for approved operational details such as counts, durations, or error codes. Omit it when unused.

Keep secrets, credentials, and raw business records out of messages and payloads. The Appliance sends both fields to Cloud.

Acknowledgements and retries

Every reply contains status. Replies with status accepted, busy, conflict, or rejected also contain eventId. An accepted reply confirms local receipt. Cloud delivery happens separately.

Reply status Meaning and sender action
accepted The event is durably queued locally. Check that the reply’s eventId matches, then remove the event from the sender’s pending queue.
busy The local queue is full. Retry with backoff using the original frame.
denied The OS account is absent from the configured sender list. Check which account runs the process.
invalid The frame or fields are invalid, or the process ID differs from the account mapping. Check encoding, size, and field values.
conflict A different frame is already queued under that event ID. Preserve the original frame for retries and allocate a fresh UUID for each distinct event.
rejected This event ID was quarantined after a permanent Cloud rejection. Ask the host administrator to inspect the rejection.

Treat a timeout, connection error, or incomplete reply as uncertain. Keep the original event and retry with backoff. If the event must survive a sidecar restart before acknowledgement, persist the encoded frame in the sidecar’s own queue before its first send.

The Appliance retries pending Cloud deliveries across restarts. Its queue holds up to 1,024 events, including quarantined reports. Cloud deduplicates accepted events per Appliance by eventId while the event is retained. A retry preserves the original expiry.

MCP registration

If your sidecar serves MCP, start its Streamable HTTP listener on loopback and send this frame over the same socket from the same service account.

json {"version":1,"operation":"mcp.register","processId":"inventory-import","endpoint":"http://127.0.0.1:8091/mcp"}

Use 127.0.0.1 or [::1], an explicit port, and a path. The Appliance requires a process ID that matches the connecting account’s mapping. A successful reply is {"status":"accepted","processId":"inventory-import"}. The Appliance keeps the endpoint locally and reports discovery metadata to Cloud at its next check-in.

Register after the MCP listener starts and repeat periodically so the Appliance can recover the registration after a restart. Sending the same registration again is safe. A new endpoint replaces the previous endpoint for that account. Retry busy, an uncertain reply, or a connection failure with backoff. Correct the frame or account mapping if the reply is invalid or denied.