Dotcloud nodejs supervisord.conf不工作 [英] Dotcloud nodejs supervisord.conf not working
问题描述
我一直在试图让我的nodejs服务器进程受到主管的监视,但是我有使supervisord.conf工作的问题。当我部署时,我收到以下错误:
I've been trying to get my nodejs server process to be monitored by supervisor, however I'm having issues getting supervisord.conf to work. When I deploy, I get the following error:
WARNING: The service crashed at startup or is listening to the wrong port. It failed to respond on port "node" (42801) within 30 seconds. Please check the application logs.
然而,当我进入dotcloud服务器并手动启动nodejs进程时,它运行正常,表示该主管无法启动节点实例。
However when I ssh into the dotcloud server and manually start the nodejs process, it runs just fine, indicating that supervisor is failing to start the node instance.
我的supervisord.conf如下所示:
My supervisord.conf looks like this:
[program:node]
command = node /home/dotcloud/current/app/server.js
autostart=true
autorestart=true
我的目录结构如下:
.dotcloudignore
dotcloud.yml
.gitignore
app/
app/package.json
app/server.js
app/supervisord.conf
在这一点上,我看不到我做错了什么这似乎与这里所列出的目录结构相同,所以我是对于什么是解决方案是失败的。任何想法?
At this point, I can't see what I'm doing wrong, as this appears to be the same directory structure as outlined here, so I'm kind of at a loss as to what the solution is. Any ideas?
编辑:
尝试 supervisorctl状态
我得到以下内容:
node FATAL Exited too quickly (process log may have details)
我发现在/ var / log / supervisor中,我收到以下错误消息:
I've found that in /var/log/supervisor, I'm getting the following error message:
module.js:337
throw new Error("Cannot find module '" + request + "'");
^
Error: Cannot find module '/home/dotcloud/current/app/server.js'
at Function._resolveFilename (module.js:337:11)
at Function._load (module.js:279:25)
at Array.0 (module.js:484:10)
at EventEmitter._tickCallback (node.js:190:38)
我不知道是什么导致的。
I'm not sure what is causing this.
推荐答案
调查问题后,看起来这个问题来自于 dotcloud.yml
指定 approot的事实:应用
。在这种情况下,请注意:
After investigating the issue, it looks like the issue came from the fact that dotcloud.yml
specified approot: app
. In that case, it is useful to note that:
-
/ home / dotcloud / code
将指向整个代码存储库; -
/ home / dotcloud / current
将指向审核(更具体地说, code> / home / dotcloud / current 将是一个符号链接,在这种情况下,code / app
li>
/home/dotcloud/code
will point to the whole code repository;/home/dotcloud/current
will point to the approot (more specifically,/home/dotcloud/current
will be a symlink to the approot, i.e.code/app
in that case).
因此, supervisord.conf
不应包含:
command = node /home/dotcloud/current/app/server.js
但是,而是:
command = node /home/dotcloud/current/server.js
Node.js中的关键是自己记录,因为Node.js抱怨无法找到 /home/dotcloud/current/app/server.js
。
The key was in the Node.js logs themselves, since Node.js was complaining about being unable to locate /home/dotcloud/current/app/server.js
.
这篇关于Dotcloud nodejs supervisord.conf不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!