forked from tobi/delayed_job
-
Notifications
You must be signed in to change notification settings - Fork 954
Rails 3 and Capistrano
jjb edited this page Sep 28, 2011
·
12 revisions
If DJ is installed as a gem don't forget to run the generator. It creates the script/delayed_job script and sets run permissions.
rails generate delayed_job
delayed_job comes with Capistrano recipes to start the script/delayed_job worker but you have to update your config/deploy.rb file to use them. There are 3 changes that need to be made:
require "delayed/recipes"
set :rails_env, "production" #added for delayed job
If you have one or more servers just for delayed job, you can have your workers run just on that server like so. If you do not set :delayed_job_server_role
, it will default to :app
.
role :delayed_job, delayed_job.example.com
set :delayed_job_server_role, :delayed_job
# Delayed Job
before "deploy:restart", "delayed_job:stop"
after "deploy:restart", "delayed_job:start"
after "deploy:stop", "delayed_job:stop"
after "deploy:start", "delayed_job:start"