I have Ruby on Rails app and after I do any deployment with Dokku, I have my old worker running the tasks normally, but when I complete the deploy, after a few seconds this worker is removed and a new one is created without finishing all the tasks that were running. Does anyone know how I get around this? Or that the worker finishes all tasks before removing, or when a worker is created after deploying, the tasks from the old worker go to the new worker? Any indication?
CodePudding user response:
Dokku's zero-downtime deploy mechanism will wait a configurable amount of time before running docker container stop
. This will send a SIGTERM
to your application, and then a SIGKILL
after a grace period.
Your application code should handle SIGTERM
and gracefully stop accepting new work, finish old work, and then terminate. This is generally what background processing frameworks do by default, but you may need to configure this in yours or add the functionality if it is a custom framework you wrote.