Question

I'm starting with Open Shift PaaS and I picked a node.js app as my first try.

So far I'm getting a 503 when I try to access my app site.

I've tried:

  • Set my github repo,
  • set the ssh key at github and made Open Shift have it,
  • created a very simple app using express (I did install express by npm)
  • did commit and pushed all changes,
  • I did install rhc and ran rhc app restart -a nodejs

But I can't get it to work.

The rhc tail -a nodejs outputs:

DEBUG: Error: Cannot find module '/var/lib/openshift/531be41fe0b8cd3d12000003/app-root/runtime/repo/server.js'
    at Function._resolveFilename (module.js:337:11)
    at Function._load (module.js:279:25)
    at Array.0 (module.js:484:10)
    at EventEmitter._tickCallback (node.js:190:38)

DEBUG: Program node server.js exited with code 1

DEBUG: Starting child process with 'node server.js'

This is my app.js file:

var express = require('express')
var server = new express()
server.use(express.static(__dirname+"/public"))


server.get('/', function (request, response) {
    response.send(200)
})

server.listen(process.env.OPENSHIFT_NODEJS_PORT || 80)

EDIT

I've renamed app.js to server.js, did git add, commit and push, restarted app with rhc. but it's not working yet though.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top