Skip to content

Commit

Permalink
cap deploy old style but stop and start
Browse files Browse the repository at this point in the history
  • Loading branch information
ndushay committed Jan 24, 2017
1 parent e8a7809 commit 8505716
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 61 deletions.
2 changes: 1 addition & 1 deletion Capfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ require 'capistrano/rails/migrations'

require 'dlss/capistrano'
require 'capistrano/passenger'
require 'capistrano/delayed_job'
# require 'capistrano/delayed_job'
require "whenever/capistrano"

# Loads custom tasks from `lib/capistrano/tasks' if you have any defined.
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ group :deployment do
gem 'capistrano-bundler'
gem 'capistrano-passenger'
gem 'capistrano-rails'
gem 'capistrano-delayed-job'
# gem 'capistrano-delayed-job'
gem 'dlss-capistrano'
end

Expand Down
5 changes: 0 additions & 5 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,6 @@ GEM
capistrano-bundler (1.1.4)
capistrano (~> 3.1)
sshkit (~> 1.2)
capistrano-delayed-job (1.1.0)
capistrano (>= 3.1)
daemons (>= 1.1)
sshkit (>= 1.2.0)
capistrano-harrow (0.5.3)
capistrano-one_time_key (0.0.1)
capistrano (~> 3.0)
Expand Down Expand Up @@ -297,7 +293,6 @@ PLATFORMS
DEPENDENCIES
assembly-image
capistrano-bundler
capistrano-delayed-job
capistrano-passenger
capistrano-rails
capybara
Expand Down
22 changes: 13 additions & 9 deletions config/deploy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,16 @@
# Default value for keep_releases is 5
# set :keep_releases, 5

# namespace :deploy do
# desc 'Restart application'
# task :restart do
# on roles(:app), in: :sequence, wait: 5 do
# execute :touch, release_path.join('tmp/restart.txt')
# invoke 'delayed_job:restart'
# end
# end
# end
set :delayed_job_prefix, 'was-thumbnail-service'

namespace :deploy do
desc 'Restart application'
task :restart do
on roles(:app), in: :sequence, wait: 5 do
execute :touch, release_path.join('tmp/restart.txt')
# note that delayed_job:restart doesn't kill old process
invoke 'delayed_job:stop'
invoke 'delayed_job:start'
end
end
end
1 change: 0 additions & 1 deletion config/initializers/delayed_job_config.rb

This file was deleted.

90 changes: 46 additions & 44 deletions lib/capistrano/tasks/delayed_job.cap
Original file line number Diff line number Diff line change
@@ -1,44 +1,46 @@
# 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
# test :bundle, :exec, :'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 :bundle, :exec, :'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 :bundle, :exec, :'bin/delayed_job', args, :restart
# end
# end
# end
# end
#
# end
# from https://github.com/collectiveidea/delayed_job/wiki/Delayed-Job-tasks-for-Capistrano-3

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
test :bundle, :exec, :'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 :bundle, :exec, :'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 :bundle, :exec, :'bin/delayed_job', args, :restart
end
end
end
end

end

0 comments on commit 8505716

Please sign in to comment.