unicorn 5.5.0 → 6.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.manifest +8 -5
- data/.olddoc.yml +15 -7
- data/CONTRIBUTORS +6 -2
- 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 +2 -9
- data/ISSUES +24 -31
- data/KNOWN_ISSUES +2 -2
- data/LATEST +16 -22
- data/Links +5 -5
- data/NEWS +155 -0
- data/README +15 -9
- data/SIGNALS +1 -1
- data/Sandbox +3 -3
- 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/c_util.h +5 -13
- data/ext/unicorn_http/common_field_optimization.h +0 -1
- data/ext/unicorn_http/epollexclusive.h +124 -0
- data/ext/unicorn_http/ext_help.h +0 -24
- data/ext/unicorn_http/extconf.rb +2 -6
- data/ext/unicorn_http/global_variables.h +1 -1
- data/ext/unicorn_http/httpdate.c +1 -0
- data/ext/unicorn_http/unicorn_http.c +258 -228
- data/ext/unicorn_http/unicorn_http.rl +48 -18
- data/lib/unicorn/configurator.rb +13 -3
- data/lib/unicorn/http_request.rb +11 -1
- data/lib/unicorn/http_server.rb +56 -29
- data/lib/unicorn/oob_gc.rb +5 -5
- data/lib/unicorn/select_waiter.rb +6 -0
- data/lib/unicorn/tmpio.rb +8 -2
- data/lib/unicorn/version.rb +1 -1
- data/lib/unicorn.rb +4 -3
- data/man/man1/unicorn.1 +89 -88
- data/man/man1/unicorn_rails.1 +78 -83
- data/t/GNUmakefile +3 -72
- data/t/README +1 -1
- data/t/test-lib.sh +2 -1
- 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 +14 -12
- data/test/test_helper.rb +38 -30
- data/test/unit/test_ccc.rb +4 -3
- data/test/unit/test_http_parser_ng.rb +81 -0
- data/test/unit/test_server.rb +81 -7
- data/test/unit/test_signals.rb +6 -6
- data/test/unit/test_socket_helper.rb +1 -1
- data/test/unit/test_upload.rb +9 -14
- data/test/unit/test_util.rb +5 -4
- data/test/unit/test_waiter.rb +34 -0
- data/unicorn.gemspec +8 -7
- metadata +16 -11
- data/Documentation/GNUmakefile +0 -30
- data/Documentation/unicorn.1.txt +0 -187
- data/Documentation/unicorn_rails.1.txt +0 -175
- data/t/hijack.ru +0 -55
- data/t/t0200-rack-hijack.sh +0 -51
data/test/unit/test_signals.rb
CHANGED
@@ -52,7 +52,7 @@ class SignalsTest < Test::Unit::TestCase
|
|
52
52
|
redirect_test_io { HttpServer.new(app, opts).start.join }
|
53
53
|
}
|
54
54
|
wait_workers_ready("test_stderr.#{pid}.log", 1)
|
55
|
-
sock =
|
55
|
+
sock = tcp_socket('127.0.0.1', @port)
|
56
56
|
sock.syswrite("GET / HTTP/1.0\r\n\r\n")
|
57
57
|
buf = sock.readpartial(4096)
|
58
58
|
assert_nil sock.close
|
@@ -79,7 +79,7 @@ class SignalsTest < Test::Unit::TestCase
|
|
79
79
|
}
|
80
80
|
wr.close
|
81
81
|
wait_workers_ready("test_stderr.#{pid}.log", 1)
|
82
|
-
sock =
|
82
|
+
sock = tcp_socket('127.0.0.1', @port)
|
83
83
|
sock.syswrite("GET / HTTP/1.0\r\n\r\n")
|
84
84
|
buf = rd.readpartial(1)
|
85
85
|
wait_master_ready("test_stderr.#{pid}.log")
|
@@ -102,7 +102,7 @@ class SignalsTest < Test::Unit::TestCase
|
|
102
102
|
}
|
103
103
|
t0 = Time.now
|
104
104
|
wait_workers_ready("test_stderr.#{pid}.log", 1)
|
105
|
-
sock =
|
105
|
+
sock = tcp_socket('127.0.0.1', @port)
|
106
106
|
sock.syswrite("GET / HTTP/1.0\r\n\r\n")
|
107
107
|
|
108
108
|
buf = nil
|
@@ -125,7 +125,7 @@ class SignalsTest < Test::Unit::TestCase
|
|
125
125
|
}
|
126
126
|
redirect_test_io { @server = HttpServer.new(app, @server_opts).start }
|
127
127
|
wait_workers_ready("test_stderr.#{$$}.log", 1)
|
128
|
-
sock =
|
128
|
+
sock = tcp_socket('127.0.0.1', @port)
|
129
129
|
sock.syswrite("GET / HTTP/1.0\r\n\r\n")
|
130
130
|
buf = ''
|
131
131
|
header_len = pid = nil
|
@@ -163,13 +163,13 @@ class SignalsTest < Test::Unit::TestCase
|
|
163
163
|
redirect_test_io { @server = HttpServer.new(app, @server_opts).start }
|
164
164
|
|
165
165
|
wait_workers_ready("test_stderr.#{$$}.log", 1)
|
166
|
-
sock =
|
166
|
+
sock = tcp_socket('127.0.0.1', @port)
|
167
167
|
sock.syswrite("GET / HTTP/1.0\r\n\r\n")
|
168
168
|
pid = sock.sysread(4096)[/\r\nX-Pid: (\d+)\r\n/, 1].to_i
|
169
169
|
assert_nil sock.close
|
170
170
|
|
171
171
|
assert pid > 0, "pid not positive: #{pid.inspect}"
|
172
|
-
sock =
|
172
|
+
sock = tcp_socket('127.0.0.1', @port)
|
173
173
|
sock.syswrite("PUT / HTTP/1.0\r\n")
|
174
174
|
sock.syswrite("Content-Length: #{@bs * @count}\r\n\r\n")
|
175
175
|
1000.times { Process.kill(:HUP, pid) }
|
@@ -116,7 +116,7 @@ class TestSocketHelper < Test::Unit::TestCase
|
|
116
116
|
client.syswrite('abcde')
|
117
117
|
exit 0
|
118
118
|
end
|
119
|
-
s =
|
119
|
+
s = unix_socket(@unix_listener_path)
|
120
120
|
IO.select([s])
|
121
121
|
assert_equal 'abcde', s.sysread(5)
|
122
122
|
pid, status = Process.waitpid2(pid)
|
data/test/unit/test_upload.rb
CHANGED
@@ -60,7 +60,7 @@ class UploadTest < Test::Unit::TestCase
|
|
60
60
|
|
61
61
|
def test_put
|
62
62
|
start_server(@sha1_app)
|
63
|
-
sock =
|
63
|
+
sock = tcp_socket(@addr, @port)
|
64
64
|
sock.syswrite("PUT / HTTP/1.0\r\nContent-Length: #{length}\r\n\r\n")
|
65
65
|
@count.times do |i|
|
66
66
|
buf = @random.sysread(@bs)
|
@@ -77,7 +77,7 @@ class UploadTest < Test::Unit::TestCase
|
|
77
77
|
def test_put_content_md5
|
78
78
|
md5 = Digest::MD5.new
|
79
79
|
start_server(@sha1_app)
|
80
|
-
sock =
|
80
|
+
sock = tcp_socket(@addr, @port)
|
81
81
|
sock.syswrite("PUT / HTTP/1.0\r\nTransfer-Encoding: chunked\r\n" \
|
82
82
|
"Trailer: Content-MD5\r\n\r\n")
|
83
83
|
@count.times do |i|
|
@@ -103,7 +103,7 @@ class UploadTest < Test::Unit::TestCase
|
|
103
103
|
@count, @bs = 2, 128
|
104
104
|
start_server(@sha1_app)
|
105
105
|
assert_equal 256, length
|
106
|
-
sock =
|
106
|
+
sock = tcp_socket(@addr, @port)
|
107
107
|
hdr = "PUT / HTTP/1.0\r\nContent-Length: #{length}\r\n\r\n"
|
108
108
|
@count.times do
|
109
109
|
buf = @random.sysread(@bs)
|
@@ -122,7 +122,7 @@ class UploadTest < Test::Unit::TestCase
|
|
122
122
|
|
123
123
|
def test_put_keepalive_truncates_small_overwrite
|
124
124
|
start_server(@sha1_app)
|
125
|
-
sock =
|
125
|
+
sock = tcp_socket(@addr, @port)
|
126
126
|
to_upload = length + 1
|
127
127
|
sock.syswrite("PUT / HTTP/1.0\r\nContent-Length: #{to_upload}\r\n\r\n")
|
128
128
|
@count.times do
|
@@ -155,7 +155,7 @@ class UploadTest < Test::Unit::TestCase
|
|
155
155
|
tmp.write(nr.to_s)
|
156
156
|
[ 200, @hdr, [] ]
|
157
157
|
})
|
158
|
-
sock =
|
158
|
+
sock = tcp_socket(@addr, @port)
|
159
159
|
buf = ' ' * @bs
|
160
160
|
sock.syswrite("PUT / HTTP/1.0\r\nContent-Length: #{length}\r\n\r\n")
|
161
161
|
|
@@ -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
@@ -51,7 +51,7 @@ class TestUtil < Test::Unit::TestCase
|
|
51
51
|
def test_reopen_logs_renamed_with_encoding
|
52
52
|
tmp = Tempfile.new('')
|
53
53
|
tmp_path = tmp.path.dup.freeze
|
54
|
-
Encoding.list.each { |encoding|
|
54
|
+
Encoding.list.sample(5).each { |encoding|
|
55
55
|
File.open(tmp_path, "a:#{encoding.to_s}") { |fp|
|
56
56
|
fp.sync = true
|
57
57
|
assert_equal encoding, fp.external_encoding
|
@@ -74,8 +74,9 @@ class TestUtil < Test::Unit::TestCase
|
|
74
74
|
def test_reopen_logs_renamed_with_internal_encoding
|
75
75
|
tmp = Tempfile.new('')
|
76
76
|
tmp_path = tmp.path.dup.freeze
|
77
|
-
Encoding.list
|
78
|
-
|
77
|
+
full = Encoding.list
|
78
|
+
full.sample(2).each { |ext|
|
79
|
+
full.sample(2).each { |int|
|
79
80
|
next if ext == int
|
80
81
|
File.open(tmp_path, "a:#{ext.to_s}:#{int.to_s}") { |fp|
|
81
82
|
fp.sync = true
|
@@ -114,7 +115,7 @@ class TestUtil < Test::Unit::TestCase
|
|
114
115
|
f_getpipe_sz = 1032
|
115
116
|
IO.pipe do |a, b|
|
116
117
|
a_sz = a.fcntl(f_getpipe_sz)
|
117
|
-
|
118
|
+
b.fcntl(f_getpipe_sz)
|
118
119
|
assert_kind_of Integer, a_sz
|
119
120
|
r_sz = r.fcntl(f_getpipe_sz)
|
120
121
|
assert_equal Raindrops::PAGE_SIZE, r_sz
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'unicorn'
|
3
|
+
require 'unicorn/select_waiter'
|
4
|
+
class TestSelectWaiter < Test::Unit::TestCase
|
5
|
+
|
6
|
+
def test_select_timeout # n.b. this is level-triggered
|
7
|
+
sw = Unicorn::SelectWaiter.new
|
8
|
+
IO.pipe do |r,w|
|
9
|
+
sw.get_readers(ready = [], [r], 0)
|
10
|
+
assert_equal [], ready
|
11
|
+
w.syswrite '.'
|
12
|
+
sw.get_readers(ready, [r], 1000)
|
13
|
+
assert_equal [r], ready
|
14
|
+
sw.get_readers(ready, [r], 0)
|
15
|
+
assert_equal [r], ready
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_linux # ugh, also level-triggered, unlikely to change
|
20
|
+
IO.pipe do |r,w|
|
21
|
+
wtr = Unicorn::Waiter.prep_readers([r])
|
22
|
+
wtr.get_readers(ready = [], [r], 0)
|
23
|
+
assert_equal [], ready
|
24
|
+
w.syswrite '.'
|
25
|
+
wtr.get_readers(ready = [], [r], 1000)
|
26
|
+
assert_equal [r], ready
|
27
|
+
wtr.get_readers(ready = [], [r], 1000)
|
28
|
+
assert_equal [r], ready, 'still ready (level-triggered :<)'
|
29
|
+
assert_nil wtr.close
|
30
|
+
end
|
31
|
+
rescue SystemCallError => e
|
32
|
+
warn "#{e.message} (#{e.class})"
|
33
|
+
end if Unicorn.const_defined?(:Waiter)
|
34
|
+
end
|
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'] || '
|
14
|
+
s.version = (ENV['VERSION'] || '6.1.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
|
+
# 2.0.0 is the minimum 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 = ">= 2.0.0"
|
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:
|
4
|
+
version: 6.1.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: 2021-12-25 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
|
@@ -158,6 +157,7 @@ files:
|
|
158
157
|
- ext/unicorn_http/CFLAGS
|
159
158
|
- ext/unicorn_http/c_util.h
|
160
159
|
- ext/unicorn_http/common_field_optimization.h
|
160
|
+
- ext/unicorn_http/epollexclusive.h
|
161
161
|
- ext/unicorn_http/ext_help.h
|
162
162
|
- ext/unicorn_http/extconf.rb
|
163
163
|
- ext/unicorn_http/global_variables.h
|
@@ -177,6 +177,7 @@ files:
|
|
177
177
|
- lib/unicorn/launcher.rb
|
178
178
|
- lib/unicorn/oob_gc.rb
|
179
179
|
- lib/unicorn/preread_input.rb
|
180
|
+
- lib/unicorn/select_waiter.rb
|
180
181
|
- lib/unicorn/socket_helper.rb
|
181
182
|
- lib/unicorn/stream_input.rb
|
182
183
|
- lib/unicorn/tee_input.rb
|
@@ -198,7 +199,6 @@ files:
|
|
198
199
|
- t/env.ru
|
199
200
|
- t/fails-rack-lint.ru
|
200
201
|
- t/heartbeat-timeout.ru
|
201
|
-
- t/hijack.ru
|
202
202
|
- t/listener_names.ru
|
203
203
|
- t/my-tap-lib.sh
|
204
204
|
- t/oob_gc.ru
|
@@ -236,7 +236,6 @@ files:
|
|
236
236
|
- t/t0100-rack-input-tests.sh
|
237
237
|
- t/t0116-client_body_buffer_size.sh
|
238
238
|
- t/t0116.ru
|
239
|
-
- t/t0200-rack-hijack.sh
|
240
239
|
- t/t0300-no-default-middleware.sh
|
241
240
|
- t/t0301-no-default-middleware-ignored-in-config.sh
|
242
241
|
- t/t0301.ru
|
@@ -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
|
@@ -266,10 +268,11 @@ files:
|
|
266
268
|
- test/unit/test_tee_input.rb
|
267
269
|
- test/unit/test_upload.rb
|
268
270
|
- test/unit/test_util.rb
|
271
|
+
- test/unit/test_waiter.rb
|
269
272
|
- unicorn.gemspec
|
270
273
|
- unicorn_1
|
271
274
|
- unicorn_rails_1
|
272
|
-
homepage: https://
|
275
|
+
homepage: https://yhbt.net/unicorn/
|
273
276
|
licenses:
|
274
277
|
- GPL-2.0+
|
275
278
|
- Ruby-1.8
|
@@ -280,9 +283,9 @@ require_paths:
|
|
280
283
|
- lib
|
281
284
|
required_ruby_version: !ruby/object:Gem::Requirement
|
282
285
|
requirements:
|
283
|
-
- - "
|
286
|
+
- - ">="
|
284
287
|
- !ruby/object:Gem::Version
|
285
|
-
version:
|
288
|
+
version: 2.0.0
|
286
289
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
287
290
|
requirements:
|
288
291
|
- - ">="
|
@@ -299,4 +302,6 @@ test_files:
|
|
299
302
|
- test/unit/test_http_parser_ng.rb
|
300
303
|
- test/unit/test_request.rb
|
301
304
|
- test/unit/test_server.rb
|
305
|
+
- test/unit/test_upload.rb
|
302
306
|
- test/unit/test_util.rb
|
307
|
+
- test/unit/test_waiter.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
|