Question

Best way to start `php artisan queue:work` for a Laravel Digital Ocean App and keep it running?

I am setting up a Laravel queue on my Digital Ocean App. Typically I have used supervisor but I have read it is problematic in this environment. This question says that using a Worker Component is the best way to do this, but I have no idea how to set one up.

I would need the worker to run the artisan command php artisan queue:work inside the main app’s primary directory and make sure it stays running after every rebuild after the app is ready.

Any help would be appreciated.


Submit an answer


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!

Sign In or Sign Up to Answer

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.

Sri Charan Madhavapeddi
DigitalOcean Employee
DigitalOcean Employee badge
July 31, 2023

Hello,

App Platform does not have an services that handle explicit queues or background jobs.

However we have a bunch of options for implementing these to fit your needs:

  • Worker components can continuously monitor and work on jobs
  • Internal Services are services that are not exposed to the public internet but can expose internally to other services and operate like a worker
  • Functions can handle running tasks as long as 15 minutes and be trigger via http call

Sample code is available here: https://www.digitalocean.com/community/questions/laravel-app-platform-cron-job

https://www.digitalocean.com/community/questions/how-to-setup-cron-job-in-app-platform-using-laravel

Hope this helps!

Cheers, Sri Charan

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel