Created
September 8, 2011 14:50
-
-
Save yssk22/1203589 to your computer and use it in GitHub Desktop.
Example: running node application with C-based add-on modules on CloudFoundry
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var rimraf = require('rimraf'), | |
path = require('path'), | |
fs = require('fs'); | |
// add-on modules | |
var cf_modules = ['iconv', 'jsdom']; | |
module.exports = function(cb){ | |
if( process.env.VCAP_APP_PORT ){ | |
// in cloud foundry | |
// symlink to precompiled module | |
['iconv', 'jsdom'].forEach(function(m){ | |
try{ | |
rimraf.sync(path.join(__dirname, '../node_modules/', m)); | |
}catch(e){ | |
} | |
fs.symlinkSync(path.join(__dirname, '../cf_modules/', m), | |
path.join(__dirname, '../node_modules/', m)); | |
}); | |
cb(); | |
}else{ | |
cb(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
before push application, prepare modules build on Ubuntu 64bit in APP_ROOT/cf_modules/ directory.