3
votes

I cant figure how to start 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

On top of that, if I run the "rake jobs:work RAILS_ENV=production" command Im getting the following error:

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

Apparently theres an issue with my psql version.

Is there any way I can get the script to work? Any effective Capistrano recipes available? All ive found on the web are old recipes for Rails 3 and older versions of capistrano.

Thanks in advance.

EDIT:

I have already bundled install the daemons gem and generated "delayed_job:active_record" on my local machine, then proceded to cap deploy which bundle installed and migrated in the production server.

The bin/delayed_job file exists in the server yet it fails with command not found.

2
Are you sure you installed the gems at your server? bundle install ?Eki Eqbal
Plz make sure to add gem "daemons" to your Gemfile, then bundle install. You have to run rails generate delayed_job:active_record && rake db:migrate.Eki Eqbal
@EkiEqbal Yes I have already bundled install the daemons gem and generated "delayed_job:active_record" on my local machine. Do I have to run it on the production server also?user3455909
Ya please run it at your production server, or if you want create a Capistrano recipe to automate that at the production server.Eki Eqbal
Keep me updated so I can post it as an answer if your problem has been solved.Eki Eqbal

2 Answers

0
votes

And add this to config/environment.rb:

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

Then at 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 you do that:

RAILS_ENV=production script/delayed_job start

As for Capistrano error you are facing, please try to add the command like:

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

You must run this on target server:

bundle exec rails generate delayed_job