Search code examples
mongodbopenshiftkeystone

Keystone and openshift, getting 503 error


Can anyone please help me install keystone.js on my openshift app?

I've pushed all my files to the remote, but get a 503 error when I browse to my page. I'm quite new to Openshift, can anyone please point me in the right direction?

I have tried changing keystone.init to:

var connectionString = process.env.OPENSHIFT_MONGODB_DB_USERNAME + ":" +  process.env.OPENSHIFT_MONGODB_DB_PASSWORD + "@" + process.env.OPENSHIFT_MONGODB_DB_HOST + dbName;

console.log(connectionString);

keystone.set('mongo', connectionString);

keystone.init({
'mongo': connectionString,

Still no joy, I dont get any console errors either.

Any advice much appreciated.

UPDATE: checked logs and found the following:

SyntaxError: Unexpected end of input
    at Module._compile (module.js:439:25)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/var/lib/openshift/5501b0c04382ecfefe0000a2/app-root/runtime/repo/node_modules/keystone/index.js:3:6)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
DEBUG: Program node keystone.js exited with code 8
DEBUG: Starting child process with 'node keystone.js'
hit me
/var/lib/openshift/5501b0c04382ecfefe0000a2/app-root/runtime/repo/node_modules/underscore/underscore.js:561
});

SyntaxError: Unexpected end of input
    at Module._compile (module.js:439:25)

Keystone.js

// Simulate config options from your production environment by
// customising the .env file in your project's root folder.

// Require keystone
var keystone = require('keystone');

// Initialise Keystone with your project's configuration.
// See http://keystonejs.com/guide/config for available options
// and documentation.

var dbName = "node";

var connectionString = process.env.OPENSHIFT_MONGODB_DB_USERNAME + ":" +  process.env.OPENSHIFT_MONGODB_DB_PASSWORD + "@" + process.env.OPENSHIFT_MONGODB_DB_HOST + dbName;

console.log(connectionString);

keystone.set('mongo', connectionString);

keystone.init({
    'mongo': connectionString,
    'name': 'node',
    'brand': 'node',

    'sass': 'public',
    'static': 'public',
    'favicon': 'public/favicon.ico',
    'views': 'templates/views',
    'view engine': 'jade',

    'auto update': true,
    'session': true,
    'auth': true,
    'user model': 'User',
    'cookie secret': '^<S0$!?a778,)~[Fx4wQvgcTw]fWq.)<s`cAJc:bExU*(L&ty9;mSV?`am:*7f.P'

});

// Load your project's Models

keystone.import('models');

// Setup common locals for your templates. The following are required for the
// bundled templates and layouts. Any runtime locals (that should be set uniquely
// for each request) should be added to ./routes/middleware.js

keystone.set('locals', {
    _: require('underscore'),
    env: keystone.get('env'),
    utils: keystone.utils,
    editable: keystone.content.editable
});

// Load your project's Routes

keystone.set('routes', require('./routes'));

// Setup common locals for your emails. The following are required by Keystone's
// default email templates, you may remove them if you're using your own.

// Configure the navigation bar in Keystone's Admin UI

keystone.set('nav', {
    'posts': ['posts', 'post-categories'],
    'enquiries': 'enquiries',
    'users': 'users'
});

// Start Keystone to connect to your database and initialise the web server

keystone.start();

Solution

  • Fixed this by making sure all node modules were on the server, pushing to the repo using sourcetree kept timing out, so the modules weren't there. I FTP'd them instead.