没有监督员在Laravel Homestead中运行。

5

我最近在一个运行于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

当我启动这台机器时,我的日志和Web界面显示“Horizon启动成功”。我的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)

有什么想法或者想法,为什么我的主管们不工作?

1个回答

14
原来我的 horizon.php 配置有误。
我修改了这一行:
'local' => [ ...

为了匹配我的APP_ENV环境变量,我将其设置为development
在某些情况下,请确保在PHP中启用proc_open

实际上,人们会认为如果特定的环境缺失,则使用默认值,但似乎每个环境都必须至少在队列环境配置中声明。 - Priit

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接