简体   繁体   中英

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:

1- setup client tools rhc, git, etc.. following this tutorial openshift tutorial result: successfully authenticated through rhc ssh to my openshift domain

2- created a new app through the web console using the open shift provided cartridge Nodejs cartridge on openshift

3- added a mongodb cartridge the the application through openshift web console

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

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

6- I needed to include the following in the app folder to successfully deploy my app to the server

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

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 `

    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

503 Service Unavailable No server is available to handle this request.

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

==> app-root/logs/haproxy.log <== [WARNING] 134/132624 (39619) : Stopping proxy express in 0 ms. [WARNING] 134/132624 (39619) : Proxy stats stopped (FE: 2 conns, BE: 0 conns). [WARNING] 134/132624 (39619) : Proxy express stopped (FE: 9 conns, BE: 103 conns). [WARNING] 134/132624 (75275) : config : log format ignored for proxy 'stats' since it has no log address. [WARNING] 134/132624 (75275) : config : log format ignored for proxy 'express' since it has no log address. [WARNING] 134/163313 (75275) : Server express/local-gear is DOWN for maintenance. [ALERT] 134/163313 (75275) : proxy 'express' has no server available! [WARNING] 134/163353 (75275) : Server express/local-gear is UP (leaving maintenance). [WARNING] 134/163355 (75275) : Server express/local-gear is DOWN, reason: Layer4 connection problem, info: "Connection refused", check duration: 0ms. 0 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in queue. [ALERT] 134/163355 (75275) : proxy 'express' has no server available!

==> 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. (/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.

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

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

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). I don't think bower works correctly on OpenShift since it expects the $HOME dir to be writable.

I'd try doing this work locally, then commit and push the result.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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