mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
Add capistrano integration [#52]
This commit is contained in:
parent
bf377d44e8
commit
9fb20f6249
6 changed files with 67 additions and 0 deletions
|
@ -1,6 +1,8 @@
|
||||||
HEAD
|
HEAD
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
|
- Add capistrano support, just require 'sidekiq/capistrano' in config/deploy.rb.
|
||||||
|
- Workers now log upon start and finish (mperham)
|
||||||
- Messages for terminated workers are now automatically requeued (mperham)
|
- Messages for terminated workers are now automatically requeued (mperham)
|
||||||
- Add support for Exceptional error reporting (bensie)
|
- Add support for Exceptional error reporting (bensie)
|
||||||
|
|
||||||
|
|
29
lib/sidekiq/capistrano.rb
Normal file
29
lib/sidekiq/capistrano.rb
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
Capistrano::Configuration.instance.load do
|
||||||
|
after "deploy", "sidekiq:restart"
|
||||||
|
|
||||||
|
namespace :sidekiq do
|
||||||
|
|
||||||
|
desc "Force stop sidekiq"
|
||||||
|
task :kill do
|
||||||
|
run "cd #{current_path} && kill `cat tmp/pids/sidekiq.pid` && sleep 5 && kill -9 `cat tmp/pids/sidekiq.pid`"
|
||||||
|
end
|
||||||
|
|
||||||
|
desc "Stop sidekiq"
|
||||||
|
task :stop do
|
||||||
|
run "cd #{current_path} && kill `cat tmp/pids/sidekiq.pid`"
|
||||||
|
end
|
||||||
|
|
||||||
|
desc "Start sidekiq"
|
||||||
|
task :start do
|
||||||
|
rails_env = fetch(:rails_env, "production")
|
||||||
|
run "cd #{current_path} && bundle exec sidekiq -e #{rails_env} -C config/sidekiq.yml -P tmp/pids/sidekiq.pid >> log/sidekiq.log &"
|
||||||
|
end
|
||||||
|
|
||||||
|
desc "Restart sidekiq"
|
||||||
|
task :restart do
|
||||||
|
stop
|
||||||
|
start
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
5
myapp/Capfile
Normal file
5
myapp/Capfile
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
load 'deploy'
|
||||||
|
# Uncomment if you are using Rails' asset pipeline
|
||||||
|
# load 'deploy/assets'
|
||||||
|
Dir['vendor/gems/*/recipes/*.rb','vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
|
||||||
|
load 'config/deploy' # remove this line to skip loading any of the default tasks
|
|
@ -4,3 +4,4 @@ gem 'rails', '3.2.1'
|
||||||
gem 'sqlite3'
|
gem 'sqlite3'
|
||||||
gem 'sidekiq', :path => '..'
|
gem 'sidekiq', :path => '..'
|
||||||
gem 'resque'
|
gem 'resque'
|
||||||
|
gem 'capistrano'
|
||||||
|
|
|
@ -40,9 +40,16 @@ GEM
|
||||||
multi_json (~> 1.0)
|
multi_json (~> 1.0)
|
||||||
arel (3.0.2)
|
arel (3.0.2)
|
||||||
builder (3.0.0)
|
builder (3.0.0)
|
||||||
|
capistrano (2.11.2)
|
||||||
|
highline
|
||||||
|
net-scp (>= 1.0.0)
|
||||||
|
net-sftp (>= 2.0.0)
|
||||||
|
net-ssh (>= 2.0.14)
|
||||||
|
net-ssh-gateway (>= 1.1.0)
|
||||||
celluloid (0.9.0)
|
celluloid (0.9.0)
|
||||||
connection_pool (0.1.0)
|
connection_pool (0.1.0)
|
||||||
erubis (2.7.0)
|
erubis (2.7.0)
|
||||||
|
highline (1.6.11)
|
||||||
hike (1.2.1)
|
hike (1.2.1)
|
||||||
i18n (0.6.0)
|
i18n (0.6.0)
|
||||||
journey (1.0.2)
|
journey (1.0.2)
|
||||||
|
@ -53,6 +60,13 @@ GEM
|
||||||
treetop (~> 1.4.8)
|
treetop (~> 1.4.8)
|
||||||
mime-types (1.17.2)
|
mime-types (1.17.2)
|
||||||
multi_json (1.1.0)
|
multi_json (1.1.0)
|
||||||
|
net-scp (1.0.4)
|
||||||
|
net-ssh (>= 1.99.1)
|
||||||
|
net-sftp (2.0.5)
|
||||||
|
net-ssh (>= 2.0.9)
|
||||||
|
net-ssh (2.3.0)
|
||||||
|
net-ssh-gateway (1.1.0)
|
||||||
|
net-ssh (>= 1.99.1)
|
||||||
polyglot (0.3.3)
|
polyglot (0.3.3)
|
||||||
rack (1.4.1)
|
rack (1.4.1)
|
||||||
rack-cache (1.1)
|
rack-cache (1.1)
|
||||||
|
@ -111,6 +125,7 @@ PLATFORMS
|
||||||
ruby
|
ruby
|
||||||
|
|
||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
|
capistrano
|
||||||
rails (= 3.2.1)
|
rails (= 3.2.1)
|
||||||
resque
|
resque
|
||||||
sidekiq!
|
sidekiq!
|
||||||
|
|
15
myapp/config/deploy.rb
Normal file
15
myapp/config/deploy.rb
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
require 'bundler/capistrano'
|
||||||
|
require 'sidekiq/capistrano'
|
||||||
|
|
||||||
|
set :scm, :git
|
||||||
|
set :repository, 'git@github.com:mperham/sidekiq'
|
||||||
|
ssh_options[:forward_agent] = true
|
||||||
|
|
||||||
|
default_run_options[:pty] = true # needed to run sudo
|
||||||
|
set :user, 'mperham'
|
||||||
|
set :application, "myapp"
|
||||||
|
set :deploy_via, :remote_cache
|
||||||
|
|
||||||
|
role :web, "localhost"
|
||||||
|
role :app, "localhost"
|
||||||
|
role :db, "localhost", :primary => true
|
Loading…
Reference in a new issue