简体   繁体   English

在openshift上设置和配置mean.js应用程序部署

[英]setting up and configuring mean.js app deployment on openshift

I have a MEAN.js app that I deployed to openshift server doing the following steps: 我有一个MEAN.js应用程序,已将其部署到openshift服务器,并执行以下步骤:

1- setup client tools rhc, git, etc.. following this tutorial openshift tutorial result: successfully authenticated through rhc ssh to my openshift domain 1-按照本教程openshift教程结果设置客户端工具rhc,git等。通过rhc ssh成功验证到我的openshift域

2- created a new app through the web console using the open shift provided cartridge Nodejs cartridge on openshift 2-使用openshift提供的盒带通过Node.js在openshift上通过Web控制台创建了一个新应用程序

3- added a mongodb cartridge the the application through openshift web console 3-通过openshift Web控制台为应用程序添加了mongodb磁带

4- Now I did a step to install bower manually to avoid committing & pushing libraries through git using rhc ssh command on the terminal i issued npm install -g bower on the console, and it seemed to work fine, bower installed successfully 4-现在我做了一个手动安装Bower的步骤,以避免在终端上使用rhc ssh命令通过git提交和推送库,我在控制台上发布了npm install -g bower,它似乎工作正常,bower安装成功

5- downloaded the nodejs app from github as guided through the setup guide now i got the folder structure of the app deployed on the server locally 5-按照安装指南的指导从github下载了nodejs应用程序,现在我将应用程序的文件夹结构部署在本地服务器上

6- I needed to include the following in the app folder to successfully deploy my app to the server 6-我需要在app文件夹中包含以下内容,才能成功将我的应用程序部署到服务器

a- npm dependencies in the package.json file b- bower.json file ( later i should be able to run bower install to install bower dependencies in the repo) was not successful I don't have sudo permissions on the directory package.json文件中的a- npm依赖项b- bower.json文件(稍后我应该能够运行bower install在回购中安装bower依赖项)不成功,我对该目录没有sudo权限

c- all the files and folder structure required to run my project d- lines of code that setup the server to run using the configuration files that bind mongoose.js, with express.js , passport, and to listen on port 3000 to do this I included code into the existing app.js file that already setup the node server to run ` c-运行我的项目所需的所有文件和文件夹结构d-代码行,将服务器设置为使用绑定了mongoose.js,express.js,passport的配置文件运行并在端口3000上监听的配置文件我将代码包含在现有的app.js文件中,该文件已经将节点服务器设置为运行`

    var mongoose = require('./config/mongoose'),
    express = require('./config/express'),
    passport = require('./config/passport');
    var db = mongoose();
    var app = express();
    var passport = passport();`

e- commit all and push done that result : through the rhc terminal was successful deployment but when I visit the link on the browser I got a 提交所有内容并推送完成结果:通过rhc终端成功部署,但是当我在浏览器上访问链接时,

503 Service Unavailable No server is available to handle this request. 503服务不可用没有服务器可用于处理此请求。

I went back to the terminal and rhc ssh to the openshift server, then ran taill_all to see whats going on in the logs found the following on repeat in the terminal 我回到终端,将rhc ssh返回到openshift服务器,然后运行taill_all以查看日志中发生了什么,在终端中重复以下内容

==> app-root/logs/haproxy.log <== [WARNING] 134/132624 (39619) : Stopping proxy express in 0 ms. ==> app-root / logs / haproxy.log <== [警告] 134/132624(39619):在0毫秒内停止代理表示。 [WARNING] 134/132624 (39619) : Proxy stats stopped (FE: 2 conns, BE: 0 conns). [警告] 134/132624(39619):代理统计信息已停止(FE:2个连接,BE:0个连接)。 [WARNING] 134/132624 (39619) : Proxy express stopped (FE: 9 conns, BE: 103 conns). [WARNING] 134/132624(39619):代理快递已停止(FE:9个连接,BE:103个连接)。 [WARNING] 134/132624 (75275) : config : log format ignored for proxy 'stats' since it has no log address. [警告] 134/132624(75275):配置:代理“统计信息”忽略了日志格式,因为它没有日志地址。 [WARNING] 134/132624 (75275) : config : log format ignored for proxy 'express' since it has no log address. [警告] 134/132624(75275):配置:代理'express'忽略了日志格式,因为它没有日志地址。 [WARNING] 134/163313 (75275) : Server express/local-gear is DOWN for maintenance. [WARNING] 134/163313(75275):服务器快速/本地齿轮停机,以进行维护。 [ALERT] 134/163313 (75275) : proxy 'express' has no server available! [ALERT] 134/163313(75275):代理“ express”没有可用的服务器! [WARNING] 134/163353 (75275) : Server express/local-gear is UP (leaving maintenance). [警告] 134/163353(75275):服务器快递/本地齿轮已启动(无需维护)。 [WARNING] 134/163355 (75275) : Server express/local-gear is DOWN, reason: Layer4 connection problem, info: "Connection refused", check duration: 0ms. [WARNING] 134/163355(75275):服务器快速/本地设备已关闭,原因:第4层连接问题,信息:“连接被拒绝”,检查持续时间:0ms。 0 active and 0 backup servers left. 剩余0个活动服务器和0个备用服务器。 0 sessions active, 0 requeued, 0 remaining in queue. 活动的会话数为0,重新排队的会话数为0,队列中剩余的0。 [ALERT] 134/163355 (75275) : proxy 'express' has no server available! [ALERT] 134/163355(75275):代理“ express”没有可用的服务器!

==> app-root/logs/nodejs.log <== at require (internal/module.js:20:19) at module.exports (/var/lib/openshift/57375ced7628e1e8f00001bd/app-root/runtime/repo/config/express.js:54:3) at Object. ==> app-root / logs / nodejs.log <==在module.exports处的require(internal / module.js:20:19)(/ var / lib / openshift / 57375ced7628e1e8f00001bd / app-root / runtime / repo / config / express.js:54:3)。 (/var/lib/openshift/57375ced7628e1e8f00001bd/app-root/runtime/repo/app.js:46:11) at Module._compile (module.js:413:34) at Object.Module._extensions..js (module.js:422:10) at Module.load (module.js:357:32) { [Error: Cannot find module '../build/Release/bson'] code: 'MODULE_NOT_FOUND' } js-bson: Failed to load c++ bson extension, using pure JS version { [Error: Cannot find module '../build/Release/bson'] code: 'MODULE_NOT_FOUND' } js-bson: Failed to load c++ bson extension, using pure JS version Warning: connect.session() MemoryStore is not designed for a production environment, as it will leak memory, and will not scale past a single process. (/var/lib/openshift/57375ced7628e1e8f00001bd/app-root/runtime/repo/app.js:46:11)位于Object.Module._extensions..js(module._compile(module.js:413:34) .js:422:10)在Module.load(module.js:357:32){[错误:找不到模块'../build/Release/bson']代码:'MODULE_NOT_FOUND'} js-bson:无法执行使用纯JS版本加载c ++ bson扩展{[错误:找不到模块'../build/Release/bson']代码:'MODULE_NOT_FOUND'} js-bson:无法使用纯JS版本加载c ++ bson扩展警告: connect.session()MemoryStore不适用于生产环境,因为它会泄漏内存,并且不会扩展到单个进程。

The problem is MEAN.IO cartidge provided by openshift is not the same project structure, or dependencies as any custom MEAN.js app, which is essentially a node.js app with mongodb and express.js for server side api routing, so it's not usable in this case such as the suggestion in the following question : suggestion to use mean.io cartridge to deploy a mean.js app 问题是openshift提供的MEAN.IO插件与任何自定义MEAN.js应用程序的项目结构或依赖关系不同,后者本质上是具有mongodb和express.js的node.js应用程序,用于服务器端api路由,因此不是在这种情况下可用,例如以下问题中的建议建议使用mean.io磁带盒来部署mean.js应用

kindly help direct me towards a more direct way to deploy & configure any mean.js app on openshift, suggestions to use other servers are welcomed if there's a clear successful past experience, thanks 请帮助指导我采用更直接的方式在openshift上部署和配置任何mean.js应用程序,如果过去的成功经验很明显,建议使用其他服务器,谢谢

If you choose to edit code directly on the server (avoiding committing and pushing your changes), your work will be lost if your app ever needs to be restored or rebuilt. 如果您选择直接在服务器上编辑代码(避免提交和推送更改),那么如果您的应用程序需要还原或重建,则您的工作将会丢失。

Bower is usually used as a generator, to scaffold code locally (before you commit and push your changes). Bower通常用作生成器,以在本地支持代码(在提交并推送更改之前)。 I don't think bower works correctly on OpenShift since it expects the $HOME dir to be writable. 我认为Bower无法在OpenShift上正常工作,因为它期望$HOME目录可写。

I'd try doing this work locally, then commit and push the result. 我会尝试在本地进行此工作,然后提交并推送结果。

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

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