Skip to content

Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.

C++

docker: keep a config link that points into /data/config, add CONFIG, print the config used (#1244)

Niko1221560030599887
diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh
index 64d096b02..2950a2571 100755
--- a/docker-entrypoint.sh
+++ b/docker-entrypoint.sh
@@ -22,6 +22,7 @@ LOW_RAM="${LOW_RAM:-auto}" # on: the experts come from the pack's experts.b
GGUF_DIR="${GGUF_DIR:-}" # a mounted folder with GGUF files you already have: no download
RESIDENT_BUDGET_GIB="${RESIDENT_BUDGET_GIB:-}" # UD-Q4_K_XL: GiB of experts kept in RAM (default: setup's pick)
KV_STREAMING="${KV_STREAMING:-}" # auto | on | off; empty: setup.py's own default (auto)
+CONFIG="${CONFIG:-}" # a config file to start with (wins over MODEL's /data/config/strata-<model>.json)
# setup.py starts the newest strata-*.json it finds, so link in exactly the one
# this family and model were set up with. The config is the recorded output of
@@ -40,7 +41,23 @@ mkdir -p "$STRATA_DATA/config"
# setup.py's own default. LOW_RAM is always passed: setup.py measures the PC's RAM
# from /proc/meminfo, which in a container is the host's total, not the container's
# limit, so a memory-capped container has to ask for the low-RAM mode itself.
-if [ "${REINSTALL:-0}" = "1" ] || [ ! -f "$cfg" ]; then
+#
+# Which config the server starts with (#1244): CONFIG when set; else a link in /opt/strata that already points
+# into $STRATA_DATA/config/ (a pod command that picked one by linking); else MODEL's strata-<model>.json.
+link="/opt/strata/strata-$tag.json"
+keep=""
+if [ -n "$CONFIG" ]; then
+ [ -f "$CONFIG" ] || { echo "CONFIG=$CONFIG does not exist." >&2; exit 1; }
+elif [ "${REINSTALL:-0}" != "1" ] && [ -L "$link" ] && [ -f "$link" ]; then
+ case "$(readlink "$link")" in "$STRATA_DATA"/config/*) keep=1 ;; esac
+fi
+
+if [ -n "$CONFIG" ]; then
+ ln -sfn "$CONFIG" "$link"
+ echo "Config: $CONFIG (from CONFIG)"
+elif [ -n "$keep" ]; then
+ echo "Config: $(readlink "$link") (existing link kept)"
+elif [ "${REINSTALL:-0}" = "1" ] || [ ! -f "$cfg" ]; then
if [ -n "$GGUF_DIR" ]; then
echo "Setting up $tag from the GGUF files in $GGUF_DIR (the engine is already in the image)."
else
@@ -58,10 +75,12 @@ if [ "${REINSTALL:-0}" = "1" ] || [ ! -f "$cfg" ]; then
if [ -n "$KV_STREAMING" ]; then set -- "$@" --kv-streaming "$KV_STREAMING"; fi
.venv/bin/python setup.py --setup --yes "$@"
[ -e "/opt/strata/strata-$tag.json" ] && { cmp -s "/opt/strata/strata-$tag.json" "$cfg" || cp -f "/opt/strata/strata-$tag.json" "$cfg"; }
+ echo "Config: $cfg (from MODEL $MODEL, just set up)"
else
# #1244: the copy on the volume is the one that counts, so a regular file left in /opt/strata by an earlier setup
# (or by an image built with one) must not stand in for it: edits to /data/config would be ignored
ln -sfn "$cfg" "/opt/strata/strata-$tag.json"
+ echo "Config: $cfg (from MODEL $MODEL)"
fi
# Later starts skip straight here: setup.py finds the installed config and
diff --git a/docs/INSTALL.md b/docs/INSTALL.md
index d31e1c4f9..ca16e3c1e 100644
--- a/docs/INSTALL.md
+++ b/docs/INSTALL.md
@@ -109,6 +109,12 @@ The same idea, in a container (NVIDIA cards).
volume needs no setup pass: `-e MODEL=Q2_0 -e FAMILY=coder` picks that model's config. Add
`-e REINSTALL=1` only to change settings for a model already set up (context, vision, KV, host,
api_key, LOW_RAM), since those are recorded in its config.
+ `MODEL` (with `FAMILY`) selects `/data/config/strata-<model>.json` (the model name in lowercase), so
+ `-e MODEL=IQ3_S.1X4-BATCH9` starts `/data/config/strata-iq3_s.1x4-batch9.json`: that is the way to keep
+ several configs of one model on one volume. `-e CONFIG=/data/config/my.json` overrides it with any
+ config file. A link `/opt/strata/strata-<model>.json` that already points into `/data/config/` (made by
+ a pod command before the entrypoint runs) is kept. The entrypoint prints one `Config:` line naming the
+ file the server starts with.
Strata loads 32-62 GB into RAM. `--gpus all` on a host with two usable cards takes both: the
layer split is setup's recommended default ([MULTI_GPU.md](MULTI_GPU.md)), and a volume
set up for one card switches to the pair on its first start there. Pin one card with `-e GPU=0`,
diff --git a/tools/test_docker_entrypoint.py b/tools/test_docker_entrypoint.py
index 3e185a6a8..4953265ba 100644
--- a/tools/test_docker_entrypoint.py
+++ b/tools/test_docker_entrypoint.py
@@ -36,8 +36,8 @@ class Entrypoint(unittest.TestCase):
self.script = self.tmp / "entry.sh"
self.script.write_text(script, encoding="utf-8")
- def run_entry(self, reinstall):
- env = dict(os.environ, STRATA_DATA=str(self.data), MODEL="IQ3_S", REINSTALL=reinstall)
+ def run_entry(self, reinstall, **extra):
+ env = dict(os.environ, STRATA_DATA=str(self.data), MODEL="IQ3_S", REINSTALL=reinstall, **extra)
r = subprocess.run([SH, str(self.script)], env=env, capture_output=True, text=True, timeout=60)
self.assertEqual(r.returncode, 0, r.stderr)
return r.stdout
@@ -62,6 +62,39 @@ class Entrypoint(unittest.TestCase):
cfg.write_text('{"args": ["edited-later"]}\n')
self.assertIn("edited-later", self.run_entry("0")) # the regular file setup left is replaced by the link
+ def test_existing_link_into_the_data_config_dir_is_kept(self): # a pod command that picked a config by linking
+ (self.data / "config" / "strata-iq3_s.json").write_text('{"args": ["plain"]}\n')
+ other = self.data / "config" / "strata-iq3_s.1x4.json"
+ other.write_text('{"args": ["batch8"]}\n')
+ os.symlink(other, self.opt / "strata-iq3_s.json")
+ out = self.run_entry("0")
+ self.assertIn("batch8", out)
+ self.assertNotIn("plain", out)
+ self.assertIn(f"Config: {other}", out)
+
+ def test_link_to_somewhere_else_is_replaced(self):
+ (self.data / "config" / "strata-iq3_s.json").write_text('{"args": ["on-volume"]}\n')
+ elsewhere = self.tmp / "elsewhere.json"
+ elsewhere.write_text('{"args": ["elsewhere"]}\n')
+ os.symlink(elsewhere, self.opt / "strata-iq3_s.json")
+ self.assertIn("on-volume", self.run_entry("0"))
+
+ def test_config_env_wins(self):
+ (self.data / "config" / "strata-iq3_s.json").write_text('{"args": ["plain"]}\n')
+ other = self.tmp / "mine.json"
+ other.write_text('{"args": ["mine"]}\n')
+ os.symlink(self.data / "config" / "strata-iq3_s.json", self.opt / "strata-iq3_s.json")
+ out = self.run_entry("0", CONFIG=str(other))
+ self.assertIn("mine", out)
+ self.assertNotIn("plain", out)
+ self.assertIn(f"Config: {other}", out)
+
+ def test_model_names_the_config_and_it_is_printed(self):
+ (self.data / "config" / "strata-iq3_s.json").write_text('{"args": ["by-model"]}\n')
+ out = self.run_entry("0")
+ self.assertIn("by-model", out)
+ self.assertIn(f"Config: {self.data}/config/strata-iq3_s.json", out)
+
if __name__ == "__main__":
unittest.main()