以下来自我的 cf push 的日志转储:
2014-09-09T15:47:35.92+0530 [App/0] ERR 2014-09-09T15:47:35.97+0530 [DEA] OUT 实例(索引 0)无法开始接受连接 2014-09-09T15:47: 55.71+0530 [DEA] OUT 使用 guid 20dba222-e0e6-453c-96a9-429940bc7002 启动应用程序实例(索引 0) 2014-09-09T15:47:57.59+0530 [API] OUT 应用程序实例以 guid 20dba222-e0e6-453c 退出-96a9-429940bc7002 有效载荷:{"cc_partition"=>"default", "droplet"=>"20dba222-e0e6-453c-96a9-429940bc7002", "version"=>"832505e6-a95d-4696-910e-a8d4a74a7005", "instance"=>"4ff487a75a674aa79b234cc1bd8f9a3d", "index"=>0, "reason"=>"CRASHED", "exit_status"=>0, "exit_description"=>"应用程序实例退出", "crash_timestamp"=>1410257878} 2014-09-09T
这就是我的 manifest.yml 文件的样子:
applications:
- name: nodetestSDB
memory: 128M
command: node app.js
services:
- mongodbnode
这就是我的 package.json 文件的样子:
{
"name": "nodetest2",
"version": "0.0.0",
"private": true,
"scripts": {
"start": "node ./bin/www"
},
"dependencies": {
"express": "~4.8.6",
"body-parser": "~1.6.6",
"cookie-parser": "~1.3.2",
"morgan": "~1.2.3",
"serve-favicon": "~2.0.1",
"debug": "~1.0.4",
"jade": "~1.5.0",
"mongodb": "*",
"monk": "*"
}
}
app.js 中的环境变量:
if (process.env.VCAP_SERVICES) {
var env = JSON.parse(process.env.VCAP_SERVICES);
if (env['mongodb-2.2']) {
var mongo = env['mongodb-2.2'][0]['credentials'];
}
var db = monk(mongo.url);
}