capistrano-sidekiq 0.3.7 → 0.3.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a62b2fe9026955663fd38cbd5172cea2ffaa187d
4
- data.tar.gz: 5bcf7e35d0415ca7387399d6ffc232cf7315c1ed
3
+ metadata.gz: 5dd1c2e79b129bc931e93fda45f0a71e40d7915e
4
+ data.tar.gz: 1681fdc2903aa89986f1c36d62b23ddfbfa0bb9b
5
5
  SHA512:
6
- metadata.gz: ec165a6a831d201137aad666c710f1ff086fb00617d9278c079253d23f5930e434bf4addb8be3833f9f6b7a613f74ff038c96d5c6d1a35dc6682918e3ae7a348
7
- data.tar.gz: 58ed4ce25f611099bfbd33a8ef0516ac1ffc826505c6a57819aa91cd57876af7244300a52f6a9c60b55b68d415491f8e4cb4e610870dd1c1cb922f9ebf6ad35c
6
+ metadata.gz: c2b565dd956c2d410123847b1dfca4b87653ec18e64507518ed001008a739fa8060b38253d13f95239c068c6c867d2c21df75a132fe674eccd906fe3e8937cce
7
+ data.tar.gz: f7f3311f90b68b9d996e5051d8f3a4d3921b49f2036099da1eeea071a3b74a8175c8686842168078a44ff02494666f36ae033f0baf89880efb757ab479f0d441
data/README.md CHANGED
@@ -54,6 +54,9 @@ There is a know bug that prevent sidekiq from starting when pty is true
54
54
  set :pty, false
55
55
  ```
56
56
  ## Changelog
57
+ - 0.3.8:
58
+ * Update monit template: use su instead of sudo / permit all Sidekiq options @bensie
59
+ * Unmonitor monit while deploy @Saicheg
57
60
  - 0.3.7:
58
61
  * fix capistrano2 task @tribble
59
62
  * Run Sidekiq as daemon from Monit @dpaluy
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module Sidekiq
3
- VERSION = '0.3.7'
3
+ VERSION = '0.3.8'
4
4
  end
5
5
  end
@@ -2,12 +2,26 @@ namespace :load do
2
2
  task :defaults do
3
3
  set :sidekiq_monit_conf_dir, -> { '/etc/monit/conf.d' }
4
4
  set :monit_bin, -> { '/usr/bin/monit' }
5
+ set :sidekiq_monit_default_hooks, -> { true }
5
6
  end
6
7
  end
7
8
 
9
+ namespace :deploy do
10
+ before :starting, :check_sidekiq_monit_hooks do
11
+ if fetch(:sidekiq_default_hooks) && fetch(:sidekiq_monit_default_hooks)
12
+ invoke 'sidekiq:monit:add_default_hooks'
13
+ end
14
+ end
15
+ end
8
16
 
9
17
  namespace :sidekiq do
10
18
  namespace :monit do
19
+
20
+ task :add_default_hooks do
21
+ after 'deploy:check', 'sidekiq:monit:unmonitor'
22
+ after 'deploy:publishing', 'sidekiq:monit:monitor'
23
+ end
24
+
11
25
  desc 'Config Sidekiq monit-service'
12
26
  task :config do
13
27
  on roles(fetch(:sidekiq_role)) do |role|
@@ -63,7 +77,31 @@ namespace :sidekiq do
63
77
  end
64
78
 
65
79
  def sidekiq_service_name(index=nil)
66
- fetch(:sidekiq_service_name, "sidekiq_#{fetch(:application)}") + index.to_s
80
+ fetch(:sidekiq_service_name, "sidekiq_#{fetch(:application)}_#{fetch(:sidekiq_env)}") + index.to_s
81
+ end
82
+
83
+ def sidekiq_config
84
+ if fetch(:sidekiq_config)
85
+ "--config #{fetch(:sidekiq_config)}"
86
+ end
87
+ end
88
+
89
+ def sidekiq_concurrency
90
+ if fetch(:sidekiq_concurrency)
91
+ "--concurrency #{fetch(:sidekiq_concurrency)}"
92
+ end
93
+ end
94
+
95
+ def sidekiq_queues
96
+ Array(fetch(:sidekiq_queue)).map do |queue|
97
+ "--queue #{queue}"
98
+ end.join(' ')
99
+ end
100
+
101
+ def sidekiq_logfile
102
+ if fetch(:sidekiq_log)
103
+ "--logfile #{fetch(:sidekiq_log)}"
104
+ end
67
105
  end
68
106
 
69
107
  end
@@ -2,8 +2,9 @@
2
2
  <% processes_pids.each_with_index do |pid_file, idx| %>
3
3
  check process <%= sidekiq_service_name(idx) %>
4
4
  with pidfile "<%= pid_file %>"
5
- start program = "/usr/bin/sudo -u <%= @role.user %> /bin/bash -c 'cd <%= current_path %> && <%= SSHKit.config.command_map[:bundle] %> exec sidekiq <% if fetch(:sidekiq_config) %> -C <%= fetch(:sidekiq_config) %> <% end %> -P <%= pid_file %>' -d" with timeout 30 seconds
6
- stop program = "/usr/bin/sudo -u <%= @role.user %> /bin/bash -c 'cd <%= current_path %> && <%= SSHKit.config.command_map[:bundle] %> exec sidekiqctl stop <%= pid_file %>'" with timeout <%= fetch(:sidekiq_timeout).to_i + 10 %> seconds
5
+ start program = "/bin/su - <%= @role.user %> -c 'cd <%= current_path %> && <%= SSHKit.config.command_map[:bundle] %> exec sidekiq <%= sidekiq_config %> --index <%= idx %> --pidfile <%= pid_file %> --environment <%= fetch(:sidekiq_env) %> <%= sidekiq_concurrency %> <%= sidekiq_logfile %> <%= sidekiq_queues %>'" with timeout 30 seconds
6
+
7
+ stop program = "/bin/su - <%= @role.user %> -c 'cd <%= current_path %> && <%= SSHKit.config.command_map[:bundle] %> exec sidekiqctl stop <%= pid_file %>'" with timeout <%= fetch(:sidekiq_timeout).to_i + 10 %> seconds
7
8
  group <%= fetch(:sidekiq_monit_group, fetch(:application)) %>-sidekiq
8
9
 
9
10
  <% 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.3.7
4
+ version: 0.3.8
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-09-01 00:00:00.000000000 Z
11
+ date: 2014-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capistrano