Laradock needs to be set up to work with Supervisor. Here is how to Run Horizon by Supervisord in Laradock .
Supervisord Configuration
To Run Horizon by supervisord in Laradock you have to add horizon.conf to php-worker/supervisord.d/horizon.conf with the following content
[program:horizon] process_name=%(program_name)s_%(process_num)02d command=php /var/www/laravel/artisan horizon autostart=true autorestart=true numprocs=1 redirect_stderr=true
Adding Queue Worker
Had an issue that the job would just stay paused. Had to add a worker queue using:
php artisan queue:work --queue=ssl-manager -- redis
You can however also add this queue to supervisord as another config:
[program:ssl-manager] process_name=%(program_name)s_%(process_num)02d command=php /var/www/laravel/artisan queue:work --queue=ssl-manager -- redis autostart=true autorestart=true numprocs=1 redirect_stderr=true
then you can restart the docker using
docker-compose restart php-worker
Supervisord Changes
Also to make supervisor check for changes check into your php worker using
docker-compose exec php-worker ash
and use:
supervisorctl reread
This so it is made aware of the new config. Then you can use
supervisorctl update
to update supervisor on your changes.
NB To check existing config files check out the config files under the directory supervisor:
root@site-staging:/etc/supervisor/conf.d# ll total 20 drwxr-xr-x 2 root root 4096 Mar 19 08:05 ./ drwxr-xr-x 3 root root 4096 Jun 19 2018 ../ -rw-r--r-- 1 root root 282 Mar 19 08:05 daemon-111.conf -rw-r--r-- 1 root root 277 Mar 2 02:53 daemon-222.conf -rw-r--r-- 1 root root 309 Mar 13 09:32 daemon-333.conf
supervisorctl start laravel-worker:*
This doesn’t work for me… Any ideas why?
Also, is this method deprecated now that `laradock/laravel-horizon/supervisord.d/laravel-horizon.conf` exists with the addition of this pull request https://github.com/laradock/laradock/pull/1854 ?
You can use the new method as well. Either one works. If this method did not work for you you need to be more specific on how it did not for anyone to see what may be have been the issue.