Delaying a job in Rails 4 with Capistrano

I cannot figure out how to run Delayed Jobs on a dedicated Ubuntu server.

It works fine on my localhost, but when I run on my server

sudo RAILS_ENV=production bin/delayed_job restart

      

I get

sudo: bin/delayed_job: command not found

      

Also, if I run the command "rake jobs: work RAILS_ENV = production" Im getting the following error:

 PG::FeatureNotSupported: ERROR:  SELECT FOR UPDATE/SHARE is not allowed in subqueries

      

Apparently the problem is with my psql version.

Is there a way to make the script work? Are there any effective Capistrano recipes available? All ive found on the internet are old recipes for Rails 3 and older versions of capistrano.

Thanks in advance.

EDIT:

I already linked the installation of the gem daemons and generated a "delayed_job: active_record" on my local machine and then decided to close the deployment which installed the package and ported to the production server.

Bin / delayed_job file exists on the server, but it doesn't work, command not found.

+3


source to share


2 answers


And add this to config / environment.rb:

ENV['RAILS_ENV'] ||= 'production'

      

Then on your production server:

RAILS_ENV=production rake db:migrate 

RAILS_ENV=test production generate delayed_job:active_record && RAILS_ENV=production rake db:migrate

      



Now after that:

RAILS_ENV=production script/delayed_job start

      

As for the Capistrano error you are facing, try adding the command:

run "cd #{current_path}; #{sudo} RACK_ENV=production bundle exec #{current_path}/bin/delayed_job start"

      

0


source


You have to run this on the target server:



bundle exec rails generate delayed_job

      

0


source







All Articles