bballantyne's avatar

Horizon doesn't read jobs from Redis

I need some guidance please. I've read all the Horizon-related questions but I still can't pinpoint the source of my issue.

I have Horizon installed on one server, redis-server on another and another Laravel project for my users on a third server.

The Horizon dashboard is active. In my current setup I didn't setup supervisor as yet, but I do have the horizon worker running.

On the Horizon project, my horizon.php:

'environments' => [
        'production' => [
            'supervisor-1' => [
                'connection' => 'redis',
                'queue' => ['default', 'prods'],
                'balance' => 'simple',
                'processes' => 10,
                'tries' => 1,
            ],
        ],

        'local' => [
            'supervisor-1' => [
                'connection' => 'redis',
                'queue' => ['default', 'tests'],
                'balance' => 'simple',
                'processes' => 3,
                'tries' => 1,
            ],
        ],
    ],

...my queue.php contains:

'redis' => [
            'driver' => 'redis',
            'connection' => 'default',
            'queue' => env('REDIS_QUEUE', 'default'),
            'retry_after' => 90,
            'block_for' => null,
        ],

and the .env has

QUEUE_CONNECTION=redis

In my other Laravel app from where the jobs are dispatched, the queue.php and .env contain the same snippets as above. In this app, I have the queue worker running as

php artisan queue:work redis

However, the Horizon dashboard always shows 0 jobs.

I'd be happy to share any other details if anyone is able to point me in at least a general direction.

0 likes
5 replies
bobbybouwmann's avatar

You need to run php artisan horizon to start Horizon. The queue:work command is a completely different way of clearing the jobs from the queue ;)

Horizon itself will start a process on the background that keeps everything running and applies the number of processes and queues, while queue:work is a simpler approach of running jobs.

1 like
bballantyne's avatar

Hi, thanks for the follow up. I actually have the php artisan horizon command running, but the dashboard still shows 0 jobs.

I subsequently installed Horizon within the business' Laravel project (ie the project that actually dispatches the jobs e.g. emails), and it works. I see the queue stats.

I think I misunderstood the docs and thought Horizon was just a queue monitor that I could install in its own project and see the status of queues from multiple servers. So can you confirm if Horizon would only work when installed within the Laravel project that dispatches the jobs?

bobbybouwmann's avatar
Level 88

Yeah, Horizon only works for Laravel project and installed on the same project. Also running horizon and queue:work together is not a good option. You need to use one of them ;)

cpries94's avatar

@bobbybouwmann This just killed me. I am trying to get horizon to work as well as workers setup using forge. I was already confused on what the difference is, setting up workers using forge seems a lot more convenient, but they do not seem to be able to access our Redis cache. I assume this is because I tried to set up horizon first and now the supervisors are confused on what to do?

Please or to participate in this conversation.