ucan-lab / docker-laravel

🐳 Build a simple laravel development environment with Docker Compose.
https://dev.to/ucan_lab/how-to-install-and-set-up-laravel-s-local-development-environment-with-docker-compose-5bcf
MIT License
1.18k stars 379 forks source link

please add supervisor for laravel queue #213

Closed vahidalvandi closed 1 year ago

vahidalvandi commented 2 years ago

thank you . please show me how i can run queue ?

vahidalvandi commented 2 years ago

i slove this by install supervisior , if you have beter solution please develop it

sudo apt-get update -y
sudo apt-get install supervisor
supervisord -v
systemctl status supervisor

nano /etc/supervisor/conf.d/laravel-worker.conf

[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=docker compose -f /media/user/disk/laravel/docker-test/docker-compose.yml exec app php artisan queue:work --sleep=3 --tries=3 --max-time=3600
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
user=root
numprocs=8
redirect_stderr=true
stdout_logfile=/var/log/supervisor/laravel-queue.log
stopwaitsecs=3600

sudo supervisorctl reread
sudo supervisorctl update
sudo supervisorctl start laravel-worker:*
askdkc commented 1 year ago

@vahidalvandi you need to install supervisor in order to queue worker to work in production.

Check this Laravel official documentation.

So your solution is exactly how to solve this problem 😉