This commit is contained in:
hailin 2025-05-19 12:37:23 +08:00
parent dd4f01dede
commit ee1f7782f1
6 changed files with 15 additions and 14 deletions

View File

@ -7,7 +7,7 @@ echo "[chatdesk-ui] Waiting for Kong to proxy PostgREST..."
until curl -s -o /dev/null -w "%{http_code}" -H "apikey: $SUPABASE_ANON_KEY" http://localhost:8000/rest/v1/ | grep -qE "^(200|401|403)$"; do until curl -s -o /dev/null -w "%{http_code}" -H "apikey: $SUPABASE_ANON_KEY" http://localhost:8000/rest/v1/ | grep -qE "^(200|401|403)$"; do
echo "[chatdesk-ui] Still waiting for /rest/v1/ ..." echo "[chatdesk-ui] Still waiting for /rest/v1/ ..."
sleep 1 sleep 3
done done

View File

@ -4,9 +4,9 @@ set -euo pipefail
echo "[gotrue] Waiting for PostgREST on localhost:3000..." echo "[gotrue] Waiting for PostgREST on localhost:3000..."
# 等待 postgrest 启动就绪 # 等待 postgrest 启动就绪
until curl -s http://localhost:3000/ >/dev/null 2>&1; do until curl -s -o /dev/null -w "%{http_code}" http://localhost:3000/ | grep -qE "^(200|401)$"; do
echo "[gotrue] Waiting..." echo "[gotrue] Waiting..."
sleep 1 sleep 1.5
done done
echo "[gotrue] PostgREST is ready. Starting GoTrue..." echo "[gotrue] PostgREST is ready. Starting GoTrue..."

View File

@ -33,12 +33,13 @@ export SUPABASE_ANON_KEY="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoiYW5vb
export SUPABASE_SERVICE_KEY="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoic2VydmljZV9yb2xlIiwiaXNzIjoic3VwYWJhc2UtZGVtbyIsImV4cCI6MjA2MjkyNTU2NSwiaWF0IjoxNzQ3NTY1NTY1fQ.18Lxnd9JrkNyV9q38l_8oQB8pwtZK8JwpLwpH2b4JaA" export SUPABASE_SERVICE_KEY="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoic2VydmljZV9yb2xlIiwiaXNzIjoic3VwYWJhc2UtZGVtbyIsImV4cCI6MjA2MjkyNTU2NSwiaWF0IjoxNzQ3NTY1NTY1fQ.18Lxnd9JrkNyV9q38l_8oQB8pwtZK8JwpLwpH2b4JaA"
# --- 等待 postgrest (通过 Kong proxy) 可访问 --- # --- 等待 postgrest (通过 Kong proxy) 可访问 ---
echo "[kong] Waiting for PostgREST to be reachable via Kong..." echo "[kong] Waiting for PostgREST on localhost:3000 (not via Kong)..."
until curl -s http://localhost:3000/ >/dev/null; do until curl -s -o /dev/null -w "%{http_code}" http://localhost:3000/ | grep -qE "^(200|401|403)$"; do
echo "[kong] Still waiting for PostgREST..." echo "[kong] Still waiting for PostgREST..."
sleep 1 sleep 2.5
done done
echo "[kong] PostgREST is reachable. Starting Kong..."
echo "[kong] PostgREST is reachable. Now starting Kong on port 8000..."
# --- 启动 Kong使用 docker-entrypoint.sh + docker-start 模式) --- # --- 启动 Kong使用 docker-entrypoint.sh + docker-start 模式) ---
exec /supabase/kong/docker-entrypoint.sh kong docker-start exec /supabase/kong/docker-entrypoint.sh kong docker-start

View File

@ -2,10 +2,10 @@
# 捕获 SIGINT / SIGTERM / SIGQUIT 信号以优雅退出 # 捕获 SIGINT / SIGTERM / SIGQUIT 信号以优雅退出
cleanup() { cleanup() {
echo "[gotrue] Caught termination signal, shutting down..." echo "[postgres] Caught termination signal, shutting down..."
exit 0 exit 0
} }
trap SIGINT SIGQUIT trap cleanup SIGINT SIGQUIT SIGTERM
exec /usr/local/bin/docker-entrypoint.sh postgres -D /etc/postgresql exec /usr/local/bin/docker-entrypoint.sh postgres -D /etc/postgresql

View File

@ -3,7 +3,7 @@ set -e
# 等待 postgres ready # 等待 postgres ready
until pg_isready -h localhost -p 5432 -U postgres; do until pg_isready -h localhost -p 5432 -U postgres; do
echo "Waiting for postgres..." echo "[postgrest] Waiting for PostgreSQL on localhost:5432..."
sleep 1 sleep 1
done done

View File

@ -7,15 +7,15 @@ export AUTH_JWT_SECRET="super-secret-jwt-token-with-at-least-32-characters-long"
export AUTH_JWT_ALGORITHM="HS256" export AUTH_JWT_ALGORITHM="HS256"
export DATABASE_URL="postgres://supabase_admin:postgres@127.0.0.1:5432/postgres" export DATABASE_URL="postgres://supabase_admin:postgres@127.0.0.1:5432/postgres"
export DATABASE_POOL_URL="postgresql://postgres:postgres@127.0.0.1:6432/postgres" export DATABASE_POOL_URL="postgresql://postgres:postgres@127.0.0.1:6432/postgres"
export DB_INSTALL_ROLES="true" #export DB_INSTALL_ROLES="true"
export STORAGE_BACKEND="file" export STORAGE_BACKEND="file"
export FILE_STORAGE_BACKEND_PATH="/var/lib/storage" export FILE_STORAGE_BACKEND_PATH="/var/lib/storage"
export DB_INSTALL_ROLES="false" export DB_INSTALL_ROLES="false"
# 等待 gotrue 服务可用(健康检查) # 等待 gotrue 服务可用(健康检查)
until curl -s http://localhost:9999/ >/dev/null 2>&1; do until curl -s -o /dev/null -w "%{http_code}" http://localhost:9999/ | grep -qE "^(200|401|403)$"; do
echo "Waiting for gotrue..." echo "[storage-api] Waiting for gotrue..."
sleep 1 sleep 2
done done
# 启动 Node 应用 # 启动 Node 应用