sh Laravel电子邮件排队主管
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh Laravel电子邮件排队主管相关的知识,希望对你有一定的参考价值。
https://blog.whabash.com/posts/installing-supervisor-manage-laravel-queue-processes-ubuntu
https://www.youtube.com/watch?v=lgHQNkxYzMI
0) change in .env from QUEUE_CONNECTION=sync
to
QUEUE_CONNECTION=database
* Some commands require Sudo
1) sudo apt install supervisor
2) check if its running:
service supervisor status
3) add user to supervisor group:
sudo usermod -a -G supervisor your_username
4) edit config file:
sudo vim /etc/supervisor/supervisord.conf
change chmod and add chown
-------------------------
; supervisor config file
[unix_http_server]
file=/var/run/supervisor.sock ; (the path to the socket file)
chmod=0770 ; sockef file mode (default 0700)
chown=root:supervisor
[supervisord]
logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log)
pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
childlogdir=/var/log/supervisor ; ('AUTO' child log dir, default $TEMP)
; the below section must remain in the config file for RPC
; (supervisorctl/web interface) to work, additional interfaces may be
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket
; The [include] section can just contain the "files" setting. This
; setting can list multiple files (separated by whitespace or
; newlines). It can also contain wildcards. The filenames are
; interpreted as relative to this file. Included files *cannot*
; include files themselves.
[include]
files = /etc/supervisor/conf.d/*.conf
-------------------------------------
run:
sudo service supervisor restart
5) Add a program configuration:
sudo vim /etc/supervisor/conf.d/queue.conf
[program:queue]
process_name=%(program_name)s_%(process_num)02d
command=sudo php /home/vagrant/www/nextdoor_reg/artisan queue:work --tries=3
user=root
autostart=true
autorestart=true
numprocs=1
redirect_stderr=true
stdout_logfile=/home/vagrant/www/nextdoor_reg/storage/logs/test.log
Note: Path to laravel project must match
6) Update supervisor about the new program:
sudo supervisorctl reread
supervisorctl update
supervisorctl status
alias supconfig='sudo vim /etc/supervisor/supervisord.conf'
alias supqueue='sudo vim /etc/supervisor/conf.d/queue.conf' # create this file or more for different queues
alias suprestart='sudo service supervisor restart'
alias supreread='supervisorctl reread'
alias supupdate='supervisorctl update'
alias supstatus='supervisorctl status'
以上是关于sh Laravel电子邮件排队主管的主要内容,如果未能解决你的问题,请参考以下文章