## sglang
pip install sglang-router
pip install requests
pip install psutil
pip install fastapi[standard]
pip install uvicorn
pip install pydantic

## redis
echo "*********** Run the project without docker ************"
wget https://download.redis.io/redis-stable.tar.gz
tar -xzvf redis-stable.tar.gz
cd redis-stable
make
cd src && make install
pip install  httpie
cd ../../

echo "***** RUN redis-server *****"
redis-server --daemonize yes
redis-cli ping  # 如果返回 PONG 说明 Redis 运行正常

echo "***** Checking Redis Connection *****"
pip install redis 
pip install fastapi[standard] 
pip install uvicorn 
pip install psutil 

### launch redis
cd code-judge
apt-get update
apt-get install -y tmux
# tmux new-session -d -s redis-client "REDIS_URI=rediss+cluster://:mgUHuuzQCZSUqrSFjh5tX6VSycF3cENpsAzCaO7PPV8=@aicoder-judge.eastus2.redis.azure.net:10000 uvicorn app.main:app --workers 4 --limit-max-requests 1000 --port 8005"
# non-high-availability
# tmux new-session -d -s redis-client "REDIS_URI=rediss+cluster://:Z2SZGEzMROPP1WGv58t3NXGlNL93wBN3XAzCaArnCrk=@aicoder-codejudge-sa.eastus2.redis.azure.net:10000 uvicorn app.main:app --workers 4 --limit-max-requests 1000 --port 8005"
tmux new-session -d -s redis-client "REDIS_URI=redis://localhost:6379 uvicorn app.main:app --workers 4 --limit-max-requests 1000 --port 8005"
tmux new-session -d -s redis-server "REDIS_URI=redis://localhost:6379 python3.12 run_workers.py"

sleep 5s
python3 test_api.py
# sleep 5s
echo "redis start !!!"
cd ..