Spaces:
				
			
			
	
			
			
		Runtime error
		
	
	
	
			
			
	
	
	
	
		
		
		Runtime error
		
	| ENV_LOCAL_PATH=/app/.env.local | |
| if test -z "${DOTENV_LOCAL}" ; then | |
| if ! test -f "${ENV_LOCAL_PATH}" ; then | |
| echo "DOTENV_LOCAL was not found in the ENV variables and .env.local is not set using a bind volume. Make sure to set environment variables properly. " | |
| fi; | |
| else | |
| echo "DOTENV_LOCAL was found in the ENV variables. Creating .env.local file." | |
| cat <<< "$DOTENV_LOCAL" > ${ENV_LOCAL_PATH} | |
| fi; | |
| if [ "$INCLUDE_DB" = "true" ] ; then | |
| echo "Starting local MongoDB instance" | |
| nohup mongod & | |
| fi; | |
| # Start vLLM Model Manager (handles multiple models with dynamic switching) | |
| echo "Starting vLLM Model Manager" | |
| # Ensure dir for model cache | |
| mkdir -p /data/models | |
| # Default model for vLLM (can be overridden via VLLM_MODEL env var) | |
| # Available models: meta-llama/Meta-Llama-3-8B-Instruct, Qwen/Qwen2.5-7B-Instruct, mistralai/Mistral-7B-Instruct-v0.3 | |
| export VLLM_MODEL=${VLLM_MODEL:-"meta-llama/Meta-Llama-3-8B-Instruct"} | |
| # Make manager executable | |
| chmod +x /app/vllm-manager.py | |
| # Start the vLLM manager (it handles vLLM and provides model switching) | |
| nohup python3 /app/vllm-manager.py > /tmp/vllm-manager.log 2>&1 & | |
| MANAGER_PID=$! | |
| # Override OPENAI_BASE_URL to use local vLLM manager at runtime | |
| export OPENAI_BASE_URL=http://localhost:8000/v1 | |
| echo "OPENAI_BASE_URL set to $OPENAI_BASE_URL for local vLLM with model switching" | |
| # Wait for vLLM manager to be ready | |
| MAX_RETRIES=120 | |
| RETRY_COUNT=0 | |
| echo "Waiting for vLLM manager to be ready (this may take several minutes for model loading)..." | |
| until curl -s http://localhost:8000/health > /dev/null 2>&1; do | |
| RETRY_COUNT=$((RETRY_COUNT + 1)) | |
| if [ $RETRY_COUNT -ge $MAX_RETRIES ]; then | |
| echo "vLLM manager failed to start after $MAX_RETRIES attempts" | |
| echo "=== vLLM manager logs ===" | |
| cat /tmp/vllm-manager.log | |
| echo "=== vLLM logs ===" | |
| cat /tmp/vllm.log | |
| exit 1 | |
| fi | |
| sleep 5 | |
| if [ $((RETRY_COUNT % 6)) -eq 0 ]; then | |
| echo "Still waiting for vLLM... (${RETRY_COUNT}/${MAX_RETRIES})" | |
| fi | |
| done | |
| echo "vLLM manager is ready! All 3 models available in UI." | |
| export PUBLIC_VERSION=$(node -p "require('./package.json').version") | |
| node /app/build/index.js --host 0.0.0.0 --port 3000 | |
 
			
