unicorn 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +1 -0
- data/SIGNALS +26 -26
- data/lib/unicorn.rb +1 -1
- data/lib/unicorn/configurator.rb +2 -1
- data/lib/unicorn/const.rb +1 -1
- data/lib/unicorn/http_request.rb +1 -1
- data/local.mk.sample +1 -1
- data/test/unit/test_configurator.rb +2 -0
- data/unicorn.gemspec +3 -3
- metadata +7 -7
data/CHANGELOG
CHANGED
data/SIGNALS
CHANGED
@@ -6,28 +6,28 @@ processes are documented here as well.
|
|
6
6
|
|
7
7
|
=== Master Process
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
* HUP - reload config file and gracefully restart all workers
|
10
|
+
If "preload_app" is false (the default), the application code
|
11
|
+
will be reloaded when workers are restarted as well.
|
12
12
|
|
13
|
-
|
13
|
+
* INT/TERM - quick shutdown, kills all workers immediately
|
14
14
|
|
15
|
-
|
16
|
-
|
15
|
+
* QUIT - graceful shutdown, waits for workers to finish their
|
16
|
+
current request before finishing.
|
17
17
|
|
18
|
-
|
19
|
-
|
18
|
+
* USR1 - reopen all logs owned by the master and all workers
|
19
|
+
See Unicorn::Util.reopen_logs for what is considered a log.
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
|
21
|
+
* USR2 - reexecute the running binary. A separate QUIT
|
22
|
+
should be sent to the original process once the child is verified to
|
23
|
+
be up and running.
|
24
24
|
|
25
|
-
|
26
|
-
|
25
|
+
* WINCH - gracefully stops workers but keep the master running.
|
26
|
+
This will only work for daemonized processes.
|
27
27
|
|
28
|
-
|
28
|
+
* TTIN - increment the number of worker processes by one
|
29
29
|
|
30
|
-
|
30
|
+
* TTOU - decrement the number of worker processes by one
|
31
31
|
|
32
32
|
=== Worker Processes
|
33
33
|
|
@@ -35,19 +35,19 @@ Sending signals directly to the worker processes should not normally be
|
|
35
35
|
needed. If the master process is running, any exited worker will be
|
36
36
|
automatically respawned.
|
37
37
|
|
38
|
-
|
39
|
-
|
40
|
-
|
38
|
+
* INT/TERM - Quick shutdown, immediately exit.
|
39
|
+
Unless WINCH has been sent to the master (or the master is killed),
|
40
|
+
the master process will respawn a worker to replace this one.
|
41
41
|
|
42
|
-
|
43
|
-
|
44
|
-
|
42
|
+
* QUIT - Gracefully exit after finishing the current request.
|
43
|
+
Unless WINCH has been sent to the master (or the master is killed),
|
44
|
+
the master process will respawn a worker to replace this one.
|
45
45
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
46
|
+
* USR1 - Reopen all logs owned by the worker process.
|
47
|
+
See Unicorn::Util.reopen_logs for what is considered a log.
|
48
|
+
Log files are not reopened until it is done processing
|
49
|
+
the current request, so multiple log lines for one request
|
50
|
+
(as done by Rails) will not be split across multiple logs.
|
51
51
|
|
52
52
|
=== Procedure to replace a running unicorn executable
|
53
53
|
|
data/lib/unicorn.rb
CHANGED
@@ -478,7 +478,7 @@ module Unicorn
|
|
478
478
|
client = nil
|
479
479
|
|
480
480
|
# closing anything we IO.select on will raise EBADF
|
481
|
-
trap(:USR1) { nr = -65536;
|
481
|
+
trap(:USR1) { nr = -65536; SELF_PIPE.first.close rescue nil }
|
482
482
|
trap(:QUIT) { alive = nil; LISTENERS.each { |s| s.close rescue nil } }
|
483
483
|
[:TERM, :INT].each { |sig| trap(sig) { exit(0) } } # instant shutdown
|
484
484
|
@logger.info "worker=#{worker.nr} ready"
|
data/lib/unicorn/configurator.rb
CHANGED
@@ -297,6 +297,7 @@ module Unicorn
|
|
297
297
|
# expands pathnames of sockets if relative to "~" or "~username"
|
298
298
|
# expands "*:port and ":port" to "0.0.0.0:port"
|
299
299
|
def expand_addr(address) #:nodoc
|
300
|
+
return "0.0.0.0:#{address}" if Integer === address
|
300
301
|
return address unless String === address
|
301
302
|
|
302
303
|
case address
|
@@ -304,7 +305,7 @@ module Unicorn
|
|
304
305
|
File.expand_path($1)
|
305
306
|
when %r{\A~}
|
306
307
|
File.expand_path(address)
|
307
|
-
when %r{\A
|
308
|
+
when %r{\A(?:\*:)?(\d+)\z}
|
308
309
|
"0.0.0.0:#$1"
|
309
310
|
when %r{\A(.*):(\d+)\z}
|
310
311
|
# canonicalize the name
|
data/lib/unicorn/const.rb
CHANGED
@@ -59,7 +59,7 @@ module Unicorn
|
|
59
59
|
REQUEST_URI='REQUEST_URI'.freeze
|
60
60
|
REQUEST_PATH='REQUEST_PATH'.freeze
|
61
61
|
|
62
|
-
UNICORN_VERSION="0.
|
62
|
+
UNICORN_VERSION="0.7.0".freeze
|
63
63
|
|
64
64
|
DEFAULT_HOST = "0.0.0.0".freeze # default TCP listen host address
|
65
65
|
DEFAULT_PORT = "8080".freeze # default TCP listen port
|
data/lib/unicorn/http_request.rb
CHANGED
@@ -18,7 +18,7 @@ module Unicorn
|
|
18
18
|
"rack.multiprocess" => true,
|
19
19
|
"rack.multithread" => false,
|
20
20
|
"rack.run_once" => false,
|
21
|
-
"rack.version" => [
|
21
|
+
"rack.version" => [1, 0].freeze,
|
22
22
|
"SCRIPT_NAME" => "".freeze,
|
23
23
|
|
24
24
|
# this is not in the Rack spec, but some apps may rely on it
|
data/local.mk.sample
CHANGED
@@ -26,6 +26,8 @@ class TestConfigurator < Test::Unit::TestCase
|
|
26
26
|
assert_equal "0.0.0.0:2007", meth.call('0.0.0.0:2007')
|
27
27
|
assert_equal "0.0.0.0:2007", meth.call(':2007')
|
28
28
|
assert_equal "0.0.0.0:2007", meth.call('*:2007')
|
29
|
+
assert_equal "0.0.0.0:2007", meth.call('2007')
|
30
|
+
assert_equal "0.0.0.0:2007", meth.call(2007)
|
29
31
|
assert_match %r{\A\d+\.\d+\.\d+\.\d+:2007\z}, meth.call('1:2007')
|
30
32
|
assert_match %r{\A\d+\.\d+\.\d+\.\d+:2007\z}, meth.call('2:2007')
|
31
33
|
end
|
data/unicorn.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{unicorn}
|
5
|
-
s.version = "0.
|
5
|
+
s.version = "0.7.0"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Eric Wong"]
|
9
|
-
s.date = %q{2009-04-
|
9
|
+
s.date = %q{2009-04-25}
|
10
10
|
s.description = %q{A small fast HTTP library and server for Rack applications.}
|
11
11
|
s.email = %q{normalperson@yhbt.net}
|
12
12
|
s.executables = ["unicorn", "unicorn_rails"]
|
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
|
|
20
20
|
s.rubyforge_project = %q{unicorn}
|
21
21
|
s.rubygems_version = %q{1.3.1}
|
22
22
|
s.summary = %q{A small fast HTTP library and server for Rack applications.}
|
23
|
-
s.test_files = ["test/unit/
|
23
|
+
s.test_files = ["test/unit/test_request.rb", "test/unit/test_http_parser.rb", "test/unit/test_server.rb", "test/unit/test_response.rb", "test/unit/test_configurator.rb", "test/unit/test_upload.rb", "test/unit/test_signals.rb", "test/unit/test_socket_helper.rb"]
|
24
24
|
|
25
25
|
if s.respond_to? :specification_version then
|
26
26
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unicorn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Wong
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-04-
|
12
|
+
date: 2009-04-25 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -209,11 +209,11 @@ signing_key:
|
|
209
209
|
specification_version: 2
|
210
210
|
summary: A small fast HTTP library and server for Rack applications.
|
211
211
|
test_files:
|
212
|
-
- test/unit/test_configurator.rb
|
213
|
-
- test/unit/test_response.rb
|
214
212
|
- test/unit/test_request.rb
|
215
|
-
- test/unit/test_signals.rb
|
216
|
-
- test/unit/test_upload.rb
|
217
213
|
- test/unit/test_http_parser.rb
|
218
|
-
- test/unit/test_socket_helper.rb
|
219
214
|
- test/unit/test_server.rb
|
215
|
+
- test/unit/test_response.rb
|
216
|
+
- test/unit/test_configurator.rb
|
217
|
+
- test/unit/test_upload.rb
|
218
|
+
- test/unit/test_signals.rb
|
219
|
+
- test/unit/test_socket_helper.rb
|