Giter Club home page Giter Club logo

Comments (6)

GochoMugo avatar GochoMugo commented on June 10, 2024

You should consider using a process manager such as supervisord or PM2. Gladly, no more code to write.

from openshift-cartridge-nodejs.

icflorescu avatar icflorescu commented on June 10, 2024

Yep, you could definitely consider using supervisord or PM2 if you're looking for an "out-of-the box" solution. To keep things un-opinionated, lean and flexible, I decided not to include any of them in the cartridge.
However, I have included in the default application template a simple pattern based on cluster which does just that: spins up a configurable number of "app instances" and restarts them automatically in case of uncaught errors.
I've successfully used the very same template in my own projects without any issues so far.

from openshift-cartridge-nodejs.

Spown avatar Spown commented on June 10, 2024

Ok, I'm using your slightly modified "application template a simple pattern based on cluster" (really just rewritten for ES3) and it seems that when the system considers the app should go down for hibernation because it was inactive for 24 hours - the default behavior for simple gadgets - the system would send a SIGTERM signal and in this case the app wouldn't restart automatically.

It seems this kind of restarting ensurance should be handled on a higher lavel - in the cartridge itself http://www.programering.com/a/MjNyQDNwATg.html Is it the case here?

Or am I missing something?

from openshift-cartridge-nodejs.

icflorescu avatar icflorescu commented on June 10, 2024

No, I'm sure this is handled at a higher level.

As far as I've noticed on my test account, the cartridge "wakes up" just fine when first accessed after hibernation, though it takes quite a while to respond to the first request. I don't remember what happens exactly on "hibernate", but if you've noticed a SIGTERM on hibernate, then I'm guessing the system also runs bin/control start to wake it up on the first post-hibernation request.

I guess this is also the most cost-effective way for OpenShift to handle the hibernation workflow on free accounts; taking and restoring "hot snapshots" would probably be unfeasible.

On the other hand, on my customers' silver-plan accounts there are a few apps having > 1 year continuous up-time. We've had some uncaught errors a couple of times and, according to the logs, the cluster workers restarted correctly (same basic template; used to be ES3 back then).

from openshift-cartridge-nodejs.

Spown avatar Spown commented on June 10, 2024

yeah, I'm not talking about silver - these ones should work. however our project test-running is done through the simple gears so this is still kinda crutial. My app doesn't wake up at all. it's status from the openshift perspective is running but the response is 503 and the last line in the log is Got SIGTERM, stopping workers... and thats it, no "quite a while to respond to the first request" - it just stays dead forever, until I git-push or manually ctl_app restart it

from openshift-cartridge-nodejs.

icflorescu avatar icflorescu commented on June 10, 2024

Then I'm not sure what happens. I'll take a look at the logs over the next few days and see if I can learn more.

The clusted-based template I've put in the application template is a bit naive (there was a lengthy section in the Node.js docs on clusters AFAIR); it worked for me but it's surely not bullet-proof and it won't fit every possible scenario. Anyway, the entire codebase in usr/template should be considered nothing more than a placeholder for your own application :-).

So, as @GochoMugo mentioned earlier, there are specific solutions for this, such as pm2 or supervisord; please consider switching to one of those instead.

from openshift-cartridge-nodejs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.