我试图部署一个节点6.0服务器与mongo 3.2到openshift。 我已经成功地创建使用节点DIY盒的应用,因为在这里找到:http://cartreflect-claytondev.rhcloud.com/reflect?github=connyay/openshift-node-diy打开移动节点+ mongodb无法启动
,并给它添加一个蒙戈DIY盒以及:https://raw.githubusercontent.com/icflorescu/openshift-cartridge-mongodb/master/metadata/manifest.yml
此外,我已经添加.Openshift \ action_hooks文件它将npm install作为构建脚本的一部分。
现在到了怪异的部分,在推送更改和依赖项完成安装后,我得到正常消息说部署成功。但是,当我尝试访问它时,服务器不断返回503错误。我试图RHC尾打电话追查出了什么服务器启动过程中错误的,但我得到的是这样的日志从MongoDB的:
2016-08-02T10:24:41.848-0400 I STORAGE [main] Engine custom option: cache_size=256M
2016-08-02T10:24:41.858-0400 I CONTROL [initandlisten] MongoDB starting : pid=263740 port=27017 dbpath=/var/lib/openshift/57a0601f0c1e66334d000014/app-root/data/.mongodb/data 64-bit host=ex-std-node712.prod.rhcloud.com
2016-08-02T10:24:41.858-0400 I CONTROL [initandlisten] db version v3.2.7
2016-08-02T10:24:41.858-0400 I CONTROL [initandlisten] git version: 4249c1d2b5999ebbf1fdf3bc0e0e3b3ff5c0aaf2
2016-08-02T10:24:41.858-0400 I CONTROL [initandlisten] allocator: tcmalloc
2016-08-02T10:24:41.858-0400 I CONTROL [initandlisten] modules: none
2016-08-02T10:24:41.858-0400 I CONTROL [initandlisten] build environment:
2016-08-02T10:24:41.858-0400 I CONTROL [initandlisten] distarch: x86_64
2016-08-02T10:24:41.858-0400 I CONTROL [initandlisten] target_arch: x86_64
2016-08-02T10:24:41.858-0400 I CONTROL [initandlisten] options: { net: { bindIp: "127.7.166.130", unixDomainSocket: { enabled: false } }, storage: { dbPath: "/var/lib/openshift/57a0601f0c1e66334d000014/app-root/data/.mongodb/data", engine: "wiredTiger", wiredTiger: { engineConfig: { configString: "cache_size=256M" } } }, systemLog: { logAppend: true, logRotate: "reopen", quiet: true } }
2016-08-02T10:24:41.920-0400 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=8G,session_max=20000,eviction=(threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0),cache_size=256M
2016-08-02T10:24:42.466-0400 I CONTROL [initandlisten]
2016-08-02T10:24:42.466-0400 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
2016-08-02T10:24:42.466-0400 I CONTROL [initandlisten] ** We suggest setting it to 'never'
2016-08-02T10:24:42.466-0400 I CONTROL [initandlisten]
2016-08-02T10:24:42.466-0400 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
2016-08-02T10:24:42.466-0400 I CONTROL [initandlisten] ** We suggest setting it to 'never'
2016-08-02T10:24:42.466-0400 I CONTROL [initandlisten]
2016-08-02T10:24:42.466-0400 I CONTROL [initandlisten] ** WARNING: soft rlimits too low. rlimits set to 350 processes, 1024 files. Number of processes should be at least 512 : 0.5 times number of files.
2016-08-02T10:24:42.466-0400 I CONTROL [initandlisten]
2016-08-02T10:24:42.473-0400 I FTDC [initandlisten] Initializing full-time diagnostic data capture with directory '/var/lib/openshift/57a0601f0c1e66334d000014/app-root/data/.mongodb/data/diagnostic.data'
2016-08-02T10:24:42.515-0400 I NETWORK [HostnameCanonicalizationWorker] Starting hostname canonicalization worker
2016-08-02T10:24:42.521-0400 I NETWORK [initandlisten] waiting for connections on port 27017
其次是这个错误日志(由节点抛出显然,虽然找不到一个文件:
> [email protected] start /var/lib/openshift/57a0601f0c1e66334d000014/app-root/runtime/repo
> NODE_ENV=development;DEBUG=*,-not_this,-morgan;node ./bin/www
Port 8080 is already in use
npm ERR! Linux 2.6.32-573.26.1.el6.x86_64
npm ERR! argv "/var/lib/openshift/57a0601f0c1e66334d000014/node-diy/bin/node/bin/node" "/var/lib/openshift/57a0601f0c1e66334d000014/node-diy/bin/node/bin/npm" "start"
npm ERR! node v5.11.1
npm ERR! npm v3.8.6
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: `NODE_ENV=development;DEBUG=*,-not_this,-morgan;node ./bin/www`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script 'NODE_ENV=development;DEBUG=*,-not_this,-morgan;node ./bin/www'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the MyApp-API package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! NODE_ENV=development;DEBUG=*,-not_this,-morgan;node ./bin/www
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs MyApp-API
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls MyApp-API
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /var/lib/openshift/57a0601f0c1e66334d000014/app-root/runtime/repo/npm-debug.log
我失去了什么这里有不似乎这里是任何真正的错误消息,它只是说,我的scripts.start脚本失败,有些建议可能是一些与环境变量,但林不?。完全可以确定哪个可能会把事情搞得像这样
编辑
我还要提到的是我已经把我的WWW应用程序设置为使用时可用的openshift变量:
var port = normalizePort(process.env.OPENSHIFT_NODEDIY_PORT || '3000');
app.set('port', port);
var ip = process.env.OPENSHIFT_NODEDIY_IP || localhost; //'192.168.1.16'
app.set('ip', ip);
和蒙戈连接:
var mongodb_connection_string = 'mongodb://localhost/' + db_name;
//take advantage of openshift env vars when available:
if(process.env.MONGODB_URL){
mongodb_connection_string = process.env.MONGODB_URL + db_name;
}
编辑2 我最终设法找到存储我得到的节点错误的日志文件,似乎rhc尾巴没有返回l堆栈,但只有最后几行。整个日志实际上揭示了有关该问题的更多细节(请参阅上面编辑的错误)
是您的节点侦听正确的地址和端口? Openshift有一些你想使用的环境变量 –
@MicheleRicciardi看到我上面的编辑,这是你的意思吗?如果是这样,比是的 –
是的那些是我说的env变量,你是否也用端口和IP调用'app.listen'? –