Comments (6)
You should consider using a process manager such as supervisord or PM2. Gladly, no more code to write.
from openshift-cartridge-nodejs.
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.
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.
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.
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.
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)
- How to disable strict-mode HOT 1
- support "stop" script HOT 5
- Instructions on how to set up HOT 3
- Number of installs/deployments
- Updating an already deployed app HOT 3
- Constant error during push - Failed to execute: 'control stop' HOT 3
- failed to install github modules?
- No ".openshift" directory HOT 2
- Failed to execute: 'control start' for ... HOT 5
- Problem while creating my application (rhc command line) HOT 4
- HTTP error 503 while node.js is booting on a idle gear HOT 4
- Constant issue -- Cannot read property 'stop' of undefined HOT 1
- Problem when deploying? HOT 1
- Failed to execute control start HOT 1
- update current running applications NODE.js cartridge HOT 5
- Sorry for being inactive lately
- Add create app logo
- Log files location? HOT 3
- Looking for maintainers HOT 2
- Missing enviroment variables HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from openshift-cartridge-nodejs.