-
Notifications
You must be signed in to change notification settings - Fork 954
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
Dont deamonize #875
Comments
If I'm understanding the question correctly then you're in a situation similar to people running DJ on Heroku. Use the |
But I don't know how to make |
@javanux or try this base image? https://github.com/phusion/baseimage-docker |
You can write a pid file manually by creating a simple plugin. Put something like this in the delayed job initializer or anywhere that is guaranteed to load.
|
The new plugin creates a pidfile at location `#{Rails.root}/tmp/delayed_job.pid` when a worker starts and then removes it when a worker stops. It uses `lifecycle.around(:execute)` to achieve this. The file is created in "write exclusive" mode. This means if the file already exists, a Errno::EEXIST exception is raised. This ensures that a worker doesn't overwrite a pidfile in use. This plugin is useful to allow an outside observer (e.g. a healthcheck) to check if the worker started successfully. The plugin is not installed by default for backwards compatibility. Users can use it by adding to their initializer: Delayed::Worker.plugins << Delayed::Plugin::Pidfile refs collectiveidea#875
The new plugin creates a pidfile at location `#{Rails.root}/tmp/delayed_job.pid` when a worker starts and then removes it when a worker stops. It uses `lifecycle.around(:execute)` to achieve this. The file is created in "write exclusive" mode. This means if the file already exists, `Errno::EEXIST` is raised. This ensures that a worker doesn't overwrite a pidfile in use. This plugin is useful to allow an outside observer (e.g. a healthcheck) to check if the worker started successfully. The plugin is not installed by default for backwards compatibility. Users can use it by adding to their initializer: Delayed::Worker.plugins << Delayed::Plugin::Pidfile refs collectiveidea#875
Thanks for this suggestion. I needed something like this and thought it might be useful to other people. So I put it into PR #1202. |
Hey in order to have our workers to run efficiently in docker we would love to have it not demonize when starting. So it can say pid one1. Is there an option to do this?
The text was updated successfully, but these errors were encountered: