Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Step 3 - Works on cloudfoundry

  • Loading branch information...
commit 0f617063e56a5b1041f6eca374f1ff009b9747cf 1 parent 58cf846
@ciberch authored
View
16 manifest.yml
@@ -0,0 +1,16 @@
+---
+applications:
@ciberch Owner
ciberch added a note

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ .:
+ name: node-express-start
@ciberch Owner
ciberch added a note

Change the name to something that is not taken

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ instances: 1
+ framework:
+ name: node
+ info:
+ exec:
+ description: Node.js Application
+ mem: 128M
+ url: ${name}.${target-base}
+ services:
+ redis-asms:
+ type: redis
+ mem: 128M
View
2  public/js/jquery.client.js
@@ -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 Owner
ciberch added a note

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
});
socketIoClient.on('connect', function () {
$$('#connected').addClass('on').find('strong').text('Online');
View
4 server.js
@@ -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 Owner
ciberch added a note

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
// 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 Owner
ciberch added a note

Internal request on ephemeral port and host

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
, 'jquery.client.js'
]
, 'debug': true
View
5 siteConfig.js
@@ -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;
Please sign in to comment.
Something went wrong with that request. Please try again.