Permalink
Browse files

Step 3 - Works on cloudfoundry

  • Loading branch information...
1 parent 58cf846 commit 0f617063e56a5b1041f6eca374f1ff009b9747cf ciberch committed May 15, 2012
Showing with 21 additions and 6 deletions.
  1. +16 −0 manifest.yml
  2. +1 −1 public/js/jquery.client.js
  3. +2 −2 server.js
  4. +2 −3 siteConfig.js
View
@@ -0,0 +1,16 @@
+---
+applications:
@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
@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
@@ -17,7 +17,7 @@
var socketIoClient = io.connect(null, {
'port': '#socketIoPort#'
, 'rememberTransport': true
- , 'transports': ['websocket', 'xhr-multipart', 'xhr-polling', 'htmlfile', 'flashsocket']
+ , 'transports': ['xhr-polling']
@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');
View
@@ -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);
@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);
@@ -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
@ciberch

ciberch May 18, 2012

Owner

Internal request on ephemeral port and host

, 'jquery.client.js'
]
, 'debug': true
View
@@ -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
@@ -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.