I’m setting up a worker in an App Platform app which is hosting a Laravel app. The worker container is going to be running
php artisan queue:work as its foreground process.
My question is: What would happen to the queue worker container when the app is deployed and all the containers are restarted? Would the worker container also be restarted? If so, is there a way to cause the deployment to wait for the worker to finish processing the queue and exit gracefully?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
App Platform will effectively kill your worker container, and thus any process it is running at the moment of deployment.
So no, the worker will not do a graceful shutdown and finish processing the job.
But you will not need to do the normal
queue:restarteither, because the deployment creates a brand new container for the worker.
I am currently also looking into these solutions:
My problem is I have some VERY long running (+5 hours) jobs at times, and waiting for them to finish is not a good solution, but I can restart them and have them continue their loop from the point they were stopped.
I have not found a satisfactory solution to this problem yet, in my use case. I hope above can give you some ideas to maybe handle your situation.
[Adding this after some time without an answer.]
Sorry if my question was a little vague, perhaps if we remove the
artisanpart; what I’m really trying to understand is the nature of the restarting of worker containers when an app is deployed on App Platform.
So my revised question is:
When a deployment takes place on an App Platform app, if the build succeeds and the deployment is successful, what happens to the existing worker containers? Are they shut down and replaced with new containers?
If so, are the worker containers shut down gracefully? What I mean by that is, are they given a chance to finish processing current tasks, or is the plug simply pulled?
Want to learn more? Join the DigitalOcean Community!
Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.
Sign up now