Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 350
AnyWhichWay Avatar asked Jun 19 '14 05:06

AnyWhichWay


2 Answers

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.

like image 73
Shekhar Avatar answered Oct 07 '22 06:10

Shekhar


Thanks for the response! However, I just discovered what the issue was by rolling back and making one change at a time. There was a buried npm dependency down in a subfile. This dependency had not been added to the package.json file and Openshift was failing to rebuild node appropriately. Once the dependency was added everything started to run again. The log errors were a bit of a red herring and simply a side effect of not having a good application to start!

like image 45
AnyWhichWay Avatar answered Oct 07 '22 08:10

AnyWhichWay