Laradock php-worker不适用于工匠队列:工作

问题描述

我正在生产模式下使用Laradock部署Laravel 7.28.3应用程序。

到目前为止,该应用程序正在使用“让我们加密”在其domain.com中工作。

由于我正在使用电子邮件验证功能,因此我希望php artisan queue:work在后​​台运行。根据{{​​3}},您可以使用php-worker容器。

所以我根据它们进行了全部设置,但是php-worker并未调度排队的作业。

在.env中,队列连接驱动程序为database

QUEUE_CONNECTION=database

配置文件如下:

laravel-worker.conf目录中的

php-worker/supervisord.d/

[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/artisan queue:work --sleep=3 --tries=3 --daemon
autostart=true
autorestart=true
numprocs=8
user=root
redirect_stderr=true

在这种情况下,我只运行nginxmysqlphp-worker容器。文档说workspace容器是自动运行的。所以:

$ sudo docker-compose -f docker-compose.production.yml up --build nginx mysql php-worker

扫描实时日志时,我收到以下消息:

php-worker_1           | 2020-08-11 03:13:48,889 CRIT Supervisor is running as root.  Privileges were not dropped because no user is specified in the config file.  If you intend to run as root,you can set user=root in the config file to avoid this message.
php-worker_1           | 2020-08-11 03:13:48,889 INFO Included extra file "/etc/supervisord.d/laravel-worker.conf" during parsing
php-worker_1           | 2020-08-11 03:13:48,895 INFO RPC interface 'supervisor' initialized
php-worker_1           | 2020-08-11 03:13:48,895 CRIT Server 'inet_http_server' running without any HTTP authentication checking
php-worker_1           | 2020-08-11 03:13:48,895 INFO supervisord started with pid 1
...
php-worker_1           | 2020-08-11 03:13:49,938 INFO spawned: 'laravel-worker_07' with pid 14
php-worker_1           | 2020-08-11 03:13:50,939 INFO success: laravel-worker_00 entered RUNNING state,process has stayed up for > than 1 seconds (startsecs)
php-worker_1           | 2020-08-11 03:13:50,939 INFO success: laravel-worker_01 entered RUNNING state,process has stayed up for > than 1 seconds (startsecs)

然后,我通过创建一个新帐户(在/ register)测试该应用程序,php-worker的日志中没有任何报告。

嗯...现在可以了!

the docs

解决方法

这对我有用:

.env文件内部添加:

REDIS_CLIENT=predis

,然后重新启动队列:php artisan queue:restart

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...