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!
[Adding this after some time without an answer.]
Sorry if my question was a little vague, perhaps if we remove the artisan part; 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?
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:restart either, 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.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.