Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #!/bin/bash
  2. #
  3. # Copyright 2025 The InfiniFlow Authors. All Rights Reserved.
  4. #
  5. # Licensed under the Apache License, Version 2.0 (the "License");
  6. # you may not use this file except in compliance with the License.
  7. # You may obtain a copy of the License at
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  11. # Unless required by applicable law or agreed to in writing, software
  12. # distributed under the License is distributed on an "AS IS" BASIS,
  13. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. # See the License for the specific language governing permissions and
  15. # limitations under the License.
  16. #
  17. set -e
  18. BASE_DIR="$(cd "$(dirname "$0")/.." && pwd)"
  19. cd "$BASE_DIR"
  20. if [ -f .env ]; then
  21. source .env
  22. SANDBOX_EXECUTOR_MANAGER_PORT="${SANDBOX_EXECUTOR_MANAGER_PORT:-9385}" # Default to 9385 if not set in .env
  23. SANDBOX_EXECUTOR_MANAGER_POOL_SIZE="${SANDBOX_EXECUTOR_MANAGER_POOL_SIZE:-5}" # Default to 5 if not set in .env
  24. SANDBOX_BASE_PYTHON_IMAGE=${SANDBOX_BASE_PYTHON_IMAGE-"sandbox-base-python:latest"}
  25. SANDBOX_BASE_NODEJS_IMAGE=${SANDBOX_BASE_NODEJS_IMAGE-"sandbox-base-nodejs:latest"}
  26. else
  27. echo "⚠️ .env not found, using default ports and pool size"
  28. SANDBOX_EXECUTOR_MANAGER_PORT=9385
  29. SANDBOX_EXECUTOR_MANAGER_POOL_SIZE=5
  30. SANDBOX_BASE_PYTHON_IMAGE=sandbox-base-python:latest
  31. SANDBOX_BASE_NODEJS_IMAGE=sandbox-base-nodejs:latest
  32. fi
  33. echo "📦 STEP 1: Build sandbox-base image ..."
  34. if [ -f .env ]; then
  35. source .env &&
  36. echo "🐍 Building base sandbox image for Python ($SANDBOX_BASE_PYTHON_IMAGE)..." &&
  37. docker build -t "$SANDBOX_BASE_PYTHON_IMAGE" ./sandbox_base_image/python &&
  38. echo "⬢ Building base sandbox image for Nodejs ($SANDBOX_BASE_NODEJS_IMAGE)..." &&
  39. docker build -t "$SANDBOX_BASE_NODEJS_IMAGE" ./sandbox_base_image/nodejs
  40. else
  41. echo "⚠️ .env file not found, skipping build."
  42. fi
  43. echo "🧹 STEP 2: Clean up old sandbox containers (sandbox_nodejs_0~$((SANDBOX_EXECUTOR_MANAGER_POOL_SIZE - 1)) and sandbox_python_0~$((SANDBOX_EXECUTOR_MANAGER_POOL_SIZE - 1))) ..."
  44. for i in $(seq 0 $((SANDBOX_EXECUTOR_MANAGER_POOL_SIZE - 1))); do
  45. echo "🧹 Deleting sandbox_python_$i..."
  46. docker rm -f "sandbox_python_$i" >/dev/null 2>&1 || true
  47. echo "🧹 Deleting sandbox_nodejs_$i..."
  48. docker rm -f "sandbox_nodejs_$i" >/dev/null 2>&1 || true
  49. done
  50. echo "🔧 STEP 3: Build executor services ..."
  51. docker compose build
  52. echo "🚀 STEP 4: Start services ..."
  53. docker compose up -d
  54. echo "⏳ STEP 5a: Check if ports are open (basic connectivity) ..."
  55. bash ./scripts/wait-for-it.sh "localhost" "$SANDBOX_EXECUTOR_MANAGER_PORT" -t 30
  56. echo "⏳ STEP 5b: Check if the interfaces are healthy (/healthz) ..."
  57. bash ./scripts/wait-for-it-http.sh "http://localhost:$SANDBOX_EXECUTOR_MANAGER_PORT/healthz" 30
  58. echo "✅ STEP 6: Run security tests ..."
  59. python3 ./tests/sandbox_security_tests_full.py
  60. echo "🎉 Service is ready: http://localhost:$SANDBOX_EXECUTOR_MANAGER_PORT/docs"