unicorn 5.3.1 → 6.1.0

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.
Files changed (84) hide show
  1. checksums.yaml +5 -5
  2. data/.manifest +10 -5
  3. data/.olddoc.yml +15 -7
  4. data/Application_Timeouts +4 -4
  5. data/CONTRIBUTORS +6 -2
  6. data/Documentation/.gitignore +1 -3
  7. data/Documentation/unicorn.1 +222 -0
  8. data/Documentation/unicorn_rails.1 +207 -0
  9. data/FAQ +1 -1
  10. data/GIT-VERSION-FILE +1 -1
  11. data/GIT-VERSION-GEN +1 -1
  12. data/GNUmakefile +117 -57
  13. data/HACKING +2 -9
  14. data/ISSUES +33 -32
  15. data/KNOWN_ISSUES +2 -2
  16. data/LATEST +16 -95
  17. data/LICENSE +2 -2
  18. data/Links +13 -11
  19. data/NEWS +239 -0
  20. data/README +27 -14
  21. data/SIGNALS +1 -1
  22. data/Sandbox +5 -5
  23. data/archive/slrnpull.conf +1 -1
  24. data/bin/unicorn +3 -1
  25. data/bin/unicorn_rails +2 -2
  26. data/examples/big_app_gc.rb +1 -1
  27. data/examples/logrotate.conf +3 -3
  28. data/examples/nginx.conf +4 -3
  29. data/examples/unicorn.conf.minimal.rb +2 -2
  30. data/examples/unicorn.conf.rb +2 -2
  31. data/examples/unicorn@.service +7 -0
  32. data/ext/unicorn_http/c_util.h +5 -13
  33. data/ext/unicorn_http/common_field_optimization.h +23 -6
  34. data/ext/unicorn_http/epollexclusive.h +124 -0
  35. data/ext/unicorn_http/ext_help.h +0 -24
  36. data/ext/unicorn_http/extconf.rb +32 -6
  37. data/ext/unicorn_http/global_variables.h +3 -3
  38. data/ext/unicorn_http/httpdate.c +3 -2
  39. data/ext/unicorn_http/unicorn_http.c +277 -237
  40. data/ext/unicorn_http/unicorn_http.rl +67 -27
  41. data/lib/unicorn/configurator.rb +26 -5
  42. data/lib/unicorn/http_request.rb +13 -3
  43. data/lib/unicorn/http_response.rb +3 -2
  44. data/lib/unicorn/http_server.rb +76 -51
  45. data/lib/unicorn/launcher.rb +1 -1
  46. data/lib/unicorn/oob_gc.rb +5 -5
  47. data/lib/unicorn/select_waiter.rb +6 -0
  48. data/lib/unicorn/socket_helper.rb +4 -3
  49. data/lib/unicorn/tmpio.rb +8 -2
  50. data/lib/unicorn/util.rb +3 -3
  51. data/lib/unicorn/version.rb +1 -1
  52. data/lib/unicorn/worker.rb +16 -2
  53. data/lib/unicorn.rb +25 -10
  54. data/man/man1/unicorn.1 +88 -85
  55. data/man/man1/unicorn_rails.1 +79 -81
  56. data/t/GNUmakefile +3 -72
  57. data/t/README +4 -4
  58. data/t/t0301-no-default-middleware-ignored-in-config.sh +25 -0
  59. data/t/t0301.ru +13 -0
  60. data/t/test-lib.sh +2 -1
  61. data/test/benchmark/README +14 -4
  62. data/test/benchmark/ddstream.ru +50 -0
  63. data/test/benchmark/readinput.ru +40 -0
  64. data/test/benchmark/uconnect.perl +66 -0
  65. data/test/exec/test_exec.rb +20 -19
  66. data/test/test_helper.rb +38 -30
  67. data/test/unit/test_ccc.rb +5 -4
  68. data/test/unit/test_droplet.rb +1 -1
  69. data/test/unit/test_http_parser.rb +16 -0
  70. data/test/unit/test_http_parser_ng.rb +81 -0
  71. data/test/unit/test_request.rb +10 -10
  72. data/test/unit/test_server.rb +86 -12
  73. data/test/unit/test_signals.rb +8 -8
  74. data/test/unit/test_socket_helper.rb +5 -5
  75. data/test/unit/test_upload.rb +9 -14
  76. data/test/unit/test_util.rb +29 -3
  77. data/test/unit/test_waiter.rb +34 -0
  78. data/unicorn.gemspec +8 -7
  79. metadata +19 -13
  80. data/Documentation/GNUmakefile +0 -30
  81. data/Documentation/unicorn.1.txt +0 -187
  82. data/Documentation/unicorn_rails.1.txt +0 -175
  83. data/t/hijack.ru +0 -43
  84. data/t/t0200-rack-hijack.sh +0 -30
@@ -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 = TCPSocket.new('127.0.0.1', @port)
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 = TCPSocket.new('127.0.0.1', @port)
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 = TCPSocket.new('127.0.0.1', @port)
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
@@ -114,8 +114,8 @@ class SignalsTest < Test::Unit::TestCase
114
114
  assert_nil buf
115
115
  assert diff > 1.0, "diff was #{diff.inspect}"
116
116
  assert diff < 60.0
117
- ensure
118
- Process.kill(:TERM, pid) rescue nil
117
+ ensure
118
+ Process.kill(:TERM, pid) rescue nil
119
119
  end
120
120
 
121
121
  def test_response_write
@@ -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 = TCPSocket.new('127.0.0.1', @port)
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 = TCPSocket.new('127.0.0.1', @port)
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 = TCPSocket.new('127.0.0.1', @port)
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) }
@@ -57,8 +57,8 @@ class TestSocketHelper < Test::Unit::TestCase
57
57
  assert File.readable?(@unix_listener_path), "not readable"
58
58
  assert File.writable?(@unix_listener_path), "not writable"
59
59
  assert_equal 0777, File.umask
60
- ensure
61
- File.umask(old_umask)
60
+ ensure
61
+ File.umask(old_umask)
62
62
  end
63
63
 
64
64
  def test_bind_listen_unix_umask
@@ -71,8 +71,8 @@ class TestSocketHelper < Test::Unit::TestCase
71
71
  assert_equal @unix_listener_path, sock_name(@unix_listener)
72
72
  assert_equal 0140700, File.stat(@unix_listener_path).mode
73
73
  assert_equal 0777, File.umask
74
- ensure
75
- File.umask(old_umask)
74
+ ensure
75
+ File.umask(old_umask)
76
76
  end
77
77
 
78
78
  def test_bind_listen_unix_idempotent
@@ -116,7 +116,7 @@ class TestSocketHelper < Test::Unit::TestCase
116
116
  client.syswrite('abcde')
117
117
  exit 0
118
118
  end
119
- s = UNIXSocket.new(@unix_listener_path)
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)
@@ -60,7 +60,7 @@ class UploadTest < Test::Unit::TestCase
60
60
 
61
61
  def test_put
62
62
  start_server(@sha1_app)
63
- sock = TCPSocket.new(@addr, @port)
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 = TCPSocket.new(@addr, @port)
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 = TCPSocket.new(@addr, @port)
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 = TCPSocket.new(@addr, @port)
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 = TCPSocket.new(@addr, @port)
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
- wr.sync = rd.sync = true
241
- pid = fork {
242
- STDIN.reopen(rd)
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
@@ -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.each { |ext|
78
- Encoding.list.each { |int|
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
@@ -102,4 +103,29 @@ class TestUtil < Test::Unit::TestCase
102
103
  }
103
104
  tmp.close!
104
105
  end
106
+
107
+ def test_pipe
108
+ r, w = Unicorn.pipe
109
+ assert r
110
+ assert w
111
+
112
+ return if RUBY_PLATFORM !~ /linux/
113
+
114
+ begin
115
+ f_getpipe_sz = 1032
116
+ IO.pipe do |a, b|
117
+ a_sz = a.fcntl(f_getpipe_sz)
118
+ b.fcntl(f_getpipe_sz)
119
+ assert_kind_of Integer, a_sz
120
+ r_sz = r.fcntl(f_getpipe_sz)
121
+ assert_equal Raindrops::PAGE_SIZE, r_sz
122
+ assert_operator a_sz, :>=, r_sz
123
+ end
124
+ rescue Errno::EINVAL
125
+ # Linux <= 2.6.34
126
+ end
127
+ ensure
128
+ w.close
129
+ r.close
130
+ end
105
131
  end
@@ -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'] || '5.3.1').dup
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@bogomips.org}
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://bogomips.org/unicorn/'
25
+ s.homepage = 'https://yhbt.net/unicorn/'
26
26
  s.test_files = test_files
27
27
 
28
- # technically we need ">= 1.9.3", too, but avoid the array here since
29
- # old rubygems versions (1.8.23.2 at least) do not support multiple
30
- # version requirements here.
31
- s.required_ruby_version = '< 3.0'
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: 5.3.1
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: 2017-10-03 00:00:00.000000000 Z
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@bogomips.org
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/GNUmakefile
124
- - Documentation/unicorn.1.txt
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,8 +236,9 @@ 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
240
+ - t/t0301-no-default-middleware-ignored-in-config.sh
241
+ - t/t0301.ru
241
242
  - t/t9000-preread-input.sh
242
243
  - t/t9001-oob_gc.sh
243
244
  - t/t9002-oob_gc-path.sh
@@ -246,7 +247,10 @@ files:
246
247
  - test/aggregate.rb
247
248
  - test/benchmark/README
248
249
  - test/benchmark/dd.ru
250
+ - test/benchmark/ddstream.ru
251
+ - test/benchmark/readinput.ru
249
252
  - test/benchmark/stack.ru
253
+ - test/benchmark/uconnect.perl
250
254
  - test/exec/README
251
255
  - test/exec/test_exec.rb
252
256
  - test/test_helper.rb
@@ -264,10 +268,11 @@ files:
264
268
  - test/unit/test_tee_input.rb
265
269
  - test/unit/test_upload.rb
266
270
  - test/unit/test_util.rb
271
+ - test/unit/test_waiter.rb
267
272
  - unicorn.gemspec
268
273
  - unicorn_1
269
274
  - unicorn_rails_1
270
- homepage: https://bogomips.org/unicorn/
275
+ homepage: https://yhbt.net/unicorn/
271
276
  licenses:
272
277
  - GPL-2.0+
273
278
  - Ruby-1.8
@@ -278,17 +283,16 @@ require_paths:
278
283
  - lib
279
284
  required_ruby_version: !ruby/object:Gem::Requirement
280
285
  requirements:
281
- - - "<"
286
+ - - ">="
282
287
  - !ruby/object:Gem::Version
283
- version: '3.0'
288
+ version: 2.0.0
284
289
  required_rubygems_version: !ruby/object:Gem::Requirement
285
290
  requirements:
286
291
  - - ">="
287
292
  - !ruby/object:Gem::Version
288
293
  version: '0'
289
294
  requirements: []
290
- rubyforge_project:
291
- rubygems_version: 2.6.13
295
+ rubygems_version: 3.0.2
292
296
  signing_key:
293
297
  specification_version: 4
294
298
  summary: Rack HTTP server for fast clients and Unix
@@ -298,4 +302,6 @@ test_files:
298
302
  - test/unit/test_http_parser_ng.rb
299
303
  - test/unit/test_request.rb
300
304
  - test/unit/test_server.rb
305
+ - test/unit/test_upload.rb
301
306
  - test/unit/test_util.rb
307
+ - test/unit/test_waiter.rb
@@ -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)
@@ -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]: http://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