Setting up pending jobs with Capistrano and Rails 4

I am trying to get Capistrano to start / stop Delayed Jobs using the Rails 4 application. I followed the instructions here , but it says Rails 3. Here is how it is configured now:

deploy.rb:

require 'delayed/recipes' after "deploy:start", "delayed_job:start" after "deploy:stop", "delayed_job:stop" after "deploy:restart", "delayed_job:stop","delayed_job:start" 

When I try to deploy, I get the following error after trying to execute RAILS_ENV = production script / delayed_job stop

 sh: script/delayed_job: not found 
+8
ruby-on-rails ruby-on-rails-4 capistrano delayed-job
source share
3 answers

Found a workaround ( set: delayed_job_command, bin / delayed_job ) and hope this helps someone else!

deploy.rb:

 require 'delayed/recipes' set :delayed_job_command, "bin/delayed_job" after "deploy:start", "delayed_job:start" after "deploy:stop", "delayed_job:stop" after "deploy:restart", "delayed_job:stop","delayed_job:start" 
+18
source share

The accepted answer didn't help me either. I did the following

deploy.rb

 def rails_env fetch(:rails_env, false) ? "RAILS_ENV=#{fetch(:rails_env)}" : '' end execute "cd #{current_path};#{rails_env} bin/delayed_job restart" 
+3
source share

It didn’t work for me. My production environment consists of ubuntu 12.04, rails 4, rbenv ruby ​​2 and for deploying capistrano 3. After reusing it with each applicable solution, I came up with this line in my deploy.rb in the restart task.

execute: ruby, "/ var / www / app / current / bin / delayed_job restart"

so simple and it took me 2 days to come up with this. In my setup, I had to manually set bin / delayed_job.

Hope someone else finds this helpful.

+1
source share

All Articles