一、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