diff --git a/instances/fastapi_server/scripts/run.sh b/instances/fastapi_server/scripts/run.sh index 640aa14..fb0c020 100644 --- a/instances/fastapi_server/scripts/run.sh +++ b/instances/fastapi_server/scripts/run.sh @@ -9,6 +9,16 @@ WORKERS=$(python config/read_config_cli app.workers) # 启动 FastAPI 服务 echo "Starting FastAPI service on $HOST:$PORT with $WORKERS workers..." -nohup uvicorn main:app --host $HOST --port $PORT --workers $WORKERS & +# 使用uvicorn启动 +# nohup uvicorn main:app --host $HOST --port $PORT --workers $WORKERS & + +# gunicorn 启动更稳定 +# logger已经将stdout 输出到logger file +nohup gunicorn main:app \ + --bind "$HOST:$PORT" \ + --workers $WORKERS \ + --worker-class "uvicorn.workers.UvicornWorker" \ + > /dev/null & + echo "FastAPI service is running on http://$HOST:$PORT"