如何解决openshift中parsing服务器的8080端口不可用错误
我将我的数据后端迁移到parse.com的openshift。
第1步 。 我将项目的openshift端口绑定更改为以下内容
//var port = process.env.PORT || 1337; var port = parseInt(process.env.OPENSHIFT_NODEJS_PORT) || 8080; var httpServer = http.createServer(app); httpServer.listen(port, function() { console.log('parse-server-example running on port ' + port + '.'); });
并作为我的新回购伙伴https://github.com/kyawzinsoe/parse-server-example.git
第2步。然后,我用下面的命令创build一个与我的分析服务器回购的齿轮。 rhc app-create myserver nodejs-0.10 mongodb-2 –from-code = https://github.com/kyawzinsoe/parse-server-example.git
但是它显示8080端口问题如下
我错过了什么? 请帮帮我。
您需要使用节点4.1+与parsing服务器。 OpenShift运行0.10.x
你可以使用这个回购https://github.com/h4t0n/nodejs-4-lts-openshift在你的OpenShift应用程序上运行Node 4.1+。
更新:
我已经build立了一个部署到OpenShiftbutton,将为你做大部分的工作:
你仍然需要通过编辑index.js文件或使用rhc env set APP_ID=myAppId MASTER_KEY=myMasterKey -a myAppName
你的“appId”和“masterKey” rhc env set APP_ID=myAppId MASTER_KEY=myMasterKey -a myAppName
这就是你如何使用rhc
工具做同样的事情:
rhc app create parseaio http://cartreflect-claytondev.rhcloud.com/github/icflorescu/openshift-cartridge-nodejs http://cartreflect-claytondev.rhcloud.com/github/icflorescu/openshift-cartridge-mongodb --from-code https://github.com/antt001/parse-server-example --env APP_ID=myAppId MASTER_KEY=myMasterKey
有关更深入的说明,请查看关于此主题的博文
原始答案
- 使用盒式磁带从http://github.com/icflorescu/openshift-cartridge-nodejs创build应用程序从Github页面粘贴url到应用程序创build页面底部的“Code Anything”文本框中select一种应用程序页面。
- 在下一页粘贴https://github.com/antt001/parse-server-example进入源代码文本框,抓取parsing示例项目,修改为openshift设置
- 根据http://github.com/icflorescu/openshift-cartridge-mongodb上的说明添加最新的MongoDB磁带
- 从OpenShift克隆你的回购
- 用您的应用程序ID和密钥replaceindex.js文件中的“appId”和“masterKey”值。
它工作正常,我现在正在运行此configuration。
更新2
我已经删除了这个代码片断,因为它现在已经在上面提到的GitHub仓库中了。
PS
正如@radzio所提到的那样,在编译需要GCC 4.8的本地nodej时存在一个问题,然而,这种configuration不需要任何这种configuration,并且按原样工作,它使用bcrypt-nodejs而不是native
感谢@ ionut-cristian-florescu自定义cartriges
我的问题是通过@Jiri Fiala的评论来解决的,我需要设置openshift IP