我正在生产模式下使用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
在这种情况下,我只运行nginx
,mysql
和php-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
的日志中没有任何报告。
嗯...现在可以了!
答案 0 :(得分:0)
这对我有用:
在.env
文件内部添加:
REDIS_CLIENT=predis
,然后重新启动队列:php artisan queue:restart