Noderax Agent is the Go-based node runtime for the platform. It enrolls a machine, opens the agent realtime socket, streams telemetry, claims tasks over HTTP long polling by default, and executes supported operations such as shell commands and package management.
- Enrollment-based node onboarding with approval tokens
- Background service support for Linux-based systems
- Built-in CLI for install, start, stop, restart, status, and config updates
- Realtime Socket.IO session for agent auth, metrics, and lifecycle signaling
- HTTP long-poll task claiming as the primary execution path
- Interactive terminal session support over the agent realtime socket
- Heartbeat-based agent version, platform version, and kernel telemetry for fleet visibility
- Graceful cancellation with log-drain timeout handling
- Non-interactive execution environment with
PAGER=catand highCOLUMNS - PTY shell fallback modes for hosts where the default controlling-TTY start path is restricted
- Scheduled runs arrive as standard queued tasks, so no separate schedule runtime is required on the agent
- Persistent node identity storage
- Linux-based systems with
systemd(Ubuntu, Debian, CentOS, RHEL, etc.) - Manual source-based execution on other developer environments
Prerequisites:
gitgo
git clone <repo-url> noderax-agent
cd noderax-agent
sudo ./scripts/install.shThe installer:
- asks for the API URL
- asks for the enrollment email
- requests an enrollment token
- waits for approval from the web UI
- installs the agent as a background service
- starts it automatically
When you run the installer from a source checkout, it mirrors the entered values into repository-level config.json for local visibility. The managed service still reads its OS-specific config path.
- Binary:
/opt/noderax-agent/noderax-agent - Symlink:
/usr/local/bin/noderax-agent - Config:
/etc/noderax-agent/config.json - State:
/var/lib/noderax-agent/agent_identity.json - Service:
/etc/systemd/system/noderax-agent.service
go build -o noderax-agent ./cmd/agentcp config.example.json config.jsonSet at least:
api_url
Leave enrollment_token empty. The enrollment command will populate it.
./noderax-agent enrollThe agent will:
- ask for the enrollment email
- call
POST /api/v1/enrollments/initiate - save the returned token
- poll
GET /api/v1/enrollments/{token} - persist the approved
nodeIdandagentToken
./noderax-agentUse a custom config path if needed:
NODERAX_CONFIG_FILE=/path/to/config.json ./noderax-agentsudo noderax-agent start
sudo noderax-agent stop
sudo noderax-agent restart
sudo noderax-agent statusShow active config:
noderax-agent config showUpdate config values:
sudo noderax-agent config set api_url https://api.example.com
sudo noderax-agent config set task_timeout 30s
sudo noderax-agent config set metrics_interval 15s
sudo noderax-agent config set log_level debugSupported keys:
api_urlenrollment_tokennode_idagent_tokenheartbeat_intervalmetrics_intervaltask_poll_intervalrequest_timeouttask_timeoutshutdown_timeoutrealtime_enabledrealtime_ping_intervalrealtime_queue_sizerealtime_backoff_jitterrealtime_namespacerealtime_pathstate_filelog_level
The current default execution path is HTTP polling.
- The agent long-polls
POST /api/v1/agent/tasks/claim - A claimed task is acknowledged with
acceptedandstarted - Logs are appended through
POST /api/v1/agent/tasks/:taskId/logs - Completion is posted to
POST /api/v1/agent/tasks/:taskId/completed - Cancellation intent is checked through agent control polling
The agent realtime socket remains important for:
- agent authentication
- metrics streaming
- lifecycle support
- interactive terminal control and streaming
- optional compatibility with API-side realtime task dispatch when explicitly enabled
Fleet visibility uses heartbeat telemetry only. The current product surface does not include agent self-update orchestration inside the agent runtime; upgrades remain an external deployment concern.
Typical realtime settings:
NODERAX_API_URL=https://<domain>
NODERAX_REALTIME_NAMESPACE=/agent-realtime
NODERAX_REALTIME_PATH=/socket.io/
NODERAX_REALTIME_PING_INTERVAL=2s
NODERAX_REALTIME_METRICS_INTERVAL=3sNotes:
- Auth is performed after socket connection with
agent.auth - Namespace and Engine.IO path are configured separately
- Startup performs a polling health-check against
/socket.io/before the full socket session is used
Common failure modes:
invalid URL inputtls/proxy handshake failurenamespace connect failureauth error
Interactive terminal sessions are not delivered through the HTTP task claim loop. They use the agent realtime socket directly.
Incoming control events:
terminal.startterminal.inputterminal.resizeterminal.stop
Outgoing lifecycle events:
terminal.openedterminal.outputterminal.exitedterminal.error
Implementation notes:
- The agent opens a PTY-backed interactive shell rather than reusing the non-interactive task executor
- Shell resolution tries
$SHELL,/bin/bash,/bin/zsh, then/bin/sh - Unix PTY startup falls back across multiple modes:
pty+cttypty-no-cttypty-minimal
- The terminal session environment sets
TERM=xterm-256colorandPAGER=cat - Output is chunked and flushed on a timer so the web console receives live updates without waiting for more keystrokes
- On constrained hosts, fallback PTY modes may log reduced job-control capability while remaining usable
The agent executes shell.exec tasks in a controlled non-interactive environment:
PAGER=catCOLUMNS=100000- graceful cancellation with log drain timeout
- scheduled tasks use the same execution path as manually queued tasks
For package listing on Debian/Ubuntu, the agent uses optimized dpkg -l parsing to return structured package metadata.
cmd/agent: application entrypoint and CLI dispatchinternal/agent: enrollment, identity persistence, bootstrapinternal/agentctl: install, service management, config CLIinternal/api: HTTP client and API modelsinternal/tasks: HTTP claim loop and task executioninternal/metrics: metrics workerinternal/realtime: Socket.IO client and handlersinternal/system: host and system information helpersscripts: installation entrypoints
Run tests:
go test ./...Build locally:
go build -o noderax-agent ./cmd/agentRun in foreground:
cp config.example.json config.json
./noderax-agent enroll
./noderax-agent-
Linux installation assumes
systemd. -
The managed service config path can be overridden with
NODERAX_CONFIG_FILE. -
API-side realtime task push is not the default control path; HTTP claiming should be considered the normal operating mode.
-
Interactive terminals are the main exception: they depend on the agent realtime socket being healthy.
-
When a node is put into maintenance mode from the control plane, the API stops assigning new work to that node while in-flight tasks are allowed to finish.
