【问题标题】:Can't get artisan queue:work to process jobs with Supervisor on Elastic Beanstalk (Laravel/Redis)无法获得工匠队列:在 Elastic Beanstalk (Laravel/Redis) 上使用主管处理作业
【发布时间】:2019-12-13 04:17:18
【问题描述】:

我们正在尝试使用 Laravel Artisan Daemon Queue Listener 处理 Redis 队列。

通过 SSH 登录到其中一台 EC2 服务器时,直接运行命令 php /var/app/current/artisan queue:work --tries=3 每次都能完美运行。但是,当通过 Supervisor 运行此命令时,没有任何反应。

在我们的 .ebextensions 文件夹中,我们有一个脚本文件,其中包含将我们的主管配置复制到机器上的文件夹所需的以下配置:

    01-migration:
        command: "php /var/app/ondeck/artisan migrate --force && php /var/app/ondeck/artisan db:seed --force"
        leader_only: true

    02-supervisor:
        command: "mkdir -p /etc/supervisor/conf.d/ && cat eb/laravel-worker.conf > /etc/supervisor/conf.d/laravel-worker.conf && cat eb/supervisord.conf > /etc/supervisor/conf.d/supervisord.conf && mkdir -p /var/log/supervisor/ && touch /var/log/supervisor/supervisord.log"

laravel-worker.conf

[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /var/app/current/artisan queue:listen --tries=3
autostart=true
autorestart=true
user=webapp
numprocs=5
redirect_stderr=true
stdout_logfile=/var/app/current/storage/worker.log

我们可以看到正在创建的进程:

正在运行的进程的屏幕截图

我们也看不到日志文件 (worker.log) 中发生的任何事情。

【问题讨论】:

    标签: laravel redis queue amazon-elastic-beanstalk laravel-artisan


    【解决方案1】:

    在 GitHub 上找到 lifeofguenter 的配置后,我们发现 supervisor 无法读取我们的环境变量。

    这句话启发了我们:

    # make sure elasticbeanstalk PARAMS are being passed through to supervisord
    . /opt/elasticbeanstalk/support/envvars
    

    来源:https://gist.github.com/lifeofguenter/f8ea93f10a403807a719

    【讨论】:

      猜你喜欢
      • 2021-05-22
      • 2016-10-26
      • 2016-03-04
      • 1970-01-01
      • 2018-07-26
      • 2014-04-05
      • 2020-03-03
      • 2023-03-17
      • 2016-05-26
      相关资源
      最近更新 更多