fix(ci): find node during toolkit socket deploy
This commit is contained in:
@@ -9,8 +9,39 @@ pid_file="$repo_path/.toolkit-socket.pid"
|
||||
log_directory="$repo_path/logs"
|
||||
log_file="$log_directory/toolkit-socket.log"
|
||||
|
||||
find_executable() {
|
||||
executable_name="$1"
|
||||
|
||||
for executable_path in \
|
||||
"$executable_name" \
|
||||
"/opt/homebrew/bin/$executable_name" \
|
||||
"/usr/local/bin/$executable_name" \
|
||||
"/usr/bin/$executable_name" \
|
||||
"$HOME/.nvm/versions/node"/*"/bin/$executable_name"; do
|
||||
if command -v "$executable_path" >/dev/null 2>&1; then
|
||||
command -v "$executable_path"
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ -x "$executable_path" ]; then
|
||||
printf '%s\n' "$executable_path"
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
cd "$repo_path"
|
||||
|
||||
node_bin="$(find_executable node || true)"
|
||||
npm_bin="$(find_executable npm || true)"
|
||||
|
||||
if [ -z "$node_bin" ]; then
|
||||
echo "[deploy:toolkit] node was not found. Install Node or add it to a standard deploy PATH."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -f package.json ] || [ ! -f socket/server.mjs ]; then
|
||||
echo "[deploy:toolkit] $repo_path is not a Bone Kingdom repo checkout."
|
||||
exit 1
|
||||
@@ -21,8 +52,13 @@ mkdir -p "$log_directory" \
|
||||
"$repo_path/src/assets/music/uploads"
|
||||
|
||||
if [ ! -d "$repo_path/node_modules/socket.io" ]; then
|
||||
if [ -z "$npm_bin" ]; then
|
||||
echo "[deploy:toolkit] npm was not found and dependencies are missing."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "[deploy:toolkit] node_modules missing socket.io; installing workspace dependencies."
|
||||
npm install --no-audit --no-fund
|
||||
"$npm_bin" install --no-audit --no-fund
|
||||
fi
|
||||
|
||||
if [ -f "$pid_file" ]; then
|
||||
@@ -41,7 +77,7 @@ echo "[deploy:toolkit] starting socket on $socket_host:$socket_port"
|
||||
TOOLKIT_SOCKET_HOST="$socket_host" \
|
||||
TOOLKIT_SOCKET_PORT="$socket_port" \
|
||||
TOOLKIT_SOCKET_CORS_ORIGIN="$socket_cors_origin" \
|
||||
nohup node socket/server.mjs >"$log_file" 2>&1 &
|
||||
nohup "$node_bin" socket/server.mjs >"$log_file" 2>&1 &
|
||||
|
||||
socket_pid="$!"
|
||||
printf '%s\n' "$socket_pid" > "$pid_file"
|
||||
|
||||
@@ -11,6 +11,18 @@
|
||||
"Validated Gitea API reachability from inside the Kubernetes namespace."
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "woodpecker-toolkit-socket-node-path",
|
||||
"version": "0.0.5-20260624-local",
|
||||
"createdAt": "2026-06-24",
|
||||
"title": "Woodpecker Toolkit Socket Node Path",
|
||||
"summary": "Fixed deployed Toolkit socket restarts when SSH sessions do not load the user's Node path.",
|
||||
"changes": [
|
||||
"Updated the Toolkit socket restart script to find Node and npm from standard macOS, Homebrew, and NVM locations.",
|
||||
"Kept the restart command safe for non-interactive SSH deploy sessions.",
|
||||
"Preserved the shared workspace socket behavior for deployed Toolkit editing."
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "deployed-toolkit-socket-workspace",
|
||||
"version": "0.0.5-20260624-local",
|
||||
|
||||
Reference in New Issue
Block a user