capistrano-sidekiq 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +25 -1
- data/lib/capistrano/sidekiq/version.rb +1 -1
- data/lib/capistrano/tasks/capistrano2.rb +31 -6
- data/lib/capistrano/tasks/sidekiq.cap +19 -8
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5ad138283f25fb8e7f052e76ebe99b729b97b6fe
|
4
|
+
data.tar.gz: f9ac72309d9b3973170be0510fe23e44e355b3a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6b45f749f552181926bb83c1e43c4ce811cd922a55585f438725621255e2263a22be1bf666d60db14d08788094761cf09cd2ed5d078c39ada24b1675c9229e2
|
7
|
+
data.tar.gz: c4a9082ac21c841d0b1c0d9a83d831846542ea3bdb77587003ffc1fa8c5525a6194d2e86a71873d8d356fe99a1d41f586874cd212548417f4a90114c3d7b1411
|
data/README.md
CHANGED
@@ -8,14 +8,38 @@ Add this line to your application's Gemfile:
|
|
8
8
|
|
9
9
|
gem 'capistrano-sidekiq' , github: 'seuros/capistrano-sidekiq'
|
10
10
|
|
11
|
+
or:
|
12
|
+
|
13
|
+
gem 'capistrano-sidekiq'
|
11
14
|
|
12
15
|
And then execute:
|
13
16
|
|
14
17
|
$ bundle
|
15
18
|
|
19
|
+
|
16
20
|
## Usage
|
21
|
+
```ruby
|
22
|
+
# Capfile
|
23
|
+
|
24
|
+
require 'capistrano/sidekiq'
|
25
|
+
```
|
26
|
+
|
27
|
+
|
28
|
+
Configurable options, shown here with defaults:
|
29
|
+
|
30
|
+
```ruby
|
31
|
+
:sidekiq_default_hooks => true
|
32
|
+
:sidekiq_pid => File.join(shared_path, 'tmp', 'pids', 'sidekiq.pid')
|
33
|
+
:sidekiq_env => fetch(:rack_env, fetch(:rails_env, fetch(:stage)))
|
34
|
+
:sidekiq_log => File.join(shared_path, 'log', 'sidekiq.log')
|
35
|
+
:sidekiq_options => "-e #{fetch(:sidekiq_env)} -L #{fetch(:sidekiq_log)}"
|
36
|
+
:sidekiq_timeout => 10
|
37
|
+
:sidekiq_role => :app
|
38
|
+
:sidekiq_processes => 1
|
39
|
+
:sidekiq_cmd => "#{fetch(:bundle_cmd, "bundle")} exec sidekiq" # Only for capistrano2.5
|
40
|
+
:sidekiqctl_cmd => "#{fetch(:bundle_cmd, "bundle")} exec sidekiqctl" # Only for capistrano2.5
|
41
|
+
```
|
17
42
|
|
18
|
-
TODO: Write usage instructions here
|
19
43
|
|
20
44
|
## Contributing
|
21
45
|
|
@@ -1,11 +1,18 @@
|
|
1
1
|
Capistrano::Configuration.instance.load do
|
2
2
|
|
3
3
|
_cset(:sidekiq_default_hooks) { true }
|
4
|
+
|
5
|
+
_cset(:sidekiq_pid) { File.join(shared_path, 'pids', 'sidekiq.pid') }
|
6
|
+
_cset(:sidekiq_env) { fetch(:rack_env, fetch(:rails_env, fetch(:stage))) }
|
7
|
+
_cset(:sidekiq_log) { File.join(shared_path, 'log', 'sidekiq.log') }
|
8
|
+
|
9
|
+
_cset(:sidekiq_options) { nil }
|
10
|
+
|
4
11
|
_cset(:sidekiq_cmd) { "#{fetch(:bundle_cmd, "bundle")} exec sidekiq" }
|
5
12
|
_cset(:sidekiqctl_cmd) { "#{fetch(:bundle_cmd, "bundle")} exec sidekiqctl" }
|
6
|
-
|
7
|
-
_cset(:
|
8
|
-
_cset(:
|
13
|
+
|
14
|
+
_cset(:sidekiq_timeout) { 10 }
|
15
|
+
_cset(:sidekiq_role) { :app }
|
9
16
|
_cset(:sidekiq_processes) { 1 }
|
10
17
|
|
11
18
|
if fetch(:sidekiq_default_hooks)
|
@@ -18,7 +25,12 @@ Capistrano::Configuration.instance.load do
|
|
18
25
|
namespace :sidekiq do
|
19
26
|
def for_each_process(&block)
|
20
27
|
fetch(:sidekiq_processes).times do |idx|
|
21
|
-
|
28
|
+
pid_file = if idx.zero? && fetch(:sidekiq_processes) <= 1
|
29
|
+
fetch(:sidekiq_pid)
|
30
|
+
else
|
31
|
+
fetch(:sidekiq_pid).gsub(/\.pid$/, "-#{idx}.pid")
|
32
|
+
end
|
33
|
+
yield(pid_file, idx)
|
22
34
|
end
|
23
35
|
end
|
24
36
|
|
@@ -38,9 +50,22 @@ Capistrano::Configuration.instance.load do
|
|
38
50
|
|
39
51
|
desc 'Start sidekiq'
|
40
52
|
task :start, :roles => lambda { fetch(:sidekiq_role) }, :on_no_matching_servers => :continue do
|
41
|
-
rails_env = fetch(:rails_env, 'production')
|
42
53
|
for_each_process do |pid_file, idx|
|
43
|
-
|
54
|
+
args = []
|
55
|
+
args.push "--index #{idx}"
|
56
|
+
args.push "--pidfile #{pid_file}"
|
57
|
+
args.push "--environment #{fetch(:sidekiq_env)}"
|
58
|
+
args.push "--logfile #{fetch(:sidekiq_log)}" if fetch(:sidekiq_log)
|
59
|
+
args.push fetch(:sidekiq_options)
|
60
|
+
|
61
|
+
if defined?(JRUBY_VERSION)
|
62
|
+
args.push ">/dev/null 2>&1 &"
|
63
|
+
logger.info 'Since JRuby doesn\'t support Process.daemon, Sidekiq will not be running as a daemon.'
|
64
|
+
else
|
65
|
+
args.push "--daemon"
|
66
|
+
end
|
67
|
+
|
68
|
+
run "cd #{current_path} ; #{fetch(:sidekiq_cmd)} #{args.compact.join(' ')} ", :pty => false
|
44
69
|
end
|
45
70
|
end
|
46
71
|
|
@@ -6,8 +6,7 @@ namespace :load do
|
|
6
6
|
set :sidekiq_env, -> { fetch(:rack_env, fetch(:rails_env, fetch(:stage))) }
|
7
7
|
set :sidekiq_log, -> { File.join(shared_path, 'log', 'sidekiq.log') }
|
8
8
|
|
9
|
-
|
10
|
-
set :sidekiq_options, -> { "-e #{fetch(:sidekiq_env)} -L #{fetch(:sidekiq_log)}" }
|
9
|
+
set :sidekiq_options, -> { nil }
|
11
10
|
|
12
11
|
set :sidekiq_timeout, -> { 10 }
|
13
12
|
set :sidekiq_role, -> { :app }
|
@@ -28,7 +27,12 @@ end
|
|
28
27
|
namespace :sidekiq do
|
29
28
|
def for_each_process(&block)
|
30
29
|
fetch(:sidekiq_processes).times do |idx|
|
31
|
-
|
30
|
+
pid_file = if idx.zero? && fetch(:sidekiq_processes) <= 1
|
31
|
+
fetch(:sidekiq_pid)
|
32
|
+
else
|
33
|
+
fetch(:sidekiq_pid).gsub(/\.pid$/, "-#{idx}.pid")
|
34
|
+
end
|
35
|
+
yield(pid_file, idx)
|
32
36
|
end
|
33
37
|
end
|
34
38
|
|
@@ -70,14 +74,21 @@ namespace :sidekiq do
|
|
70
74
|
on roles fetch(:sidekiq_role) do
|
71
75
|
within current_path do
|
72
76
|
for_each_process do |pid_file, idx|
|
73
|
-
|
77
|
+
args = []
|
78
|
+
args.push "--index #{idx}"
|
79
|
+
args.push "--pidfile #{pid_file}"
|
80
|
+
args.push "--environment #{fetch(:sidekiq_env)}"
|
81
|
+
args.push "--logfile #{fetch(:sidekiq_log)}" if fetch(:sidekiq_log)
|
82
|
+
args.push fetch(:sidekiq_options)
|
83
|
+
|
74
84
|
if defined?(JRUBY_VERSION)
|
75
|
-
|
76
|
-
warn 'Since JRuby doesn\'t support Process.daemon, Sidekiq will be running
|
85
|
+
args.push ">/dev/null 2>&1 &"
|
86
|
+
warn 'Since JRuby doesn\'t support Process.daemon, Sidekiq will not be running as a daemon.'
|
77
87
|
else
|
78
|
-
|
88
|
+
args.push "--daemon"
|
79
89
|
end
|
80
|
-
|
90
|
+
|
91
|
+
execute :bundle, :exec, :sidekiq, args.compact.join(' ')
|
81
92
|
end
|
82
93
|
end
|
83
94
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-sidekiq
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Abdelkader Boudih
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03-
|
11
|
+
date: 2014-03-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capistrano
|