capistrano-resque 0.0.4 → 0.0.5
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.
- data/Gemfile +4 -2
- data/Gemfile.lock +10 -16
- data/README.md +3 -4
- data/lib/capistrano-resque/capistrano_integration.rb +29 -7
- data/lib/capistrano-resque/version.rb +1 -1
- metadata +4 -4
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,14 +1,3 @@
|
|
1
|
-
GIT
|
2
|
-
remote: git@github.com:sj26/resque.git
|
3
|
-
revision: 05e4c5e6f92fe62b25db40984b20dad4b9f870d8
|
4
|
-
branch: logfile
|
5
|
-
specs:
|
6
|
-
resque (1.19.0)
|
7
|
-
multi_json (~> 1.0)
|
8
|
-
redis-namespace (~> 1.0.2)
|
9
|
-
sinatra (>= 0.9.2)
|
10
|
-
vegas (~> 0.1.2)
|
11
|
-
|
12
1
|
PATH
|
13
2
|
remote: .
|
14
3
|
specs:
|
@@ -25,7 +14,7 @@ GEM
|
|
25
14
|
net-ssh (>= 2.0.14)
|
26
15
|
net-ssh-gateway (>= 1.1.0)
|
27
16
|
highline (1.6.13)
|
28
|
-
multi_json (1.3.
|
17
|
+
multi_json (1.3.6)
|
29
18
|
net-scp (1.0.4)
|
30
19
|
net-ssh (>= 1.99.1)
|
31
20
|
net-sftp (2.0.5)
|
@@ -36,9 +25,14 @@ GEM
|
|
36
25
|
rack (1.4.1)
|
37
26
|
rack-protection (1.2.0)
|
38
27
|
rack
|
39
|
-
redis (
|
40
|
-
redis-namespace (1.0
|
41
|
-
redis (
|
28
|
+
redis (3.0.1)
|
29
|
+
redis-namespace (1.2.0)
|
30
|
+
redis (~> 3.0.0)
|
31
|
+
resque (1.21.0)
|
32
|
+
multi_json (~> 1.0)
|
33
|
+
redis-namespace (~> 1.0)
|
34
|
+
sinatra (>= 0.9.2)
|
35
|
+
vegas (~> 0.1.2)
|
42
36
|
sinatra (1.3.2)
|
43
37
|
rack (~> 1.3, >= 1.3.6)
|
44
38
|
rack-protection (~> 1.2)
|
@@ -52,4 +46,4 @@ PLATFORMS
|
|
52
46
|
|
53
47
|
DEPENDENCIES
|
54
48
|
capistrano-resque!
|
55
|
-
resque
|
49
|
+
resque (~> 1.21.0)
|
data/README.md
CHANGED
@@ -36,6 +36,9 @@ Running cap -vT | grep resque should give you...
|
|
36
36
|
cap resque:start # Start Resque workers
|
37
37
|
cap resque:stop # Quit running Resque workers
|
38
38
|
cap resque:restart # Restart running Resque workers
|
39
|
+
cap resque:scheduler:restart #
|
40
|
+
cap resque:scheduler:start # Starts resque scheduler with default configs
|
41
|
+
cap resque:scheduler:stop # Stops resque scheduler
|
39
42
|
```
|
40
43
|
|
41
44
|
### Restart on deployment
|
@@ -46,7 +49,3 @@ add the following line to your `deploy.rb`:
|
|
46
49
|
```
|
47
50
|
after "deploy:restart", "resque:restart"
|
48
51
|
```
|
49
|
-
|
50
|
-
## Logging
|
51
|
-
|
52
|
-
Currently, resque doesn't log to a logfile. I'm using the 'logfile' branch of http://github.com/sj26/resque in my consuming Gemfile to achieve this functionality. Hopefully that will get merged into defunkt/resque soon.
|
@@ -8,7 +8,6 @@ module CapistranoResque
|
|
8
8
|
|
9
9
|
_cset(:workers, {"*" => 1})
|
10
10
|
_cset(:app_env, (fetch(:rails_env) rescue "production"))
|
11
|
-
_cset(:verbosity, 1)
|
12
11
|
|
13
12
|
def remote_file_exists?(full_path)
|
14
13
|
"true" == capture("if [ -e #{full_path} ]; then echo 'true'; fi").strip
|
@@ -24,7 +23,7 @@ module CapistranoResque
|
|
24
23
|
|
25
24
|
namespace :resque do
|
26
25
|
desc "See current worker status"
|
27
|
-
task :status do
|
26
|
+
task :status, :roles => :resque_worker do
|
28
27
|
current_pids.each do |pid|
|
29
28
|
if remote_file_exists?(pid)
|
30
29
|
if remote_process_exists?(pid)
|
@@ -37,22 +36,21 @@ module CapistranoResque
|
|
37
36
|
end
|
38
37
|
|
39
38
|
desc "Start Resque workers"
|
40
|
-
task :start do
|
39
|
+
task :start, :roles => :resque_worker do
|
41
40
|
worker_id = 1
|
42
41
|
workers.each_pair do |queue, number_of_workers|
|
43
42
|
puts "Starting #{number_of_workers} worker(s) with QUEUE: #{queue}"
|
44
43
|
number_of_workers.times do
|
45
44
|
pid = "./tmp/pids/resque_worker_#{worker_id}.pid"
|
46
45
|
run "cd #{current_path} && RAILS_ENV=#{app_env} QUEUE=\"#{queue}\" \
|
47
|
-
|
48
|
-
bundle exec rake environment resque:work"
|
46
|
+
PIDFILE=#{pid} BACKGROUND=yes VERBOSE=1 bundle exec rake environment resque:work"
|
49
47
|
worker_id += 1
|
50
48
|
end
|
51
49
|
end
|
52
50
|
end
|
53
51
|
|
54
52
|
desc "Quit running Resque workers"
|
55
|
-
task :stop do
|
53
|
+
task :stop, :roles => :resque_worker do
|
56
54
|
current_pids.each do |pid|
|
57
55
|
if remote_file_exists?(pid)
|
58
56
|
if remote_process_exists?(pid)
|
@@ -69,10 +67,34 @@ module CapistranoResque
|
|
69
67
|
end
|
70
68
|
|
71
69
|
desc "Restart running Resque workers"
|
72
|
-
task :restart do
|
70
|
+
task :restart, :roles => :resque_worker do
|
73
71
|
stop
|
74
72
|
start
|
75
73
|
end
|
74
|
+
|
75
|
+
namespace :scheduler do
|
76
|
+
desc "Starts resque scheduler with default configs"
|
77
|
+
task :start, :roles => :resque_scheduler do
|
78
|
+
run "cd #{current_path} && RAILS_ENV=#{rails_env} \
|
79
|
+
PIDFILE=./tmp/pids/scheduler.pid BACKGROUND=yes bundle exec rake resque:scheduler"
|
80
|
+
end
|
81
|
+
|
82
|
+
desc "Stops resque scheduler"
|
83
|
+
task :stop, :roles => :resque_scheduler do
|
84
|
+
pid = "#{current_path}/tmp/pids/scheduler.pid"
|
85
|
+
if remote_file_exists?(pid)
|
86
|
+
logger.important("Shutting down resque scheduler...", "Resque Scheduler")
|
87
|
+
run remote_process_exists?(pid) ? "#{try_sudo} kill `cat #{pid}`" : "rm #{pid}"
|
88
|
+
else
|
89
|
+
logger.important("Resque scheduler not running", "Resque Scheduler")
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
task :restart do
|
94
|
+
stop
|
95
|
+
start
|
96
|
+
end
|
97
|
+
end
|
76
98
|
end
|
77
99
|
end
|
78
100
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-resque
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 5
|
10
|
+
version: 0.0.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Steven Shingler
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-
|
18
|
+
date: 2012-07-28 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: capistrano
|