当前位置: 代码迷 >> 综合 >> Supervisor 进程管理FastAPI ini文件配置
  详细解决方案

Supervisor 进程管理FastAPI ini文件配置

热度:85   发布时间:2024-02-13 05:59:18.0

在处理一些高并发任务的接口时,选择FastAPI会相对更合适

[supervisord]
minfds=65536
minprocs=32768[fcgi-program:uvicorn12001]
# 定义临时变量通过os.getenv('JCSP_DEPLOY_ENV', 'local')可以获取
environment=JCSP_DEPLOY_ENV="beta"
socket=tcp://0.0.0.0:12001
command     = /usr/local/bin/uvicorn --fd 0 xxx:app
directory   = /data/gofish-interface/src
# 开启4个进程处理
numprocs=4
process_name=uvicorn-%(process_num)d
user        = root
startsecs   = 3
redirect_stderr         = true
stdout_logfile_maxbytes = 50MB
stdout_logfile_backups  = 10
stdout_logfile          = /var/lib/docker/containers/xxx/api.log

参考:https://www.uvicorn.org/deployment/#supervisor