#!/usr/bin/env bash set -e INSTALL_DIR="/opt/openclaw" REPO="https://git.yalu.pro/evgeny/openclaw.git" # ====== PORT SETTINGS ====== OPENCLAW_PORT="${OPENCLAW_PORT:-18789}" OPENCLAW_HOST="${OPENCLAW_HOST:-0.0.0.0}" echo "Installing OpenClaw..." echo "Gateway will run on: ${OPENCLAW_HOST}:${OPENCLAW_PORT}" # ====== Node 22 ====== if ! command -v node >/dev/null || [[ $(node -v | cut -d. -f1 | tr -d v) -lt 22 ]]; then curl -fsSL https://deb.nodesource.com/setup_22.x | bash - apt install -y nodejs fi # ====== pnpm ====== if ! command -v pnpm >/dev/null; then npm install -g pnpm fi # ====== clone or update ====== if [ -d "$INSTALL_DIR" ]; then git -C "$INSTALL_DIR" pull else git clone "$REPO" "$INSTALL_DIR" fi cd "$INSTALL_DIR" pnpm install pnpm build echo "Running onboarding..." npx openclaw onboard echo "Starting OpenClaw..." # передаём порт в runtime export OPENCLAW_PORT export OPENCLAW_HOST npx openclaw start & sleep 5 SERVER_IP=$(hostname -I | awk '{print $1}') echo "" echo "=====================================" echo " OpenClaw is running!" echo "" echo " Local: http://localhost:${OPENCLAW_PORT}" echo " Server: http://${SERVER_IP}:${OPENCLAW_PORT}" echo "====================================="