我最近在一个运行在Homestead Vagrant盒子上的Laravel项目中安装了Horizon。
我的问题是队列工作人员没有找到工作。我没有主管:
vagrant@homestead:~/Code/project$ artisan horizon:list
+----------------+------+-------------+---------+
| Name | PID | Supervisors | Status |
+----------------+------+-------------+---------+
| homestead-D2dV | 7094 | None | running |
+----------------+------+-------------+---------+
vagrant@homestead:~/Code/project$ artisan horizon:supervisors
No supervisors are running.
这是我的主管(horizon.conf)配置:
[program:horizon]
process_name=%(program_name)s
command=/usr/bin/php /home/vagrant/Code/project/artisan horizon
autostart=true
autorestart=true
user=vagrant
redirect_stderr=true
stdout_logfile=/home/vagrant/Code/project/storage/logs/horizon.log
当我启动此计算机时,我的日志和网络界面显示“ Horizon已成功启动。”。
我的视野(horizon.php)配置:
'environments' => [
'production' => [
'supervisor-1' => [
'connection' => 'redis',
'queue' => ['default', 'queue-1', 'queue-2', 'queue-3'],
'balance' => 'auto',
'processes' => env('HORIZON_PROCESSES', 10),
'tries' => 3,
],
],
'local' => [
'supervisor-1' => [
'connection' => 'redis',
'queue' => ['default', 'queue-1', 'queue-2', 'queue-3'],
'balance' => 'auto',
'processes' => env('HORIZON_PROCESSES', 3),
'tries' => 3,
],
],
],
我的主管似乎也很活跃:
vagrant@homestead:~/Code/project$ sudo service supervisor status
● supervisor.service - Supervisor process control system for UNIX
Loaded: loaded (/lib/systemd/system/supervisor.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2018-03-28 13:03:08 UTC; 6h ago
Docs: http://supervisord.org
Process: 1591 ExecStop=/usr/bin/supervisorctl $OPTIONS shutdown (code=exited, status=0/SUCCESS)
Main PID: 2547 (supervisord)
Tasks: 2
Memory: 34.4M
CPU: 21.038s
CGroup: /system.slice/supervisor.service
├─2547 /usr/bin/python /usr/bin/supervisord -n -c /etc/supervisor/supervisord.conf
└─7094 /usr/bin/php /home/vagrant/Code/project/artisan horizon
Mar 28 18:32:13 homestead supervisord[2547]: 2018-03-28 18:32:13,225 INFO spawned: 'horizon' with pid 7057
Mar 28 18:32:15 homestead supervisord[2547]: 2018-03-28 18:32:15,055 INFO success: horizon entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
Mar 28 18:32:16 homestead php[7057]: DIGEST-MD5 common mech free
Mar 28 18:32:16 homestead supervisord[2547]: 2018-03-28 18:32:16,693 INFO exited: horizon (exit status 0; expected)
Mar 28 18:32:17 homestead supervisord[2547]: 2018-03-28 18:32:17,706 INFO spawned: 'horizon' with pid 7072
Mar 28 18:32:19 homestead supervisord[2547]: 2018-03-28 18:32:19,584 INFO success: horizon entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
Mar 28 18:32:26 homestead php[7072]: DIGEST-MD5 common mech free
Mar 28 18:32:26 homestead supervisord[2547]: 2018-03-28 18:32:26,206 INFO exited: horizon (exit status 0; expected)
Mar 28 18:32:27 homestead supervisord[2547]: 2018-03-28 18:32:27,210 INFO spawned: 'horizon' with pid 7094
Mar 28 18:32:29 homestead supervisord[2547]: 2018-03-28 18:32:29,052 INFO success: horizon entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
关于为什么我的主管不工作的任何想法或想法?
答案 0 :(得分:2)
原来我的 horizon.php 配置错误。
我更改了这一行:
'local' => [ ...
匹配我的APP_ENV
环境变量;我设置为development
。