laravel 8使用laradock配置supervisor和horizon
一、laradock启用supervisor
1 - Open the .env
file
2 - Set WORKSPACE_INSTALL_SUPERVISOR
and WORKSPACE_INSTALL_PYTHON
to true
.
3 - Create supervisor configuration file (for ex., named laravel-worker.conf
) for Laravel Queue Worker in php-worker/supervisord.d/
by simply copy from laravel-worker.conf.example
4 - Re-build the container docker-compose build workspace
Or docker-compose up --build -d workspace
参考这里 https://laradock.io/documentation/#install-supervisor
二、启动php-worker
docker-compose up -d php-worker
三、进入workspace
docker-compose exec workspace bash
cd example-app
composer require laravel/horizon
php artisan horizon:install # 执行完这一步,可以打开 http://localhost/horizon/dashboard 访问,但是status是in-active,这是因为horizon还没有启动,用下面的命令启动就可以了
php artisan horizon # 启动horizon,此时horizon的状态会变成active
参考资料
https://laravel.com/docs/9.x/horizon#configuration