#!/usr/bin/env bash # Search-box.ai # Author: Simon-Pierre Boucher # Contact: contact@spboucher.ai # File: deploy/start.sh # Description: Production start on node m3u96a — build, migrate, serve, tunnel (PM2). set -euo pipefail cd "$(dirname "$0")/.." if [ ! -f .env ]; then echo "missing .env (secrets live only on the node)" >&2 exit 1 fi pnpm install --frozen-lockfile pnpm migrate pnpm build # App under PM2 (auto-restart), tunnel under PM2 alongside it. pm2 delete search-box-web >/dev/null 2>&1 || true pm2 start "pnpm start" --name search-box-web pm2 delete search-box-ngrok >/dev/null 2>&1 || true pm2 start "ngrok start --config deploy/ngrok.yml search-box-web" --name search-box-ngrok pm2 save echo "search-box.ai is up: https://www.search-box.ai"