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 astart
command that just runs your app with something likenode ./server.js
(server.js being whatever file you coded your main app start script in). You don't need theexpress
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
Crontab Run Every 15 Minutes Between Certain Hours
How to Launch a New Process That Is Not a Child of the Original Process
Performance Difference Between Ipc Shared Memory and Threads Memory
List Supported Ssl/Tls Versions for a Specific Openssl Build
Create New File But Add Number If Filename Already Exists in Bash
How to Check the Version of Openmp on Linux
Rename Files in Multiple Directories to the Name of the Directory
Gurus Say That Ld_Library_Path Is Bad - What's the Alternative
Loading Multiple Shared Libraries with Different Versions
How to Get the Last Word in Each Line with Bash
Git: Can't Push (Unpacker Error) Related to Permission Issues
Simulate a Faulty Block Device with Read Errors
Identifying Received Signal Name in Bash
How to Tell If a File Is Older Than 30 Minutes from /Bin/Sh