capistrano-unicorn-edge 0.1.5 → 0.1.6

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4dc96d50be88089308947a7034468db16be65b37
4
- data.tar.gz: cd519fc2a7f8e6e773e5b0b69ca08ade9855e793
3
+ metadata.gz: b50eaf0a41c3a3f1ec77b0eab2a72cee477b85ac
4
+ data.tar.gz: 1060be56f977c9f5e068a355fc10119300e37fed
5
5
  SHA512:
6
- metadata.gz: 389ae4a775edde94e6db97e60fd96d053e36806a97038871a9431a60d8bb7c348b140947edaaa5bf395f87ccba1538da63cc275410b6db97a083791d51339a9c
7
- data.tar.gz: 3b30e56046b20eae72eddaa8bcd2b2227d7fbb7424e8de260bcc12837e05c1ceab1bdf0f2049df071a07c2a68538703aa006ce32266b7c91b1ad398f99d5a6ee
6
+ metadata.gz: 3c8f6d1fc296293373bb9858eda9162283504ecf5a9b83f503560df016f52f46a4bde0492dcf74cb28169c1376054e18e8c42bf0273cb2e5bddfa210bcd48dc9
7
+ data.tar.gz: 7cc64f66c0e4f16587fb434ad33acfbb3edc8bc105f78f0e48f70b0f70c2f212aefcd91a079365393b156f0a0c08142f5cf87158c4b1846e25e22273dbd2baa7
data/README.md CHANGED
@@ -7,11 +7,11 @@ cap unicorn:start # Start unicorn
7
7
  cap unicorn:stop # Stop unicorn gracefully (QUIT)
8
8
  cap unicorn:shutdown # Stop unicorn immediately (TERM)
9
9
  cap unicorn:restart # Restart unicorn
10
+ cat unicorn:restart_quit # Restart unicorn, simple stop it gracefully and start again (QUIT)
11
+ cat unicorn:restart_term # Restart unicorn, simple stop it immediately and start it again (TERM)
10
12
  cap unicorn:restart_hup # Restart unicorn, when preload_app is false (HUP)
11
13
  cap unicorn:restart_usr2 # Restart unicorn, when before_fork hook is set and preload_app is true (USR2)
12
14
  cap unicorn:restart_usr2_quit # Restart unicorn, when before_fork hook is not set and preload_app is true (USR2 + QUIT)
13
- cat unicorn:restart_quit # Restart unicorn, simple stop it gracefully and start again (QUIT)
14
- cat unicorn:restart_term # Restart unicorn, simple stop it immediately and start it again (TERM)
15
15
  cap unicorn:add_worker[count] # Add a worker (TTIN)
16
16
  cap unicorn:remove_worker[count] # Remove a worker (TTOU)
17
17
  cap unicorn:stop_workers # Stop all workers but keep the master running (WINCH)
@@ -51,19 +51,17 @@ set :unicorn_roles, :app # this is default
51
51
  set :unicorn_options, '' # this is default
52
52
  set :unicorn_restart_delay, 5 # this is default
53
53
  set :unicorn_rack_env, :deployment # this is default
54
- set :unicorn_restart_method, :restart_usr2 # this is default
54
+ set :unicorn_restart_method, :restart_quit # this is default
55
55
  ```
56
56
 
57
- Everything should work **out of the box** but you need to **set up unicorn's config**. (see an example `examples/unicorn.rb`).
58
-
59
- There are three different ways to restart server:
60
- * `:restart_hup` restarts all workers and therefore all code changes, makes sense if `preload_app` is false
61
- * `:restart_usr2_quit` re-executes the running binary and stops previous instance in `:unicorn_restart_delay`
62
- * `:restart_usr2` the same as above but `before_fork` hook has to be set, default and the best choice
57
+ There are five different ways to restart server:
63
58
  * `:restart_quit` stops server gracefully and starts it again in `:unicorn_restart_delay`
64
59
  * `:restart_term` stops server immediately and starts it again
60
+ * `:restart_hup` restarts all workers and therefore all code changes, makes sense if `preload_app` is false
61
+ * `:restart_usr2` the same as above but `before_fork` hook has to be set, see an example `examples/unicorn.rb`
62
+ * `:restart_usr2_quit` re-executes the running binary and stops previous instance in `:unicorn_restart_delay`
65
63
 
66
- Using methods which are based on `QUIT` signal can't be absolutely reliable
64
+ `USR2` signal based methods give you zero-downtime deployments but I've run into one trouble when environment changes (e.g. in `/etc/environment`) aren't updated because new instance is spawned by the old one, unfortunately it can be solved only by re-logining and starting a new instance (`restart_quit` does the stuff).
67
65
 
68
66
  ## Contributing
69
67
 
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "capistrano-unicorn-edge"
7
- spec.version = "0.1.5"
7
+ spec.version = "0.1.6"
8
8
  spec.authors = ["Alexander Menzhinsky"]
9
9
  spec.email = ["amenzhinsky@gmail.com"]
10
10
  spec.summary = %q{Unicorn support for Capistrano 3.x}
data/examples/unicorn.rb CHANGED
@@ -24,6 +24,12 @@ stdout_path "#{app_path}/log/unicorn.log"
24
24
  pid "#{app_path}/tmp/pids/unicorn.pid"
25
25
 
26
26
  before_fork do |server, worker|
27
+ # Using Capistrano, the path to the Gemfile is stored with release
28
+ # timestamp in the path, rather than the current symlink.
29
+ unless ENV['BUNDLE_GEMFILE']
30
+ ENV['BUNDLE_GEMFILE'] = "#{app_path}/Gemfile"
31
+ end
32
+
27
33
  ##
28
34
  # When sent a USR2, Unicorn will suffix its pidfile with .oldbin and
29
35
  # immediately start loading up a new version of itself (loaded with a new
@@ -25,6 +25,23 @@ namespace :unicorn do
25
25
  invoke "unicorn:#{fetch(:unicorn_restart_method)}"
26
26
  end
27
27
 
28
+ desc 'Restart unicorn, simple stop it gracefully and start again (QUIT)'
29
+ task :restart_quit do
30
+ on roles(fetch(:unicorn_roles)) do
31
+ unicorn_send_signal(:QUIT) if unicorn_is_running?
32
+ execute :sleep, fetch(:unicorn_restart_delay)
33
+ unicorn_start
34
+ end
35
+ end
36
+
37
+ desc 'Restart unicorn, simple stop it immediately and start it again (TERM)'
38
+ task :restart_term do
39
+ on roles(fetch(:unicorn_roles)) do
40
+ unicorn_send_signal(:TERM) if unicorn_is_running?
41
+ unicorn_start
42
+ end
43
+ end
44
+
28
45
  desc 'Restart unicorn, when preload_app is false (HUP)'
29
46
  task :restart_hup do
30
47
  on roles(fetch(:unicorn_roles)) do
@@ -64,23 +81,6 @@ namespace :unicorn do
64
81
  end
65
82
  end
66
83
 
67
- desc 'Restart unicorn, simple stop it gracefully and start again (QUIT)'
68
- task :restart_quit do
69
- on roles(fetch(:unicorn_roles)) do
70
- unicorn_send_signal(:QUIT) if unicorn_is_running?
71
- execute :sleep, fetch(:unicorn_restart_delay)
72
- unicorn_start
73
- end
74
- end
75
-
76
- desc 'Restart unicorn, simple stop it immediately and start it again (TERM)'
77
- task :restart_term do
78
- on roles(fetch(:unicorn_roles)) do
79
- unicorn_send_signal(:TERM) if unicorn_is_running?
80
- unicorn_start
81
- end
82
- end
83
-
84
84
  desc 'Add a worker (TTIN)'
85
85
  task :add_worker, :count do |_, args|
86
86
  on roles(fetch(:unicorn_roles)) do
@@ -134,7 +134,7 @@ namespace :load do
134
134
  set :unicorn_options, ''
135
135
  set :unicorn_restart_delay, 5
136
136
  set :unicorn_rack_env, :deployment
137
- set :unicorn_restart_method, :restart_usr2
137
+ set :unicorn_restart_method, :restart_quit
138
138
  end
139
139
  end
140
140
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-unicorn-edge
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Menzhinsky
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-26 00:00:00.000000000 Z
11
+ date: 2014-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capistrano