Django使用supervisor启动生产中的芹菜守护进程

2024-04-24 04:24:55 发布

您现在位置:Python中文网/ 问答频道 /正文

我在/etc/supervisor/conf.d/myproject-celery.conf中为supervisor创建了一个conf文件

我的配置文件如下所示:

[program:celery]
command=/var/www/html/project/venv/bin/python  /var/www/html/project/manage.py celeryd --loglevel=INFO
environment=PYTHONPATH=/var/www/html/project
directory=/var/www/html/project
user=www-data
numprocs=1
stdout_logfile=/var/log/celeryd.log
stderr_logfile=/var/log/celeryd.log
autostart=true
autorestart=true
startsecs=10
stopwaitsecs = 600
priority=998

在我的产品里,我想开始芹菜。为此我正在做

^{pr2}$

当我这么做的时候它说

Error: .ini file does not include supervisord section

这是什么问题?在


Tags: 文件projectlogtruevarmyprojectconfhtml
1条回答
网友
1楼 · 发布于 2024-04-24 04:24:55

看起来您在配置文件中缺少[supervisord]部分,但这很可能是因为您没有加载主conf文件

docs

不应该用-c和conf.d文件启动supervisord,该文件夹中的文件通常是自动加载的。通常,-c是为在普通目录之外的其他地方创建的conf而保留的。在

如果在没有-c的情况下启动supervisord,它应该加载您的/etc/supervisor/supervisor.conf文件

您的conf文件应该如下所示:

; supervisor config file

[unix_http_server]
file=/var/run/supervisor.sock   ; (the path to the socket file)
chmod=0700                       ; sockef file mode (default 0700)

[supervisord]
logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log)
pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
childlogdir=/var/log/supervisor            ; ('AUTO' child log dir, default $TEMP)

; the below section must remain in the config file for RPC
; (supervisorctl/web interface) to work, additional interfaces may be
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface

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

; The [include] section can just contain the "files" setting.  This
; setting can list multiple files (separated by whitespace or
; newlines).  It can also contain wildcards.  The filenames are
; interpreted as relative to this file.  Included files *cannot*
; include files themselves.

[include]
files = /etc/supervisor/conf.d/*.conf

如您所见,它会自动加载conf.d文件夹中的所有conf文件

相关问题 更多 >