Failed to deploy Node app for Openshift

I am trying to deploy a simple ExpressJS application that I have Openshift using command line tools. I have 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 application listens on port 8080:

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

Can anyone help?

Deploying an empty application does not seem to cause errors.

+4
source share
2 answers

Have you checked the log on the server? I ran into a similar problem, and this happened because I had syntax errors in my script. If you use SSH in your application and

 tail app-root/logs/nodejs.log 

you can see the console output for the application. Use -n [# lines] to view more logs if 10 is not enough or use less, and press shift + g to view the document starting at the bottom if you want to scroll up and down.

+9
source

Try logging in via ssh to go to openshift node. I am using the rhc tool. Run your code and you will see where the problem is.

0
source

All Articles