Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
776 views
in Technique[技术] by (71.8m points)

node.js - Openshift Layer4 connection, App Won't Start

I recently pushed a set of node.js changes to an app on Openshift. The app runs fine on my local machine and is pretty close to the vanilla example deployed by Openshift. The Openshift haproxy log has this final line:

[fbaradar-hydrasale.rhcloud.com logs]> [WARNING] 169/002631 (93881) : 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.

The nodejs.log has this final line and no error mesages before this line: DEBUG: Program node server.js exited with code 8

I have searched high and low and can't seem to find anyone with a similar problem or hints at how to resolve this issue. Obviously, the above result in a 503 Service Unavailable when trying to access the app over the web.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Looking at the question I think it is happening because you don't have any routes configured at root '/'. OpenShift uses HAProxy as a load balancer in scalable applications. HAProxy is configured to ping root '/' url for health checks to determine whether your application is up or down. In your application, you have not configured anything at the root url so when HAProxy pings '/' it gets 503, hence your application behaves like this. There are two ways you can fix this problem

  1. Create an index.html and push it to OpenShift application
  2. The better solution is to configure HAProxy configuration file. SSH into the main gear using rhc ssh --app command, then change directory to haproxy/conf, and then update option httpchk GET / to option httpchk GET /valid_location, and finally restart the HAProxy using rhc cartridge-restart --cartridge haproxy. You can check the status of your gears by going to http://myapp-myusername.rhcloud.com/haproxy-status.

Hope this will help you.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...