Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No supervisors are running in Laravel Homestead

I recently installed Horizon on a Laravel project which is running on a Homestead Vagrant box.

My issue is that no jobs are being picked up by the queue workers. I have no supervisors:

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.

Here is my supervisor (horizon.conf) configuration:

[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

When I bring this machine up, my logs and the web interface indicate that "Horizon started successfully.".

And my horizon (horizon.php) configuration:

'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,
        ],
    ],
],

My supervisor appears to be active as well:

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)

Any thoughts or ideas as to why my supervisor(s) are not working?

like image 822
mykisscool Avatar asked Mar 28 '18 19:03

mykisscool


1 Answers

Turns out my horizon.php configuration was wrong.

I changed this line:

'local' => [ ...

To match my APP_ENV environment variable; which I had set as development.

like image 80
mykisscool Avatar answered Oct 31 '22 10:10

mykisscool