598 lines
32 KiB
Markdown
598 lines
32 KiB
Markdown
# 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
|
||
|
||
Configure top-level JSON `max_in_flight_requests` or environment
|
||
`STRATA_MAX_IN_FLIGHT_REQUESTS` to bound admitted HTTP inference requests
|
||
(1–256; default 17). Environment overrides the file. At capacity, new Responses
|
||
POSTs receive 429 `runtime_overloaded` and `Retry-After: 1` before parsing;
|
||
drain still returns 503. This covers queued requests and streaming bodies,
|
||
not GPU concurrency. `/admin/lifecycle` exposes the limit and available request
|
||
slots; `check-config` validates and reports the limit. See
|
||
[admission lifecycle](../docs/api-contract.md#admission-lifecycle) for scope.
|
||
|
||
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](../docs/api-contract.md).
|
||
|
||
An optional `engine.generation_timeout_s` (or `STRATA_GENERATION_TIMEOUT_S`)
|
||
sets an absolute active-command deadline, 1–86400 seconds. It is **disabled
|
||
when omitted**. Select a budget that accommodates the model's longest prefill
|
||
and output. The clock starts when the worker takes the command; HTTP parsing,
|
||
tokenization and queue wait are excluded. Engine stdin writes, reading tokens
|
||
and waiting on the streaming channel are included. Native `check-config`
|
||
reports this value, or null when disabled/unconfigured.
|
||
|
||
On expiry the supervisor revokes readiness and kills/reaps that worker rather
|
||
than attempting to reuse its unfinished protocol stream. The failed command
|
||
and queued work are never replayed. The existing finite restart budget applies;
|
||
model loading and caches must be rebuilt after restart. With zero restarts the
|
||
worker remains failed. Connected clients receive the terminal failure described
|
||
in [the API contract](../docs/api-contract.md#active-generation-deadline).
|
||
|
||
## 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:
|
||
|
||
```sh
|
||
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](../docs/api-contract.md#optional-bearer-authentication).
|
||
|
||
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:
|
||
|
||
```sh
|
||
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):
|
||
|
||
```sh
|
||
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:
|
||
|
||
```sh
|
||
python3 scripts/install-qwen-native-api.py
|
||
qwen-codex-ctl native-api status
|
||
qwen-codex-ctl native-api wait-ready --wait 60
|
||
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:
|
||
|
||
```sh
|
||
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.
|
||
|
||
`wait-ready --wait SECONDS` waits for native model readiness using read-only
|
||
`GET /status` calls, including when the process is still loading its model or
|
||
recovering its worker. It retries connection failures and polls every 250 ms.
|
||
The positive wait budget (up to 3600 seconds) starts before the first request;
|
||
each socket timeout is capped by the remaining budget and eight seconds.
|
||
As with the other commands, this is not a hard total deadline against a server
|
||
that keeps sending partial bytes. A response arriving after the budget does not
|
||
count as success. With no positive wait, it performs one check and fails if
|
||
the model is not ready.
|
||
|
||
Authentication/HTTP/JSON errors, wrong endpoint identity, inconsistent status,
|
||
and failed/stopping/unconfigured workers fail immediately. The command never
|
||
starts a service, sends inference, restarts a failed worker or changes the
|
||
selected connection. Ready means available at that instant; it does not mean
|
||
idle, model quality verified, or sustained stability.
|
||
|
||
The retained GPU trial supports `native-api status` and `native-api wait-ready`; 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:
|
||
|
||
```sh
|
||
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):
|
||
|
||
```sh
|
||
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.
|
||
|
||
Optional signal grace: set top-level `shutdown_grace_s` in the native JSON config
|
||
or `STRATA_SHUTDOWN_GRACE_S` in its environment (integer 0–20 seconds, default 0).
|
||
`strata-next check-config` reports the effective setting. A positive value lets
|
||
admitted requests finish after SIGTERM/SIGINT, until the grace expires. During
|
||
that interval lifecycle reports `shutting_down: true`, readiness is false, new
|
||
inference is rejected, and resume cannot reopen admission. Worker shutdown
|
||
starts when admitted HTTP/worker activity clears or the grace expires.
|
||
|
||
The rendered unit's 45-second stop budget still applies. Grace is only the
|
||
initial drain phase; worker and HTTP cleanup follow it. Use the explicit drain
|
||
procedure above for longer maintenance windows. Existing deployments keep
|
||
immediate interruption until this setting and a supporting binary are installed.
|
||
|
||
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.
|
||
|
||
## Optional embedded engine preview
|
||
|
||
A private build can carry a pinned Linux engine executable inside `strata-next`:
|
||
|
||
```sh
|
||
export STRATA_EMBED_ENGINE_PATH=/absolute/path/to/verified/strata
|
||
export STRATA_EMBED_ENGINE_SHA256=THE_64_HEX_DIGIT_ENGINE_SHA256
|
||
export STRATA_EMBED_ENGINE_REVISION=THE_FULL_40_HEX_DIGIT_SOURCE_COMMIT
|
||
cargo build --manifest-path control-plane/Cargo.toml --locked --release \
|
||
--target x86_64-unknown-linux-musl
|
||
```
|
||
|
||
Use an actual engine digest and its declared source revision. The build requires
|
||
all three variables together, verifies the digest, limits the payload to 1 GiB with a 64 KiB copy/hash buffer
|
||
and checks an ELF64 little-endian executable header matching the target CPU.
|
||
This is not a complete ELF dependency audit or proof that the declared revision
|
||
produced that binary; retain the build/provenance record alongside the digest.
|
||
Normal builds without these variables remain control-plane-only builds. The
|
||
copy/hash stage uses a fixed buffer; Rust compilation/linking still process the
|
||
full payload and require memory and disk space proportional to its size.
|
||
|
||
`strata-next engine-info` reports payload identity without executing it.
|
||
`strata-next engine-help` materializes the embedded worker and runs its `--help`
|
||
with no GPU visible; this checks loading and help output, not model readiness.
|
||
`strata-next --engine-license` prints the imported Strata MIT license. The
|
||
upstream record in `docs/upstream.md` remains authoritative and unchanged.
|
||
Select the embedded worker explicitly in the usual configuration:
|
||
|
||
```json
|
||
{
|
||
"bind": "127.0.0.1:18082",
|
||
"model": "your-model-id",
|
||
"engine": {
|
||
"executable": "@embedded",
|
||
"args": ["--pack", "/absolute/path/to/pack"],
|
||
"tokenizer_dir": "/absolute/path/to/tokenizer"
|
||
}
|
||
}
|
||
```
|
||
|
||
Keep the actual engine arguments from the qualified model profile. An external
|
||
executable path continues to work even in a payload build. Missing payload or
|
||
unsupported platforms fail before the HTTP listener opens when `@embedded` is
|
||
selected. The Linux supervisor copies the embedded bytes into an anonymous
|
||
executable `memfd`, seals content and size changes, and retains its descriptor
|
||
through worker restarts. The descriptor is released after worker shutdown;
|
||
there is no persistent extraction directory. This consumes RAM proportional to
|
||
engine size in addition to the executable's mapped pages. `/proc` access and
|
||
an OS policy allowing executable memfds are required; the runtime does not
|
||
change kernel policy. See the [Linux memfd documentation](https://man7.org/linux/man-pages/man2/memfd_create.2.html)
|
||
and [executable memfd policy](https://docs.kernel.org/userspace-api/mfd_noexec.html).
|
||
|
||
**One packaged executable does not yet mean a fully static GPU runtime.** The
|
||
current qualified engine still needs host `libcudart.so.13`, `libcublas.so.13`,
|
||
C++/C runtime libraries and the NVIDIA driver. These are not embedded, and the
|
||
engine's existing library search paths remain unchanged. Model/tokenizer assets
|
||
also remain external. Do not deploy this preview to a clean host assuming a
|
||
driver alone suffices, or replace a running user trial to test packaging.
|
||
The synthetic CPU packaging check exercises supervisor behavior without GPU
|
||
qualification. A production single-file package still needs library/linking,
|
||
clean-node, real-model and license/distribution gates.
|
||
|
||
## Validate configuration before switching a service
|
||
|
||
```sh
|
||
strata-next check-config --config /absolute/path/to/native.json
|
||
```
|
||
|
||
This native command reads the same configuration, environment overrides, key file
|
||
and tokenizer assets as `serve`. It checks that an external engine resolves to
|
||
an accessible executable file (including `PATH` lookup), or that the selected
|
||
embedded engine is present in a Linux build. Bare executable names require `PATH`;
|
||
an explicit executable path avoids lookup ambiguity. Run it with the same user,
|
||
working directory and environment as the intended service.
|
||
|
||
The existing laptop controller can run this check over SSH after installing its
|
||
updated helper:
|
||
|
||
```sh
|
||
python3 scripts/install-qwen-native-service.py
|
||
qwen-codex-ctl native-service check-config --host rnr5090 \
|
||
--binary /absolute/path/to/candidate/strata-next \
|
||
--config /absolute/path/to/native.json \
|
||
--working-dir /absolute/path/to/engine-workdir
|
||
```
|
||
|
||
All three paths refer to the remote host. This uses the SSH login environment;
|
||
it does not source a systemd environment file, upload files, install a unit or
|
||
change the selected connection. The candidate must already support `check-config`.
|
||
The client filters the returned JSON and suppresses raw remote errors. SSH stdout
|
||
is capped at 64 KiB with a 30-second local deadline; on failure the local SSH
|
||
process is terminated, which is not a guarantee that a remote process has exited.
|
||
Only invoke an explicitly chosen, trusted candidate executable.
|
||
|
||
Success prints JSON with `configuration_valid`, `engine`, `tokenizer_validated`,
|
||
`authentication_enabled` and `inference_configured`. The last field means both
|
||
engine and tokenizer are configured. A control-plane-only config can also pass.
|
||
Keys, engine arguments and raw file contents are not printed; failures identify
|
||
the config/key, executable or tokenizer stage and return nonzero.
|
||
|
||
The check does not execute the worker, extract the embedded payload, bind the
|
||
configured port, contact a running server or inspect model weights. Files and
|
||
permissions may change after it runs. `readiness_checked` is always false:
|
||
shared libraries, driver compatibility, model loading, available ports and real
|
||
generation still require deployment qualification. An already occupied port is
|
||
allowed so the candidate can be checked while the current service keeps running.
|
||
|
||
## Linux engine with static CUDA toolkit libraries
|
||
|
||
`STRATA_CUDA_STATIC=ON` is an optional Linux/GNU C++ build profile. It selects
|
||
CMake's static CUDA runtime and cuBLAS targets and statically links the engine's
|
||
GNU C++ runtime. The default CUDA profile continues to use shared toolkit
|
||
libraries. HIP and non-Linux/GNU configurations reject this option.
|
||
|
||
On a Linux builder with the toolkit and CMake already installed:
|
||
|
||
```sh
|
||
export CUDACXX=/absolute/path/to/cuda/bin/nvcc
|
||
export CUDAToolkit_ROOT=/absolute/path/to/cuda
|
||
# Optional existing pinned llama.cpp checkout; otherwise CMake fetches its pinned source:
|
||
export STRATA_GGML_DIR=/absolute/path/to/llama.cpp
|
||
BUILD_JOBS=2 scripts/build-static-cuda.sh
|
||
```
|
||
|
||
The script builds only `strata`, using SM 120 and portable AVX2 GGML defaults;
|
||
`CUDA_ARCHITECTURES` and `STRATA_BUILD_DIR` can override the build target/path.
|
||
It audits ELF dependencies and runs only `--help` with no GPU visible. It does
|
||
not install anything, serve a model, change a service, or run a speed test.
|
||
CMake's imported targets provide the static dependency closure; see the
|
||
[FindCUDAToolkit reference](https://cmake.org/cmake/help/latest/module/FindCUDAToolkit.html).
|
||
|
||
The measured CUDA 13.2 build has only `libm.so.6`, `libc.so.6` and the host loader
|
||
in DT_NEEDED, with no RPATH/RUNPATH. It is **593,942,184 bytes**. This host's GNU
|
||
build requires **glibc 2.43**; build against an older supported glibc baseline
|
||
before targeting older distributions. The audit reports this symbol-version
|
||
minimum. NVIDIA's installed driver remains required. ELF direct dependencies
|
||
do not establish whether runtime-selected CUDA paths use additional `dlopen`
|
||
components; real-model and clean-host qualification are still necessary.
|
||
|
||
This private candidate has not replaced the user's running engine. The bounded
|
||
large-payload path can now include it in one executable under the 1 GiB cap.
|
||
The combined static-CUDA preview is **611,277,088 bytes**. On Linux it passed
|
||
embedded identity verification and `engine-help` with `LD_LIBRARY_PATH` unset
|
||
and no GPU visible. The outer musl executable has no ELF interpreter or
|
||
DT_NEEDED entries; the embedded engine retains the glibc/driver requirements
|
||
above. The earlier 63 MB combined preview remains a separate fallback containing
|
||
the dynamic engine. See the [packaging report](../docs/experiments/2026-10-04-large-embedded-package.md).
|
||
No quality, numerical parity, speedup or production-ready claim follows from
|
||
linking successfully. Keep the default profile until the model gates pass.
|
||
|
||
The optional `static_cuda_package` workflow-dispatch job performs the build and
|
||
ELF audit on the private CUDA runner without inference. It publishes no package
|
||
and cleans its private build directory. The runner must have the required
|
||
compiler/toolkit in its environment; hosted execution has not yet occurred.
|
||
|
||
## Fetch pinned assets as part of native startup
|
||
|
||
`serve --config /absolute/runtime.json` can now acquire prebuilt model-pack and
|
||
Qwen tokenizer files before it opens its HTTP listener or starts the worker.
|
||
Declare an optional `assets` array alongside the existing engine configuration:
|
||
|
||
```json
|
||
{
|
||
"assets": [
|
||
{
|
||
"manifest": "/home/user/strata/pack-v1.manifest.json",
|
||
"directory": "/home/user/strata/assets/pack-v1"
|
||
},
|
||
{
|
||
"manifest": "/home/user/strata/tokenizer-v1.manifest.json",
|
||
"directory": "/home/user/strata/assets/tokenizer-v1"
|
||
}
|
||
],
|
||
"engine": {
|
||
"executable": "@embedded",
|
||
"args": ["--pack", "/home/user/strata/assets/pack-v1"],
|
||
"tokenizer_dir": "/home/user/strata/assets/tokenizer-v1"
|
||
}
|
||
}
|
||
```
|
||
|
||
Each local manifest uses the same schema as `model fetch`: `schema_version: 1`
|
||
and a nonempty `files` array with `name`, HTTPS `url`, positive `size` and
|
||
`sha256` for each file. Names are flat, unique filenames. Use manifests for
|
||
artifacts already prepared for the chosen worker; fetching GGUF shards alone
|
||
is not a Strata pack conversion. Models and private manifests stay outside Git.
|
||
The example requires a Linux executable built with an embedded engine.
|
||
|
||
To acquire/verify the assets separately without starting the service:
|
||
|
||
```sh
|
||
strata-next provision --config /absolute/runtime.json
|
||
```
|
||
|
||
Paths must be absolute, without `..`; bundle destinations cannot overlap.
|
||
All manifests are parsed before acquisition. Each bundle is downloaded into a
|
||
private sibling `.NAME.strata-stage`, verified in full, and then published by
|
||
a directory rename. Existing bundles are verified even when offline; a digest
|
||
mismatch fails without overwriting them. Use a new versioned destination for
|
||
upgrades, and retain the previous config/destination for rollback. No global
|
||
current-model pointer or running service is changed by provisioning.
|
||
|
||
A per-destination `.NAME.strata-lock` coordinates native preparers. A competing
|
||
preparer fails promptly; process death releases the OS lock. The small lock
|
||
file remains to avoid an inode race. Failed/interrupted stages remain for
|
||
resume; after stopping all preparers they may be removed to discard incomplete
|
||
downloads. Extra files from a different manifest fail verification. Atomicity
|
||
is per bundle: if a later bundle fails, earlier verified bundles remain, but
|
||
`serve` never launches the worker. Use user-owned local storage for locks and
|
||
staging. This is not a defense against another process with the same user's
|
||
write access altering files after verification.
|
||
|
||
`check-config` stays read-only and reports the bundle count and
|
||
`assets_verified: false`; it does not download or hash model files. It still
|
||
requires configured tokenizer assets to exist. Run `provision` first when
|
||
using that preflight on a fresh installation.
|
||
|
||
This implements acquisition of prepared assets, not automatic GGUF-to-pack
|
||
conversion or full KAR model preparation. The complete-package Linux/GPU
|
||
clean-node acceptance gate remains separate. The CPU smoke uses synthetic
|
||
pack bytes and tokenizer files; it proves publication and startup ordering,
|
||
not model inference or performance.
|
||
|
||
## Prepare a native serving pack from GGUF
|
||
|
||
The native CLI can now build a Qwen `qwen4exp` serving pack from locally present,
|
||
manifest-pinned GGUF shards:
|
||
|
||
```sh
|
||
strata-next model prepare-native-pack /absolute/shards.json \
|
||
--source-dir /absolute/models --output /absolute/packs/model-v1
|
||
```
|
||
|
||
The command verifies source sizes and SHA-256, split shard identity/counts,
|
||
unique tensors, expert router counts and gate/up/down geometry. It emits
|
||
`dense.bin`, `index.txt`, `native_experts.txt`, `conversions.json`,
|
||
`source.json` and `tokenizer/` through a private staging directory, then renames
|
||
the completed directory into place. Existing output is refused; retain the
|
||
old version and configuration for rollback. Failed ordinary preparation
|
||
removes its own stage; after a killed process an unused
|
||
`.NAME.native-pack-PID.tmp` may be removed before retrying. No existing pack is
|
||
replaced and no worker is started.
|
||
|
||
Use the result with the existing engine's `--native FIRST_SHARD.gguf` option
|
||
and `--pack` output directory, plus the pack's `tokenizer/` for native Responses.
|
||
The quantized expert weights, native dense projections and large PLE table
|
||
remain in the original GGUF shards: **retain those shards**. This command does
|
||
not create `experts.bin`, add KAR compression or reduce the model's quantization.
|
||
Source shard filenames must form the engine's usual split-file family.
|
||
|
||
Preparation currently accepts matching float types, exact F32-to-BF16,
|
||
F16/BF16-to-F32 widening, and exact F32-to-F16 through the loader's index kind3.
|
||
It rejects conversions that would round weights; there is no `--compat-bf16`
|
||
option. Unsupported architectures, missing expert roles, incompatible shapes,
|
||
quantized projections requiring conversion, and non-finite converted values
|
||
fail without publishing a pack. `conversions.json` records the exact changes
|
||
and source tensor hashes; `source.json` records the verified shard identities.
|
||
|
||
`scripts/smoke-native-pack.py` compares dense bytes, index rows and the complete
|
||
v3/v4 expert table against the unmodified pinned `tools/iq_pack.py` oracle on
|
||
small single/split GGUF fixtures, including per-role shard offsets. Numerical
|
||
and byte tolerance is zero. Python/numpy are test-only dependencies. This does
|
||
not establish full-model GPU readiness: real-model pack parity and clean-node
|
||
GPU startup still require their separate gates. Automatic fetch/prepare/start
|
||
orchestration remains a subsequent integration step.
|
||
|
||
## Fetch, prepare and serve a native GGUF model
|
||
|
||
An optional `native_model` section connects source acquisition and exact pack
|
||
preparation to `provision --config` and `serve --config`:
|
||
|
||
```json
|
||
{
|
||
"bind": "127.0.0.1:8081",
|
||
"model": "qwen-flash-native",
|
||
"gpu_requirement": "cuda-13.0-linux",
|
||
"native_model": {
|
||
"manifest": "/srv/strata/manifests/source-v1.json",
|
||
"source_dir": "/srv/strata/models/source-v1",
|
||
"output": "/srv/strata/models/pack-v1"
|
||
},
|
||
"engine": {
|
||
"executable": "@embedded",
|
||
"args": ["--max-context", "262144"]
|
||
}
|
||
}
|
||
```
|
||
|
||
Use a binary that actually embeds the Linux engine, or an explicit engine path.
|
||
The existing engine still needs a compatible GPU/driver and appropriate memory
|
||
settings. This configuration does not select new hardware or compression policy.
|
||
|
||
Startup obtains and verifies source shards, builds the exact native pack, then
|
||
adds `--pack OUTPUT --native FIRST_SHARD` and selects `OUTPUT/tokenizer` before
|
||
opening HTTP or launching the worker. Do not also supply those engine arguments
|
||
or a tokenizer override. `check-config` remains read-only and reports an absent
|
||
managed tokenizer as pending; it does not claim model integrity or readiness.
|
||
|
||
The pack now includes `receipt.json`, with source identities and SHA-256/size for
|
||
all generated files. Offline reuse verifies both source shards and the complete
|
||
pack, rejecting damaged files, symlinks and unexpected entries. The receipt is an
|
||
integrity record in user-owned storage, not a publisher signature or protection
|
||
against a local actor who can replace both receipt and files. Earlier packs
|
||
without a receipt must be regenerated into a new versioned directory.
|
||
|
||
Use distinct versioned source/output directories when changing models. A failed
|
||
new preparation leaves earlier versions intact; reverting to the earlier config
|
||
reuses that version after verification. This does not hot-switch an already
|
||
running service or automatically restart a previous service after a worker
|
||
startup failure. A per-output OS lock prevents concurrent managed preparation.
|
||
Source GGUF files remain required for native quantized weights and PLE lookup.
|
||
|
||
MTP is a separate pack selected by the engine's `--mtp PATH` option. The native
|
||
preparer does not produce MTP, vision or calibration assets. Acquire any required
|
||
auxiliary pack with a separate pinned `assets` bundle and pass its explicit path;
|
||
keep its directory disjoint from managed sources/output. The baseline can run
|
||
without optional MTP. Full-model and clean-node GPU qualification remain open.
|
||
|
||
`scripts/smoke-native-bootstrap.py` verifies real HTTP acquisition, exact pack
|
||
preparation and offline reuse with a synthetic worker, including corruption,
|
||
locking, conflicting config and previous-version preservation. It is a CPU
|
||
startup-order test, not an inference or model-quality result.
|
||
|
||
### Explicit GPU profile requirement
|
||
|
||
Set top-level `"gpu_requirement": "cuda-13.0-linux"` on CUDA 13.0 Linux
|
||
profiles. `provision` and `serve` check the host before fetching assets,
|
||
preparing a model, materializing an embedded engine, starting a worker, or
|
||
opening the HTTP listener. Unsupported OS, missing/unreadable driver, and a
|
||
version below this profile's conservative **580.65.06** floor fail with an
|
||
actionable error. The floor follows the Linux CUDA 13.0 GA toolkit driver in
|
||
[NVIDIA's release table](https://docs.nvidia.com/cuda/archive/13.0.0/cuda-toolkit-release-notes/index.html).
|
||
This is an explicit deployment policy, not a universal CUDA compatibility limit.
|
||
|
||
The check reads the kernel driver version, falling back to `nvidia-smi` when
|
||
unavailable. That subprocess has a five-second timeout and 8 KiB output limit;
|
||
it is killed and reaped on failure. Versions are compared numerically. No CUDA
|
||
context or inference request is created. `check-config` only reports the
|
||
requirement with `gpu_requirement_checked: false`; it never runs this probe.
|
||
Omitting the requirement preserves CPU/manual worker behavior. A requirement
|
||
without a worker, or an unknown requirement, is rejected.
|
||
|
||
A successful check does **not** qualify GPU architecture, free VRAM, model
|
||
quality, engine shared-library dependencies, MTP support, or a clean-node
|
||
real-model launch. Those remain separate release gates. Keep model/auxiliary
|
||
bundles pinned and use distinct versioned output directories as described above.
|