如何在没有WSGI的情况下为Gunicorn配置ExecStart?

德文

Systemd和Gunicorn需要某种wsgi文件作为最后一个arg ExecStarthttp : //docs.gunicorn.org/en/latest/deploy.html?highlight=ExecStart#systemd

在Django中,这在主模块中为wsgi.py

ExecStart=/home/admin/django/bin/gunicorn --config /home/admin/src/gunicorn.py --bind unix:/tmp/api.sock myapp.wsgi

但是,在使用Sanic和uvloop时,该文件显然不存在(我相信新协议称为ASGI)。我尝试将其替换为app.py毫无用地的方法:

ExecStart=/home/admin/sanic/bin/gunicorn --config /home/admin/src/gunicorn.py --bind unix:/tmp/api.sock myapp.app

使用Sanic时应如何配置此参数?

克里斯托·古森(Christo Goosen)

如果您想以systemd开始sanic,为什么不使用supervisrod:Supervisord

引导->系统->主管-> Gunicorn-> sanic

[unix_http_server]
file=/tmp/supervisor.sock                       ; path to your socket file

[supervisord]
logfile=/var/log/supervisord/supervisord.log    ; supervisord log file
logfile_maxbytes=50MB                           ; maximum size of logfile before rotation
logfile_backups=10                              ; number of backed up logfiles
loglevel=error                                  ; info, debug, warn, trace
pidfile=/var/run/supervisord.pid                ; pidfile location
nodaemon=false                                  ; run supervisord as a daemon
minfds=1024                                     ; number of startup file descriptors
minprocs=200                                    ; number of process descriptors
user=root                                       ; default user
childlogdir=/var/log/supervisord/               ; where child log files will live

[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface

[supervisorctl]
serverurl=unix:///tmp/supervisor.sock         ; use a unix:// URL  for a unix socket

[program:ctrlapi]
directory=/home/ubuntu/api
command=/home/ubuntu/api/venv3/bin/gunicorn api:app --bind 0.0.0.0:8000 --worker-class sanic.worker.GunicornWorker -w 2
stderr_logfile = log/api_stderr.log
stdout_logfile = log/api_stdout.log

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

如何在没有构造函数的情况下为“this”赋值

如何在没有REST API的情况下为neo4j集群配置用户和密码

如何在没有最初定义的情况下为 range::view 定义类型?

如何在没有HDMI的情况下为Android Things连接扬声器

如何在没有构造函数的情况下为对象实例化设置断点?

如何在没有setup.py的情况下为python项目创建deb包

如何在没有EntityManager的情况下为当前实体禁用Hibernate缓存?

如何在没有设置模式的情况下为多列使用pandasmelt

如何在没有警告的情况下为2个对象运行代码

如何在没有修饰符的情况下为JRadioButton设置快捷键

如何在没有 T() 的情况下为泛型类分配内存

如何在没有单独的<div>元素的情况下为全角<section>的内容设置最大宽度?

如何在没有主键的情况下为表或视图进行休眠映射

如何在没有 Android SDK 的情况下为 Visual Studio 2017 安装 Xamarin?

如何在没有循环的情况下为多列设置值

jQuery:如何在没有已知高度的情况下为高度变化设置动画?

如何在没有模型的情况下为@ Html.TextBox()添加验证器

如何在没有列填充的情况下为Bootstrap行背景着色?

如何在没有第三方库的情况下为雪人制作动画?

如何在没有子类化的情况下为 QTextEdit 小部件定义 mousePressEvent 函数?

如何在没有效果原始对象的情况下为复制对象赋值

统一:如何在没有VIVE设备的情况下为HTC VIVE Pro开发

如何在没有KO的情况下为未映射的实体属性扩展Breeze元数据

如何在没有模型cancancan的情况下为api资源设置功能

如何在没有 js/jquery 的情况下为移动版本包装 LI 标记文本

如何在没有 Oauth 的情况下为自己实施 YouTube 可恢复上传

如何在没有负载均衡器的情况下为HTTPS在Elastic Beanstalk上配置Springboot后端服务器

如何在没有for循环的情况下为给定组有条件地分配中值?

Unity 命令行——如何在没有 -quit(ing) 的情况下为每个命令访问现有实例