Files
leleka/deploy/README.md
T

10 KiB
Raw Blame History

Deployment

Linux CI builds a statically linked musl CLI/control-plane preview and publishes it as a prerelease artifact on version tags. This is not yet a complete GPU runtime: the C++/CUDA engine is not linked into that executable. The host must have a compatible NVIDIA driver already installed (CUDA 13.0 GA baseline: 580.65.06 or newer). The strata-next doctor command checks the installed version. Model weights belong on an external volume. A complete GPU deployment image has not been built yet.

For a local static CLI image smoke test, build deploy/Dockerfile.static-cli with a Linux/musl target. The final image is scratch plus the CLI binary. It is a packaging test, not the deployment image for inference.

Worker recovery

The Rust supervisor defaults to three lifetime restarts after a post-READY worker failure, with 2/4/8-second backoff. Configure engine.max_restarts or STRATA_MAX_WORKER_RESTARTS from 0 to 3; zero disables recovery. Failed and queued generations are not replayed. Readiness stays false until the new worker handshake completes. A startup failure or an exhausted budget leaves the service unhealthy for inference until an operator restarts it; /health remains available. See the API contract.

Native Linux service lifecycle

strata-next service-unit renders a systemd user unit to stdout. It does not install, start, enable or replace a service. Provision the native executable, engine, tokenizer and private JSON configuration first; all supplied paths must be absolute and exist. Systemd disallows quotes and backslashes in the executable path; the renderer rejects these with a relocation instruction. For example, on the Linux host:

umask 077
mkdir -p "$HOME/.config/systemd/user"
/absolute/path/strata-next service-unit \
  --config /absolute/path/config.json \
  --working-dir /absolute/path/engine-workdir \
  --env-file /absolute/path/runtime.env > "$HOME/strata-next.service"
systemd-analyze --user verify "$HOME/strata-next.service"
# Review the generated unit before installing. Do not overwrite a live unit.
systemctl --user link "$HOME/strata-next.service"
systemctl --user start strata-next.service
systemctl --user status strata-next.service
journalctl --user -u strata-next.service -n 100

Omit --env-file if unnecessary. The file uses systemd EnvironmentFile syntax, not shell commands; it can set LD_LIBRARY_PATH and engine tuning variables. Its path cannot contain glob characters (*, ?, [), backslashes or trailing whitespace, because systemd interprets that directive as a filename pattern. serve --config FILE selects the explicit config even if STRATA_CONFIG is also set; other documented environment overrides still apply. Keep the API bound to loopback and use SSH forwarding; optional bearer authentication does not provide transport encryption. Set STRATA_API_KEY_FILE to a private key file to enable the native auth gate.

Systemd process startup is not model readiness: check the configured /ready endpoint before connecting the console harness. Restart=no preserves the supervisor's finite worker restart policy. SIGTERM goes to the supervisor; remaining processes in its cgroup are killed after the 45-second stop deadline. No model or logs are copied into a release by rendering the unit. Journald retention is managed by the host; model and capture paths should remain private.

To stop and remove an explicitly installed service:

systemctl --user stop strata-next.service
systemctl --user disable strata-next.service
systemctl --user daemon-reload

The service is not enabled at login/boot by these instructions. A running user manager is required. The existing trial endpoint remains externally launched; these instructions do not migrate it. Use the existing connect strata-native command once a provisioned service is ready.

Console controller

Install the opt-in controller commands on the laptop after the native Responses launcher integration (the installer preserves the selected connection):

python3 scripts/install-qwen-native.py
python3 scripts/install-qwen-native-service.py
qwen-codex-ctl native-service status --host rnr5090 --unit strata-next.service
qwen-codex-ctl native-service start --host rnr5090 --unit strata-next.service
qwen-codex-ctl native-service logs --host rnr5090 --unit strata-next.service
qwen-codex-ctl native-service stop --host rnr5090 --unit strata-next.service

These operate on an already provisioned systemd user unit through SSH; they never install, enable, migrate or switch a model. The host defaults to the launcher's configured SSH alias, and the unit to strata-next.service. Optional unit names must follow strata-next-NAME.service. Start/stop are idempotent; SSH calls time out after 90 seconds. Logs show the selected unit's last 100 entries. No service credentials are copied or stored by this helper.

The JSON status describes the process; model_readiness: not_checked is explicit. Model initialization can continue after process startup. The separate qwen-codex-ctl connect strata-native --url http://127.0.0.1:18084 --no-auth checks inference readiness through the existing SSH tunnel before switching the console connection. Tunnel setup remains separate. The existing plain start/stop commands retain their previous behavior; use native-service explicitly for a managed native unit. The currently running external trial has no such unit, so these commands safely report it as not provisioned.

Native API commands in the console controller

Install the API helper after the native launcher integration:

python3 scripts/install-qwen-native-api.py
qwen-codex-ctl native-api status
qwen-codex-ctl native-api metrics
qwen-codex-ctl native-api lifecycle
qwen-codex-ctl native-api drain --wait 60
# Explicitly reopen admission when maintenance is abandoned or complete:
qwen-codex-ctl native-api resume

These use the selected strata-native connection and its private key file. An explicit URL requires an explicit authentication choice and does not change the selected connection:

qwen-codex-ctl native-api status --url http://127.0.0.1:18084 --no-auth
qwen-codex-ctl native-api metrics --url http://127.0.0.1:18084 --key-file /private/path/api.key

The helper verifies native /status identity before any admission mutation. It uses direct loopback HTTP, ignoring proxy environment variables, refuses redirects, and bounds each JSON response to 64 KiB. Socket operations time out after eight seconds; this is not a hard total deadline for a server that keeps sending partial bytes. Credentials are never command-line token arguments.

drain --wait SECONDS polls lifecycle for up to the requested interval (0–3600 seconds, subject to in-flight HTTP I/O). Without a positive wait it returns the initial snapshot. Timeout, interruption or a concurrent resume produces an error; the client never automatically stops or resumes the runtime. Inspect lifecycle after any uncertain mutation result. Serialize operator actions. No service, SSH tunnel or model is created or switched by these commands.

The retained GPU trial supports native-api status; metrics and admission controls require the newer feature preview and return HTTP 404 on that older trial. The helper does not upgrade a runtime automatically. Client Python is part of the existing laptop harness; native production serving remains Rust.

Verification without GPU inference:

python3 scripts/smoke-service-unit.py /absolute/path/strata-next --lifecycle

This creates and removes an isolated CPU-only service on an unused loopback port. It checks real systemd path parsing (spaces, quotes, backslashes, $ and %), config precedence, environment loading, health, false readiness without a worker and process removal. Without --lifecycle, only unit syntax and rejected path checks run, as wired into Linux CI. Hosted CI execution remains pending.

Drain before maintenance

The feature preview exposes process-local admission controls (protected by the configured API key, if enabled):

curl -fsS -X POST http://127.0.0.1:18082/admin/drain
curl -fsS http://127.0.0.1:18082/admin/lifecycle
# Wait for drained: true, then perform an intentional stop using your service manager.
# To abandon maintenance and accept new work again:
curl -fsS -X POST http://127.0.0.1:18082/admin/resume

Use the configured endpoint port and bearer header when enabled. These calls only change admission; they do not stop, restart, migrate or switch the engine. They are not installed on the preserved GPU user trial yet.

Drain is idempotent. It rejects new Responses admissions with HTTP 503 runtime_draining and makes /ready return 503 (/status.ready is false). Previously admitted JSON/SSE requests, including requests waiting for the command queue, continue normally. Health, metrics and admin endpoints remain available. Resume is idempotent and restores admission, subject to ordinary worker readiness.

GET /admin/lifecycle reports draining, requests_in_flight, generation_jobs, worker and drained. Request tracking starts before body parsing and lasts until the response body is consumed or dropped. Generation tracking includes queue waits, queued commands, execution and worker protocol cleanup. Client disconnect does not declare a generation drained while STOP is still being processed. Frames and trailers pass through unchanged.

drained: true requires drain mode, zero tracked requests and commands, no active generation, and a ready or unconfigured worker. Startup, restart, stopping or failed worker states report false. A stalled client or worker can hold drain indefinitely; the existing STOP timeout and finite restart policy still apply. No deadline triggers a forced stop. Investigate a stuck drain or explicitly choose to stop, accepting interruption, using the service manager.

Serialize maintenance operations: another operator can resume admission after a status snapshot. The state is not a deployment lock or evidence that a client received/processed all bytes. It resets to accepting after a control-plane restart. CPU protocol tests cover the controls; managed GPU maintenance and long-running user workloads require separate qualification.