Universe ships two process-based runtimes out of the box:Documentation Index
Fetch the complete documentation index at: https://mintlify.com/universeclouddev/Universe/llms.txt
Use this file to discover all available pages before exploring further.
screen (GNU Screen) and tmux. Both are implemented directly in the app module — no extension JAR is required. They are ideal for local development, bare-metal nodes, and any environment where you want the lowest possible overhead between Universe and the instance process.
Both runtimes follow the same lifecycle model:
- Start — spawn a new detached session named
universe-<instanceId>and run the instance command inside it. - Execute — pipe a command string to the session’s stdin.
- Stop — terminate the session and clean up cgroup resources.
- Recover — on startup, Universe scans existing sessions to reconcile in-flight instances.
How the Screen Runtime Works
ScreenRuntimeProvider creates one GNU Screen session per instance. The session name is always universe-<instanceId>, which makes it easy to identify and attach to sessions manually.
When start() is called:
- Any stale session with the same name is quit silently first (
screen -S <name> -X quit), ensuring a clean slate. - Universe builds a shell command:
cd <workingDir> && <resourcePrefix><command>and launches it inside a new detached session viascreen -dmS <name> bash -c <shellCommand>. - Environment variables from the instance configuration are injected via
ProcessBuilder.environment(). - If cgroup v2 is available, the session’s PID is moved into a dedicated cgroup for memory and CPU enforcement.
executeCommand() is called, Universe sends the command to the session’s stdin with a trailing newline using screen -S <name> -X stuff "<command>\n".
When stop() is called, Universe issues screen -S <name> -X quit to terminate the session and calls CgroupResourceEnforcer.cleanupCgroup().
Log capture uses screen -X hardcopy <tempfile> to dump the current screen buffer to a temporary file, which is then read and returned.
How the Tmux Runtime Works
TmuxRuntimeProvider follows the same structure but uses tmux primitives. The session name format is identical (universe-<instanceId>).
When start() is called:
- Any stale session is killed first (
tmux kill-session -t <name>). - A new detached session is created via
tmux new-session -d -s <name> -c <workingDir> <command>, which sets the working directory natively without a shell wrapper. - Environment variables and cgroup setup work identically to the screen runtime.
executeCommand() is called, Universe uses tmux send-keys -t <name> <command> Enter to simulate a keypress in the session.
When stop() is called, tmux kill-session -t <name> terminates the session.
Log capture uses tmux capture-pane -p -t <name> -S -<lines> to retrieve the last N lines from the pane’s scrollback buffer.
Configuration
Setruntime to "screen" or "tmux" in any instance configuration file under ./configuration/:
- Screen
- Tmux
ramMB, environmentVariables, templateInstallationConfig, etc.) are respected.
Prerequisites
Install screen or tmux on the node
The corresponding multiplexer must be installed and on
$PATH for the Universe process.Working Directory
Each instance runs from./running/<instanceId>/ on the node’s filesystem. Universe copies the resolved template tree into this directory before handing control to the runtime. For the screen runtime, the shell wrapper uses cd <workingDir> to enter this directory before executing the command. For tmux, the working directory is passed directly via the -c flag to tmux new-session.
Template variable substitution (e.g., %PORT%, %INSTANCE_ID%) is performed on files listed in fileModifications before the runtime starts, so the instance’s configuration files are already patched when the process launches.
executeCommand() Behavior
Both runtimes implementexecuteCommand(instanceId, command) by writing to the session’s stdin — no network socket or RPC is involved:
| Runtime | Mechanism |
|---|---|
screen | screen -S universe-<id> -X stuff "<command>\n" |
tmux | tmux send-keys -t universe-<id> "<command>" Enter |
stop() Behavior
Stopping an instance terminates the entire screen or tmux session:| Runtime | Stop Command |
|---|---|
screen | screen -S universe-<id> -X quit |
tmux | tmux kill-session -t universe-<id> |
Neither the
screen nor the tmux runtime supports streaming logs to the REST API via WebSocket (GET /api/instances/{id}/live-log). The getLogs() implementation captures a snapshot of the current screen buffer, not a continuous stream. Use the Docker or Kubernetes runtime if your workflow depends on live log tailing through the API.