sidekiq-cluster 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.document +5 -0
- data/.gitignore +20 -0
- data/.rspec +1 -0
- data/.travis.yml +28 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +20 -0
- data/README.md +80 -0
- data/Rakefile +35 -0
- data/exe/sidekiq-cluster +6 -0
- data/lib/sidekiq/cluster.rb +9 -0
- data/lib/sidekiq/cluster/cli.rb +277 -0
- data/lib/sidekiq/cluster/version.rb +6 -0
- data/sidekiq-cluster.gemspec +38 -0
- metadata +172 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: da72edd26d09ba063231b3b73a06ce891ed34fd2
|
4
|
+
data.tar.gz: 3dc9fcb9359f7626a26b62a1694c20365ccdd5ed
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 14fedbc8f6500d3c27dfc7821bf4582ef931187b6ccf24314184ff060f2bd70f187203b54ca819c7cd384d7dea3cca03d2f42bca2f502d4db89492b020978862
|
7
|
+
data.tar.gz: 2222f7178526b52c8bd8e925e1c6ea72ac63c7f0d38c06a1208b33af4accad001f64fa1e7c73eb99222a9efb33999fbd591a92bb863f6ed264506690d87cfefd
|
data/.document
ADDED
data/.gitignore
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
.idea/
|
2
|
+
/.bundle/
|
3
|
+
/.yardoc
|
4
|
+
/Gemfile.lock
|
5
|
+
/_yardoc/
|
6
|
+
/doc/
|
7
|
+
/pkg/
|
8
|
+
/coverage/
|
9
|
+
/spec/coverage/
|
10
|
+
/tmp/
|
11
|
+
/data
|
12
|
+
/*.enc
|
13
|
+
**/.DS_Store
|
14
|
+
.ruby-version
|
15
|
+
.rspec_status
|
16
|
+
/spec/fixtures/file*/Arlifile.*
|
17
|
+
/spec/fixtures/file*/libraries
|
18
|
+
.rake_tasks~
|
19
|
+
.vscode
|
20
|
+
|
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/.travis.yml
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
env:
|
2
|
+
global:
|
3
|
+
- CC_TEST_REPORTER_ID=f8f229bdf1f374a3a9227d3bef6f57b78f88c73a2d4705c9de5852bb484eaaef
|
4
|
+
sudo: false
|
5
|
+
language: ruby
|
6
|
+
cache: bundler
|
7
|
+
rvm:
|
8
|
+
- 2.2.7
|
9
|
+
- 2.4.1
|
10
|
+
- 2.3.5
|
11
|
+
- 2.5.0
|
12
|
+
before_install: gem install bundler -v 1.15.4
|
13
|
+
before_script:
|
14
|
+
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64
|
15
|
+
> ./cc-test-reporter
|
16
|
+
- chmod +x ./cc-test-reporter
|
17
|
+
- "./cc-test-reporter before-build"
|
18
|
+
script:
|
19
|
+
- bundle exec rspec
|
20
|
+
after_script:
|
21
|
+
- "./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT"
|
22
|
+
notifications:
|
23
|
+
webhooks:
|
24
|
+
urls:
|
25
|
+
- secure: fgpv34jAm3rDNjiWuQtuijE0p9B2bpsCWdoCQ82pDZwktSITmNjanYCoZC0hlEw/kqMBDKRN78HfIIidy8dS664sLz8KyaFXq7RWAFsMP9fn/GMG/r9B+S3YumifQ/Zy+3OGa+0Qz76075q291QfNSPv0Y5QDMoAU5VljIVashC/qJS6DRO+vekDaDKIhi4Dr/+JpHPnjchqS4VaMB8gEIrDpeSYNlhrj1oAI/8GwgqZ8UR4sZGxNpIzUg+XGJSYz5/cAB3P18ENSQvOwaNefJa7qIVNjMD7YwXKmfX9cyr5RHM5sibq/S5fHH/N7pig+aveTquGGVxInJr1IEDiyr2TsFARjPitp9KJSFLHLsA2jm1cZfNW0/d6ii+51HdLPKorHom3fPjb0jkIe1LPa9CrrjnfSrAE9a/w4qpSnDv7OjAzkieepz+VQCtpQGIzQxJcHWaFX32iZ6RQ6pmKc/22E0OZwsNM2FHrB5V1b+rfczl8Ej7/R1wAOtHWkbLbfwZ9Ux2N0N0EKW8r8cOjEbsxmN8FFQubTwl68uqjJLhEtrOUbM28JM/NkX+Ue1KRw+NJAdMFEZQKPb/b/X6s3nwPD4/4yLyUDCGyr8aGpzSBD5uIu5uSJNiWdNDjcnXtJJ6TlGGZqj91r7FckjA8FuSA6S3yA8epMNG3FTUxPVE=
|
26
|
+
on_success: always
|
27
|
+
on_failure: onchange
|
28
|
+
on_start: never
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2018 Konstantin Gredeskoul
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
[![Build Status](https://travis-ci.org/kigster/sidekiq-cluster.svg?branch=master)](https://travis-ci.org/kigster/sidekiq-cluster)
|
2
|
+
|
3
|
+
## Sidekiq Cluster
|
4
|
+
|
5
|
+
This is a tiny gem that allows starting sidekiq using multiple processes.
|
6
|
+
|
7
|
+
It does not depend on any particular version of sidekiq, as long as the CLI class of Sidekiq remains named the same.
|
8
|
+
|
9
|
+
### Usage
|
10
|
+
|
11
|
+
Install the gem:
|
12
|
+
|
13
|
+
```
|
14
|
+
gem install sidekiq-cluster
|
15
|
+
```
|
16
|
+
|
17
|
+
Then try running it with `--help`:
|
18
|
+
|
19
|
+
```
|
20
|
+
sidekiq-cluster -h
|
21
|
+
|
22
|
+
USAGE
|
23
|
+
sidekiq-cluster [options] -- [sidekiq-options]
|
24
|
+
|
25
|
+
EXAMPLES
|
26
|
+
$ cd rails_app
|
27
|
+
$ bundle exec sidekiq-cluster -N 2 -- -c 10 -q default,12 -l log/sidekiq.log
|
28
|
+
|
29
|
+
SIDEKIQ CLUSTER OPTIONS
|
30
|
+
-n, --name=NAME the name of this cluster, used when
|
31
|
+
when running multiple clusters
|
32
|
+
|
33
|
+
-P, --pidfile=FILE Pidfile prefix,
|
34
|
+
eg "/var/www/shared/config/sidekiq.pid"
|
35
|
+
|
36
|
+
-l, --logfile=FILE Logfile for the cluster script
|
37
|
+
|
38
|
+
-M, --max-memory=PERCENT Maximum percent RAM that this
|
39
|
+
cluster should not exceed. Defaults to 80%.
|
40
|
+
|
41
|
+
-N, --num-processes=NUM Number of processes to start,
|
42
|
+
defaults to number of cores - 1
|
43
|
+
|
44
|
+
-q, --quiet Do not log to STDOUT
|
45
|
+
-d, --debug Print debugging info before starting sidekiqs
|
46
|
+
-h, --help this help
|
47
|
+
|
48
|
+
|
49
|
+
```
|
50
|
+
|
51
|
+
## Examples
|
52
|
+
|
53
|
+
```bash
|
54
|
+
$ cd rails-app
|
55
|
+
$ echo "gem 'sidekiq-cluster'" >> Gemfile
|
56
|
+
$ bundle install
|
57
|
+
$ bundle exec sidekiq-cluster \
|
58
|
+
-P /var/pids/sidekiq.pid \ # these are arguments to sidekiq-cluster
|
59
|
+
-n default \
|
60
|
+
-M 90 \
|
61
|
+
-L /var/log/sidekiq-cluster.log \
|
62
|
+
-N 2 \
|
63
|
+
-- \ # these are arguments for sidekiq.
|
64
|
+
-L /var/log/sidekiq.log -c 10 -e production -q default,10 -q critical,20
|
65
|
+
```
|
66
|
+
|
67
|
+
## Contributing to sidekiq-cluster
|
68
|
+
|
69
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
70
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
71
|
+
* Fork the project.
|
72
|
+
* Start a feature/bugfix branch.
|
73
|
+
* Commit and push until you are happy with your contribution.
|
74
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
75
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
76
|
+
|
77
|
+
## Copyright
|
78
|
+
|
79
|
+
Copyright © 2018 Konstantin Gredeskoul. See LICENSE.txt for further details.
|
80
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
2
|
+
require 'rspec/core/rake_task'
|
3
|
+
require 'yard'
|
4
|
+
|
5
|
+
def shell(*args)
|
6
|
+
puts "running: #{args.join(' ')}"
|
7
|
+
system(args.join(' '))
|
8
|
+
end
|
9
|
+
|
10
|
+
task :clean do
|
11
|
+
shell('rm -rf pkg/ tmp/ coverage/ doc/ s' )
|
12
|
+
end
|
13
|
+
|
14
|
+
task :gem => [:build] do
|
15
|
+
shell('gem install pkg/*')
|
16
|
+
end
|
17
|
+
|
18
|
+
task :permissions => [ :clean ] do
|
19
|
+
shell("chmod -v o+r,g+r * */* */*/* */*/*/* */*/*/*/* */*/*/*/*/*")
|
20
|
+
shell("find . -type d -exec chmod o+x,g+x {} \\;")
|
21
|
+
end
|
22
|
+
|
23
|
+
task :build => :permissions
|
24
|
+
|
25
|
+
YARD::Rake::YardocTask.new(:doc) do |t|
|
26
|
+
t.files = %w(lib/**/*.rb exe/*.rb - README.md LICENSE.txt)
|
27
|
+
t.options.unshift('--title','Sidekiq Cluster — The Missing Multi-Process Sidekiq Manager')
|
28
|
+
t.after = ->() { exec('open doc/index.html') }
|
29
|
+
end
|
30
|
+
|
31
|
+
RSpec::Core::RakeTask.new(:spec)
|
32
|
+
|
33
|
+
task :default => :spec
|
34
|
+
|
35
|
+
|
data/exe/sidekiq-cluster
ADDED
@@ -0,0 +1,277 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'etc'
|
3
|
+
require 'optparse'
|
4
|
+
require 'logger'
|
5
|
+
require 'colored2'
|
6
|
+
|
7
|
+
module Sidekiq
|
8
|
+
module Cluster
|
9
|
+
MAX_RAM_PCT = 80
|
10
|
+
|
11
|
+
ProcessDescriptor = Struct.new(:pid, :index, :pidfile)
|
12
|
+
|
13
|
+
class CLI
|
14
|
+
attr_accessor :name,
|
15
|
+
:pid_prefix,
|
16
|
+
:argv,
|
17
|
+
:sidekiq_argv,
|
18
|
+
:process_count,
|
19
|
+
:pids,
|
20
|
+
:processes,
|
21
|
+
:watch_children,
|
22
|
+
:memory_percentage_limit,
|
23
|
+
:log_device,
|
24
|
+
:logger
|
25
|
+
|
26
|
+
def initialize(argv = ARGV.dup)
|
27
|
+
self.argv = argv
|
28
|
+
self.sidekiq_argv = []
|
29
|
+
end
|
30
|
+
|
31
|
+
def per_process_memory_limit
|
32
|
+
memory_percentage_limit.to_f / process_count.to_f
|
33
|
+
end
|
34
|
+
|
35
|
+
def run!
|
36
|
+
initialize_cli_arguments!
|
37
|
+
print_header!
|
38
|
+
start_main_loop!
|
39
|
+
end
|
40
|
+
|
41
|
+
def start_main_loop!
|
42
|
+
self.processes = {}
|
43
|
+
start_children.each do |descriptor|
|
44
|
+
processes[descriptor.pid] = descriptor
|
45
|
+
end
|
46
|
+
|
47
|
+
self.pids = processes.keys
|
48
|
+
self.watch_children = true
|
49
|
+
|
50
|
+
initiate_main_loop
|
51
|
+
setup_signal_traps
|
52
|
+
|
53
|
+
Process.waitall
|
54
|
+
info 'shutting down...'
|
55
|
+
end
|
56
|
+
|
57
|
+
def print(*args)
|
58
|
+
puts(*args)
|
59
|
+
end
|
60
|
+
|
61
|
+
def stop!(code = 0)
|
62
|
+
Kernel.exit(code)
|
63
|
+
end
|
64
|
+
|
65
|
+
def initialize_cli_arguments!
|
66
|
+
if argv.nil? || argv.empty?
|
67
|
+
argv << '-h'
|
68
|
+
else
|
69
|
+
split_argv! if argv.include?('--')
|
70
|
+
end
|
71
|
+
|
72
|
+
self.log_device = STDOUT
|
73
|
+
self.memory_percentage_limit = MAX_RAM_PCT
|
74
|
+
self.process_count = Etc.nprocessors - 1
|
75
|
+
|
76
|
+
init_logger!
|
77
|
+
parse_args!
|
78
|
+
end
|
79
|
+
|
80
|
+
private
|
81
|
+
|
82
|
+
def print_header!
|
83
|
+
info "starting up sidekiq-cluster for #{name}"
|
84
|
+
info "NOTE: cluster max memory limit is #{memory_percentage_limit.round(2)}% of total"
|
85
|
+
info "NOTE: per sidekiq memory limit is #{per_process_memory_limit.round(2)}% of total"
|
86
|
+
end
|
87
|
+
|
88
|
+
def init_logger!
|
89
|
+
self.logger = ::Logger.new(log_device, level: ::Logger::INFO)
|
90
|
+
end
|
91
|
+
|
92
|
+
def split_argv!
|
93
|
+
self.sidekiq_argv = argv[(argv.index('--') + 1)..-1]
|
94
|
+
self.argv = argv[0..(argv.index('--') - 1)]
|
95
|
+
end
|
96
|
+
|
97
|
+
def setup_signal_traps
|
98
|
+
%w(INT USR1 TERM).each do |sig|
|
99
|
+
Signal.trap(sig) do
|
100
|
+
handle_sig(sig)
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
def initiate_main_loop
|
106
|
+
Thread.new do
|
107
|
+
info 'watching for outsized Sidekiq processes...'
|
108
|
+
loop do
|
109
|
+
sleep 10
|
110
|
+
check_pids
|
111
|
+
break unless @watch_children
|
112
|
+
end
|
113
|
+
info 'leaving the main loop..'
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
def info(*args)
|
118
|
+
@logger.info(*args)
|
119
|
+
end
|
120
|
+
|
121
|
+
def error(*args, exception: nil)
|
122
|
+
@logger.error("exception: #{exception.message}") if exception
|
123
|
+
@logger.error(*args)
|
124
|
+
end
|
125
|
+
|
126
|
+
def handle_sig(sig)
|
127
|
+
print "received OS signal #{sig}"
|
128
|
+
# If we're shutting down, we don't need to re-spawn child processes that die
|
129
|
+
@watch_children = false if sig == 'INT' || sig == 'TERM'
|
130
|
+
@pids.each do |pid|
|
131
|
+
Process.kill(sig, pid)
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
def fork_child(index)
|
136
|
+
require 'sidekiq'
|
137
|
+
require 'sidekiq/cli'
|
138
|
+
|
139
|
+
Process.fork do
|
140
|
+
process_argv = sidekiq_argv.dup << '-P' << pid_file(index)
|
141
|
+
process_argv << '--tag' << "sidekiq.#{name}"
|
142
|
+
info "starting up sidekiq instance #{index} with ARGV: 'bundle exec sidekiq #{process_argv.join(' ')}'"
|
143
|
+
begin
|
144
|
+
cli = Sidekiq::CLI.instance
|
145
|
+
cli.parse process_argv
|
146
|
+
cli.run
|
147
|
+
rescue => e
|
148
|
+
raise e if $DEBUG
|
149
|
+
error e.message
|
150
|
+
error e.backtrace.join("\n")
|
151
|
+
stop!(1)
|
152
|
+
end
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
def pid_file(index)
|
157
|
+
"#{pid_prefix}.#{index}"
|
158
|
+
end
|
159
|
+
|
160
|
+
def start_children
|
161
|
+
Array.new(process_count) do |index|
|
162
|
+
pid = fork_child(index)
|
163
|
+
ProcessDescriptor.new(pid, index, pid_file(index))
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
def check_pids
|
168
|
+
print_info = false
|
169
|
+
@last_info_printed ||= Time.now.to_i
|
170
|
+
if Time.now.to_i - @last_info_printed > 60
|
171
|
+
@last_info_printed = Time.now.to_i
|
172
|
+
print_info = true
|
173
|
+
end
|
174
|
+
|
175
|
+
pids.each do |pid|
|
176
|
+
memory_percent_used = `ps -o %mem= -p #{pid}`.to_f
|
177
|
+
info "sidekiq.#{name % '%15s'}[#{processes[pid].index}] —— pid=#{pid.to_s % '%6d'} —— memory pct=#{memory_percent_used.round(2)}%" if print_info
|
178
|
+
if memory_percent_used == 0.0 # child died
|
179
|
+
restart_dead_child(pid)
|
180
|
+
elsif memory_percent_used > per_process_memory_limit
|
181
|
+
info "pid #{pid} crossed memory threshold, used #{memory_percent_used.round(2)}% of RAM, exceeded #{per_process_memory_limit}% —> replacing..."
|
182
|
+
restart_oversized_child(pid)
|
183
|
+
elsif $DEBUG
|
184
|
+
info "#{pid}: #{memory_percent_used.round(2)}"
|
185
|
+
end
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
189
|
+
def restart_oversized_child(pid)
|
190
|
+
@pids.delete(pid)
|
191
|
+
Process.kill('USR1', pid)
|
192
|
+
sleep 5
|
193
|
+
Process.kill('TERM', pid)
|
194
|
+
@pids << fork_child
|
195
|
+
end
|
196
|
+
|
197
|
+
def replace_pid(old_pid, new_pid)
|
198
|
+
if processes[old_pid]
|
199
|
+
pd = processes[old_pid]
|
200
|
+
pid_file = pid_file(pd.index)
|
201
|
+
|
202
|
+
::File.unlink(pid_file) if ::File.exist?(pidfile)
|
203
|
+
pids.delete(old_pid)
|
204
|
+
pd.pid = new_pid
|
205
|
+
|
206
|
+
processes.delete(pid)
|
207
|
+
processes[new_pid] = pd
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
211
|
+
def restart_dead_child(pid)
|
212
|
+
info "pid=#{pid} died, restarting..."
|
213
|
+
|
214
|
+
pd = processes[pid]
|
215
|
+
new_pid = fork_child(pd.index)
|
216
|
+
|
217
|
+
replace_pid(pid, new_pid)
|
218
|
+
info "replaced lost pid #{pid} with #{new_pid}"
|
219
|
+
end
|
220
|
+
|
221
|
+
def parse_args!
|
222
|
+
options = {}
|
223
|
+
banner = "USAGE".bold.blue + "\n sidekiq-cluster [options] -- [sidekiq-options]".bold.green
|
224
|
+
parser = ::OptionParser.new(banner) do |opts|
|
225
|
+
opts.separator ''
|
226
|
+
opts.separator 'EXAMPLES'.bold.blue
|
227
|
+
opts.separator ' $ cd rails_app'.bold.magenta
|
228
|
+
opts.separator ' $ bundle exec sidekiq-cluster -N 2 -- -c 10 -q default,12 -l log/sidekiq.log'.bold.magenta
|
229
|
+
opts.separator ' '
|
230
|
+
opts.separator 'SIDEKIQ CLUSTER OPTIONS'.bold.blue
|
231
|
+
|
232
|
+
opts.on('-n', '--name=NAME',
|
233
|
+
'the name of this cluster, used when ',
|
234
|
+
'when running multiple clusters', ' ') do |v|
|
235
|
+
self.name = v
|
236
|
+
end
|
237
|
+
opts.on('-P', '--pidfile=FILE',
|
238
|
+
'Pidfile prefix, ',
|
239
|
+
'eg "/var/www/shared/config/sidekiq.pid"', ' ') do |v|
|
240
|
+
self.pid_prefix = v
|
241
|
+
end
|
242
|
+
opts.on('-l', '--logfile=FILE',
|
243
|
+
'Logfile for the cluster script', ' ') do |v|
|
244
|
+
self.log_device = v
|
245
|
+
init_logger!
|
246
|
+
end
|
247
|
+
opts.on('-M', '--max-memory=PERCENT',
|
248
|
+
'Maximum percent RAM that this',
|
249
|
+
'cluster should not exceed. Defaults to ' +
|
250
|
+
Sidekiq::Cluster::MAX_RAM_PCT.to_s + '%.', ' ') do |v|
|
251
|
+
self.memory_percentage_limit = v.to_f
|
252
|
+
end
|
253
|
+
opts.on('-N', '--num-processes=NUM',
|
254
|
+
'Number of processes to start,',
|
255
|
+
'defaults to number of cores - 1', ' ') do |v|
|
256
|
+
self.process_count = v.to_i
|
257
|
+
end
|
258
|
+
opts.on('-q', '--quiet',
|
259
|
+
'Do not log to STDOUT') do |v|
|
260
|
+
self.logger = Logger.new(nil)
|
261
|
+
end
|
262
|
+
opts.on('-d', '--debug',
|
263
|
+
'Print debugging info before starting sidekiqs') do |_v|
|
264
|
+
options[:debug] = true
|
265
|
+
end
|
266
|
+
opts.on('-h', '--help', 'this help') do |_v|
|
267
|
+
self.print opts
|
268
|
+
stop!
|
269
|
+
end
|
270
|
+
end
|
271
|
+
parser.order!(argv)
|
272
|
+
print("debug: #{self.inspect}") if options[:debug]
|
273
|
+
end
|
274
|
+
end
|
275
|
+
end
|
276
|
+
end
|
277
|
+
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
lib = File.expand_path('../lib', __FILE__)
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
+
require 'sidekiq/cluster/version'
|
6
|
+
|
7
|
+
Sidekiq::Cluster::DESCRIPTION = <<-eof
|
8
|
+
This gem provides a wrapper script around starting sidekiq across multiple cores.
|
9
|
+
eof
|
10
|
+
|
11
|
+
Gem::Specification.new do |spec|
|
12
|
+
spec.name = 'sidekiq-cluster'
|
13
|
+
spec.version = Sidekiq::Cluster::VERSION
|
14
|
+
spec.authors = ['Konstantin Gredeskoul']
|
15
|
+
spec.email = ['kigster@gmail.com']
|
16
|
+
|
17
|
+
spec.summary = Sidekiq::Cluster::DESCRIPTION
|
18
|
+
spec.description = Sidekiq::Cluster::DESCRIPTION
|
19
|
+
spec.homepage = 'https://github.com/kigster/sidekiq-cluster'
|
20
|
+
spec.license = 'MIT'
|
21
|
+
|
22
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
23
|
+
f.match(%r{^(test|spec|features)/})
|
24
|
+
end
|
25
|
+
spec.bindir = 'exe'
|
26
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
27
|
+
spec.require_paths = ['lib']
|
28
|
+
|
29
|
+
spec.add_dependency 'colored2'
|
30
|
+
spec.add_dependency 'sidekiq'
|
31
|
+
|
32
|
+
spec.add_development_dependency 'rspec', '~> 3.5.0'
|
33
|
+
spec.add_development_dependency 'rspec-its'
|
34
|
+
spec.add_development_dependency 'bundler', '~> 1.15'
|
35
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
36
|
+
spec.add_development_dependency 'simplecov'
|
37
|
+
spec.add_development_dependency 'yard'
|
38
|
+
end
|
metadata
ADDED
@@ -0,0 +1,172 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sidekiq-cluster
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Konstantin Gredeskoul
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-05-02 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: colored2
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: sidekiq
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 3.5.0
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 3.5.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec-its
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: bundler
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.15'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.15'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rake
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '10.0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '10.0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: simplecov
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: yard
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
description: |2
|
126
|
+
This gem provides a wrapper script around starting sidekiq across multiple cores.
|
127
|
+
email:
|
128
|
+
- kigster@gmail.com
|
129
|
+
executables:
|
130
|
+
- sidekiq-cluster
|
131
|
+
extensions: []
|
132
|
+
extra_rdoc_files: []
|
133
|
+
files:
|
134
|
+
- ".document"
|
135
|
+
- ".gitignore"
|
136
|
+
- ".rspec"
|
137
|
+
- ".travis.yml"
|
138
|
+
- Gemfile
|
139
|
+
- LICENSE.txt
|
140
|
+
- README.md
|
141
|
+
- Rakefile
|
142
|
+
- exe/sidekiq-cluster
|
143
|
+
- lib/sidekiq/cluster.rb
|
144
|
+
- lib/sidekiq/cluster/cli.rb
|
145
|
+
- lib/sidekiq/cluster/version.rb
|
146
|
+
- sidekiq-cluster.gemspec
|
147
|
+
homepage: https://github.com/kigster/sidekiq-cluster
|
148
|
+
licenses:
|
149
|
+
- MIT
|
150
|
+
metadata: {}
|
151
|
+
post_install_message:
|
152
|
+
rdoc_options: []
|
153
|
+
require_paths:
|
154
|
+
- lib
|
155
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
161
|
+
requirements:
|
162
|
+
- - ">="
|
163
|
+
- !ruby/object:Gem::Version
|
164
|
+
version: '0'
|
165
|
+
requirements: []
|
166
|
+
rubyforge_project:
|
167
|
+
rubygems_version: 2.4.5.2
|
168
|
+
signing_key:
|
169
|
+
specification_version: 4
|
170
|
+
summary: This gem provides a wrapper script around starting sidekiq across multiple
|
171
|
+
cores.
|
172
|
+
test_files: []
|