【问题标题】:Unable to deploy Node app to Openshift无法将 Node 应用程序部署到 Openshift
【发布时间】:2015-08-15 19:25:45
【问题描述】:

我正在尝试部署一个简单的 ExpressJS 应用程序,我必须使用命令行工具来 Openshift。我在下面提供了调试跟踪:

>npm info ok 
Preparing build for deployment
Deployment id is 5e2abc99
Activating deployment
HAProxy already running
HAProxy instance is started
Starting NodeJS cartridge
Sat Aug 15 2015 15:17:47 GMT-0400 (EDT): Starting application 'xxxxx' ...
Waiting for application port (8080) become available ...
Application 'xxxxx' failed to start (port 8080 not available)

Git Post-Receive Result: failure
Activation status: failure
Activation failed for the following gears:
55cf8fc589f5cf9dbf00023c (Error activating gear: CLIENT_ERROR: Failed to execute: 'control start' for /var/lib/openshift/55cf8fc589f5cf9dbf00023c/nodejs
#<IO:0x00000001ec7290>
#<IO:0x00000001ec7218>
>)
Deployment completed with status: failure
postreceive failed

但是我的应用正在监听 8080 端口:

app.listen(process.env.OPENSHIFT_NODEJS_PORT || 8080);

有人可以帮忙吗?

部署一个空的应用程序似乎不会引发任何错误。

【问题讨论】:

  • 您解决了这个问题吗?我也遇到了同样的问题

标签: javascript node.js openshift openshift-cartridge


【解决方案1】:

您检查过服务器上的日志吗?我遇到了类似的问题,这是因为我的脚本中有语法错误。如果您通过 SSH 连接到您的应用程序并且

tail app-root/logs/nodejs.log

您可以看到应用程序的控制台输出。如果 10 行不够,请使用 -n [# of lines] 查看更多日志,或者使用 less 并按 shift + g 查看从底部开始的文档,如果您想向上滚动并通过这一切。

【讨论】:

  • 这将更适合作为对该问题的评论。
  • 问题是服务器在失败时会自行销毁,所以没有日志可查
【解决方案2】:

尝试通过 ssh 登录到您的 openshift 节点。我使用rhc tool。运行你的代码,你会发现问题出在哪里。

【讨论】:

    猜你喜欢
    • 2014-01-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-08-26
    • 1970-01-01
    • 2014-04-30
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多