简体   繁体   English

无法将Node应用程序部署到Openshift

[英]Unable to deploy Node app to Openshift

I'm trying to deploy a simple ExpressJS app I have to Openshift using the command line tools. 我正在尝试使用命令行工具部署一个简单的ExpressJS应用程序,我必须使用Openshift I've provided a debug trace below: 我在下面提供了一个调试跟踪:

>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)

and

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

However my app is listening on port 8080: 但是我的应用程序正在侦听端口8080:

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

Can anyone help? 有人可以帮忙吗?

Deploying an empty application doesn't seem to throw any errors. 部署空应用程序似乎不会引发任何错误。

Have you checked the log on the server? 你检查过服务器上的日志了吗? I was encountering a similar issue and it was because I had syntax errors in my script. 我遇到了类似的问题,因为我的脚本中存在语法错误。 If you SSH into your application and 如果你SSH到你的应用程序和

tail app-root/logs/nodejs.log

you can see the console output for the app. 你可以看到应用程序的控制台输出。 Use -n [# of lines] to view more of the log if 10 isn't enough or use less and press shift + g to view the document starting at the bottom if you want to scroll up and down through it all. 如果你想要向上和向下滚动所有内容,请使用-n [行数]查看更多日志(如果10不够或使用更少)并按shift + g查看从底部开始的文档。

Try to login via ssh to your openshift node. 尝试通过ssh登录到您的openshift节点。 I use the rhc tool . 我使用rhc工具 Run your code and you will see where the problem is. 运行您的代码,您将看到问题所在。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM