launcher: pass-through coderai server flags via --coderai-arg/--coderai-args

coderai-oci (in-image): append ${CODERAI_EXTRA_ARGS} to the server argv in both
exec paths. supervisord runs a fixed command, so arbitrary server flags arrive
via this env var rather than argv. (Takes effect after an image rebuild.)

run_oci.sh: --coderai-arg ARG (repeatable, one token each) and --coderai-args
"STR" build CODERAI_EXTRA_ARGS and inject it with -e; new cdr-args banner line.
`--` still goes to the container engine, not coderai.

Docs (AI.PROMPT, dist-bundle README.md/.txt) updated accordingly.
Co-Authored-By: 's avatarClaude Opus 4.8 <noreply@anthropic.com>
parent d669c797
......@@ -346,6 +346,12 @@ Run against your LIVE local config + data (no rebuild — pure bind-mounts):
- -p/--port PORT sets the host port; --host ADDR binds the published port to a
specific interface (e.g. 127.0.0.1 localhost-only; default = all interfaces).
CODERAI_HOST stays 0.0.0.0 so the server listens on all interfaces in-container.
- Pass-through coderai server flags: --coderai-arg ARG (repeatable, one token
each) and --coderai-args "STR" build CODERAI_EXTRA_ARGS, which the in-image
coderai launcher (coderai-oci) appends to the server argv. supervisord's
command is fixed, so extra flags ride in via this env var (NOT via `--`, which
goes to the container engine). The launcher change is baked in needs an image
(re)build / update_oci_image.sh to take effect.
- The image launcher reads config from /config/coderai and runs
`coderai --config /config/coderai`, rewriting server.host/port in config.json.
- `--local` (= --config-dir ~/.coderai) copies ONLY the *.json config files to
......
......@@ -57,6 +57,8 @@ Then open <http://127.0.0.1:8776/admin>.
| `--nvidia` / `--vulkan` | GPU backends; **additive** (pass both, or `--all`). `--vulkan` auto-maps the host `libcuda.so.1` (the bundled llama-cpp is a CUDA build); `--with-libcuda[=PATH]` overrides. |
| `-p, --port PORT` | Host port (default `8776`). |
| `--host ADDR` | Bind the published port to a specific interface (e.g. `127.0.0.1` localhost-only; default all interfaces). |
| `--coderai-arg ARG` | Pass one extra flag straight through to the coderai server (repeatable; one token each). |
| `--coderai-args "STR"` | Pass a raw space-separated string of extra coderai flags. |
| `--data-dir PATH` | Where config/models/cache live (default `./coderai-runtime`). |
| `--local` | Run against your existing `~/.coderai` config. |
| `--map HOST[:CONT]` | Bind-mount a host dir at the same path (for absolute model paths in `models.json`), e.g. `--map /AI/guffcache`. |
......
......@@ -49,6 +49,9 @@ Useful options (see --help)
-p, --port PORT Host port (default 8776).
--host ADDR Bind the published port to a specific interface
(e.g. 127.0.0.1 for localhost-only; default all).
--coderai-arg ARG Pass one extra flag straight to the coderai server
(repeatable; one token each).
--coderai-args "STR" Pass a raw space-separated string of extra coderai flags.
--data-dir PATH Where config/models/cache live (default ./coderai-runtime).
--local Run against your existing ~/.coderai config.
--map HOST[:CONT] Bind-mount a host dir at the same path (for absolute
......
......@@ -101,6 +101,11 @@ case " $DEBUG_ARGS " in *" --debug "*) : ;; *[!\ ]*) DEBUG_ARGS="--debug$DEBUG_A
set -- --config "$CONFIG_DIR" "$@"
[ -n "${CODERAI_TMP:-}" ] && set -- "$@" --tmp "$CODERAI_TMP"
# Extra coderai CLI flags passed straight through from the host launcher
# (coderai-docker --coderai-arg / --coderai-args -> CODERAI_EXTRA_ARGS). supervisord
# runs this script with a fixed command, so arbitrary server flags arrive via this
# env var rather than argv. Word-split intentionally (like DEBUG_ARGS below).
CODERAI_BIN="/opt/coderai/python/bin/python3 /opt/coderai/app/coderai"
# Optional host-tailable file log. CODERAI_LOG_FILE should point under a mounted
......@@ -112,7 +117,7 @@ if [ -n "${CODERAI_LOG_FILE:-}" ]; then
mkdir -p "$(dirname "$CODERAI_LOG_FILE")" 2>/dev/null || true
echo "[coderai-oci] debug='${CODERAI_DEBUG:-off}' → logging to $CODERAI_LOG_FILE" >&2
# shellcheck disable=SC2086
exec $CODERAI_BIN "$@" $DEBUG_ARGS 2>&1 | tee -a "$CODERAI_LOG_FILE"
exec $CODERAI_BIN "$@" $DEBUG_ARGS ${CODERAI_EXTRA_ARGS:-} 2>&1 | tee -a "$CODERAI_LOG_FILE"
fi
# shellcheck disable=SC2086
exec $CODERAI_BIN "$@" $DEBUG_ARGS
exec $CODERAI_BIN "$@" $DEBUG_ARGS ${CODERAI_EXTRA_ARGS:-}
......@@ -22,6 +22,10 @@ PORT="${CODERAI_PORT:-8776}"
# Host interface the published port binds to. Empty = Docker's default (all
# interfaces, 0.0.0.0). Set e.g. 127.0.0.1 to expose only on localhost.
HOST_BIND="${CODERAI_HOST_BIND:-}"
# Extra CLI flags passed straight through to the coderai server inside the
# container (via CODERAI_EXTRA_ARGS, appended by the in-image coderai launcher).
# Built from --coderai-arg (repeatable, one token each) and --coderai-args "...".
CODERAI_EXTRA_ARGS="${CODERAI_EXTRA_ARGS:-}"
DATA_ROOT="$PWD/coderai-runtime"
DETACH=0
NAME="coderai"
......@@ -77,6 +81,12 @@ Options:
--host ADDR Host interface to bind the published port to (e.g.
127.0.0.1 for localhost-only, 0.0.0.0 for all interfaces).
Default: Docker's default (all interfaces).
--coderai-arg ARG Pass one extra flag straight through to the coderai server
(e.g. --coderai-arg --some-flag). Repeatable; each ARG is a
single token (no embedded spaces).
--coderai-args STR Pass a raw string of extra coderai flags (space-separated),
e.g. --coderai-args "--foo bar --baz". Appended after any
--coderai-arg values.
--data-dir PATH Directory for config/models/cache (default: ./coderai-runtime).
--name NAME Container name (default: coderai).
-d, --detach Run in background.
......@@ -126,6 +136,12 @@ while [[ $# -gt 0 ]]; do
--host)
[[ $# -ge 2 ]] || { echo "Error: --host requires an address" >&2; exit 2; }
HOST_BIND="$2"; shift 2 ;;
--coderai-arg)
[[ $# -ge 2 ]] || { echo "Error: --coderai-arg requires a value" >&2; exit 2; }
CODERAI_EXTRA_ARGS="${CODERAI_EXTRA_ARGS:+$CODERAI_EXTRA_ARGS }$2"; shift 2 ;;
--coderai-args)
[[ $# -ge 2 ]] || { echo "Error: --coderai-args requires a string" >&2; exit 2; }
CODERAI_EXTRA_ARGS="${CODERAI_EXTRA_ARGS:+$CODERAI_EXTRA_ARGS }$2"; shift 2 ;;
--data-dir)
[[ $# -ge 2 ]] || { echo "Error: --data-dir requires a path" >&2; exit 2; }
DATA_ROOT="$2"; shift 2 ;;
......@@ -177,6 +193,10 @@ else
PUBLISH="$PORT:8776"
fi
args=(run --rm --name "$NAME" --ipc=host -p "$PUBLISH" -e CODERAI_HOST=0.0.0.0 -e CODERAI_PORT=8776)
# Pass-through coderai server flags (appended by the in-image launcher's argv).
if [[ -n "$CODERAI_EXTRA_ARGS" ]]; then
args+=(-e "CODERAI_EXTRA_ARGS=$CODERAI_EXTRA_ARGS")
fi
if [[ "$DETACH" == "1" ]]; then
args+=(-d)
fi
......@@ -320,6 +340,7 @@ Starting CoderAI OCI container
debug: ${DEBUG_SPEC:-off}
log: $LOG_HOST_NOTE
tools: $TOOLS_NOTE
cdr-args:${CODERAI_EXTRA_ARGS:+ $CODERAI_EXTRA_ARGS}
EOF
if [[ "$LOG_HOST_NOTE" != "(none)" ]]; then
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment