Deployed Node app for OpenShift successfully, OpenShift still shows default page

So, here are the steps I've taken so far:

  • Created application in openshift
  • Re-cloning applications
  • Removed all files for the sample app in the cloned repo
  • Added project files
  • Git-Push executed and completed successfully.

I can still see the default landing page:

enter image description here

The only thing I can see in the deployment is logging this warning, which doesn’t make any sense because it’s not my code that does it (I’m just trying to deploy a sample application from Express)

enter image description here

Any ideas as to what might be causing this? I'm trying to dump Heroku but can't get the basic things to work.

UPDATE . I found this article on KB which explains how to run my own file (why this information is not documented and part of the main tutorial is outside of me). I am still unclear if the code is needed in server.js or not ... Or should I always use server.js as a wrapper for all my code.

https://www.openshift.com/kb/kb-e1048-how-can-i-run-my-own-nodejs-script

+1


source to share


1 answer


I found the answer here:

https://www.openshift.com/blogs/run-your-nodejs-projects-on-openshift-in-two-simple-steps

The bottom line is this:

  • Change main in package.json to set main to yourApp.js ( as per this article )
  • Make sure you are running your server with the correct IP and port in OpenShift (see below).


app.set('port', process.env.OPENSHIFT_NODEJS_PORT || 8080); app.set('ip', process.env.OPENSHIFT_NODEJS_IP || '127.0.0.1');

and then

http.createServer(app).listen(app.get('port'), app.get('ip'), function(){ console.log('Express server listening on port ' + app.get('port')); });

+1


source







All Articles