0

I have a simple node project that I am trying to get deployed to Openshift Online 3 but having some ip and port problems. Reading the documentation I need to get some environment variables from openshift system, seems legit. But Openshift doesn't seem to set the variables OPENSHIFT_NODEJS_PORT and OPENSHIFT_NODEJS_IP.

Using the example below:

var express = require('express');
var app = express();
var server_ip_address = process.env.OPENSHIFT_NODEJS_IP || '127.0.0.1'
var port = process.env.OPENSHIFT_NODEJS_PORT || 1212

console.log('environment_port: ' + process.env.OPENSHIFT_NODEJS_PORT);
console.log('environment_ip: ' + process.env.OPENSHIFT_NODEJS_IP);

app.listen(port, server_ip_address, function (err) {
    console.log('Running on port ' + port + ' ip: ' + server_ip_address);
});

I get the following output from openshift logs:

enter image description here

Why isn't Openshift Online 3 setting the system varaibles?

1 Answer 1

2

In OpenShift 3, no environment variables will be set. Your HTTP server process should listen on port 8080 if using one of the S2I builders.

Sign up to request clarification or add additional context in comments.

7 Comments

Hi, I'm facing the same problem on my migration :S Can you explain me a bit more? What about IP ? Thx!
Default to 0.0.0.0 instead of 127.0.0.1.
Thx! My app is now running with 0.0.0.0 with debug print "App listening on 0.0.0.0:8080" but still not available to the world, Am I missing something to expose my express.js end points? On version 2, everything was ok. Mistery... now end points are live! Now my telegram bot is the only part with no connection...
How did you create the application, through the web console or on the command line? If you used the command line, a route to expose it via a URL to the public is NOT created and you need to create one yourself using os expose svc yourappname.
I did it by web console, it now exposed (a bit slow...) -> granadabusnode6-granadabus.1d35.starter-us-east-1.openshiftapps… Next is expose my telegram bot... Do I need to open any kind of ports or similar? THX!!!
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.