unicorn 4.9.0 → 6.0.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 (95) hide show
  1. checksums.yaml +5 -5
  2. data/.gitattributes +5 -0
  3. data/.olddoc.yml +13 -6
  4. data/Application_Timeouts +7 -7
  5. data/DESIGN +2 -4
  6. data/Documentation/.gitignore +1 -3
  7. data/Documentation/unicorn.1 +222 -0
  8. data/Documentation/unicorn_rails.1 +207 -0
  9. data/FAQ +17 -8
  10. data/GIT-VERSION-GEN +1 -1
  11. data/GNUmakefile +121 -56
  12. data/HACKING +1 -2
  13. data/ISSUES +40 -41
  14. data/KNOWN_ISSUES +11 -11
  15. data/LICENSE +2 -2
  16. data/Links +24 -25
  17. data/PHILOSOPHY +0 -6
  18. data/README +46 -39
  19. data/SIGNALS +2 -2
  20. data/Sandbox +10 -9
  21. data/TODO +0 -2
  22. data/TUNING +30 -9
  23. data/archive/slrnpull.conf +1 -1
  24. data/bin/unicorn +4 -2
  25. data/bin/unicorn_rails +3 -3
  26. data/examples/big_app_gc.rb +1 -1
  27. data/examples/init.sh +36 -8
  28. data/examples/logrotate.conf +17 -2
  29. data/examples/nginx.conf +14 -14
  30. data/examples/unicorn.conf.minimal.rb +2 -2
  31. data/examples/unicorn.conf.rb +3 -6
  32. data/examples/unicorn.socket +11 -0
  33. data/examples/unicorn@.service +40 -0
  34. data/ext/unicorn_http/common_field_optimization.h +23 -5
  35. data/ext/unicorn_http/ext_help.h +0 -20
  36. data/ext/unicorn_http/extconf.rb +37 -1
  37. data/ext/unicorn_http/global_variables.h +1 -1
  38. data/ext/unicorn_http/httpdate.c +2 -2
  39. data/ext/unicorn_http/unicorn_http.rl +167 -170
  40. data/ext/unicorn_http/unicorn_http_common.rl +1 -1
  41. data/lib/unicorn.rb +66 -46
  42. data/lib/unicorn/configurator.rb +110 -44
  43. data/lib/unicorn/const.rb +2 -25
  44. data/lib/unicorn/http_request.rb +110 -31
  45. data/lib/unicorn/http_response.rb +17 -31
  46. data/lib/unicorn/http_server.rb +238 -157
  47. data/lib/unicorn/launcher.rb +1 -1
  48. data/lib/unicorn/oob_gc.rb +6 -6
  49. data/lib/unicorn/socket_helper.rb +58 -78
  50. data/lib/unicorn/stream_input.rb +8 -7
  51. data/lib/unicorn/tee_input.rb +8 -10
  52. data/lib/unicorn/tmpio.rb +8 -7
  53. data/lib/unicorn/util.rb +5 -4
  54. data/lib/unicorn/worker.rb +36 -23
  55. data/t/GNUmakefile +3 -72
  56. data/t/README +4 -4
  57. data/t/t0011-active-unix-socket.sh +1 -1
  58. data/t/t0012-reload-empty-config.sh +2 -1
  59. data/t/t0301-no-default-middleware-ignored-in-config.sh +25 -0
  60. data/t/t0301.ru +13 -0
  61. data/t/test-lib.sh +2 -2
  62. data/test/benchmark/README +14 -4
  63. data/test/benchmark/ddstream.ru +50 -0
  64. data/test/benchmark/readinput.ru +40 -0
  65. data/test/benchmark/uconnect.perl +66 -0
  66. data/test/exec/test_exec.rb +73 -19
  67. data/test/test_helper.rb +40 -31
  68. data/test/unit/test_ccc.rb +91 -0
  69. data/test/unit/test_droplet.rb +1 -1
  70. data/test/unit/test_http_parser.rb +46 -16
  71. data/test/unit/test_http_parser_ng.rb +97 -114
  72. data/test/unit/test_request.rb +10 -10
  73. data/test/unit/test_response.rb +28 -16
  74. data/test/unit/test_server.rb +86 -12
  75. data/test/unit/test_signals.rb +8 -8
  76. data/test/unit/test_socket_helper.rb +14 -10
  77. data/test/unit/test_upload.rb +9 -14
  78. data/test/unit/test_util.rb +27 -2
  79. data/unicorn.gemspec +27 -19
  80. metadata +24 -45
  81. data/Documentation/GNUmakefile +0 -30
  82. data/Documentation/unicorn.1.txt +0 -185
  83. data/Documentation/unicorn_rails.1.txt +0 -175
  84. data/examples/git.ru +0 -13
  85. data/lib/unicorn/app/exec_cgi.rb +0 -154
  86. data/lib/unicorn/app/inetd.rb +0 -109
  87. data/lib/unicorn/ssl_client.rb +0 -11
  88. data/lib/unicorn/ssl_configurator.rb +0 -104
  89. data/lib/unicorn/ssl_server.rb +0 -42
  90. data/t/hijack.ru +0 -42
  91. data/t/t0016-trust-x-forwarded-false.sh +0 -30
  92. data/t/t0017-trust-x-forwarded-true.sh +0 -30
  93. data/t/t0200-rack-hijack.sh +0 -27
  94. data/test/unit/test_http_parser_xftrust.rb +0 -38
  95. data/test/unit/test_sni_hostnames.rb +0 -47
@@ -60,7 +60,7 @@ def teardown
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 @@ def test_put
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 @@ def test_put_trickle_small
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 @@ def test_put_trickle_small
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 @@ def test_put_excessive_overwrite_closed
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 @@ def test_chunked_upload_via_curl
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
@@ -69,7 +69,7 @@ def test_reopen_logs_renamed_with_encoding
69
69
  }
70
70
  }
71
71
  tmp.close!
72
- end if STDIN.respond_to?(:external_encoding)
72
+ end
73
73
 
74
74
  def test_reopen_logs_renamed_with_internal_encoding
75
75
  tmp = Tempfile.new('')
@@ -101,5 +101,30 @@ def test_reopen_logs_renamed_with_internal_encoding
101
101
  }
102
102
  }
103
103
  tmp.close!
104
- end if STDIN.respond_to?(:external_encoding)
104
+ end
105
+
106
+ def test_pipe
107
+ r, w = Unicorn.pipe
108
+ assert r
109
+ assert w
110
+
111
+ return if RUBY_PLATFORM !~ /linux/
112
+
113
+ begin
114
+ f_getpipe_sz = 1032
115
+ IO.pipe do |a, b|
116
+ a_sz = a.fcntl(f_getpipe_sz)
117
+ b.fcntl(f_getpipe_sz)
118
+ assert_kind_of Integer, a_sz
119
+ r_sz = r.fcntl(f_getpipe_sz)
120
+ assert_equal Raindrops::PAGE_SIZE, r_sz
121
+ assert_operator a_sz, :>=, r_sz
122
+ end
123
+ rescue Errno::EINVAL
124
+ # Linux <= 2.6.34
125
+ end
126
+ ensure
127
+ w.close
128
+ r.close
129
+ end
105
130
  end
data/unicorn.gemspec CHANGED
@@ -1,9 +1,6 @@
1
1
  # -*- encoding: binary -*-
2
- ENV["VERSION"] or abort "VERSION= must be specified"
3
- manifest = File.readlines('.manifest').map! { |x| x.chomp! }
4
- require 'olddoc'
5
- extend Olddoc::Gemspec
6
- name, summary, title = readme_metadata
2
+ manifest = File.exist?('.manifest') ?
3
+ IO.readlines('.manifest').map!(&:chomp!) : `git ls-files`.split("\n")
7
4
 
8
5
  # don't bother with tests that fork, not worth our time to get working
9
6
  # with `gem check -t` ... (of course we care for them when testing with
@@ -14,28 +11,39 @@
14
11
 
15
12
  Gem::Specification.new do |s|
16
13
  s.name = %q{unicorn}
17
- s.version = ENV["VERSION"].dup
18
- s.authors = ["#{name} hackers"]
19
- s.summary = summary
20
- s.description = readme_description
21
- s.email = %q{unicorn-public@bogomips.org}
14
+ s.version = (ENV['VERSION'] || '6.0.0').dup
15
+ s.authors = ['unicorn hackers']
16
+ s.summary = 'Rack HTTP server for fast clients and Unix'
17
+ s.description = File.read('README').split("\n\n")[1]
18
+ s.email = %q{unicorn-public@yhbt.net}
22
19
  s.executables = %w(unicorn unicorn_rails)
23
20
  s.extensions = %w(ext/unicorn_http/extconf.rb)
24
- s.extra_rdoc_files = extra_rdoc_files(manifest)
21
+ s.extra_rdoc_files = IO.readlines('.document').map!(&:chomp!).keep_if do |f|
22
+ File.exist?(f)
23
+ end
25
24
  s.files = manifest
26
- s.homepage = Olddoc.config['rdoc_url']
25
+ s.homepage = 'https://yhbt.net/unicorn/'
27
26
  s.test_files = test_files
28
27
 
29
- # for people that are absolutely stuck on Rails 2.3.2 and can't
30
- # up/downgrade to any other version, the Rack dependency may be
31
- # commented out. Nevertheless, upgrading to Rails 2.3.4 or later is
32
- # *strongly* recommended for security reasons.
33
- s.add_dependency(%q<rack>)
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"
33
+
34
+ # We do not have a hard dependency on rack, it's possible to load
35
+ # things which respond to #call. HTTP status lines in responses
36
+ # won't have descriptive text, only the numeric status.
37
+ s.add_development_dependency(%q<rack>)
38
+
34
39
  s.add_dependency(%q<kgio>, '~> 2.6')
35
40
  s.add_dependency(%q<raindrops>, '~> 0.7')
36
41
 
37
42
  s.add_development_dependency('test-unit', '~> 3.0')
38
- s.add_development_dependency('olddoc', '~> 1.0')
39
43
 
40
- s.licenses = ["GPLv2+", "Ruby 1.8"]
44
+ # Note: To avoid ambiguity, we intentionally avoid the SPDX-compatible
45
+ # 'Ruby' here since Ruby 1.9.3 switched to BSD-2-Clause, but we
46
+ # inherited our license from Mongrel when Ruby was at 1.8.
47
+ # We cannot automatically switch licenses when Ruby changes.
48
+ s.licenses = ['GPL-2.0+', 'Ruby-1.8']
41
49
  end
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.9.0
4
+ version: 6.0.0
5
5
  platform: ruby
6
6
  authors:
7
- - Unicorn hackers
7
+ - unicorn hackers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-24 00:00:00.000000000 Z
11
+ date: 2021-03-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -17,7 +17,7 @@ dependencies:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
- type: :runtime
20
+ type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
@@ -66,27 +66,13 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '3.0'
69
- - !ruby/object:Gem::Dependency
70
- name: olddoc
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: '1.0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: '1.0'
83
69
  description: |-
84
- \Unicorn is an HTTP server for Rack applications designed to only serve
70
+ unicorn is an HTTP server for Rack applications designed to only serve
85
71
  fast clients on low-latency, high-bandwidth connections and take
86
72
  advantage of features in Unix/Unix-like kernels. Slow clients should
87
73
  only be served by placing a reverse proxy capable of fully buffering
88
- both the the request and response in between \Unicorn and slow clients.
89
- email: unicorn-public@bogomips.org
74
+ both the the request and response in between unicorn and slow clients.
75
+ email: unicorn-public@yhbt.net
90
76
  executables:
91
77
  - unicorn
92
78
  - unicorn_rails
@@ -124,6 +110,7 @@ extra_rdoc_files:
124
110
  files:
125
111
  - ".CHANGELOG.old"
126
112
  - ".document"
113
+ - ".gitattributes"
127
114
  - ".gitignore"
128
115
  - ".mailmap"
129
116
  - ".manifest"
@@ -133,9 +120,8 @@ files:
133
120
  - COPYING
134
121
  - DESIGN
135
122
  - Documentation/.gitignore
136
- - Documentation/GNUmakefile
137
- - Documentation/unicorn.1.txt
138
- - Documentation/unicorn_rails.1.txt
123
+ - Documentation/unicorn.1
124
+ - Documentation/unicorn_rails.1
139
125
  - FAQ
140
126
  - GIT-VERSION-FILE
141
127
  - GIT-VERSION-GEN
@@ -160,13 +146,14 @@ files:
160
146
  - bin/unicorn_rails
161
147
  - examples/big_app_gc.rb
162
148
  - examples/echo.ru
163
- - examples/git.ru
164
149
  - examples/init.sh
165
150
  - examples/logger_mp_safe.rb
166
151
  - examples/logrotate.conf
167
152
  - examples/nginx.conf
168
153
  - examples/unicorn.conf.minimal.rb
169
154
  - examples/unicorn.conf.rb
155
+ - examples/unicorn.socket
156
+ - examples/unicorn@.service
170
157
  - ext/unicorn_http/CFLAGS
171
158
  - ext/unicorn_http/c_util.h
172
159
  - ext/unicorn_http/common_field_optimization.h
@@ -178,8 +165,6 @@ files:
178
165
  - ext/unicorn_http/unicorn_http.rl
179
166
  - ext/unicorn_http/unicorn_http_common.rl
180
167
  - lib/unicorn.rb
181
- - lib/unicorn/app/exec_cgi.rb
182
- - lib/unicorn/app/inetd.rb
183
168
  - lib/unicorn/app/old_rails.rb
184
169
  - lib/unicorn/app/old_rails/static.rb
185
170
  - lib/unicorn/cgi_wrapper.rb
@@ -192,9 +177,6 @@ files:
192
177
  - lib/unicorn/oob_gc.rb
193
178
  - lib/unicorn/preread_input.rb
194
179
  - lib/unicorn/socket_helper.rb
195
- - lib/unicorn/ssl_client.rb
196
- - lib/unicorn/ssl_configurator.rb
197
- - lib/unicorn/ssl_server.rb
198
180
  - lib/unicorn/stream_input.rb
199
181
  - lib/unicorn/tee_input.rb
200
182
  - lib/unicorn/tmpio.rb
@@ -215,7 +197,6 @@ files:
215
197
  - t/env.ru
216
198
  - t/fails-rack-lint.ru
217
199
  - t/heartbeat-timeout.ru
218
- - t/hijack.ru
219
200
  - t/listener_names.ru
220
201
  - t/my-tap-lib.sh
221
202
  - t/oob_gc.ru
@@ -245,8 +226,6 @@ files:
245
226
  - t/t0014-rewindable-input-true.sh
246
227
  - t/t0014.ru
247
228
  - t/t0015-configurator-internals.sh
248
- - t/t0016-trust-x-forwarded-false.sh
249
- - t/t0017-trust-x-forwarded-true.sh
250
229
  - t/t0018-write-on-close.sh
251
230
  - t/t0019-max_header_len.sh
252
231
  - t/t0020-at_exit-handler.sh
@@ -255,8 +234,9 @@ files:
255
234
  - t/t0100-rack-input-tests.sh
256
235
  - t/t0116-client_body_buffer_size.sh
257
236
  - t/t0116.ru
258
- - t/t0200-rack-hijack.sh
259
237
  - t/t0300-no-default-middleware.sh
238
+ - t/t0301-no-default-middleware-ignored-in-config.sh
239
+ - t/t0301.ru
260
240
  - t/t9000-preread-input.sh
261
241
  - t/t9001-oob_gc.sh
262
242
  - t/t9002-oob_gc-path.sh
@@ -265,20 +245,22 @@ files:
265
245
  - test/aggregate.rb
266
246
  - test/benchmark/README
267
247
  - test/benchmark/dd.ru
248
+ - test/benchmark/ddstream.ru
249
+ - test/benchmark/readinput.ru
268
250
  - test/benchmark/stack.ru
251
+ - test/benchmark/uconnect.perl
269
252
  - test/exec/README
270
253
  - test/exec/test_exec.rb
271
254
  - test/test_helper.rb
255
+ - test/unit/test_ccc.rb
272
256
  - test/unit/test_configurator.rb
273
257
  - test/unit/test_droplet.rb
274
258
  - test/unit/test_http_parser.rb
275
259
  - test/unit/test_http_parser_ng.rb
276
- - test/unit/test_http_parser_xftrust.rb
277
260
  - test/unit/test_request.rb
278
261
  - test/unit/test_response.rb
279
262
  - test/unit/test_server.rb
280
263
  - test/unit/test_signals.rb
281
- - test/unit/test_sni_hostnames.rb
282
264
  - test/unit/test_socket_helper.rb
283
265
  - test/unit/test_stream_input.rb
284
266
  - test/unit/test_tee_input.rb
@@ -287,10 +269,10 @@ files:
287
269
  - unicorn.gemspec
288
270
  - unicorn_1
289
271
  - unicorn_rails_1
290
- homepage: http://unicorn.bogomips.org/
272
+ homepage: https://yhbt.net/unicorn/
291
273
  licenses:
292
- - GPLv2+
293
- - Ruby 1.8
274
+ - GPL-2.0+
275
+ - Ruby-1.8
294
276
  metadata: {}
295
277
  post_install_message:
296
278
  rdoc_options: []
@@ -300,15 +282,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
300
282
  requirements:
301
283
  - - ">="
302
284
  - !ruby/object:Gem::Version
303
- version: '0'
285
+ version: 1.9.3
304
286
  required_rubygems_version: !ruby/object:Gem::Requirement
305
287
  requirements:
306
288
  - - ">="
307
289
  - !ruby/object:Gem::Version
308
290
  version: '0'
309
291
  requirements: []
310
- rubyforge_project:
311
- rubygems_version: 2.4.5
292
+ rubygems_version: 3.0.2
312
293
  signing_key:
313
294
  specification_version: 4
314
295
  summary: Rack HTTP server for fast clients and Unix
@@ -316,9 +297,7 @@ test_files:
316
297
  - test/unit/test_configurator.rb
317
298
  - test/unit/test_http_parser.rb
318
299
  - test/unit/test_http_parser_ng.rb
319
- - test/unit/test_http_parser_xftrust.rb
320
300
  - test/unit/test_request.rb
321
- - test/unit/test_response.rb
322
301
  - test/unit/test_server.rb
323
- - test/unit/test_sni_hostnames.rb
302
+ - test/unit/test_upload.rb
324
303
  - test/unit/test_util.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,185 +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). The unicorn CONFIG_FILE must still
170
- have the inherited listen socket parameters defined as in a normal
171
- startup, otherwise the socket will be closed.
172
-
173
- # SEE ALSO
174
-
175
- * unicorn_rails(1)
176
- * *Rack::Builder* ri/RDoc
177
- * *Unicorn::Configurator* ri/RDoc
178
- * [Unicorn RDoc][1]
179
- * [Rack RDoc][2]
180
- * [Rackup HowTo][3]
181
-
182
- [1]: http://unicorn.bogomips.org/
183
- [2]: http://rdoc.info/gems/r#/gems/rack/frames
184
- [3]: http://wiki.github.com/rack/rack/tutorial-rackup-howto
185
- [4]: http://unicorn.bogomips.org/SIGNALS.html