4

I have no problems with running it in development mode via rake jobs:work. However, I'm somehow unable to figure out how to use it in production. I'm using Capistrano for deployment.

Thanks for any advice!

Milan Novota
  • 15,506
  • 7
  • 54
  • 62

5 Answers5

3

If you install delayed_job as a gem you need to run the generator in order to create the script scripts/delayed_job and set run permissions.

Then you can follow the instructions on How to configure Capistrano for Delayed Job to hook it up in your Capistrano file.

Andrew
  • 227,796
  • 193
  • 515
  • 708
ismaSan
  • 301
  • 1
  • 4
  • 9
2

See this answer. In a nutshell, use the Collective Idea fork of delayed_job. It contains a script called delayed_job that can be used.

Community
  • 1
  • 1
Justin Rudd
  • 5,334
  • 4
  • 22
  • 16
  • I use this fork and have been very happy with it so far. The scripts are just convenience methods to make sure you want the other features or I'd just pull out the scripts. – Mike Aug 19 '11 at 21:22
2

You can run the generated delayed_job script as follows:

RAILS_ENV=production script/delayed_job start

Hope this helps

Jazmin
  • 271
  • 2
  • 6
  • This gives me `-bash: bin/delayed_job: Permission denied`. Using Centos in production. Any suggestions? – Disha Aug 15 '19 at 20:48
0

My first thought will be to add a after deploy task in capistrano to run the rake jobs:work task. you might need to check if the process is already running and restart it.

ez.
  • 7,604
  • 5
  • 30
  • 29
-1

If you are running it via rake then couldn't you just run however often you wanted via cron? The whenever gem is a great interface to this from ruby.

nitecoder
  • 5,496
  • 1
  • 28
  • 35
  • Scheduling asynchronous jobs should prevent from having to manage a schedule task. If you want those tasks without having to poll your server it is not a good option. – Raphael Pr Jun 30 '14 at 14:29