Openshift NodeJS + MongoDB application suddenly st

2019-08-10 06:56发布

I recently started using OpenShift as a scalable platform for a NodeJS + MongoDB application. I got it all working, except that after some time (mostly within a few hours or days) my application suddenly gets inaccesible. I think there are 2 causes for my app to stop. One cause is that the MongoDB connection times out, which is probably an easy fixable error by checking whether the database is still connected before using the database.

However the other cause is that NodeJS suddenly stops listening to new requests. I am not exactly sure what happens and what the reason for this behaviour is, but when this happens, I have to manually restart the application through ssh, and in a production environment this is unacceptable.

Since I dont get any errors, I can't really provide any more details, except that i (probably) have a scalable app, currently using 2 gears, one for the NodeJS app and one for the MongoDB database. I use MongooseJS to connect to the database. For the time being im still in the free plan, but once more traffic is coming, ill probably go for the silver plan (assuming that scaling actually works).

I hope someone can provide me with some advice or a solution.

Sincerely,

Hylke Bron

1条回答
姐就是有狂的资本
2楼-- · 2019-08-10 07:14

So there are a few things you should be aware of. The first being Idling, If your application does not receive any external http requests for 48 hours it will be idled. Then once a http request is made the application will come back online automatically.

If you're getting external http requests frequently then the next thing we'll need to check is the logs for your application. You can check the logs for your app but running rhc tail <yourappname>.

查看更多
登录 后发表回答