首页 > 解决方案 > Laravel 8 为 DDEV 开发设置主管 .conf 文件

问题描述

我正在尝试设置主管来处理队列。我很确定这与 .conf 由于 DDEV 而运行的范围有关,但我不是 100% 确定。

这是我现在的.conf

[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/html/artisan queue:work redis
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
user=www-data
numprocs=5
redirect_stderr=true
stdout_logfile=/home/user/app/workers.log

在这个目录中运行/var/www/html我得到了这个错误:

supervisor: couldn't chdir to /var/www/html: ENOENT
supervisor: child process was not spawned

我尝试过的其他事情

我试过在目录中运行/home/user/app/artisan,这实际上有点工作。它确实启动了工作人员,但他们没有监听 DDEV 的正确范围原因,它需要位于/var/www/html我通过 ssh 的目录中ddev ssh。说到这我也已经尝试将 .conf 更改为

directory=/home/user/app
command=ddev exec php artisan queue:work redis

我收到一个关于它无法识别 ddev 命令的错误,但它从命令行运行良好。

如果需要任何其他信息,请告诉我。

标签: phplaravelsupervisordwsl-2ddev

解决方案


Once the configuration file has been created, you may update the Supervisor configuration and start the processes using the following commands:

sudo supervisorctl reread

sudo supervisorctl update

sudo supervisorctl start laravel-worker:*

For more information on Supervisor, Please Check Here - http://supervisord.org/index.html


推荐阅读