【发布时间】:2020-02-12 03:17:36
【问题描述】:
我在rails应用程序开发中使用delayed_job,在开发环境中我使用bin/delayed_job start
但是在生产环境中怎么做呢?
【问题讨论】:
标签: ruby-on-rails ruby ruby-on-rails-4 delayed-job
我在rails应用程序开发中使用delayed_job,在开发环境中我使用bin/delayed_job start
但是在生产环境中怎么做呢?
【问题讨论】:
标签: ruby-on-rails ruby ruby-on-rails-4 delayed-job
RAILS_ENV=production bin/delayed_job start
这应该使延迟的作业在生产环境中运行
【讨论】:
bin/delayed_job: Permission denied。使用 Centos 进行生产。有什么建议吗?
开始:
cd /home/user/app;
bundle exec /usr/bin/env RAILS_ENV=production /home/user/app/script/delayed_job start
停止:
cd /home/user/app;
bundle exec /usr/bin/env RAILS_ENV=production /home/user/app/script/delayed_job stop
请参阅github 的官方文档。
RAILS_ENV=production script/delayed_job start
RAILS_ENV=production script/delayed_job stop
# Runs two workers in separate processes.
RAILS_ENV=production script/delayed_job -n 2 start
RAILS_ENV=production script/delayed_job stop
# Set the --queue or --queues option to work from a particular queue.
RAILS_ENV=production script/delayed_job --queue=tracking start
RAILS_ENV=production script/delayed_job --queues=mailers,tasks start
# Use the --pool option to specify a worker pool. You can use this option multiple times to start different numbers of workers for different queues.
# The following command will start 1 worker for the tracking queue,
# 2 workers for the mailers and tasks queues, and 2 workers for any jobs:
RAILS_ENV=production script/delayed_job --pool=tracking --pool=mailers,tasks:2 --pool=*:2 start
# Runs all available jobs and then exits
RAILS_ENV=production script/delayed_job start --exit-on-complete
# or to run in the foreground
RAILS_ENV=production script/delayed_job run --exit-on-complete
【讨论】:
如果其他人遇到 -bash: bin/delayed_job: Permission denied 错误,就像 Disha 在上面的 cmets 中所做的那样,对于 Centos 来说,将项目目录中 bin/ 文件夹中的延迟作业设置为可执行文件就足够了。
【讨论】: