unicorn 5.5.0 → 5.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.manifest +5 -3
- data/.olddoc.yml +12 -7
- data/Documentation/.gitignore +1 -3
- data/Documentation/unicorn.1 +222 -0
- data/Documentation/unicorn_rails.1 +207 -0
- data/FAQ +1 -1
- data/GIT-VERSION-FILE +1 -1
- data/GIT-VERSION-GEN +1 -1
- data/GNUmakefile +112 -57
- data/HACKING +1 -1
- data/ISSUES +16 -21
- data/KNOWN_ISSUES +2 -2
- data/LATEST +22 -29
- data/Links +5 -5
- data/NEWS +23 -0
- data/README +13 -6
- data/SIGNALS +1 -1
- data/Sandbox +2 -2
- data/archive/slrnpull.conf +1 -1
- data/bin/unicorn_rails +2 -2
- data/examples/big_app_gc.rb +1 -1
- data/examples/logrotate.conf +2 -2
- data/examples/nginx.conf +1 -1
- data/examples/unicorn.conf.minimal.rb +2 -2
- data/examples/unicorn.conf.rb +2 -2
- data/examples/unicorn@.service +7 -0
- data/ext/unicorn_http/extconf.rb +5 -0
- data/ext/unicorn_http/unicorn_http.c +253 -215
- data/ext/unicorn_http/unicorn_http.rl +43 -5
- data/lib/unicorn/configurator.rb +13 -3
- data/lib/unicorn/http_request.rb +11 -0
- data/lib/unicorn/http_server.rb +36 -4
- data/lib/unicorn/oob_gc.rb +2 -2
- data/lib/unicorn/tmpio.rb +8 -2
- data/lib/unicorn/version.rb +1 -1
- data/lib/unicorn.rb +4 -1
- data/man/man1/unicorn.1 +89 -88
- data/man/man1/unicorn_rails.1 +78 -83
- data/t/GNUmakefile +3 -72
- data/test/benchmark/README +14 -4
- data/test/benchmark/ddstream.ru +50 -0
- data/test/benchmark/readinput.ru +40 -0
- data/test/benchmark/uconnect.perl +66 -0
- data/test/exec/test_exec.rb +9 -7
- data/test/test_helper.rb +22 -30
- data/test/unit/test_http_parser_ng.rb +81 -0
- data/test/unit/test_server.rb +74 -0
- data/test/unit/test_upload.rb +4 -9
- data/test/unit/test_util.rb +1 -1
- data/unicorn.gemspec +8 -7
- metadata +12 -9
- data/Documentation/GNUmakefile +0 -30
- data/Documentation/unicorn.1.txt +0 -187
- data/Documentation/unicorn_rails.1.txt +0 -175
@@ -11,6 +11,20 @@ class HttpParserNgTest < Test::Unit::TestCase
|
|
11
11
|
@parser = HttpParser.new
|
12
12
|
end
|
13
13
|
|
14
|
+
# RFC 7230 allows gzip/deflate/compress Transfer-Encoding,
|
15
|
+
# but "chunked" must be last if used
|
16
|
+
def test_is_chunked
|
17
|
+
[ 'chunked,chunked', 'chunked,gzip', 'chunked,gzip,chunked' ].each do |x|
|
18
|
+
assert_raise(HttpParserError) { HttpParser.is_chunked?(x) }
|
19
|
+
end
|
20
|
+
[ 'gzip, chunked', 'gzip,chunked', 'gzip ,chunked' ].each do |x|
|
21
|
+
assert HttpParser.is_chunked?(x)
|
22
|
+
end
|
23
|
+
[ 'gzip', 'xhunked', 'xchunked' ].each do |x|
|
24
|
+
assert !HttpParser.is_chunked?(x)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
14
28
|
def test_parser_max_len
|
15
29
|
assert_raises(RangeError) do
|
16
30
|
HttpParser.max_header_len = 0xffffffff + 1
|
@@ -566,6 +580,73 @@ class HttpParserNgTest < Test::Unit::TestCase
|
|
566
580
|
end
|
567
581
|
end
|
568
582
|
|
583
|
+
def test_duplicate_content_length
|
584
|
+
str = "PUT / HTTP/1.1\r\n" \
|
585
|
+
"Content-Length: 1\r\n" \
|
586
|
+
"Content-Length: 9\r\n" \
|
587
|
+
"\r\n"
|
588
|
+
assert_raises(HttpParserError) { @parser.headers({}, str) }
|
589
|
+
end
|
590
|
+
|
591
|
+
def test_chunked_overrides_content_length
|
592
|
+
order = [ 'Transfer-Encoding: chunked', 'Content-Length: 666' ]
|
593
|
+
%w(a b).each do |x|
|
594
|
+
str = "PUT /#{x} HTTP/1.1\r\n" \
|
595
|
+
"#{order.join("\r\n")}" \
|
596
|
+
"\r\n\r\na\r\nhelloworld\r\n0\r\n\r\n"
|
597
|
+
order.reverse!
|
598
|
+
env = @parser.headers({}, str)
|
599
|
+
assert_nil @parser.content_length
|
600
|
+
assert_equal 'chunked', env['HTTP_TRANSFER_ENCODING']
|
601
|
+
assert_equal '666', env['CONTENT_LENGTH'],
|
602
|
+
'Content-Length logged so the app can log a possible client bug/attack'
|
603
|
+
@parser.filter_body(dst = '', str)
|
604
|
+
assert_equal 'helloworld', dst
|
605
|
+
@parser.parse # handle the non-existent trailer
|
606
|
+
assert @parser.next?
|
607
|
+
end
|
608
|
+
end
|
609
|
+
|
610
|
+
def test_chunked_order_good
|
611
|
+
str = "PUT /x HTTP/1.1\r\n" \
|
612
|
+
"Transfer-Encoding: gzip\r\n" \
|
613
|
+
"Transfer-Encoding: chunked\r\n" \
|
614
|
+
"\r\n"
|
615
|
+
env = @parser.headers({}, str)
|
616
|
+
assert_equal 'gzip,chunked', env['HTTP_TRANSFER_ENCODING']
|
617
|
+
assert_nil @parser.content_length
|
618
|
+
|
619
|
+
@parser.clear
|
620
|
+
str = "PUT /x HTTP/1.1\r\n" \
|
621
|
+
"Transfer-Encoding: gzip, chunked\r\n" \
|
622
|
+
"\r\n"
|
623
|
+
env = @parser.headers({}, str)
|
624
|
+
assert_equal 'gzip, chunked', env['HTTP_TRANSFER_ENCODING']
|
625
|
+
assert_nil @parser.content_length
|
626
|
+
end
|
627
|
+
|
628
|
+
def test_chunked_order_bad
|
629
|
+
str = "PUT /x HTTP/1.1\r\n" \
|
630
|
+
"Transfer-Encoding: chunked\r\n" \
|
631
|
+
"Transfer-Encoding: gzip\r\n" \
|
632
|
+
"\r\n"
|
633
|
+
assert_raise(HttpParserError) { @parser.headers({}, str) }
|
634
|
+
end
|
635
|
+
|
636
|
+
def test_double_chunked
|
637
|
+
str = "PUT /x HTTP/1.1\r\n" \
|
638
|
+
"Transfer-Encoding: chunked\r\n" \
|
639
|
+
"Transfer-Encoding: chunked\r\n" \
|
640
|
+
"\r\n"
|
641
|
+
assert_raise(HttpParserError) { @parser.headers({}, str) }
|
642
|
+
|
643
|
+
@parser.clear
|
644
|
+
str = "PUT /x HTTP/1.1\r\n" \
|
645
|
+
"Transfer-Encoding: chunked,chunked\r\n" \
|
646
|
+
"\r\n"
|
647
|
+
assert_raise(HttpParserError) { @parser.headers({}, str) }
|
648
|
+
end
|
649
|
+
|
569
650
|
def test_backtrace_is_empty
|
570
651
|
begin
|
571
652
|
@parser.headers({}, "AAADFSFDSFD\r\n\r\n")
|
data/test/unit/test_server.rb
CHANGED
@@ -23,6 +23,34 @@ class TestHandler
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
+
class TestEarlyHintsHandler
|
27
|
+
def call(env)
|
28
|
+
while env['rack.input'].read(4096)
|
29
|
+
end
|
30
|
+
env['rack.early_hints'].call(
|
31
|
+
"Link" => "</style.css>; rel=preload; as=style\n</script.js>; rel=preload"
|
32
|
+
)
|
33
|
+
[200, { 'Content-Type' => 'text/plain' }, ['hello!\n']]
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
class TestRackAfterReply
|
38
|
+
def initialize
|
39
|
+
@called = false
|
40
|
+
end
|
41
|
+
|
42
|
+
def call(env)
|
43
|
+
while env['rack.input'].read(4096)
|
44
|
+
end
|
45
|
+
|
46
|
+
env["rack.after_reply"] << -> { @called = true }
|
47
|
+
|
48
|
+
[200, { 'Content-Type' => 'text/plain' }, ["after_reply_called: #{@called}"]]
|
49
|
+
rescue Unicorn::ClientShutdown, Unicorn::HttpParserError => e
|
50
|
+
$stderr.syswrite("#{e.class}: #{e.message} #{e.backtrace.empty?}\n")
|
51
|
+
raise e
|
52
|
+
end
|
53
|
+
end
|
26
54
|
|
27
55
|
class WebServerTest < Test::Unit::TestCase
|
28
56
|
|
@@ -84,6 +112,52 @@ class WebServerTest < Test::Unit::TestCase
|
|
84
112
|
tmp.close!
|
85
113
|
end
|
86
114
|
|
115
|
+
def test_early_hints
|
116
|
+
teardown
|
117
|
+
redirect_test_io do
|
118
|
+
@server = HttpServer.new(TestEarlyHintsHandler.new,
|
119
|
+
:listeners => [ "127.0.0.1:#@port"],
|
120
|
+
:early_hints => true)
|
121
|
+
@server.start
|
122
|
+
end
|
123
|
+
|
124
|
+
sock = TCPSocket.new('127.0.0.1', @port)
|
125
|
+
sock.syswrite("GET / HTTP/1.0\r\n\r\n")
|
126
|
+
|
127
|
+
responses = sock.read(4096)
|
128
|
+
assert_match %r{\AHTTP/1.[01] 103\b}, responses
|
129
|
+
assert_match %r{^Link: </style\.css>}, responses
|
130
|
+
assert_match %r{^Link: </script\.js>}, responses
|
131
|
+
|
132
|
+
assert_match %r{^HTTP/1.[01] 200\b}, responses
|
133
|
+
end
|
134
|
+
|
135
|
+
def test_after_reply
|
136
|
+
teardown
|
137
|
+
|
138
|
+
redirect_test_io do
|
139
|
+
@server = HttpServer.new(TestRackAfterReply.new,
|
140
|
+
:listeners => [ "127.0.0.1:#@port"])
|
141
|
+
@server.start
|
142
|
+
end
|
143
|
+
|
144
|
+
sock = TCPSocket.new('127.0.0.1', @port)
|
145
|
+
sock.syswrite("GET / HTTP/1.0\r\n\r\n")
|
146
|
+
|
147
|
+
responses = sock.read(4096)
|
148
|
+
assert_match %r{\AHTTP/1.[01] 200\b}, responses
|
149
|
+
assert_match %r{^after_reply_called: false}, responses
|
150
|
+
|
151
|
+
sock = TCPSocket.new('127.0.0.1', @port)
|
152
|
+
sock.syswrite("GET / HTTP/1.0\r\n\r\n")
|
153
|
+
|
154
|
+
responses = sock.read(4096)
|
155
|
+
assert_match %r{\AHTTP/1.[01] 200\b}, responses
|
156
|
+
assert_match %r{^after_reply_called: true}, responses
|
157
|
+
|
158
|
+
sock.close
|
159
|
+
end
|
160
|
+
|
87
161
|
def test_broken_app
|
88
162
|
teardown
|
89
163
|
app = lambda { |env| raise RuntimeError, "hello" }
|
data/test/unit/test_upload.rb
CHANGED
@@ -236,15 +236,10 @@ class UploadTest < Test::Unit::TestCase
|
|
236
236
|
resp = Tempfile.new('resp')
|
237
237
|
resp.sync = true
|
238
238
|
|
239
|
-
rd, wr = IO.pipe
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
rd.close
|
244
|
-
wr.close
|
245
|
-
STDOUT.reopen(resp)
|
246
|
-
exec cmd
|
247
|
-
}
|
239
|
+
rd, wr = IO.pipe.each do |io|
|
240
|
+
io.sync = io.close_on_exec = true
|
241
|
+
end
|
242
|
+
pid = spawn(*cmd, { 0 => rd, 1 => resp })
|
248
243
|
rd.close
|
249
244
|
|
250
245
|
tmp.rewind
|
data/test/unit/test_util.rb
CHANGED
@@ -114,7 +114,7 @@ class TestUtil < Test::Unit::TestCase
|
|
114
114
|
f_getpipe_sz = 1032
|
115
115
|
IO.pipe do |a, b|
|
116
116
|
a_sz = a.fcntl(f_getpipe_sz)
|
117
|
-
|
117
|
+
b.fcntl(f_getpipe_sz)
|
118
118
|
assert_kind_of Integer, a_sz
|
119
119
|
r_sz = r.fcntl(f_getpipe_sz)
|
120
120
|
assert_equal Raindrops::PAGE_SIZE, r_sz
|
data/unicorn.gemspec
CHANGED
@@ -11,24 +11,25 @@ end.compact
|
|
11
11
|
|
12
12
|
Gem::Specification.new do |s|
|
13
13
|
s.name = %q{unicorn}
|
14
|
-
s.version = (ENV['VERSION'] || '5.
|
14
|
+
s.version = (ENV['VERSION'] || '5.8.0').dup
|
15
15
|
s.authors = ['unicorn hackers']
|
16
16
|
s.summary = 'Rack HTTP server for fast clients and Unix'
|
17
17
|
s.description = File.read('README').split("\n\n")[1]
|
18
|
-
s.email = %q{unicorn-public@
|
18
|
+
s.email = %q{unicorn-public@yhbt.net}
|
19
19
|
s.executables = %w(unicorn unicorn_rails)
|
20
20
|
s.extensions = %w(ext/unicorn_http/extconf.rb)
|
21
21
|
s.extra_rdoc_files = IO.readlines('.document').map!(&:chomp!).keep_if do |f|
|
22
22
|
File.exist?(f)
|
23
23
|
end
|
24
24
|
s.files = manifest
|
25
|
-
s.homepage = 'https://
|
25
|
+
s.homepage = 'https://yhbt.net/unicorn/'
|
26
26
|
s.test_files = test_files
|
27
27
|
|
28
|
-
#
|
29
|
-
#
|
30
|
-
#
|
31
|
-
|
28
|
+
# 1.9.3 is the minumum supported version. We don't specify
|
29
|
+
# a maximum version to make it easier to test pre-releases,
|
30
|
+
# but we do warn users if they install unicorn on an untested
|
31
|
+
# version in extconf.rb
|
32
|
+
s.required_ruby_version = ">= 1.9.3"
|
32
33
|
|
33
34
|
# We do not have a hard dependency on rack, it's possible to load
|
34
35
|
# things which respond to #call. HTTP status lines in responses
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unicorn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- unicorn hackers
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-12-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -72,7 +72,7 @@ description: |-
|
|
72
72
|
advantage of features in Unix/Unix-like kernels. Slow clients should
|
73
73
|
only be served by placing a reverse proxy capable of fully buffering
|
74
74
|
both the the request and response in between unicorn and slow clients.
|
75
|
-
email: unicorn-public@
|
75
|
+
email: unicorn-public@yhbt.net
|
76
76
|
executables:
|
77
77
|
- unicorn
|
78
78
|
- unicorn_rails
|
@@ -120,9 +120,8 @@ files:
|
|
120
120
|
- COPYING
|
121
121
|
- DESIGN
|
122
122
|
- Documentation/.gitignore
|
123
|
-
- Documentation/
|
124
|
-
- Documentation/
|
125
|
-
- Documentation/unicorn_rails.1.txt
|
123
|
+
- Documentation/unicorn.1
|
124
|
+
- Documentation/unicorn_rails.1
|
126
125
|
- FAQ
|
127
126
|
- GIT-VERSION-FILE
|
128
127
|
- GIT-VERSION-GEN
|
@@ -248,7 +247,10 @@ files:
|
|
248
247
|
- test/aggregate.rb
|
249
248
|
- test/benchmark/README
|
250
249
|
- test/benchmark/dd.ru
|
250
|
+
- test/benchmark/ddstream.ru
|
251
|
+
- test/benchmark/readinput.ru
|
251
252
|
- test/benchmark/stack.ru
|
253
|
+
- test/benchmark/uconnect.perl
|
252
254
|
- test/exec/README
|
253
255
|
- test/exec/test_exec.rb
|
254
256
|
- test/test_helper.rb
|
@@ -269,7 +271,7 @@ files:
|
|
269
271
|
- unicorn.gemspec
|
270
272
|
- unicorn_1
|
271
273
|
- unicorn_rails_1
|
272
|
-
homepage: https://
|
274
|
+
homepage: https://yhbt.net/unicorn/
|
273
275
|
licenses:
|
274
276
|
- GPL-2.0+
|
275
277
|
- Ruby-1.8
|
@@ -280,9 +282,9 @@ require_paths:
|
|
280
282
|
- lib
|
281
283
|
required_ruby_version: !ruby/object:Gem::Requirement
|
282
284
|
requirements:
|
283
|
-
- - "
|
285
|
+
- - ">="
|
284
286
|
- !ruby/object:Gem::Version
|
285
|
-
version:
|
287
|
+
version: 1.9.3
|
286
288
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
287
289
|
requirements:
|
288
290
|
- - ">="
|
@@ -299,4 +301,5 @@ test_files:
|
|
299
301
|
- test/unit/test_http_parser_ng.rb
|
300
302
|
- test/unit/test_request.rb
|
301
303
|
- test/unit/test_server.rb
|
304
|
+
- test/unit/test_upload.rb
|
302
305
|
- test/unit/test_util.rb
|
data/Documentation/GNUmakefile
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
all::
|
2
|
-
|
3
|
-
PANDOC = pandoc
|
4
|
-
PANDOC_OPTS = -f markdown --email-obfuscation=none
|
5
|
-
pandoc = $(PANDOC) $(PANDOC_OPTS)
|
6
|
-
pandoc_html = $(pandoc) --toc -t html --no-wrap
|
7
|
-
|
8
|
-
man1 := $(addsuffix .1,unicorn unicorn_rails)
|
9
|
-
html1 := $(addsuffix .html,$(man1))
|
10
|
-
|
11
|
-
all:: html man
|
12
|
-
|
13
|
-
html: $(html1)
|
14
|
-
man: $(man1)
|
15
|
-
|
16
|
-
install-html: html
|
17
|
-
mkdir -p ../doc/man1
|
18
|
-
install -m 644 $(html1) ../doc/man1
|
19
|
-
|
20
|
-
install-man: man
|
21
|
-
mkdir -p ../man/man1
|
22
|
-
install -m 644 $(man1) ../man/man1
|
23
|
-
|
24
|
-
%.1: %.1.txt
|
25
|
-
$(pandoc) -s -t man < $< > $@+ && mv $@+ $@
|
26
|
-
%.1.html: %.1.txt
|
27
|
-
$(pandoc_html) < $< > $@+ && mv $@+ $@
|
28
|
-
|
29
|
-
clean::
|
30
|
-
$(RM) $(man1) $(html1)
|
data/Documentation/unicorn.1.txt
DELETED
@@ -1,187 +0,0 @@
|
|
1
|
-
% UNICORN(1) Unicorn User Manual
|
2
|
-
% The Unicorn Community <unicorn-public@bogomips.org>
|
3
|
-
% September 15, 2009
|
4
|
-
|
5
|
-
# NAME
|
6
|
-
|
7
|
-
unicorn - a rackup-like command to launch the Unicorn HTTP server
|
8
|
-
|
9
|
-
# SYNOPSIS
|
10
|
-
|
11
|
-
unicorn [-c CONFIG_FILE] [-E RACK_ENV] [-D] [RACKUP_FILE]
|
12
|
-
|
13
|
-
# DESCRIPTION
|
14
|
-
|
15
|
-
A rackup(1)-like command to launch Rack applications using Unicorn.
|
16
|
-
It is expected to be started in your application root (APP_ROOT),
|
17
|
-
but the "working_directory" directive may be used in the CONFIG_FILE.
|
18
|
-
|
19
|
-
While unicorn takes a myriad of command-line options for
|
20
|
-
compatibility with ruby(1) and rackup(1), it is recommended to stick
|
21
|
-
to the few command-line options specified in the SYNOPSIS and use
|
22
|
-
the CONFIG_FILE as much as possible.
|
23
|
-
|
24
|
-
# RACKUP FILE
|
25
|
-
|
26
|
-
This defaults to \"config.ru\" in APP_ROOT. It should be the same
|
27
|
-
file used by rackup(1) and other Rack launchers, it uses the
|
28
|
-
*Rack::Builder* DSL.
|
29
|
-
|
30
|
-
Embedded command-line options are mostly parsed for compatibility
|
31
|
-
with rackup(1) but strongly discouraged.
|
32
|
-
|
33
|
-
# UNICORN OPTIONS
|
34
|
-
-c, \--config-file CONFIG_FILE
|
35
|
-
: Path to the Unicorn-specific config file. The config file is
|
36
|
-
implemented as a Ruby DSL, so Ruby code may executed.
|
37
|
-
See the RDoc/ri for the *Unicorn::Configurator* class for the full
|
38
|
-
list of directives available from the DSL.
|
39
|
-
Using an absolute path for for CONFIG_FILE is recommended as it
|
40
|
-
makes multiple instances of Unicorn easily distinguishable when
|
41
|
-
viewing ps(1) output.
|
42
|
-
|
43
|
-
-D, \--daemonize
|
44
|
-
: Run daemonized in the background. The process is detached from
|
45
|
-
the controlling terminal and stdin is redirected to "/dev/null".
|
46
|
-
Unlike many common UNIX daemons, we do not chdir to \"/\"
|
47
|
-
upon daemonization to allow more control over the startup/upgrade
|
48
|
-
process.
|
49
|
-
Unless specified in the CONFIG_FILE, stderr and stdout will
|
50
|
-
also be redirected to "/dev/null".
|
51
|
-
|
52
|
-
-E, \--env RACK_ENV
|
53
|
-
: Run under the given RACK_ENV. See the RACK ENVIRONMENT section
|
54
|
-
for more details.
|
55
|
-
|
56
|
-
-l, \--listen ADDRESS
|
57
|
-
: Listens on a given ADDRESS. ADDRESS may be in the form of
|
58
|
-
HOST:PORT or PATH, HOST:PORT is taken to mean a TCP socket
|
59
|
-
and PATH is meant to be a path to a UNIX domain socket.
|
60
|
-
Defaults to "0.0.0.0:8080" (all addresses on TCP port 8080)
|
61
|
-
For production deployments, specifying the "listen" directive in
|
62
|
-
CONFIG_FILE is recommended as it allows fine-tuning of socket
|
63
|
-
options.
|
64
|
-
-N, \--no-default-middleware
|
65
|
-
: Disables loading middleware implied by RACK_ENV. This bypasses the
|
66
|
-
configuration documented in the RACK ENVIRONMENT section, but still
|
67
|
-
allows RACK_ENV to be used for application/framework-specific purposes.
|
68
|
-
|
69
|
-
# RACKUP COMPATIBILITY OPTIONS
|
70
|
-
-o, \--host HOST
|
71
|
-
: Listen on a TCP socket belonging to HOST, default is
|
72
|
-
"0.0.0.0" (all addresses).
|
73
|
-
If specified multiple times on the command-line, only the
|
74
|
-
last-specified value takes effect.
|
75
|
-
This option only exists for compatibility with the rackup(1) command,
|
76
|
-
use of "-l"/"\--listen" switch is recommended instead.
|
77
|
-
|
78
|
-
-p, \--port PORT
|
79
|
-
: Listen on the specified TCP PORT, default is 8080.
|
80
|
-
If specified multiple times on the command-line, only the last-specified
|
81
|
-
value takes effect.
|
82
|
-
This option only exists for compatibility with the rackup(1) command,
|
83
|
-
use of "-l"/"\--listen" switch is recommended instead.
|
84
|
-
|
85
|
-
-s, \--server SERVER
|
86
|
-
: No-op, this exists only for compatibility with rackup(1).
|
87
|
-
|
88
|
-
# RUBY OPTIONS
|
89
|
-
-e, \--eval LINE
|
90
|
-
: Evaluate a LINE of Ruby code. This evaluation happens
|
91
|
-
immediately as the command-line is being parsed.
|
92
|
-
|
93
|
-
-d, \--debug
|
94
|
-
: Turn on debug mode, the $DEBUG variable is set to true.
|
95
|
-
|
96
|
-
-w, \--warn
|
97
|
-
: Turn on verbose warnings, the $VERBOSE variable is set to true.
|
98
|
-
|
99
|
-
-I, \--include PATH
|
100
|
-
: specify $LOAD_PATH. PATH will be prepended to $LOAD_PATH.
|
101
|
-
The \':\' character may be used to delimit multiple directories.
|
102
|
-
This directive may be used more than once. Modifications to
|
103
|
-
$LOAD_PATH take place immediately and in the order they were
|
104
|
-
specified on the command-line.
|
105
|
-
|
106
|
-
-r, \--require LIBRARY
|
107
|
-
: require a specified LIBRARY before executing the application. The
|
108
|
-
\"require\" statement will be executed immediately and in the order
|
109
|
-
they were specified on the command-line.
|
110
|
-
|
111
|
-
# SIGNALS
|
112
|
-
|
113
|
-
The following UNIX signals may be sent to the master process:
|
114
|
-
|
115
|
-
* HUP - reload config file, app, and gracefully restart all workers
|
116
|
-
* INT/TERM - quick shutdown, kills all workers immediately
|
117
|
-
* QUIT - graceful shutdown, waits for workers to finish their
|
118
|
-
current request before finishing.
|
119
|
-
* USR1 - reopen all logs owned by the master and all workers
|
120
|
-
See Unicorn::Util.reopen_logs for what is considered a log.
|
121
|
-
* USR2 - reexecute the running binary. A separate QUIT
|
122
|
-
should be sent to the original process once the child is verified to
|
123
|
-
be up and running.
|
124
|
-
* WINCH - gracefully stops workers but keep the master running.
|
125
|
-
This will only work for daemonized processes.
|
126
|
-
* TTIN - increment the number of worker processes by one
|
127
|
-
* TTOU - decrement the number of worker processes by one
|
128
|
-
|
129
|
-
See the [SIGNALS][4] document for full description of all signals
|
130
|
-
used by Unicorn.
|
131
|
-
|
132
|
-
# RACK ENVIRONMENT
|
133
|
-
|
134
|
-
Accepted values of RACK_ENV and the middleware they automatically load
|
135
|
-
(outside of RACKUP_FILE) are exactly as those in rackup(1):
|
136
|
-
|
137
|
-
* development - loads Rack::CommonLogger, Rack::ShowExceptions, and
|
138
|
-
Rack::Lint middleware
|
139
|
-
* deployment - loads Rack::CommonLogger middleware
|
140
|
-
* none - loads no middleware at all, relying
|
141
|
-
entirely on RACKUP_FILE
|
142
|
-
|
143
|
-
All unrecognized values for RACK_ENV are assumed to be
|
144
|
-
"none". Production deployments are strongly encouraged to use
|
145
|
-
"deployment" or "none" for maximum performance.
|
146
|
-
|
147
|
-
As of Unicorn 0.94.0, RACK_ENV is exported as a process-wide environment
|
148
|
-
variable as well. While not current a part of the Rack specification as
|
149
|
-
of Rack 1.0.1, this has become a de facto standard in the Rack world.
|
150
|
-
|
151
|
-
Note the Rack::ContentLength and Rack::Chunked middlewares are also
|
152
|
-
loaded by "deployment" and "development", but no other values of
|
153
|
-
RACK_ENV. If needed, they must be individually specified in the
|
154
|
-
RACKUP_FILE, some frameworks do not require them.
|
155
|
-
|
156
|
-
# ENVIRONMENT VARIABLES
|
157
|
-
|
158
|
-
The RACK_ENV variable is set by the aforementioned \-E switch.
|
159
|
-
All application or library-specific environment variables (e.g. TMPDIR)
|
160
|
-
may always be set in the Unicorn CONFIG_FILE in addition to the spawning
|
161
|
-
shell. When transparently upgrading Unicorn, all environment variables
|
162
|
-
set in the old master process are inherited by the new master process.
|
163
|
-
Unicorn only uses (and will overwrite) the UNICORN_FD environment
|
164
|
-
variable internally when doing transparent upgrades.
|
165
|
-
|
166
|
-
UNICORN_FD is a comma-delimited list of one or more file descriptors
|
167
|
-
used to implement USR2 upgrades. Init systems may bind listen sockets
|
168
|
-
itself and spawn unicorn with UNICORN_FD set to the file descriptor
|
169
|
-
numbers of the listen socket(s).
|
170
|
-
|
171
|
-
As of unicorn 5.0, LISTEN_PID and LISTEN_FDS are used for socket
|
172
|
-
activation as documented in the sd_listen_fds(3) manpage. Users
|
173
|
-
relying on this feature do not need to specify a listen socket in
|
174
|
-
the unicorn config file.
|
175
|
-
|
176
|
-
# SEE ALSO
|
177
|
-
|
178
|
-
* *Rack::Builder* ri/RDoc
|
179
|
-
* *Unicorn::Configurator* ri/RDoc
|
180
|
-
* [Unicorn RDoc][1]
|
181
|
-
* [Rack RDoc][2]
|
182
|
-
* [Rackup HowTo][3]
|
183
|
-
|
184
|
-
[1]: https://bogomips.org/unicorn/
|
185
|
-
[2]: https://www.rubydoc.info/github/rack/rack/
|
186
|
-
[3]: https://github.com/rack/rack/wiki/tutorial-rackup-howto
|
187
|
-
[4]: https://bogomips.org/unicorn/SIGNALS.html
|