OpenShift:在节点应用程序上“控制启动失败”

时间:2021-09-13 22:45:34

I realize in advance this is kind of a vague question, but I'm stumped as to what else I can try here...

我事先就意识到这是一个模糊的问题,但我不知道我还能在这里尝试什么……

I've been going through other SO questions and following their recommendations but so far nothing has solved my issue yet.

我也遇到过类似的问题,也遵循过他们的建议,但到目前为止,还没有什么能解决我的问题。

Here's the specific error I'm getting.

这是我得到的具体误差。

Stopping NodeJS cartridge
Fri Jul 10 2015 10:36:28 GMT-0400 (EDT): Stopping application 'appname' ...
Fri Jul 10 2015 10:36:29 GMT-0400 (EDT): Stopped Node application 'appname'

Starting NodeJS cartridge
Fri Jul 10 2015 10:36:30 GMT-0400 (EDT): Starting application 'appname' ...

Waiting for application port (8080) become available ...

Application 'appname' failed to start (port 8080 not available)

Failed to execute: 'control restart' for /var/lib/openshift/MYID/nodejs

My package.json file is up to date will all my dependencies, has the scripts: { start: 'node server.js' } property and yet I'm still getting this error.

我的包。json文件是最新的将我所有的依赖项,有脚本:{start: 'node server。js'}属性,但我仍然得到这个错误。

If I SSH in and go to my current/repo directory and run node server.js it works fine. However, I can't just use screen to run it in the background forever.

如果我SSH到当前/repo目录并运行节点服务器。js效果好。但是,我不能只使用屏幕永远在后台运行它。

I've also tried for stopping and restarting, git pushing, and restarting through the browser. I'm stumped as to what else I can try to get my (very simple) node application running on OpenShift.

我还尝试通过浏览器停止和重新启动、git推送和重新启动。在OpenShift上运行我的(非常简单的)节点应用程序时,我还能做些什么呢?

Any suggestions are much appreciated.

非常感谢您的建议。

2 个解决方案

#1


13  

For an OpenShift Node app you need to specify the start script as: main: "server.js" instead of using scripts. This is due to the way Node applications are started on OpenShift using node-supervisor.

对于OpenShift节点应用程序,您需要将开始脚本指定为:main:“server”。而不是使用脚本。这是因为节点管理器在OpenShift上启动节点应用程序的方式。

#2


12  

OpenShift Node apps require you to give the configuration to start your app in package.json under main and scripts.start:

OpenShift节点应用程序需要您提供配置来启动应用程序。开始:

"scripts": {
     "start": "node server.js"
  },
"main": "server.js"

Further it also requires to give it IP and PORT provided by your node environment through environment variables:

此外,它还需要通过环境变量为其提供您的节点环境提供的IP和端口:

for PORT Number       process.env.OPENSHIFT_NODEJS_PORT
for IP                process.env.OPENSHIFT_NODEJS_IP

If these variables not used in app , it shows error which looks like:

如果这些变量不在app中使用,则会出现如下错误:

Waiting for application port (8080) become available ...
Application 'appname' failed to start (port 8080 not available)

Here is an example to show how to use these environment variables in your node app(from source):

下面是一个示例,演示如何在您的节点应用程序(从源代码)中使用这些环境变量:

var server_port = process.env.OPENSHIFT_NODEJS_PORT || 8080
var server_ip_address = process.env.OPENSHIFT_NODEJS_IP || '127.0.0.1'

server.listen(server_port, server_ip_address, function () {
console.log( "Listening on " + server_ip_address + ", server_port " + port )
});

Source: https://blog.openshift.com/run-your-nodejs-projects-on-openshift-in-two-simple-steps/

来源:https://blog.openshift.com/run-your-nodejs-projects-on-openshift-in-two-simple-steps/

Related Post: Application 'appname' failed to start (port 8080 not available) on open shift node app

相关帖子:应用“appname”在open shift节点app上启动失败(端口8080不可用)

#1


13  

For an OpenShift Node app you need to specify the start script as: main: "server.js" instead of using scripts. This is due to the way Node applications are started on OpenShift using node-supervisor.

对于OpenShift节点应用程序,您需要将开始脚本指定为:main:“server”。而不是使用脚本。这是因为节点管理器在OpenShift上启动节点应用程序的方式。

#2


12  

OpenShift Node apps require you to give the configuration to start your app in package.json under main and scripts.start:

OpenShift节点应用程序需要您提供配置来启动应用程序。开始:

"scripts": {
     "start": "node server.js"
  },
"main": "server.js"

Further it also requires to give it IP and PORT provided by your node environment through environment variables:

此外,它还需要通过环境变量为其提供您的节点环境提供的IP和端口:

for PORT Number       process.env.OPENSHIFT_NODEJS_PORT
for IP                process.env.OPENSHIFT_NODEJS_IP

If these variables not used in app , it shows error which looks like:

如果这些变量不在app中使用,则会出现如下错误:

Waiting for application port (8080) become available ...
Application 'appname' failed to start (port 8080 not available)

Here is an example to show how to use these environment variables in your node app(from source):

下面是一个示例,演示如何在您的节点应用程序(从源代码)中使用这些环境变量:

var server_port = process.env.OPENSHIFT_NODEJS_PORT || 8080
var server_ip_address = process.env.OPENSHIFT_NODEJS_IP || '127.0.0.1'

server.listen(server_port, server_ip_address, function () {
console.log( "Listening on " + server_ip_address + ", server_port " + port )
});

Source: https://blog.openshift.com/run-your-nodejs-projects-on-openshift-in-two-simple-steps/

来源:https://blog.openshift.com/run-your-nodejs-projects-on-openshift-in-two-simple-steps/

Related Post: Application 'appname' failed to start (port 8080 not available) on open shift node app

相关帖子:应用“appname”在open shift节点app上启动失败(端口8080不可用)