laravel - Laravel Homestead 中没有运行主管

标签 laravel homestead laravel-horizon

我最近在一个 Laravel 项目上安装了 Horizo​​n,该项目在 Homestead Vagrant 盒子上运行。

我的问题是队列工作人员没有拾取任何作业。我没有主管:

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.

这是我的主管(horizo​​n.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 界面显示“Horizo​​n 已成功启动。”。

还有我的地平线(horizo​​n.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)

对于我的主管为什么不工作有什么想法或想法吗?

最佳答案

事实证明我的horizo​​n.php配置是错误的。

我改变了这一行:

'local' => [ ...

匹配我的APP_ENV环境变量;我已将其设置为开发

And in some cases make sure that you enable proc_open in PHP

关于laravel - Laravel Homestead 中没有运行主管,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49542349/

相关文章:

javascript - 如何从 Laravel 5 中的 AJAX 调用返回 View ?

mysql - Homestead - 连接到我的数据库

php - Homestead v6.1.0 不适用设置 PHP5.6

php - Laravel 队列有时会重复作业

laravel - QUEUE_CONNECTION 'database' 工作但 'redis' 抛出 'Array to String conversion'

php - Laravel 5.5 - 排队事件监听器的 Horizo​​n 自定义作业标签

php - 如何在 Laravel 5.2 中使用 cookie

php - Laravel 迁移 : 2 different tables with the same blueprint/structure

php - 拉拉维尔 : How do I parse this json data in view blade?

vagrant - 为什么使用 Vagrant 的虚拟盒 vboxheadless 进程使用 100% 的 CPU?