simple-capistrano-unicorn 0.0.6 → 0.0.7
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/README.md
CHANGED
@@ -6,29 +6,35 @@ This gem is composed from the gems `capistrano-unicorn-methods` and `capistrano-
|
|
6
6
|
|
7
7
|
## Setup
|
8
8
|
|
9
|
-
### 1.
|
9
|
+
### 1. Add Gem to Gemfile
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'simple-capistrano-unicorn'
|
13
|
+
```
|
14
|
+
|
15
|
+
### 2. Require this gem in deploy.rb
|
10
16
|
|
11
17
|
You should add this line in the bottom of `RAILS_ROOT/config/deploy.rb`:
|
12
18
|
|
13
|
-
```
|
19
|
+
```ruby
|
14
20
|
require 'simple-capistrano-unicorn'
|
15
21
|
```
|
16
22
|
|
17
|
-
###
|
23
|
+
### 3. Restart Unicorn on deploy
|
18
24
|
|
19
25
|
You should place this line in `RAILS_ROOT/config/deploy.rb`:
|
20
26
|
|
21
|
-
```
|
27
|
+
```ruby
|
22
28
|
after :deploy, "unicorn:restart"
|
23
29
|
```
|
24
30
|
|
25
|
-
###
|
31
|
+
### 4. Add unicorn.rb (only for single-stage setup)
|
26
32
|
|
27
33
|
Grab the sample Unicorn configuration here: http://unicorn.bogomips.org/examples/unicorn.conf.rb
|
28
34
|
|
29
35
|
And place it here: `RAILS_ROOT/config/unicorn.rb`
|
30
36
|
|
31
|
-
###
|
37
|
+
### 5. Add unicorn stage files (only for multi-stage setup)
|
32
38
|
|
33
39
|
Make sure that you are using the multi-stage extension for Capistrano ( https://github.com/capistrano/capistrano/wiki/2.x-Multistage-Extension )
|
34
40
|
|
@@ -38,7 +44,7 @@ You should create different Unicorn files to use for each of your different envi
|
|
38
44
|
|
39
45
|
You can then override the `unicorn_config`-variable that this gem is listening for, by placing this in `RAILS_ROOT/config/deploy.rb`:
|
40
46
|
|
41
|
-
```
|
47
|
+
```ruby
|
42
48
|
set(:unicorn_config) { "#{fetch(:current_path)}/config/unicorn/#{fetch(:stage)}.rb" }
|
43
49
|
```
|
44
50
|
|
@@ -81,7 +81,7 @@ module SimpleCapistranoUnicorn
|
|
81
81
|
end
|
82
82
|
end
|
83
83
|
|
84
|
-
# Restarts the unicorn process(es) with the
|
84
|
+
# Restarts the unicorn process(es) with the USR2 code, to gracefully
|
85
85
|
# create a new server, and kill of the old one, leaving *no* downtime.
|
86
86
|
#
|
87
87
|
desc "Zero-downtime restart of Unicorn"
|
@@ -90,15 +90,14 @@ module SimpleCapistranoUnicorn
|
|
90
90
|
if unicorn_is_running?(server)
|
91
91
|
pid = capture "cat #{unicorn_pid}", :hosts => [server]
|
92
92
|
run "kill -s USR2 #{pid.to_i}", :hosts => [server] if pid.to_i > 0
|
93
|
-
sleep(5)
|
94
93
|
logger.info nice_output("Restarted Unicorn!", server)
|
95
|
-
clean_old_unicorn(server)
|
96
94
|
else
|
97
95
|
logger.info nice_output("Unicorn wasn't running, starting it!", server)
|
98
96
|
start_unicorn(server)
|
99
97
|
logger.info nice_output("Started Unicorn!", server)
|
100
98
|
end
|
101
99
|
end
|
100
|
+
unicorn.cleanup
|
102
101
|
end
|
103
102
|
|
104
103
|
desc "Restart of Unicorn with downtime"
|
@@ -122,6 +121,7 @@ module SimpleCapistranoUnicorn
|
|
122
121
|
#
|
123
122
|
desc "Cleans up the old unicorn processes"
|
124
123
|
task :cleanup, :roles => :app do
|
124
|
+
logger.info "Cleaning up old Unicorns.."
|
125
125
|
find_servers(:roles => :app).each do |server|
|
126
126
|
clean_old_unicorn(server)
|
127
127
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple-capistrano-unicorn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-01-
|
12
|
+
date: 2013-01-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|