supervisor.conf 默认位置

新手上路,请多包涵

我正在尝试进行自动部署,包括 supervisord 并被默认设置路径混淆。

我发现的每个部署方案都使用 /etc/supervisor/supervisor.conf/etc/supervisor/conf.d/ 没有任何预设和链接,而且,在通过 apt-get 安装 supervisor 包之后,这个路径实际上是由示例配置填充的。

在此 示例 中,流程看起来像这样,没有任何链接和创建类似 /etc/supervisor.conf 内容:

 sudo('apt-get -y install supervisor')
put('config/supervisor_gunicorn.conf', '/etc/supervisor/conf.d/gunicorn.conf', use_sudo=True)
sudo('supervisorctl reload')

但在 supervisorctl 此路径未指定为默认路径,并且假设默认位置在某处 /etc/supervisor.conf 手册 中指定

我尝试以所有可能的方式安装主管,但我无法获得结果。

我知道这只是愚蠢的小细节,但我将非常感谢您帮助我保持良好的部署方案。

原文由 mrjj 发布,翻译遵循 CC BY-SA 4.0 许可协议

阅读 551
2 个回答

通常 默认文件确实是 /etc/supervisor.conf ,但是 Debian 发行版对此进行了修补(链接到 Debian 提供的 gzip 补丁)以首先查找 /etc/supervisor/supervisor.conf

 --- supervisor-3.0a8.orig/src/supervisor/options.py
+++ supervisor-3.0a8/src/supervisor/options.py
@@ -105,7 +105,7 @@
     def default_configfile(self):
         """Return the name of the found config file or raise. """
         paths = ['supervisord.conf', 'etc/supervisord.conf',
-                 '/etc/supervisord.conf']
+                 '/etc/supervisor/supervisord.conf', '/etc/supervisord.conf']
         config = None
         for path in paths:
             if os.path.exists(path):

So with that patch, supervisor looks for supervisord.conf in the local directory, in the etc/ subdirectory, then in the global /etc/supervisor/ and /etc/ 目录。

Debian 安装的默认 supervisord.conf 文件末尾有这个:

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

导致 supervisord 加载放在 conf.d 目录中的任何额外文件。

原文由 Martijn Pieters 发布,翻译遵循 CC BY-SA 3.0 许可协议

您可能已经通过 pip 安装了 supervisor,因此在

/usr/local/lib/python2.7/dist-packages/supervisor/

优先于补丁版本

/usr/lib/pymodules/python2.7/supervisor

有关补丁的详细信息,请参阅 Martjin 的回答。简单的解决方案是:

pip uninstall supervisor

然后重新运行包安装,以防它只是部分安装:

apt-get install supervisor

还要确保您的 /etc/supervisor/supervisord.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

原文由 crizCraig 发布,翻译遵循 CC BY-SA 3.0 许可协议

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题