-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Auto Restarting crashed apps #216
Comments
When putting together the dokku-shoreman plugin, I was thinking that supervisord would be a good candidate for monitoring apps. There's no ruby requirement and it's available in the ubuntu repos. Translating from a Procfile to a supervisord conf, like foreman does, wouldn't be bad either. |
I've been toying with RUnit, it's already working well with Docker, but I didn't get very far yet regarding integration with Dokku. |
Thanks for the suggestions, I'm starting to take a look into supervisord and runit, are there any good tutorials or examples out there to point me in the right direction with having it monitor a dokku/docker container? |
@jwarzech I put together a supervisord runner plugin. Try it out if you'd like. https://github.com/statianzo/dokku-supervisord |
Thats great plugin @statianzo .. I'm currently thinking the way to integrate pm2, it's specialised for node.js apps, but it does job well. Would be happy if you have any suggestions how to do that plug. |
@alexanderbeletsky Thanks. You could take a similar approach of generating a processes.json from a procfile. If you need more complicated behavior, you could support detecting a processes.json that already exists in the source before generating and use that (I was thinking about adding that to the supervisord plugin). |
awesome suggestions! I just playing pm2 locally now, to understand it On Wed, Sep 25, 2013 at 6:30 PM, Jason Staten notifications@github.comwrote:
Alexander Beletsky, |
My initial thought is that it should be managed with Upstart. When an app is deployed, an Upstart job is created for each process. Then it's a matter of exposing the management of them via dokku commands (or at least the common operations) |
I'm personally more in favor of Runit, but that's mainly because I have experience with it. What I'd love to see is a refactoring of the app creation/restarting that caters for different process managements plugins. |
Well there is an assumption of Ubuntu and Upstart is the Ubuntu way to do On Wed, Sep 25, 2013 at 4:16 PM, Lars Gierth notifications@github.comwrote:
Jeff Lindsay |
I've integrated upstart with my fork of dokku — μPaaS (basically dokku with plain Dockerfiles and Makefiles instead of Heroku buildpacks to specify stack and build operations, everything else is just Dokku). All integration is in a single commit — andreypopp/upaas@54569cc It's a little sophisticated cause I don't use PID-1 upstart for security reasons and instead spawn a new upstart session specifically for As a bonus point I get easy start/stop/restart commands
I think it would be easy to backport to dokku if necessary. |
Added this as potential improvement for 0.3.0 for now. :) |
Can we get a discussion on why supervisor shouldn't be the default deploy mechanism for all dokku apps? See my pull request on buildstep to solve this here: progrium/buildstep#43 A couple reasons for it:
|
First, upstart is preferred because we're targeting Ubuntu. Second, Heroku But autorestarting is great. On Thu, Oct 24, 2013 at 5:54 PM, Parham Negahdar
Jeff Lindsay |
@progrium hmm Ill look into upstart. I think thats simply an issue of billing (first dyno free, worker processes = 2nd dyno) which is why they force you to start to acknowledge the fact that you're going to be paying for that second dyno. Perhaps we're going to keep things herokuish (see #225) but in this seems way out of that scope. |
What's out of scope? On Thu, Oct 24, 2013 at 6:08 PM, Parham Negahdar
Jeff Lindsay |
Was there ever any official progress on the issue of auto-restarting crashed apps? |
dokku-supervisord is a great solution and actively maintained. https://github.com/statianzo/dokku-supervisord |
Thanks @pnegahdar! |
Here is a much more useful supervisor plugin providing Individual app logs on the host https://github.com/sehrope/dokku-logging-supervisord |
I remember Heroku to cease an desist of your app if it crashes and restart too often. I kind of liked this behavior in fact... |
What about dockers own |
@michaelshobbs We've definitely discussed this before, but I don't remember why we haven't added
|
Yeah the default zero downtime check relies on containers exiting on error. |
We can probably get around that by checking the number of restarts? restarts=$(docker inspect -f "{{ .RestartCount }}" $DOKKU_APP_CONTAINER_ID)
[[ $restarts -ne 0 ]] && dokku_log_fail "App container failed to start!!" Thoughts? |
Note: that would leave the container restarting 5ever, so we probably want to at least call |
This could work: container_restarts=$(docker inspect -f "{{ .RestartCount }}" $DOKKU_APP_CONTAINER_ID)
if [[ $container_restarts -ne 0 ]]; then
docker stop "$DOKKU_APP_CONTAINER_ID" || true
dokku_log_fail "App container failed to start!!"
fi |
Maybe My use case as an app that dies maybe once in a couple of days due to extraordinary coincidences. Edit: |
Dokku doesn't have an agent, so unfortunately we can't do smart crash restart policies like heroku does. Perhaps the |
Previously a crashed container would stay down, regardless of exit status. In some cases, it may be useful to restart the container. For example, an application may not be correctly implementing their error handling, or the crash may be caused by a transient error. By setting the restart policy to `on-failure:N` - where N is a number of max restarts - we can help developers guard against crashing applications. Note that this is not a replacement for proper error handling, nor does this include notifications to a developer when a container is restarted. Those patterns should be implemented application side, or via a feature request to docker. The value is configurable at the app-level by setting DOKKU_RESTART_LIMIT to a number. By default, containers will be restarted a max of 10 times. If a container crashes during the check-deploy plugin trigger, then the deploy will be marked as a failure. Closes #216 Closes #398 Closes #1327
Is the current best practice to use dokku-logging-supervisord (which looks like it's had a bug for the last year that makes restarting and deploying a lot slower), or is crashed job restarting now built into dokku via. #1473? i.e.: can I sleep soundly with the default dokku and this in my Procfile:
|
Well, I guess not. This morning I had two The Would there be any downsides to doing something like:
? Edit: Per @josegonzalez's and @beverku's recommendation I'm manually enabling the
I have a multiple server deployment, so in the name of science 🔬 I've only enabled it on one of the servers. I'll wait until the next crash and report back what happens (expecting the server I enabled |
@christiangenco Have you encountered any crashes since your comment? |
Is there a proposed solution for monitoring dokku apps and auto restarting if the crash? Would just setting up something like http://godrb.com/ work?
The text was updated successfully, but these errors were encountered: