Files
Project_Velocity/backend/scripts/nemoclaw_deploy.sh

96 lines
2.7 KiB
Bash

#!/usr/bin/env bash
set -euo pipefail
# NemoClaw deployment helper for the Desineuron SGLang runtime.
# This script intentionally avoids Ollama-era assumptions and configures
# NemoClaw/OpenShell to talk to the shared OpenAI-compatible SGLang endpoint.
NVME_ROOT="${NVME_ROOT:-/opt/dlami/nvme/nemoclaw}"
SGLANG_BASE_URL="${SGLANG_BASE_URL:-https://llm.desineuron.in}"
SGLANG_MODEL="${SGLANG_MODEL:-qwen3.6:35b-a3b}"
SGLANG_API_TOKEN="${SGLANG_API_TOKEN:-}"
OPENSHELL_PORT="${OPENSHELL_PORT:-8080}"
AGENT_NAME="${AGENT_NAME:-velocity-sentinel}"
if [[ "${EUID}" -ne 0 ]]; then
echo "Run this script with sudo or as root."
exit 1
fi
echo "==> Desineuron NemoClaw deploy"
echo "NVME root : ${NVME_ROOT}"
echo "SGLang base URL: ${SGLANG_BASE_URL}"
echo "Model : ${SGLANG_MODEL}"
echo "Agent : ${AGENT_NAME}"
mkdir -p "${NVME_ROOT}"/{logs,state,home}
if ! command -v node >/dev/null 2>&1; then
curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
apt-get update -y
apt-get install -y nodejs
fi
if ! command -v docker >/dev/null 2>&1; then
apt-get update -y
apt-get install -y docker.io
systemctl enable --now docker
fi
if ! command -v openshell >/dev/null 2>&1; then
npm install -g @nvidia/openshell || true
fi
if ! command -v nemoclaw >/dev/null 2>&1; then
npm install -g @nvidia/nemoclaw || true
fi
cat >/etc/default/desineuron-nemoclaw <<EOF
SGLANG_BASE_URL=${SGLANG_BASE_URL}
SGLANG_MODEL=${SGLANG_MODEL}
SGLANG_API_TOKEN=${SGLANG_API_TOKEN}
NEMOCLAW_BASE_URL=${SGLANG_BASE_URL}
NEMOCLAW_MODEL=${SGLANG_MODEL}
NEMOCLAW_API_TOKEN=${SGLANG_API_TOKEN}
EOF
chmod 600 /etc/default/desineuron-nemoclaw
if command -v openshell >/dev/null 2>&1; then
openshell inference set \
--provider compatible-endpoint \
--base-url "${SGLANG_BASE_URL}/v1" \
--api-key "${SGLANG_API_TOKEN:-desineuron}" \
--model "${SGLANG_MODEL}" \
--context-window 8192 \
--max-tokens 4096 || true
fi
cat >/etc/systemd/system/desineuron-nemoclaw-gateway.service <<EOF
[Unit]
Description=Desineuron NemoClaw Gateway
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
EnvironmentFile=/etc/default/desineuron-nemoclaw
WorkingDirectory=${NVME_ROOT}
Environment=HOME=${NVME_ROOT}/home
ExecStart=/usr/bin/env bash -lc 'nemoclaw serve --name ${AGENT_NAME} --port ${OPENSHELL_PORT}'
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable --now desineuron-nemoclaw-gateway.service
systemctl --no-pager --full status desineuron-nemoclaw-gateway.service
echo
echo "NemoClaw deployment complete."
echo "Gateway port : ${OPENSHELL_PORT}"
echo "Model : ${SGLANG_MODEL}"
echo "Runtime : ${SGLANG_BASE_URL}/v1"