caplets 1.0.2 → 1.0.3
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/CHANGELOG +7 -0
- data/lib/caplets/unicorn.rb +19 -12
- data/lib/caplets/version.rb +1 -1
- metadata +4 -20
data/CHANGELOG
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
== 1.0.3 - 2011.05.25
|
2
|
+
* Improved process management of deploy:unicorn commands.
|
3
|
+
|
4
|
+
== 1.0.2
|
5
|
+
* No changes. The 1.0.1 gem was not properly created, so it was yanked and replaced
|
6
|
+
with 1.0.2.
|
7
|
+
|
1
8
|
== 1.0.1
|
2
9
|
* bundle:install now uses `bundle check` to short-circuit if possible
|
3
10
|
* Add deploy:passenger:reload
|
data/lib/caplets/unicorn.rb
CHANGED
@@ -19,6 +19,16 @@ namespace :deploy do
|
|
19
19
|
"while [ #{'!' unless to_disappear} -f tmp/pids/#{pid} ] ; do sleep 1; done"
|
20
20
|
end
|
21
21
|
|
22
|
+
def wait_for_workers
|
23
|
+
working_count =
|
24
|
+
"cat tmp/pids/unicorn.pid | " +
|
25
|
+
"xargs ps -o command --ppid | " +
|
26
|
+
"grep unicorn | " +
|
27
|
+
"wc -l"
|
28
|
+
condition = "$(#{working_count}) -lt #{fetch(:server_processes)}"
|
29
|
+
"while [ #{condition} ] ; do sleep 1 ; done"
|
30
|
+
end
|
31
|
+
|
22
32
|
desc "Write the unicorn config to the shared directory."
|
23
33
|
task :config, :roles => :app, :except => {:no_release => true} do
|
24
34
|
config = File.read(__FILE__).split(/^__END__$/, 2)[1]
|
@@ -28,30 +38,27 @@ namespace :deploy do
|
|
28
38
|
|
29
39
|
desc "Start the unicorn master and workers."
|
30
40
|
task :start, :roles => :app, :except => {:no_release => true} do
|
31
|
-
run_current start_cmd
|
41
|
+
run_current start_cmd, wait_for_workers
|
32
42
|
end
|
33
43
|
|
34
44
|
desc "Stop the unicorn master and workers."
|
35
45
|
task :stop, :roles => :app, :except => {:no_release => true} do
|
36
|
-
run_current stop_cmd
|
46
|
+
run_current stop_cmd, wait_for_pid('unicorn.pid', :to_disappear)
|
37
47
|
end
|
38
48
|
|
39
49
|
desc "Restart the unicorn master and workers."
|
40
50
|
task :restart, :roles => :app, :except => {:no_release => true} do
|
41
|
-
|
42
|
-
|
43
|
-
start_cmd,
|
44
|
-
wait_for_pid('unicorn.pid'),
|
45
|
-
'sleep 5' # app start-up
|
51
|
+
stop
|
52
|
+
start
|
46
53
|
end
|
47
54
|
|
48
55
|
desc "Reload the unicorn master and workers with zero downtime."
|
49
56
|
task :reload, :roles => :app, :except => {:no_release => true} do
|
50
|
-
run_current stop_cmd('USR2'),
|
51
|
-
wait_for_pid('unicorn.pid.oldbin'),
|
52
|
-
wait_for_pid('unicorn.pid'),
|
53
|
-
|
54
|
-
stop_cmd('QUIT', 'unicorn.pid.oldbin')
|
57
|
+
run_current stop_cmd('USR2'), # boot new master
|
58
|
+
wait_for_pid('unicorn.pid.oldbin'), # wait for master switch
|
59
|
+
wait_for_pid('unicorn.pid'), # wait for new master
|
60
|
+
wait_for_workers, # wait for new workers
|
61
|
+
stop_cmd('QUIT', 'unicorn.pid.oldbin') # stop old master
|
55
62
|
end
|
56
63
|
end
|
57
64
|
end
|
data/lib/caplets/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: caplets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
segments:
|
7
|
-
- 1
|
8
|
-
- 0
|
9
|
-
- 2
|
10
|
-
version: 1.0.2
|
4
|
+
prerelease:
|
5
|
+
version: 1.0.3
|
11
6
|
platform: ruby
|
12
7
|
authors:
|
13
8
|
- Dean Strelau
|
@@ -15,7 +10,7 @@ autorequire:
|
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
12
|
|
18
|
-
date:
|
13
|
+
date: 2011-05-25 00:00:00 -04:00
|
19
14
|
default_executable:
|
20
15
|
dependencies:
|
21
16
|
- !ruby/object:Gem::Dependency
|
@@ -26,11 +21,6 @@ dependencies:
|
|
26
21
|
requirements:
|
27
22
|
- - ">="
|
28
23
|
- !ruby/object:Gem::Version
|
29
|
-
hash: 27
|
30
|
-
segments:
|
31
|
-
- 2
|
32
|
-
- 5
|
33
|
-
- 0
|
34
24
|
version: 2.5.0
|
35
25
|
type: :runtime
|
36
26
|
version_requirements: *id001
|
@@ -82,23 +72,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
82
72
|
requirements:
|
83
73
|
- - ">="
|
84
74
|
- !ruby/object:Gem::Version
|
85
|
-
hash: 3
|
86
|
-
segments:
|
87
|
-
- 0
|
88
75
|
version: "0"
|
89
76
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
77
|
none: false
|
91
78
|
requirements:
|
92
79
|
- - ">="
|
93
80
|
- !ruby/object:Gem::Version
|
94
|
-
hash: 3
|
95
|
-
segments:
|
96
|
-
- 0
|
97
81
|
version: "0"
|
98
82
|
requirements: []
|
99
83
|
|
100
84
|
rubyforge_project:
|
101
|
-
rubygems_version: 1.
|
85
|
+
rubygems_version: 1.6.1
|
102
86
|
signing_key:
|
103
87
|
specification_version: 3
|
104
88
|
summary: Capistrano super powers
|