As the title suggested, I\'ve been playing around deploying apps with Amazons new OpsWorks management system, however I haven\'t been able to figure out how to get the node serv
Great answer from ZachRabbit. I'd just like to add that OpsWorks now supports setting of environment variables (i.e. process.env.PORT) for the deployed application process.
When you Add App (or edit) you can go ahead and set up an environment variable with a key of PORT and a value of 80 if you're using something like the following in your server.js:
!/usr/bin/env node
var debug = require('debug')('my-app');
var app = require('app');
app.set('port', process.env.PORT || 3000);
var server = app.listen(app.get('port'), function() {
debug('Express server listening on port ' + server.address().port);
});
More information on the setting of the environment variables can be found here:
http://docs.aws.amazon.com/opsworks/latest/userguide/apps-environment-vars.html
Ensuring that the filename was server.js and setting the environment variable PORT to 80 worked like a champ for me.