capistrano-resque 0.2.1 → 0.2.2

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: 5b898f69f6ed18119548b8e823a1e4256a05bacf
4
- data.tar.gz: a3125435d75fa17c2178bde81ea35d744ee9a028
3
+ metadata.gz: fcb1a22ec0a47cbb81286b69622d9ad72cbb0270
4
+ data.tar.gz: faa6bf544364befa0fb1cb75a2826615267cd854
5
5
  SHA512:
6
- metadata.gz: 0feb02dd81e7a47541af2b2af9b562278938b95ff40fd83a99de26ff85a9b40e6705cce6fb537b9b9eddbee7163033cd3f04229f8ecf72d129bcb6380a791429
7
- data.tar.gz: 8481eeb7d14e711bcac8c218a0c736ea8e706c8d8a929c30291a829742b5f7daa8513a3a87e3acac36192a20b232c81e4ec2aaa9f08ee77f50b3ff70a04034c6
6
+ metadata.gz: 4dff079d78d320353edd58014605c777939a7391a23912bc558fca5eda02193bd75b06f256fe6bdc118e0e8573c6925b24468ff696b410ef2b2e6647f5c5a18d
7
+ data.tar.gz: 1ac2ad838229bce32cec733365515e2f7aba1b4793dff4309b279c69b15ec45d3a2ec15b49d4fae8bbbe042112fb9eabde4c82daa8d0298508d1d0b8e33c174f
@@ -1,3 +1,7 @@
1
+ # 0.2.2
2
+ * Start all background tasks with `nohup` to avoid `SIGHUP` problems
3
+ * Add a `:resque_verbose` option to toggle verbose output (defaults to `true`)
4
+
1
5
  # 0.2.1
2
6
  * Create the directory for pid files when it doesn't exist
3
7
  * Default pid files to `#{shared_path}/tmp/pids` now
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
1
  source "http://rubygems.org"
2
2
 
3
- gem 'resque', :git => 'git://github.com/defunkt/resque.git', :branch => '1-x-stable'
3
+ gem 'resque', :git => 'git://github.com/resque/resque.git', :branch => '1-x-stable'
4
4
  gem 'resque-scheduler'
5
5
 
6
6
  gemspec
@@ -1,18 +1,19 @@
1
1
  GIT
2
- remote: git://github.com/defunkt/resque.git
3
- revision: 3cb5c07dde21500afe17232ec43e6317cc96e6d1
2
+ remote: git://github.com/resque/resque.git
3
+ revision: 41469a3eaa9394a60a2ff249c4d00a41f06b4b22
4
4
  branch: 1-x-stable
5
5
  specs:
6
- resque (1.23.0)
6
+ resque (1.25.2)
7
+ mono_logger (~> 1.0)
7
8
  multi_json (~> 1.0)
8
- redis-namespace (~> 1.0)
9
+ redis-namespace (~> 1.3)
9
10
  sinatra (>= 0.9.2)
10
11
  vegas (~> 0.1.2)
11
12
 
12
13
  PATH
13
14
  remote: .
14
15
  specs:
15
- capistrano-resque (0.1.0)
16
+ capistrano-resque (0.2.2)
16
17
  capistrano
17
18
  resque
18
19
  resque-scheduler
@@ -20,39 +21,43 @@ PATH
20
21
  GEM
21
22
  remote: http://rubygems.org/
22
23
  specs:
23
- capistrano (2.14.1)
24
- highline
25
- net-scp (>= 1.0.0)
26
- net-sftp (>= 2.0.0)
27
- net-ssh (>= 2.0.14)
28
- net-ssh-gateway (>= 1.1.0)
29
- highline (1.6.15)
30
- multi_json (1.3.6)
31
- net-scp (1.0.4)
32
- net-ssh (>= 1.99.1)
33
- net-sftp (2.0.5)
34
- net-ssh (>= 2.0.9)
35
- net-ssh (2.6.3)
36
- net-ssh-gateway (1.1.0)
37
- net-ssh (>= 1.99.1)
38
- rack (1.4.1)
39
- rack-protection (1.2.0)
24
+ capistrano (3.4.0)
25
+ i18n
26
+ rake (>= 10.0.0)
27
+ sshkit (~> 1.3)
28
+ colorize (0.7.5)
29
+ i18n (0.7.0)
30
+ mono_logger (1.1.0)
31
+ multi_json (1.10.1)
32
+ net-scp (1.2.1)
33
+ net-ssh (>= 2.6.5)
34
+ net-ssh (2.9.2)
35
+ rack (1.5.2)
36
+ rack-protection (1.5.3)
40
37
  rack
41
- redis (3.0.2)
42
- redis-namespace (1.2.1)
43
- redis (~> 3.0.0)
44
- resque-scheduler (2.0.0)
45
- redis (>= 2.0.1)
46
- resque (>= 1.20.0)
47
- rufus-scheduler
48
- rufus-scheduler (2.0.17)
49
- tzinfo (>= 0.3.23)
50
- sinatra (1.3.3)
51
- rack (~> 1.3, >= 1.3.6)
52
- rack-protection (~> 1.2)
53
- tilt (~> 1.3, >= 1.3.3)
54
- tilt (1.3.3)
55
- tzinfo (0.3.34)
38
+ rake (10.4.2)
39
+ redis (3.1.0)
40
+ redis-namespace (1.5.1)
41
+ redis (~> 3.0, >= 3.0.4)
42
+ resque-scheduler (3.0.0)
43
+ mono_logger (~> 1.0)
44
+ redis (~> 3.0)
45
+ resque (~> 1.25)
46
+ rufus-scheduler (~> 2.0)
47
+ rufus-scheduler (2.0.24)
48
+ tzinfo (>= 0.3.22)
49
+ sinatra (1.4.5)
50
+ rack (~> 1.4)
51
+ rack-protection (~> 1.4)
52
+ tilt (~> 1.3, >= 1.3.4)
53
+ sshkit (1.7.1)
54
+ colorize (>= 0.7.0)
55
+ net-scp (>= 1.1.2)
56
+ net-ssh (>= 2.8.0)
57
+ thread_safe (0.3.4)
58
+ tilt (1.4.1)
59
+ tzinfo (1.2.2)
60
+ thread_safe (~> 0.1)
56
61
  vegas (0.1.11)
57
62
  rack (>= 1.0.0)
58
63
 
data/README.md CHANGED
@@ -3,15 +3,25 @@
3
3
  Basic tasks for putting some Resque in your Cap. This should be fully compatible with both Capistrano 2.x and 3.x,
4
4
  but if you run into any issues please report them.
5
5
 
6
+ At this time, we are only targeting Resque 1.x; the 2.0/master branch is still a work-in-progress without a published gem.
7
+
6
8
  ### In your Gemfile:
7
9
 
10
+ ```ruby
11
+ gem "capistrano-resque", "~> 0.2.2", require: false
8
12
  ```
9
- gem "capistrano-resque", "~> 0.2.0", require: false
10
- ```
13
+
14
+ ### In lib/tasks:
15
+
16
+ You'll need to make sure your app is set to include Resque's rake tasks. Per the
17
+ [Resque 1.x README](https://github.com/resque/resque/blob/1-x-stable/README.markdown#in-a-rails-3-app-as-a-gem),
18
+ you'll need to add `require 'resque/tasks'` somewhere under the `lib/tasks` directory (e.g. in a `lib/tasks/resque.rake` file).
11
19
 
12
20
  ### In your Capfile:
13
21
 
14
- ```
22
+ Put this line __after__ any of capistrano's own `require`/`load` statements (specifically `load 'deploy'` for Cap v2):
23
+
24
+ ```ruby
15
25
  require "capistrano-resque"
16
26
  ```
17
27
 
@@ -21,7 +31,11 @@ the `cap` command (e.g. running `rails console`).
21
31
 
22
32
  ### In your deploy.rb:
23
33
 
24
- ```
34
+ ```ruby
35
+ # Specify the server that Resque will be deployed on. If you are using Cap v3
36
+ # and have multiple stages with different Resque requirements for each, then
37
+ # these __must__ be set inside of the applicable config/deploy/... stage files
38
+ # instead of config/deploy.rb:
25
39
  role :resque_worker, "app_domain"
26
40
  role :resque_scheduler, "app_domain"
27
41
 
@@ -39,7 +53,7 @@ set :workers, { "my_queue_name" => 2 }
39
53
  You can also specify multiple queues and the number of workers
40
54
  for each queue:
41
55
 
42
- ```
56
+ ```ruby
43
57
  set :workers, { "archive" => 1, "mailing" => 3, "search_index, cache_warming" => 1 }
44
58
  ```
45
59
 
@@ -53,7 +67,7 @@ The above will start five workers in total:
53
67
 
54
68
  You can also start up workers on multiple servers/roles:
55
69
 
56
- ```
70
+ ```ruby
57
71
  role :worker_server_A, <server-ip-A>
58
72
  role :worker_servers_B_and_C, [<server-ip-B>, <server-ip-C>]
59
73
 
@@ -81,13 +95,13 @@ With Rails, Resque requires loading the Rails environment task to have access to
81
95
 
82
96
  If you would like to load the `environment` task automatically, add this to your `deploy.rb`:
83
97
 
84
- ```
98
+ ```ruby
85
99
  set :resque_environment_task, true
86
100
  ```
87
101
 
88
102
  If you would like your workers to use a different Rails environment than your actual Rails app:
89
103
 
90
- ```
104
+ ```ruby
91
105
  set :resque_rails_env, "my_resque_env"
92
106
  ```
93
107
 
@@ -111,7 +125,7 @@ cap resque:scheduler:stop # Stops Resque Scheduler
111
125
  To restart you workers automatically when `cap deploy:restart` is executed
112
126
  add the following line to your `deploy.rb`:
113
127
 
114
- ```
128
+ ```ruby
115
129
  after "deploy:restart", "resque:restart"
116
130
  ```
117
131
 
@@ -121,13 +135,13 @@ Backgrounding and logging are current sticking points. I'm using the HEAD of res
121
135
 
122
136
  In your Gemfile, you will need to specify:
123
137
 
124
- ```
138
+ ```ruby
125
139
  gem 'resque', :git => 'git://github.com/resque/resque.git', :branch => '1-x-stable'
126
140
  ```
127
141
 
128
142
  Also, you will need to include:
129
143
 
130
- ```
144
+ ```ruby
131
145
  Resque.logger = Logger.new("new_resque_log_file")
132
146
  ```
133
147
 
@@ -145,6 +159,12 @@ If you'd like to capture this output instead, just specify a log file:
145
159
  set :resque_log_file, "log/resque.log"
146
160
  ```
147
161
 
162
+ You can also disable the `VERBOSE` option to reduce the amount of log output:
163
+
164
+ ```ruby
165
+ set :resque_verbose, false
166
+ ```
167
+
148
168
  ### Limitations
149
169
 
150
170
  Starting workers is done concurrently via Capistrano and you are limited by ssh connections limit on your server (default limit is 10)
@@ -11,6 +11,7 @@ module CapistranoResque
11
11
  _cset(:interval, "5")
12
12
  _cset(:resque_environment_task, false)
13
13
  _cset(:resque_log_file, "/dev/null")
14
+ _cset(:resque_verbose, true)
14
15
  _cset(:resque_pid_path) { File.join(shared_path, 'tmp', 'pids') }
15
16
 
16
17
  def rails_env
@@ -45,9 +46,11 @@ module CapistranoResque
45
46
 
46
47
  def start_command(queue, pid)
47
48
  "cd #{current_path} && RAILS_ENV=#{rails_env} QUEUE=\"#{queue}\" \
48
- PIDFILE=#{pid} BACKGROUND=yes VERBOSE=1 INTERVAL=#{interval} \
49
- #{fetch(:bundle_cmd, "bundle")} exec rake \
50
- #{"environment" if fetch(:resque_environment_task)} \
49
+ PIDFILE=#{pid} BACKGROUND=yes \
50
+ #{"VERBOSE=1 " if fetch(:resque_verbose)}\
51
+ INTERVAL=#{interval} \
52
+ nohup #{fetch(:bundle_cmd, "bundle")} exec rake \
53
+ #{"environment " if fetch(:resque_environment_task)}\
51
54
  resque:work #{output_redirection}"
52
55
  end
53
56
 
@@ -74,8 +77,12 @@ module CapistranoResque
74
77
 
75
78
  def start_scheduler(pid)
76
79
  "cd #{current_path} && RAILS_ENV=#{rails_env} \
77
- PIDFILE=#{pid} BACKGROUND=yes VERBOSE=1 MUTE=1 \
78
- #{fetch(:bundle_cmd, "bundle")} exec rake resque:scheduler #{output_redirection}"
80
+ PIDFILE=#{pid} BACKGROUND=yes \
81
+ #{"VERBOSE=1 " if fetch(:resque_verbose)}\
82
+ MUTE=1 \
83
+ nohup #{fetch(:bundle_cmd, "bundle")} exec rake \
84
+ #{"environment " if fetch(:resque_environment_task)}\
85
+ resque:scheduler #{output_redirection}"
79
86
  end
80
87
 
81
88
  def stop_scheduler(pid)
@@ -5,6 +5,7 @@ namespace :load do
5
5
  set :interval, "5"
6
6
  set :resque_environment_task, false
7
7
  set :resque_log_file, "/dev/null"
8
+ set :resque_verbose, true
8
9
  set :resque_pid_path, -> { File.join(shared_path, 'tmp', 'pids') }
9
10
  end
10
11
  end
@@ -68,7 +69,7 @@ namespace :resque do
68
69
  number_of_workers.times do
69
70
  pid = "#{fetch(:resque_pid_path)}/resque_work_#{worker_id}.pid"
70
71
  within current_path do
71
- execute :rake, %{RAILS_ENV=#{rails_env} QUEUE="#{queue}" PIDFILE=#{pid} BACKGROUND=yes VERBOSE=1 INTERVAL=#{fetch(:interval)} #{"environment" if fetch(:resque_environment_task)} resque:work #{output_redirection}}
72
+ execute :nohup, %{#{SSHKit.config.command_map[:rake]} RAILS_ENV=#{rails_env} QUEUE="#{queue}" PIDFILE=#{pid} BACKGROUND=yes #{"VERBOSE=1 " if fetch(:resque_verbose)}INTERVAL=#{fetch(:interval)} #{"environment " if fetch(:resque_environment_task)}resque:work #{output_redirection}}
72
73
  end
73
74
  worker_id += 1
74
75
  end
@@ -128,7 +129,7 @@ namespace :resque do
128
129
  create_pid_path
129
130
  pid = "#{fetch(:resque_pid_path)}/scheduler.pid"
130
131
  within current_path do
131
- execute :rake, %{RAILS_ENV=#{rails_env} PIDFILE=#{pid} BACKGROUND=yes VERBOSE=1 MUTE=1 resque:scheduler #{output_redirection}}
132
+ execute :nohup, %{#{SSHKit.config.command_map[:rake]} RAILS_ENV=#{rails_env} PIDFILE=#{pid} BACKGROUND=yes #{"VERBOSE=1 " if fetch(:resque_verbose)}MUTE=1 #{"environment " if fetch(:resque_environment_task)}resque:scheduler #{output_redirection}}
132
133
  end
133
134
  end
134
135
  end
@@ -1,5 +1,5 @@
1
1
  module CapistranoResque
2
2
  unless defined?(::CapistranoResque::VERSION)
3
- VERSION = "0.2.1".freeze
3
+ VERSION = "0.2.2".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-resque
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steven Shingler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-25 00:00:00.000000000 Z
11
+ date: 2015-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capistrano
@@ -89,7 +89,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
89
89
  version: '0'
90
90
  requirements: []
91
91
  rubyforge_project:
92
- rubygems_version: 2.4.1
92
+ rubygems_version: 2.4.5
93
93
  signing_key:
94
94
  specification_version: 4
95
95
  summary: Resque integration for Capistrano