skip to Main Content
Run Horizon By Supervisord In Laradock

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.

Jasper Frumau

Jasper has been working with web frameworks and applications such as Laravel, Magento and his favorite CMS WordPress including Roots Trellis and Sage for more than a decade. He helps customers with web design and online marketing. Services provided are web design, ecommerce, SEO, content marketing. When Jasper is not coding, marketing a website, reading about the web or dreaming the internet of things he plays with his son, travels or run a few blocks.

This Post Has One Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

Back To Top