0

i´m trying to host my node.js steambot on openshift, i haven´t used it before, so basicly what i´m trying is to Commit a basic "in my eyes, not a server" to their nodejs "hosting".

so, when i commit the files and such, everytime the app starts, it tells me that "port 8080 is not available" and so it can´t start. idk what is blocking the port so.

what could be the issue ?

regards

Z8pn
  • 40
  • 4

2 Answers2

2

The openshift environment is very restrictively firewalled for security reasons. As such you cannot open just any port for your server. The only port you're allowed to open is:

process.env.OPENSHIFT_NODEJS_PORT

If you do testing on your own machine before uploading to openshift, it is useful to check if this environment variable exist or use your own port (like 8080). So you'd typically use do:

var port = process.env.OPENSHIFT_NODEJS_PORT || 8080;

For the outside, you access your openshift server using the URL they gave you at port 80.

slebetman
  • 109,858
  • 19
  • 140
  • 171
0

OpenShift will routinely check your application to see if it is working correctly. The expectation is that all apps are "web apps", so if you are not listening on the correct port, your app may get rebooted, suspended, or may fail to start correctly.

For your bot to appear to be in good health, you'll need to bind to (process.env.OPENSHIFT_NODEJS_PORT ,process.env.OPENSHIFT_NODEJS_IP), as described in "Run Your Nodejs projects on OpenShift in Two Simple Steps".

Returning a simple HTTP 200 on "/" should be enough to convince OpenShift that your bot (web app) is in good health.

ʀɣαɳĵ
  • 1,992
  • 1
  • 15
  • 20