Add capistrano support for delayed job
This commit is contained in:
parent
825dee8e02
commit
fc5fa70980
2 changed files with 45 additions and 0 deletions
|
@ -45,6 +45,7 @@ namespace :passenger do
|
||||||
execute "touch #{current_path}/tmp/restart.txt"
|
execute "touch #{current_path}/tmp/restart.txt"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
invoke 'delayed_job:restart'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
44
lib/capistrano/tasks/delayed_job.cap
Normal file
44
lib/capistrano/tasks/delayed_job.cap
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
namespace :delayed_job do
|
||||||
|
|
||||||
|
def args
|
||||||
|
fetch(:delayed_job_args, "")
|
||||||
|
end
|
||||||
|
|
||||||
|
def delayed_job_roles
|
||||||
|
fetch(:delayed_job_server_role, :app)
|
||||||
|
end
|
||||||
|
|
||||||
|
desc 'Stop the delayed_job process'
|
||||||
|
task :stop do
|
||||||
|
on roles(delayed_job_roles) do
|
||||||
|
within release_path do
|
||||||
|
with rails_env: fetch(:rails_env) do
|
||||||
|
execute :ruby, 'bin/delayed_job', :stop
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
desc 'Start the delayed_job process'
|
||||||
|
task :start do
|
||||||
|
on roles(delayed_job_roles) do
|
||||||
|
within release_path do
|
||||||
|
with rails_env: fetch(:rails_env) do
|
||||||
|
execute :ruby, 'bin/delayed_job', args, :start
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
desc 'Restart the delayed_job process'
|
||||||
|
task :restart do
|
||||||
|
on roles(delayed_job_roles) do
|
||||||
|
within release_path do
|
||||||
|
with rails_env: fetch(:rails_env) do
|
||||||
|
execute :ruby, 'bin/delayed_job', args, :restart
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
Loading…
Reference in a new issue