Add managed Lab 3 browser terminal deployment
This commit is contained in:
+19
-1
@@ -17,9 +17,15 @@ load_runtime_env() {
|
||||
: "${COURSEWARE_URL_HOST:=127.0.0.1}"
|
||||
: "${COURSEWARE_PROMPTFOO_PORT:=15500}"
|
||||
: "${COURSEWARE_WIKI_PORT:=80}"
|
||||
: "${COURSEWARE_WETTY_PORT:=7681}"
|
||||
: "${COURSEWARE_WETTY_BASE_PATH:=/wetty}"
|
||||
: "${COURSEWARE_STUDENT_USERNAME:=student}"
|
||||
: "${COURSEWARE_LAB3_DIR:=/home/student/lab3}"
|
||||
: "${NODE_RUNTIME_BIN_DIR:=$COURSEWARE_STATE_DIR/tools/node-runtime/node_modules/node/bin}"
|
||||
: "${WETTY_BIN:=$COURSEWARE_STATE_DIR/tools/wetty/node_modules/.bin/wetty}"
|
||||
: "${PROMPTFOO_DIR:=$COURSEWARE_STATE_DIR/lab6}"
|
||||
: "${WIKI_DIR:=$COURSEWARE_STATE_DIR/repos/LLM-Labs}"
|
||||
: "${WIKI_RUNTIME_CONFIG_PATH:=$WIKI_DIR/public/courseware-runtime.json}"
|
||||
: "${LLAMA_CPP_BIN_DIR:=$COURSEWARE_STATE_DIR/repos/llama.cpp/build/bin}"
|
||||
|
||||
if [ -n "${OLLAMA_BIN:-}" ] && [[ "$OLLAMA_BIN" != */* ]] && command -v "$OLLAMA_BIN" >/dev/null 2>&1; then
|
||||
@@ -43,7 +49,8 @@ service_list() {
|
||||
"embedding-atlas" \
|
||||
"unsloth" \
|
||||
"promptfoo" \
|
||||
"wiki"
|
||||
"wiki" \
|
||||
"wetty"
|
||||
}
|
||||
|
||||
service_pid_file() {
|
||||
@@ -64,6 +71,7 @@ service_port() {
|
||||
unsloth) printf '%s\n' "${COURSEWARE_UNSLOTH_PORT}" ;;
|
||||
promptfoo) printf '%s\n' "${COURSEWARE_PROMPTFOO_PORT}" ;;
|
||||
wiki) printf '%s\n' "${COURSEWARE_WIKI_PORT}" ;;
|
||||
wetty) printf '%s\n' "${COURSEWARE_WETTY_PORT}" ;;
|
||||
*) return 1 ;;
|
||||
esac
|
||||
}
|
||||
@@ -78,6 +86,7 @@ service_url() {
|
||||
unsloth) printf 'http://%s:%s\n' "$COURSEWARE_URL_HOST" "$COURSEWARE_UNSLOTH_PORT" ;;
|
||||
promptfoo) printf 'http://%s:%s\n' "$COURSEWARE_URL_HOST" "$COURSEWARE_PROMPTFOO_PORT" ;;
|
||||
wiki) printf 'http://%s:%s\n' "$COURSEWARE_URL_HOST" "$COURSEWARE_WIKI_PORT" ;;
|
||||
wetty) printf 'http://%s:%s%s\n' "$COURSEWARE_URL_HOST" "$COURSEWARE_WETTY_PORT" "$COURSEWARE_WETTY_BASE_PATH" ;;
|
||||
*) return 1 ;;
|
||||
esac
|
||||
}
|
||||
@@ -144,6 +153,15 @@ service_command() {
|
||||
"$COURSEWARE_BIND_HOST" \
|
||||
"$COURSEWARE_WIKI_PORT"
|
||||
;;
|
||||
wetty)
|
||||
printf 'cd "%s" && PATH="%s:$PATH" exec "%s" --host %s --port %s --base %s --allow-iframe --ssh-host 127.0.0.1 --ssh-port 22 --ssh-auth password' \
|
||||
"$COURSEWARE_ROOT" \
|
||||
"$NODE_RUNTIME_BIN_DIR" \
|
||||
"$WETTY_BIN" \
|
||||
"$COURSEWARE_BIND_HOST" \
|
||||
"$COURSEWARE_WETTY_PORT" \
|
||||
"$COURSEWARE_WETTY_BASE_PATH"
|
||||
;;
|
||||
*)
|
||||
return 1
|
||||
;;
|
||||
|
||||
Executable → Regular
+43
-1
@@ -28,6 +28,44 @@ ensure_transformerlab_default_user() {
|
||||
--last-name "${TRANSFORMERLAB_DEFAULT_USER_LAST_NAME:-}" >>"$STATE_DIR/logs/transformerlab_default_user.log" 2>&1 || true
|
||||
}
|
||||
|
||||
check_wetty_prereqs() {
|
||||
if ! id "$COURSEWARE_STUDENT_USERNAME" >/dev/null 2>&1; then
|
||||
echo "Missing terminal user '$COURSEWARE_STUDENT_USERNAME'. Re-run ./labctl up after setting COURSEWARE_STUDENT_PASSWORD_HASH." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -x "$WETTY_BIN" ]; then
|
||||
echo "Missing WeTTY binary at $WETTY_BIN. Re-run ./labctl up." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -f "$WIKI_RUNTIME_CONFIG_PATH" ]; then
|
||||
echo "Missing wiki runtime config at $WIKI_RUNTIME_CONFIG_PATH. Re-run ./labctl up." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -d "$COURSEWARE_LAB3_DIR" ]; then
|
||||
echo "Missing lab workspace at $COURSEWARE_LAB3_DIR. Re-run ./labctl up." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! python3 - <<'PY'
|
||||
import socket, sys
|
||||
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
sock.settimeout(1)
|
||||
try:
|
||||
sock.connect(("127.0.0.1", 22))
|
||||
except OSError:
|
||||
sys.exit(1)
|
||||
finally:
|
||||
sock.close()
|
||||
PY
|
||||
then
|
||||
echo "Loopback sshd is not reachable on 127.0.0.1:22." >&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
resolve_targets() {
|
||||
if [ $# -eq 0 ]; then
|
||||
echo "No target specified." >&2
|
||||
@@ -82,7 +120,7 @@ service_ready() {
|
||||
promptfoo)
|
||||
curl -fsS "$(service_url "$service")/health" >/dev/null 2>&1
|
||||
;;
|
||||
open-webui|chunkviz|embedding-atlas|unsloth|wiki)
|
||||
open-webui|chunkviz|embedding-atlas|unsloth|wiki|wetty)
|
||||
curl -fsS "$(service_url "$service")" >/dev/null 2>&1
|
||||
;;
|
||||
*)
|
||||
@@ -176,6 +214,9 @@ start_one() {
|
||||
--required-support "batched" >>"$STATE_DIR/logs/transformerlab_plugin_supports.log" 2>&1 || true
|
||||
fi
|
||||
;;
|
||||
wetty)
|
||||
check_wetty_prereqs
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
@@ -289,6 +330,7 @@ Unsloth Studio: $(service_url unsloth)
|
||||
Promptfoo CLI: $PROMPTFOO_BIN
|
||||
Promptfoo UI: $(service_url promptfoo)
|
||||
Wiki: $(service_url wiki)
|
||||
Lab 3 Terminal: $(service_url wetty)
|
||||
Kiln app: ${KILN_LAUNCH_PATH:-not installed}
|
||||
EOF
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user