Reorganize: llm/scripts -> scripts (LLM serve scripts, units, env tunables)
The LLM fleet serve scripts, systemd units, env tunables, and bench harnesses join the deploy scripts. The vllmScripts deploy.sh is removed here; its functionality is folded into the unified scripts/deploy.sh in a follow-up commit. bench-spec-stack.sh gains the executable bit (required by the scripts_syntax test seam).
This commit is contained in:
@@ -1,167 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# deploy.sh - Deploy the vllmScripts repo to a target and restart its service.
|
||||
#
|
||||
# This script implements the second half of the git deployment workflow from
|
||||
# AGENTS.md. It assumes the local changes are committed and pushed, then:
|
||||
# 1. Pulls the repo on the target
|
||||
# 2. Symlinks the systemd unit
|
||||
# 3. Reloads systemd and restarts the service
|
||||
# 4. Waits for the health endpoint and reports status
|
||||
#
|
||||
# Sudo: set FRANK_SUDO_PW so remote sudo reads the password from stdin
|
||||
# (`sudo -S`). The passwordless restart helpers installed for the retired
|
||||
# topology are obsolete and must not be used.
|
||||
#
|
||||
# Usage:
|
||||
# ./deploy.sh <target> [--dry-run]
|
||||
# FRANK_SUDO_PW=... ./deploy.sh <target>
|
||||
#
|
||||
# Targets (2026-08-18 topology):
|
||||
# dankserver - llama.cpp Qwen3.6-35B-A3B Q6_K_P (frank-default-small.service, port 7770)
|
||||
# dankclaw - CIRU ROCmFPX llama.cpp Qwen3.8-27B (frank-default-large.service, port 52625)
|
||||
set -euo pipefail
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Target configuration
|
||||
# ---------------------------------------------------------------------------
|
||||
declare -A REMOTE_USER REMOTE_HOST REMOTE_DIR SERVICE SERVICE_HEALTH DROP_CACHES HEALTH_WAIT
|
||||
|
||||
REMOTE_USER[dankserver]=dank
|
||||
REMOTE_HOST[dankserver]=dankserver
|
||||
REMOTE_DIR[dankserver]="/home/dank/vLLM"
|
||||
SERVICE[dankserver]="frank-default-small"
|
||||
SERVICE_HEALTH[dankserver]="http://127.0.0.1:7770/health"
|
||||
DROP_CACHES[dankserver]=0
|
||||
# Cold load: --no-mmap reads the 30.6 GB Q6_K_P through RAM (MoE experts on
|
||||
# CPU); allow 20 minutes.
|
||||
HEALTH_WAIT[dankserver]=600
|
||||
|
||||
REMOTE_USER[dankclaw]=dank
|
||||
REMOTE_HOST[dankclaw]=dankclaw
|
||||
REMOTE_DIR[dankclaw]="/home/dank/vllmScripts"
|
||||
SERVICE[dankclaw]="frank-default-large"
|
||||
SERVICE_HEALTH[dankclaw]="http://127.0.0.1:52625/health"
|
||||
DROP_CACHES[dankclaw]=0
|
||||
# CIRU llama.cpp (ROCm 7.15) loads the v3 five-file payload (GGUF + FFN +
|
||||
# GDN + Output-K8 .pfs + mmproj, ~36.7 GiB) + MTP draft/Output-K8 proxy and
|
||||
# initializes PromptForge views; allow 20 minutes.
|
||||
HEALTH_WAIT[dankclaw]=600
|
||||
|
||||
TARGET="${1:-}"
|
||||
DRY_RUN=0
|
||||
if [ "${2:-}" = "--dry-run" ]; then
|
||||
DRY_RUN=1
|
||||
fi
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Validation
|
||||
# ---------------------------------------------------------------------------
|
||||
if [ -z "${TARGET:-}" ]; then
|
||||
echo "Usage: $0 <dankserver|dankclaw> [--dry-run]"
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "${REMOTE_HOST[$TARGET]:-}" ]; then
|
||||
echo "Unknown target: $TARGET"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Sudo wrapper (headless-friendly)
|
||||
# ---------------------------------------------------------------------------
|
||||
SUDO_PREFIX="sudo"
|
||||
if [ -n "${FRANK_SUDO_PW:-}" ]; then
|
||||
SUDO_PREFIX="printf '%s\n' '$FRANK_SUDO_PW' | sudo -S"
|
||||
fi
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Local checks (pre-flight)
|
||||
# ---------------------------------------------------------------------------
|
||||
cd "$(dirname "$0")/.."
|
||||
if ! git diff --quiet HEAD; then
|
||||
echo "FAIL: Local working tree has uncommitted changes."
|
||||
echo "Commit or stash them before deploying."
|
||||
exit 1
|
||||
fi
|
||||
if [ "$(git rev-parse --abbrev-ref HEAD)" != "main" ]; then
|
||||
echo "WARN: Not on 'main'; deploying a non-main branch."
|
||||
fi
|
||||
|
||||
echo "=== Deploying to ${TARGET} ==="
|
||||
echo " host: ${REMOTE_HOST[$TARGET]}"
|
||||
echo " dir: ${REMOTE_DIR[$TARGET]}"
|
||||
echo " service: ${SERVICE[$TARGET]}"
|
||||
echo " health: ${SERVICE_HEALTH[$TARGET]}"
|
||||
echo ""
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Push (unless dry-run)
|
||||
# ---------------------------------------------------------------------------
|
||||
if [ "$DRY_RUN" = "1" ]; then
|
||||
echo "[dry-run] Would push local main to origin"
|
||||
echo "[dry-run] Would SSH to ${REMOTE_HOST[$TARGET]} and git pull"
|
||||
else
|
||||
echo "[1/4] Pushing local main to origin..."
|
||||
git push origin main
|
||||
fi
|
||||
|
||||
REMOTE="$(
|
||||
printf '%s@%s' "${REMOTE_USER[$TARGET]}" "${REMOTE_HOST[$TARGET]}"
|
||||
)"
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Remote: pull + install + restart
|
||||
# ---------------------------------------------------------------------------
|
||||
DROP_CACHES_CMD=""
|
||||
if [ "${DROP_CACHES[$TARGET]}" = "1" ]; then
|
||||
DROP_CACHES_CMD="
|
||||
echo 'Dropping page caches for reliable model load...'
|
||||
${SUDO_PREFIX} sh -c 'sync; echo 3 > /proc/sys/vm/drop_caches'
|
||||
"
|
||||
fi
|
||||
|
||||
REMOTE_SCRIPT="
|
||||
set -euo pipefail
|
||||
cd '${REMOTE_DIR[$TARGET]}'
|
||||
|
||||
echo '[2/4] Pulling repo on ${TARGET}...'
|
||||
git pull origin main
|
||||
|
||||
echo '[3/4] Symlink unit and restart ${SERVICE[$TARGET]}...'
|
||||
${SUDO_PREFIX} ln -sf '${REMOTE_DIR[$TARGET]}/scripts/${SERVICE[$TARGET]}.service' /etc/systemd/system/${SERVICE[$TARGET]}.service
|
||||
${DROP_CACHES_CMD}
|
||||
${SUDO_PREFIX} systemctl daemon-reload
|
||||
${SUDO_PREFIX} systemctl enable '${SERVICE[$TARGET]}'
|
||||
${SUDO_PREFIX} systemctl restart '${SERVICE[$TARGET]}'
|
||||
"
|
||||
|
||||
if [ "$DRY_RUN" = "1" ]; then
|
||||
echo "[dry-run] Remote commands would run:"
|
||||
echo "$REMOTE_SCRIPT"
|
||||
else
|
||||
# shellcheck disable=SC2087
|
||||
ssh "$REMOTE" bash -s <<REMOTE_EOF
|
||||
${REMOTE_SCRIPT}
|
||||
REMOTE_EOF
|
||||
fi
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Health check
|
||||
# ---------------------------------------------------------------------------
|
||||
if [ "$DRY_RUN" = "1" ]; then
|
||||
echo "[dry-run] Would wait for health at ${SERVICE_HEALTH[$TARGET]}"
|
||||
else
|
||||
echo "[4/4] Waiting for health endpoint ${SERVICE_HEALTH[$TARGET]} (via ssh)..."
|
||||
HEALTH_URL="${SERVICE_HEALTH[$TARGET]}"
|
||||
HEALTH_ITERS="${HEALTH_WAIT[$TARGET]:-300}"
|
||||
for i in $(seq 1 "$HEALTH_ITERS"); do
|
||||
if ssh "$REMOTE" "curl -sf '$HEALTH_URL'" > /dev/null 2>&1; then
|
||||
echo " Service healthy after approx $((i * 2))s"
|
||||
echo ""
|
||||
echo "=== Deploy complete: ${TARGET} ==="
|
||||
exit 0
|
||||
fi
|
||||
sleep 2
|
||||
done
|
||||
echo "FAIL: Service did not become healthy in $((HEALTH_ITERS * 2))s"
|
||||
exit 1
|
||||
fi
|
||||
Regular → Executable
Reference in New Issue
Block a user