Skip to content

Commit

Permalink
Step 3 - Works on cloudfoundry
Browse files Browse the repository at this point in the history
  • Loading branch information
ciberch committed May 15, 2012
1 parent 58cf846 commit 0f61706
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 6 deletions.
16 changes: 16 additions & 0 deletions manifest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
applications:

This comment has been minimized.

Copy link
@ciberch

ciberch May 18, 2012

Owner

This gets generated by vmc after you push your app so you can push it again later or push it to another cloud

.:
name: node-express-start

This comment has been minimized.

Copy link
@ciberch

ciberch May 18, 2012

Owner

Change the name to something that is not taken

instances: 1
framework:
name: node
info:
exec:
description: Node.js Application
mem: 128M
url: ${name}.${target-base}
services:
redis-asms:
type: redis
mem: 128M
2 changes: 1 addition & 1 deletion public/js/jquery.client.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
var socketIoClient = io.connect(null, {
'port': '#socketIoPort#'
, 'rememberTransport': true
, 'transports': ['websocket', 'xhr-multipart', 'xhr-polling', 'htmlfile', 'flashsocket']
, 'transports': ['xhr-polling']

This comment has been minimized.

Copy link
@ciberch

ciberch May 18, 2012

Owner

For now we have to use xhr-polling on Cloud Foundry.com

});
socketIoClient.on('connect', function () {
$$('#connected').addClass('on').find('strong').text('Online');
Expand Down
4 changes: 2 additions & 2 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ var RedisStore = require('connect-redis')(express);
var sessionStore = new RedisStore(siteConf.redisOptions);

var app = module.exports = express.createServer();
app.listen(siteConf.port, null);
app.listen(siteConf.internal_port, null);

This comment has been minimized.

Copy link
@ciberch

ciberch May 18, 2012

Owner

Listen on the ephemeral port assigned at runtime if on Cloud Foundry


// Setup socket.io server
var socketIo = new require('./lib/socket-io-server.js')(app, sessionStore);
Expand All @@ -39,7 +39,7 @@ var assetsSettings = {
, 'dataType': 'javascript'
, 'files': [
'http://code.jquery.com/jquery-latest.js'
, siteConf.uri+'/socket.io/socket.io.js' // special case since the socket.io module serves its own js
, 'http://' + siteConf.internal_host+ ':' + siteConf.internal_port + '/socket.io/socket.io.js' // special case since the socket.io module serves its own js

This comment has been minimized.

Copy link
@ciberch

ciberch May 18, 2012

Owner

Internal request on ephemeral port and host

, 'jquery.client.js'
]
, 'debug': true
Expand Down
5 changes: 2 additions & 3 deletions siteConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ var settings = {
};

if (cf.cloud) {
settings.uri = 'http://' + cf.app.name + '.cloudfoundry.com';
settings.uri = 'http://' + cf.app.name + '.cloudfoundry.com';
settings.internal_host = cf.host;
settings.internal_port = cf.port;
settings.port = 80; // CloudFoundry uses process.env.VMC_APP_PORT
settings.port = 80; // CloudFoundry uses process.env.VMC_APP_PORT

settings.airbrakeApiKey = process.env.airbrake_api_key; // Error logging, Get free API key from https://airbrakeapp.com/account/new/Free

Expand All @@ -47,6 +47,5 @@ if (cf.cloud) {
settings.redisOptions.host = redisConfig.hostname;
settings.redisOptions.pass = redisConfig.password;
}
settings.user_email = cf.app['users'][0];
}
module.exports = settings;

0 comments on commit 0f61706

Please sign in to comment.