From 35850bad5f269d515893babd6f0332befa224d6a Mon Sep 17 00:00:00 2001 From: hailin Date: Sun, 18 May 2025 13:31:23 +0800 Subject: [PATCH] . --- chatbot-ui/package.json | 2 +- supabase/chatai-ui/wrapper.sh | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/chatbot-ui/package.json b/chatbot-ui/package.json index 153f6f1..041c2e7 100644 --- a/chatbot-ui/package.json +++ b/chatbot-ui/package.json @@ -9,7 +9,7 @@ "clean": "npm run lint:fix && npm run format:write", "dev": "next dev -H 0.0.0.0", "build": "next build", - "start": "next start", + "start": "next start -H 0.0.0.0", "start:prod": "npm run build && pm2 start npm --name \"chatai-ui\" -- run start", "lint": "next lint", "lint:fix": "next lint --fix", diff --git a/supabase/chatai-ui/wrapper.sh b/supabase/chatai-ui/wrapper.sh index fd3be4c..b3d3bef 100644 --- a/supabase/chatai-ui/wrapper.sh +++ b/supabase/chatai-ui/wrapper.sh @@ -1,5 +1,14 @@ #!/bin/bash set -e -# 直接启动已构建好的 Next.js app,监听 0.0.0.0 -exec node node_modules/next/dist/bin/next start -H 0.0.0.0 +# --- 等待 Kong 代理接口可用(假设它暴露在 127.0.0.1:8000)--- +echo "[chatai-ui] Waiting for Kong to be ready at http://localhost:8000/..." +until curl -sSf http://localhost:8000/ > /dev/null; do + echo "[chatai-ui] Kong not ready yet, retrying..." + sleep 1 +done +echo "[chatai-ui] Kong is ready." + +# --- 切换到项目目录并启动 next.js --- +cd /supabase/chatai-ui +exec npm run start