Application 'Appname' Failed to Start (Port 8080 Not Available) on Open Shift Node App

Application failed to start (port 8080) not available

The error turned out to be a generic error that had nothing to do with the port. Apparently, if there is any fatal javascript error, it gives this message.

Running an OpenShift node server: Getting error Application 'appname' failed to start (port 8080 not available)

The standart Openshift Node.js cartridge gives you the Port and IP you should listen to with environment variables.

I would use something like that because PORT and IP are more common ways to do that, and if nothing is provided (dev environment), it listens to the same like right now:

const PORT = process.env.OPENSHIFT_NODEJS_PORT ||process.env.PORT || 8080;
const IP = process.env.OPENSHIFT_NODEJS_IP || process.env.IP || '0.0.0.0';

OpenShift: Failed to execute control start on node application

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.

How do I make Openshift to use Express 4, instead of its installed Express 3?

Here's how to troubleshoot:

  • ssh into your cartridge
  • cd into the app-root/repo directory
  • run grep version ./node_modules/express/package.json
  • you should see a version based on your package.json dependency
  • verify your package.json has a scripts section containing a start command that just runs your app with something like node ./server.js (server.js being whatever file you coded your main app start script in). You don't need the express command line program to launch an express server. It's for setting up new project boilerplate and other ancillary tasks.
  • To see the version of express running within your app, you can add this code to your server.js (or equivalent) file: console.log(require("express/package").version);

Cannot connect to live database in Nodejs Openshift Application

If your application code works locally while connecting to your remote OpenShift-hosted DB (using rhc port-forward), then I would suspect that your app may have some undocumented dependencies.

It could be that you've installed something locally (or globally) in your dev environment, without including that dep in your app's package.json file.

Make sure that everything your app needs in order to run in a fresh environment is included in your app's package.json file before pushing it to OpenShift.

npm install my_dependency --save

I've written up some additional notes that might be useful for testing locally with a port-forwarded connection to an OpenShift-hosted DB: https://www.openshift.com/blogs/set-up-local-access-to-openshift-hosted-services-with-port-forwarding



Related Topics



Leave a reply



Submit