From ee1f7782f10a421a6067504ab0f1894d4df3eed2 Mon Sep 17 00:00:00 2001 From: hailin Date: Mon, 19 May 2025 12:37:23 +0800 Subject: [PATCH] . --- supabase/chatdesk/wrapper.sh | 2 +- supabase/gotrue/wrapper.sh | 4 ++-- supabase/kong/wrapper.sh | 9 +++++---- supabase/postgres/wrapper.sh | 4 ++-- supabase/postgrest/wrapper.sh | 2 +- supabase/storage-api/wrapper.sh | 8 ++++---- 6 files changed, 15 insertions(+), 14 deletions(-) diff --git a/supabase/chatdesk/wrapper.sh b/supabase/chatdesk/wrapper.sh index 9a8df5e..593be99 100644 --- a/supabase/chatdesk/wrapper.sh +++ b/supabase/chatdesk/wrapper.sh @@ -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 echo "[chatdesk-ui] Still waiting for /rest/v1/ ..." - sleep 1 + sleep 3 done diff --git a/supabase/gotrue/wrapper.sh b/supabase/gotrue/wrapper.sh index f95daea..3e9d2a1 100644 --- a/supabase/gotrue/wrapper.sh +++ b/supabase/gotrue/wrapper.sh @@ -4,9 +4,9 @@ set -euo pipefail echo "[gotrue] Waiting for PostgREST on localhost:3000..." # 等待 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..." - sleep 1 + sleep 1.5 done echo "[gotrue] PostgREST is ready. Starting GoTrue..." diff --git a/supabase/kong/wrapper.sh b/supabase/kong/wrapper.sh index 1dbd047..6a1cd66 100644 --- a/supabase/kong/wrapper.sh +++ b/supabase/kong/wrapper.sh @@ -33,12 +33,13 @@ export SUPABASE_ANON_KEY="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoiYW5vb export SUPABASE_SERVICE_KEY="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoic2VydmljZV9yb2xlIiwiaXNzIjoic3VwYWJhc2UtZGVtbyIsImV4cCI6MjA2MjkyNTU2NSwiaWF0IjoxNzQ3NTY1NTY1fQ.18Lxnd9JrkNyV9q38l_8oQB8pwtZK8JwpLwpH2b4JaA" # --- 等待 postgrest (通过 Kong proxy) 可访问 --- -echo "[kong] Waiting for PostgREST to be reachable via Kong..." -until curl -s http://localhost:3000/ >/dev/null; do +echo "[kong] Waiting for PostgREST on localhost:3000 (not via Kong)..." +until curl -s -o /dev/null -w "%{http_code}" http://localhost:3000/ | grep -qE "^(200|401|403)$"; do echo "[kong] Still waiting for PostgREST..." - sleep 1 + sleep 2.5 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 模式) --- exec /supabase/kong/docker-entrypoint.sh kong docker-start diff --git a/supabase/postgres/wrapper.sh b/supabase/postgres/wrapper.sh index 2ed3ebb..72c7905 100644 --- a/supabase/postgres/wrapper.sh +++ b/supabase/postgres/wrapper.sh @@ -2,10 +2,10 @@ # 捕获 SIGINT / SIGTERM / SIGQUIT 信号以优雅退出 cleanup() { - echo "[gotrue] Caught termination signal, shutting down..." + echo "[postgres] Caught termination signal, shutting down..." exit 0 } -trap SIGINT SIGQUIT +trap cleanup SIGINT SIGQUIT SIGTERM exec /usr/local/bin/docker-entrypoint.sh postgres -D /etc/postgresql \ No newline at end of file diff --git a/supabase/postgrest/wrapper.sh b/supabase/postgrest/wrapper.sh index 2bc65ff..311bfb6 100644 --- a/supabase/postgrest/wrapper.sh +++ b/supabase/postgrest/wrapper.sh @@ -3,7 +3,7 @@ set -e # 等待 postgres ready until pg_isready -h localhost -p 5432 -U postgres; do - echo "Waiting for postgres..." + echo "[postgrest] Waiting for PostgreSQL on localhost:5432..." sleep 1 done diff --git a/supabase/storage-api/wrapper.sh b/supabase/storage-api/wrapper.sh index 09428c9..2847d7e 100644 --- a/supabase/storage-api/wrapper.sh +++ b/supabase/storage-api/wrapper.sh @@ -7,15 +7,15 @@ export AUTH_JWT_SECRET="super-secret-jwt-token-with-at-least-32-characters-long" export AUTH_JWT_ALGORITHM="HS256" 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 DB_INSTALL_ROLES="true" +#export DB_INSTALL_ROLES="true" export STORAGE_BACKEND="file" export FILE_STORAGE_BACKEND_PATH="/var/lib/storage" export DB_INSTALL_ROLES="false" # 等待 gotrue 服务可用(健康检查) -until curl -s http://localhost:9999/ >/dev/null 2>&1; do - echo "Waiting for gotrue..." - sleep 1 +until curl -s -o /dev/null -w "%{http_code}" http://localhost:9999/ | grep -qE "^(200|401|403)$"; do + echo "[storage-api] Waiting for gotrue..." + sleep 2 done # 启动 Node 应用