#!/bin/sh # =========================================================================== # SearchAI Index Server — one-line installer # # curl -fsSL https://index-server.searchblox.com/install | sudo bash # # Options (env vars before `bash`): # curl -fsSL .../install | sudo PORT=9300 bash # curl -fsSL .../install | sudo VERSION=1.3.1 bash # # PORT API port for the systemd service (default 9200) # VERSION release version to fetch (default 1.3.1) # PREFIX install prefix (default /opt/searchai-index) # # Detects the platform, downloads the matching self-contained bundle # (server binary + embedded engine + config + install scripts) from the # public artifact URL, verifies it against its published sha256, unpacks it, # and runs the systemd installer. Linux only; on macOS/Windows use Docker. # =========================================================================== set -eu BASE="${SEARCHAI_BASE_URL:-https://index-server.searchblox.com}" VERSION="${VERSION:-1.3.1}" PORT="${PORT:-9200}" PREFIX="${PREFIX:-/opt/searchai-index}" if [ "$(uname -s)" != "Linux" ]; then echo "This installer is Linux-only. On macOS/Windows use Docker or a Linux VM." >&2 echo "See $BASE/getting-started.html" >&2 exit 1 fi if [ "$(id -u)" -ne 0 ]; then echo "Please run with sudo:" >&2 echo " curl -fsSL $BASE/install | sudo bash" >&2 exit 1 fi command -v curl >/dev/null 2>&1 || { echo "curl is required." >&2; exit 1; } command -v tar >/dev/null 2>&1 || { echo "tar is required." >&2; exit 1; } # Resolve platform token: {glibc|musl} x {arm64|amd64} case "$(uname -m)" in aarch64|arm64) ARCH=arm64 ;; x86_64|amd64) ARCH=amd64 ;; *) echo "unsupported architecture: $(uname -m)" >&2; exit 1 ;; esac if ldd --version 2>&1 | grep -qi musl; then echo "Alpine/musl builds are not published — build from source instead:" >&2 echo " see $BASE/download.html#source" >&2 exit 1 fi PLAT="linux-$ARCH" TARBALL="searchai-index-server-${VERSION}-${PLAT}.tar.gz" URL="$BASE/releases/$VERSION/$TARBALL" WORK="$(mktemp -d /tmp/searchai-index-install.XXXXXX)" trap 'rm -rf "$WORK"' EXIT echo "Fetching $TARBALL from $BASE ..." curl -fsSL "$URL" -o "$WORK/$TARBALL" if curl -fsSL "$URL.sha256" -o "$WORK/$TARBALL.sha256" 2>/dev/null; then ( cd "$WORK" && sha256sum -c "$TARBALL.sha256" ) || { echo "checksum verification failed." >&2; exit 1; } else echo "WARN: no published sha256 for $TARBALL — skipping checksum verification." >&2 fi echo "Unpacking ..." tar -C "$WORK" -xzf "$WORK/$TARBALL" DIR="$WORK/$(basename "$TARBALL" .tar.gz)" [ -d "$DIR" ] || DIR="$(find "$WORK" -maxdepth 1 -type d -name 'searchai-index-server-*' | head -1)" [ -d "$DIR" ] || { echo "could not locate unpacked bundle." >&2; exit 1; } echo "Installing systemd service (port $PORT, prefix $PREFIX) ..." "$DIR/deploy/install-searchai-index.sh" --prefix "$PREFIX" --port "$PORT" echo "" echo "==============================================================" echo " SearchAI Index Server is running." echo "" echo " API (OpenSearch 3.5): http://localhost:$PORT" echo " Handshake: curl http://localhost:$PORT/" echo " Health probe: curl http://localhost:$PORT/health" echo " Config: $PREFIX/conf/server.properties" echo " Docs: $BASE/getting-started.html" echo "" echo " SECURITY: auth is off by default. Set server.api-key in the config" echo " and front the port with a gateway before exposing it. See" echo " $BASE/docs.html#production" echo "=============================================================="