I try to add Laravel Horizon to my app on the local environment via doker to run a queue with Redis. After installation, I can see the Horizon dashboard. But when I try to add processes in the queue I see them in the pending and never execute.
I am not sure I missed something
Here my docker-compose
version: '3.1'
services:
app:
build: .
container_name: app
restart: always
tty: true
ports:
- "80:80"
working_dir: /var/www
volumes:
- ./code:/var/www
- data:/var/run/php
depends_on:
- redis
networks:
- app-network
redis:
container_name: redis
hostname: redis
image: redis:alpine
restart: unless-stopped
volumes:
- data:/.data
networks:
- app-network
queue:
container_name: queue
hostname: queue
image: redis:alpine
restart: unless-stopped
volumes:
- data:/.data
networks:
- app-network
volumes:
data:
networks:
app-network:
driver: bridge
.env
APP_NAME="Laravel"
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost
LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug
DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=mydb
DB_USERNAME=root
DB_PASSWORD=password
BROADCAST_DRIVER=log
CACHE_DRIVER=redis
FILESYSTEM_DISK=local
QUEUE_CONNECTION=redis
SESSION_DRIVER=redis
SESSION_LIFETIME=120
REDIS_HOST=redis
REDIS_PASSWORD=null
REDIS_PORT=6379
QUEUE_DRIVER=redis
REDIS_QUEUE=queue
REDIS_QUEUE_HOST=queue
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false
horizon.php
'defaults' => [
'supervisor-1' => [
'connection' => 'redis',
'queue' => ['default'],
'balance' => 'auto',
'autoScalingStrategy' => 'time',
'maxProcesses' => 10,
'maxTime' => 0,
'maxJobs' => 0,
'memory' => 128,
'tries' => 1,
'timeout' => 60,
'nice' => 0,
],
],
'environments' => [
'production' => [
'supervisor-1' => [
'maxProcesses' => 10,
'balanceMaxShift' => 1,
'balanceCooldown' => 3,
],
],
'local' => [
'supervisor-1' => [
'connection' => 'redis',
'queue' => ['default'],
'balance' => 'auto',
'autoScalingStrategy' => 'time',
'maxProcesses' => 10,
'maxTime' => 0,
'maxJobs' => 0,
'memory' => 128,
'tries' => 1,
'timeout' => 60,
'nice' => 0,
],
],
],
From the above configuration, I run the command
php artisan horizon
It did not execute and let them in pending, but If I try php artisan horizon:work It will process all pending jobs.
Suppose anyone knows how to fix this or have any suggestions. Please share how to fix it.