简体   繁体   English

成功将节点应用程序部署到OpenShift,OpenShift仍显示默认页面

[英]Deployed Node app to OpenShift successfully, OpenShift still shows default page

So here are the steps I've taken so far: 因此,这是我到目前为止采取的步骤:

  1. Created application on openshift 在openshift上创建的应用程序
  2. Cloned application's repo 克隆的应用程序的仓库
  3. Deleted all files for the sample app in the cloned repo 删除克隆存储库中示例应用程序的所有文件
  4. Added my project files 添加了我的项目文件
  5. Performed a Git-Push which completed successfully. 执行了一个Git-Push,它已成功完成。

I still see the default landing page: 我仍然看到默认的登录页面:

在此处输入图片说明

The only odd thing I see in the deployment logs this warning, which makes no senses because it's not my code doing that (I'm basically just trying to deploy the sample app from Express) 我在部署中看到的唯一奇怪的东西记录了此警告,这是没有意义的,因为这不是我的代码执行的(我基本上只是在尝试从Express部署示例应用程序)

在此处输入图片说明

Any ideas as to what could be causing this? 关于什么可能导致此的任何想法? I'm trying to dump Heroku but can't get basic things to work. 我正在尝试转储Heroku,但无法使基本功能正常工作。

UPDATE : I found this KB article which explains how to run your own file (why this information isn't better documented and part of the basic tutorial is beyond me). 更新 :我发现这篇知识库文章解释了如何运行自己的文件(为什么这些信息没有得到更好的记录,而基础教程的一部分超出了我的理解)。 It is still unclear to me whether the code in server.js is needed or not... Or I'm expected to always use server.js as a shell to all my code. 对我来说仍然不清楚,是否需要server.js中的代码……或者我应该总是将server.js用作我所有代码的外壳。

https://www.openshift.com/kb/kb-e1048-how-can-i-run-my-own-nodejs-script https://www.openshift.com/kb/kb-e1048-how-can-i-run-my-own-nodejs-script

I found the answer here: 我在这里找到了答案:

https://www.openshift.com/blogs/run-your-nodejs-projects-on-openshift-in-two-simple-steps https://www.openshift.com/blogs/run-your-nodejs-projects-on-openshift-in-two-simple-steps

The gist of it is this: 要点是:

  • Change main in package.json to set main to yourApp.js ( as per this article ) 更改package.json中的main以将main设置为yourApp.js( 根据本文
  • Make sure you're starting your server with the right IP and Port on OpenShift (see below) 确保在OpenShift上使用正确的IP和端口启动服务器(请参见下文)

app.set('port', process.env.OPENSHIFT_NODEJS_PORT || 8080); app.set('ip', process.env.OPENSHIFT_NODEJS_IP || '127.0.0.1');

and then 接着

http.createServer(app).listen(app.get('port'), app.get('ip'), function(){ console.log('Express server listening on port ' + app.get('port')); });

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM