unicorn 5.0.1 → 6.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. checksums.yaml +5 -5
  2. data/.manifest +11 -5
  3. data/.olddoc.yml +16 -6
  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 +118 -58
  13. data/HACKING +2 -10
  14. data/ISSUES +40 -35
  15. data/KNOWN_ISSUES +2 -2
  16. data/LATEST +23 -28
  17. data/LICENSE +2 -2
  18. data/Links +13 -11
  19. data/NEWS +612 -0
  20. data/README +30 -29
  21. data/SIGNALS +1 -1
  22. data/Sandbox +8 -7
  23. data/TODO +0 -2
  24. data/TUNING +19 -1
  25. data/archive/slrnpull.conf +1 -1
  26. data/bin/unicorn +3 -1
  27. data/bin/unicorn_rails +2 -2
  28. data/examples/big_app_gc.rb +1 -1
  29. data/examples/init.sh +36 -8
  30. data/examples/logrotate.conf +17 -2
  31. data/examples/nginx.conf +4 -3
  32. data/examples/unicorn.conf.minimal.rb +2 -2
  33. data/examples/unicorn.conf.rb +2 -2
  34. data/examples/unicorn@.service +14 -0
  35. data/ext/unicorn_http/c_util.h +5 -13
  36. data/ext/unicorn_http/common_field_optimization.h +22 -5
  37. data/ext/unicorn_http/epollexclusive.h +124 -0
  38. data/ext/unicorn_http/ext_help.h +0 -44
  39. data/ext/unicorn_http/extconf.rb +32 -6
  40. data/ext/unicorn_http/global_variables.h +2 -2
  41. data/ext/unicorn_http/httpdate.c +2 -1
  42. data/ext/unicorn_http/unicorn_http.c +853 -498
  43. data/ext/unicorn_http/unicorn_http.rl +86 -30
  44. data/ext/unicorn_http/unicorn_http_common.rl +1 -1
  45. data/lib/unicorn/configurator.rb +93 -13
  46. data/lib/unicorn/http_request.rb +101 -11
  47. data/lib/unicorn/http_response.rb +8 -4
  48. data/lib/unicorn/http_server.rb +141 -72
  49. data/lib/unicorn/launcher.rb +1 -1
  50. data/lib/unicorn/oob_gc.rb +6 -6
  51. data/lib/unicorn/select_waiter.rb +6 -0
  52. data/lib/unicorn/socket_helper.rb +23 -7
  53. data/lib/unicorn/stream_input.rb +5 -4
  54. data/lib/unicorn/tee_input.rb +8 -10
  55. data/lib/unicorn/tmpio.rb +8 -2
  56. data/lib/unicorn/util.rb +3 -3
  57. data/lib/unicorn/version.rb +1 -1
  58. data/lib/unicorn/worker.rb +33 -8
  59. data/lib/unicorn.rb +55 -29
  60. data/man/man1/unicorn.1 +120 -118
  61. data/man/man1/unicorn_rails.1 +106 -107
  62. data/t/GNUmakefile +3 -72
  63. data/t/README +4 -4
  64. data/t/t0011-active-unix-socket.sh +1 -1
  65. data/t/t0012-reload-empty-config.sh +2 -1
  66. data/t/t0301-no-default-middleware-ignored-in-config.sh +25 -0
  67. data/t/t0301.ru +13 -0
  68. data/t/test-lib.sh +4 -3
  69. data/test/benchmark/README +14 -4
  70. data/test/benchmark/ddstream.ru +50 -0
  71. data/test/benchmark/readinput.ru +40 -0
  72. data/test/benchmark/uconnect.perl +66 -0
  73. data/test/exec/test_exec.rb +26 -24
  74. data/test/test_helper.rb +38 -30
  75. data/test/unit/test_ccc.rb +91 -0
  76. data/test/unit/test_droplet.rb +1 -1
  77. data/test/unit/test_http_parser.rb +46 -16
  78. data/test/unit/test_http_parser_ng.rb +81 -0
  79. data/test/unit/test_request.rb +10 -10
  80. data/test/unit/test_server.rb +86 -12
  81. data/test/unit/test_signals.rb +8 -8
  82. data/test/unit/test_socket_helper.rb +13 -9
  83. data/test/unit/test_upload.rb +9 -14
  84. data/test/unit/test_util.rb +31 -5
  85. data/test/unit/test_waiter.rb +34 -0
  86. data/unicorn.gemspec +21 -22
  87. metadata +21 -28
  88. data/Documentation/GNUmakefile +0 -30
  89. data/Documentation/unicorn.1.txt +0 -188
  90. data/Documentation/unicorn_rails.1.txt +0 -175
  91. data/t/hijack.ru +0 -43
  92. data/t/t0200-rack-hijack.sh +0 -30
@@ -12,18 +12,19 @@ class Unicorn::Worker
12
12
  # :stopdoc:
13
13
  attr_accessor :nr, :switched
14
14
  attr_reader :to_io # IO.select-compatible
15
+ attr_reader :master
15
16
 
16
17
  PER_DROP = Raindrops::PAGE_SIZE / Raindrops::SIZE
17
18
  DROPS = []
18
19
 
19
- def initialize(nr)
20
+ def initialize(nr, pipe=nil)
20
21
  drop_index = nr / PER_DROP
21
22
  @raindrop = DROPS[drop_index] ||= Raindrops.new(PER_DROP)
22
23
  @offset = nr % PER_DROP
23
24
  @raindrop[@offset] = 0
24
25
  @nr = nr
25
26
  @switched = false
26
- @to_io, @master = Unicorn.pipe
27
+ @to_io, @master = pipe || Unicorn.pipe
27
28
  end
28
29
 
29
30
  def atfork_child # :nodoc:
@@ -111,29 +112,53 @@ class Unicorn::Worker
111
112
  # In most cases, you should be using the Unicorn::Configurator#user
112
113
  # directive instead. This method should only be used if you need
113
114
  # fine-grained control of exactly when you want to change permissions
114
- # in your after_fork hooks.
115
+ # in your after_fork or after_worker_ready hooks, or if you want to
116
+ # use the chroot support.
115
117
  #
116
- # Changes the worker process to the specified +user+ and +group+
118
+ # Changes the worker process to the specified +user+ and +group+,
119
+ # and chroots to the current working directory if +chroot+ is set.
117
120
  # This is only intended to be called from within the worker
118
121
  # process from the +after_fork+ hook. This should be called in
119
122
  # the +after_fork+ hook after any privileged functions need to be
120
123
  # run (e.g. to set per-worker CPU affinity, niceness, etc)
121
124
  #
125
+ # +group+ can be specified as a string, or as an array of two
126
+ # strings. If an array of two strings is given, the first string
127
+ # is used as the primary group of the process, and the second is
128
+ # used as the group of the log files.
129
+ #
122
130
  # Any and all errors raised within this method will be propagated
123
131
  # directly back to the caller (usually the +after_fork+ hook.
124
132
  # These errors commonly include ArgumentError for specifying an
125
- # invalid user/group and Errno::EPERM for insufficient privileges
126
- def user(user, group = nil)
133
+ # invalid user/group and Errno::EPERM for insufficient privileges.
134
+ #
135
+ # chroot support is only available in unicorn 5.3.0+
136
+ # user and group switching appeared in unicorn 0.94.0 (2009-11-05)
137
+ def user(user, group = nil, chroot = false)
127
138
  # we do not protect the caller, checking Process.euid == 0 is
128
139
  # insufficient because modern systems have fine-grained
129
140
  # capabilities. Let the caller handle any and all errors.
130
141
  uid = Etc.getpwnam(user).uid
131
- gid = Etc.getgrnam(group).gid if group
132
- Unicorn::Util.chown_logs(uid, gid)
142
+
143
+ if group
144
+ if group.is_a?(Array)
145
+ group, log_group = group
146
+ log_gid = Etc.getgrnam(log_group).gid
147
+ end
148
+ gid = Etc.getgrnam(group).gid
149
+ log_gid ||= gid
150
+ end
151
+
152
+ Unicorn::Util.chown_logs(uid, log_gid)
133
153
  if gid && Process.egid != gid
134
154
  Process.initgroups(user, gid)
135
155
  Process::GID.change_privilege(gid)
136
156
  end
157
+ if chroot
158
+ chroot = Dir.pwd if chroot == true
159
+ Dir.chroot(chroot)
160
+ Dir.chdir('/')
161
+ end
137
162
  Process.euid != uid and Process::UID.change_privilege(uid)
138
163
  @switched = true
139
164
  end
data/lib/unicorn.rb CHANGED
@@ -1,8 +1,15 @@
1
1
  # -*- encoding: binary -*-
2
2
  require 'etc'
3
3
  require 'stringio'
4
- require 'rack'
5
4
  require 'kgio'
5
+ require 'raindrops'
6
+ require 'io/wait'
7
+
8
+ begin
9
+ require 'rack'
10
+ rescue LoadError
11
+ warn 'rack not available, functionality reduced'
12
+ end
6
13
 
7
14
  # :stopdoc:
8
15
  # Unicorn module containing all of the classes (include C extensions) for
@@ -20,7 +27,9 @@ module Unicorn
20
27
  # application dispatch. This is always raised with an empty backtrace
21
28
  # since there is nothing in the application stack that is responsible
22
29
  # for client shutdowns/disconnects. This exception is visible to Rack
23
- # applications unless PrereadInput middleware is loaded.
30
+ # applications unless PrereadInput middleware is loaded. This
31
+ # is a subclass of the standard EOFError class and applications should
32
+ # not rescue it explicitly, but rescue EOFError instead.
24
33
  ClientShutdown = Class.new(EOFError)
25
34
 
26
35
  # :stopdoc:
@@ -32,13 +41,12 @@ module Unicorn
32
41
  def self.builder(ru, op)
33
42
  # allow Configurator to parse cli switches embedded in the ru file
34
43
  op = Unicorn::Configurator::RACKUP.merge!(:file => ru, :optparse => op)
35
-
36
- # Op is going to get cleared before the returned lambda is called, so
37
- # save this value so that it's still there when we need it:
38
- no_default_middleware = op[:no_default_middleware]
44
+ if ru =~ /\.ru$/ && !defined?(Rack::Builder)
45
+ abort "rack and Rack::Builder must be available for processing #{ru}"
46
+ end
39
47
 
40
48
  # always called after config file parsing, may be called after forking
41
- lambda do ||
49
+ lambda do |_, server|
42
50
  inner_app = case ru
43
51
  when /\.ru$/
44
52
  raw = File.read(ru)
@@ -49,9 +57,21 @@ module Unicorn
49
57
  Object.const_get(File.basename(ru, '.rb').capitalize)
50
58
  end
51
59
 
52
- pp({ :inner_app => inner_app }) if $DEBUG
60
+ if $DEBUG
61
+ require 'pp'
62
+ pp({ :inner_app => inner_app })
63
+ end
53
64
 
54
- return inner_app if no_default_middleware
65
+ return inner_app unless server.default_middleware
66
+
67
+ middleware = { # order matters
68
+ ContentLength: nil,
69
+ Chunked: nil,
70
+ CommonLogger: [ $stderr ],
71
+ ShowExceptions: nil,
72
+ Lint: nil,
73
+ TempfileReaper: nil,
74
+ }
55
75
 
56
76
  # return value, matches rackup defaults based on env
57
77
  # Unicorn does not support persistent connections, but Rainbows!
@@ -59,32 +79,24 @@ module Unicorn
59
79
  # middlewares will need ContentLength/Chunked middlewares.
60
80
  case ENV["RACK_ENV"]
61
81
  when "development"
62
- Rack::Builder.new do
63
- use Rack::ContentLength
64
- use Rack::Chunked
65
- use Rack::CommonLogger, $stderr
66
- use Rack::ShowExceptions
67
- use Rack::Lint
68
- use Rack::TempfileReaper if Rack.const_defined?(:TempfileReaper)
69
- run inner_app
70
- end.to_app
71
82
  when "deployment"
72
- Rack::Builder.new do
73
- use Rack::ContentLength
74
- use Rack::Chunked
75
- use Rack::CommonLogger, $stderr
76
- use Rack::TempfileReaper if Rack.const_defined?(:TempfileReaper)
77
- run inner_app
78
- end.to_app
83
+ middleware.delete(:ShowExceptions)
84
+ middleware.delete(:Lint)
79
85
  else
80
- inner_app
86
+ return inner_app
81
87
  end
88
+ Rack::Builder.new do
89
+ middleware.each do |m, args|
90
+ use(Rack.const_get(m), *args) if Rack.const_defined?(m)
91
+ end
92
+ run inner_app
93
+ end.to_app
82
94
  end
83
95
  end
84
96
 
85
97
  # returns an array of strings representing TCP listen socket addresses
86
98
  # and Unix domain socket paths. This is useful for use with
87
- # Raindrops::Middleware under Linux: http://raindrops.bogomips.org/
99
+ # Raindrops::Middleware under Linux: https://yhbt.net/raindrops/
88
100
  def self.listener_names
89
101
  Unicorn::HttpServer::LISTENERS.map do |io|
90
102
  Unicorn::SocketHelper.sock_name(io)
@@ -98,9 +110,23 @@ module Unicorn
98
110
  exc.backtrace.each { |line| logger.error(line) }
99
111
  end
100
112
 
101
- # remove this when we only support Ruby >= 2.0
113
+ F_SETPIPE_SZ = 1031 if RUBY_PLATFORM =~ /linux/
114
+
102
115
  def self.pipe # :nodoc:
103
- Kgio::Pipe.new.each { |io| io.close_on_exec = true }
116
+ Kgio::Pipe.new.each do |io|
117
+ # shrink pipes to minimize impact on /proc/sys/fs/pipe-user-pages-soft
118
+ # limits.
119
+ if defined?(F_SETPIPE_SZ)
120
+ begin
121
+ io.fcntl(F_SETPIPE_SZ, Raindrops::PAGE_SIZE)
122
+ rescue Errno::EINVAL
123
+ # old kernel
124
+ rescue Errno::EPERM
125
+ # resizes fail if Linux is close to the pipe limit for the user
126
+ # or if the user does not have permissions to resize
127
+ end
128
+ end
129
+ end
104
130
  end
105
131
  # :startdoc:
106
132
  end
data/man/man1/unicorn.1 CHANGED
@@ -1,220 +1,222 @@
1
- .TH UNICORN 1 "September 15, 2009" "Unicorn User Manual"
1
+ .TH "UNICORN" "1" "September 15, 2009" "Unicorn User Manual" ""
2
+ .hy
2
3
  .SH NAME
3
4
  .PP
4
- unicorn - a rackup-like command to launch the Unicorn HTTP server
5
+ unicorn \- a rackup\-like command to launch the Unicorn HTTP server
5
6
  .SH SYNOPSIS
6
7
  .PP
7
- unicorn [-c CONFIG_FILE] [-E RACK_ENV] [-D] [RACKUP_FILE]
8
+ unicorn [\-c CONFIG_FILE] [\-E RACK_ENV] [\-D] [RACKUP_FILE]
8
9
  .SH DESCRIPTION
9
10
  .PP
10
- A rackup(1)-like command to launch Rack applications using Unicorn.
11
- It is expected to be started in your application root (APP_ROOT), but
12
- the "working_directory" directive may be used in the CONFIG_FILE.
11
+ A rackup(1)\-like command to launch Rack applications using Unicorn.
12
+ It is expected to be started in your application root (APP_ROOT),
13
+ but the "working_directory" directive may be used in the CONFIG_FILE.
13
14
  .PP
14
- While unicorn takes a myriad of command-line options for compatibility
15
- with ruby(1) and rackup(1), it is recommended to stick to the few
16
- command-line options specified in the SYNOPSIS and use the CONFIG_FILE
17
- as much as possible.
15
+ While unicorn takes a myriad of command\-line options for
16
+ compatibility with ruby(1) and rackup(1), it is recommended to stick
17
+ to the few command\-line options specified in the SYNOPSIS and use
18
+ the CONFIG_FILE as much as possible.
18
19
  .SH RACKUP FILE
19
20
  .PP
20
- This defaults to "config.ru" in APP_ROOT.
21
- It should be the same file used by rackup(1) and other Rack launchers,
22
- it uses the \f[I]Rack::Builder\f[] DSL.
21
+ This defaults to "config.ru" in APP_ROOT. It should be the same
22
+ file used by rackup(1) and other Rack launchers, it uses the
23
+ \f[I]Rack::Builder\f[] DSL.
23
24
  .PP
24
- Embedded command-line options are mostly parsed for compatibility with
25
- rackup(1) but strongly discouraged.
25
+ Embedded command\-line options are mostly parsed for compatibility
26
+ with rackup(1) but strongly discouraged.
26
27
  .SH UNICORN OPTIONS
27
28
  .TP
28
- .B -c, --config-file CONFIG_FILE
29
- Path to the Unicorn-specific config file.
30
- The config file is implemented as a Ruby DSL, so Ruby code may executed.
31
- See the RDoc/ri for the \f[I]Unicorn::Configurator\f[] class for the
32
- full list of directives available from the DSL.
33
- Using an absolute path for for CONFIG_FILE is recommended as it makes
34
- multiple instances of Unicorn easily distinguishable when viewing ps(1)
35
- output.
29
+ .B \-c, \-\-config\-file CONFIG_FILE
30
+ Path to the Unicorn\-specific config file. The config file is
31
+ implemented as a Ruby DSL, so Ruby code may executed.
32
+ See the RDoc/ri for the \f[I]Unicorn::Configurator\f[] class for the full
33
+ list of directives available from the DSL.
34
+ Using an absolute path for for CONFIG_FILE is recommended as it
35
+ makes multiple instances of Unicorn easily distinguishable when
36
+ viewing ps(1) output.
36
37
  .RS
37
38
  .RE
38
39
  .TP
39
- .B -D, --daemonize
40
- Run daemonized in the background.
41
- The process is detached from the controlling terminal and stdin is
42
- redirected to "/dev/null".
43
- Unlike many common UNIX daemons, we do not chdir to "/" upon
44
- daemonization to allow more control over the startup/upgrade process.
45
- Unless specified in the CONFIG_FILE, stderr and stdout will also be
46
- redirected to "/dev/null".
40
+ .B \-D, \-\-daemonize
41
+ Run daemonized in the background. The process is detached from
42
+ the controlling terminal and stdin is redirected to "/dev/null".
43
+ Unlike many common UNIX daemons, we do not chdir to "/"
44
+ upon daemonization to allow more control over the startup/upgrade
45
+ process.
46
+ Unless specified in the CONFIG_FILE, stderr and stdout will
47
+ also be redirected to "/dev/null".
47
48
  .RS
48
49
  .RE
49
50
  .TP
50
- .B -E, --env RACK_ENV
51
- Run under the given RACK_ENV.
52
- See the RACK ENVIRONMENT section for more details.
51
+ .B \-E, \-\-env RACK_ENV
52
+ Run under the given RACK_ENV. See the RACK ENVIRONMENT section
53
+ for more details.
53
54
  .RS
54
55
  .RE
55
56
  .TP
56
- .B -l, --listen ADDRESS
57
- Listens on a given ADDRESS.
58
- ADDRESS may be in the form of HOST:PORT or PATH, HOST:PORT is taken to
59
- mean a TCP socket and PATH is meant to be a path to a UNIX domain
60
- socket.
61
- Defaults to "0.0.0.0:8080" (all addresses on TCP port 8080) For
62
- production deployments, specifying the "listen" directive in CONFIG_FILE
63
- is recommended as it allows fine-tuning of socket options.
57
+ .B \-l, \-\-listen ADDRESS
58
+ Listens on a given ADDRESS. ADDRESS may be in the form of
59
+ HOST:PORT or PATH, HOST:PORT is taken to mean a TCP socket
60
+ and PATH is meant to be a path to a UNIX domain socket.
61
+ Defaults to "0.0.0.0:8080" (all addresses on TCP port 8080)
62
+ For production deployments, specifying the "listen" directive in
63
+ CONFIG_FILE is recommended as it allows fine\-tuning of socket
64
+ options.
64
65
  .RS
65
66
  .RE
66
67
  .TP
67
- .B -N, --no-default-middleware
68
- Disables loading middleware implied by RACK_ENV.
69
- This bypasses the configuration documented in the RACK ENVIRONMENT
70
- section, but still allows RACK_ENV to be used for
71
- application/framework-specific purposes.
68
+ .B \-N, \-\-no\-default\-middleware
69
+ Disables loading middleware implied by RACK_ENV. This bypasses the
70
+ configuration documented in the RACK ENVIRONMENT section, but still
71
+ allows RACK_ENV to be used for application/framework\-specific purposes.
72
72
  .RS
73
73
  .RE
74
74
  .SH RACKUP COMPATIBILITY OPTIONS
75
75
  .TP
76
- .B -o, --host HOST
77
- Listen on a TCP socket belonging to HOST, default is "0.0.0.0" (all
78
- addresses).
79
- If specified multiple times on the command-line, only the last-specified
80
- value takes effect.
76
+ .B \-o, \-\-host HOST
77
+ Listen on a TCP socket belonging to HOST, default is
78
+ "0.0.0.0" (all addresses).
79
+ If specified multiple times on the command\-line, only the
80
+ last\-specified value takes effect.
81
81
  This option only exists for compatibility with the rackup(1) command,
82
- use of "-l"/"--listen" switch is recommended instead.
82
+ use of "\-l"/"\-\-listen" switch is recommended instead.
83
83
  .RS
84
84
  .RE
85
85
  .TP
86
- .B -p, --port PORT
86
+ .B \-p, \-\-port PORT
87
87
  Listen on the specified TCP PORT, default is 8080.
88
- If specified multiple times on the command-line, only the last-specified
88
+ If specified multiple times on the command\-line, only the last\-specified
89
89
  value takes effect.
90
90
  This option only exists for compatibility with the rackup(1) command,
91
- use of "-l"/"--listen" switch is recommended instead.
91
+ use of "\-l"/"\-\-listen" switch is recommended instead.
92
92
  .RS
93
93
  .RE
94
94
  .TP
95
- .B -s, --server SERVER
96
- No-op, this exists only for compatibility with rackup(1).
95
+ .B \-s, \-\-server SERVER
96
+ No\-op, this exists only for compatibility with rackup(1).
97
97
  .RS
98
98
  .RE
99
99
  .SH RUBY OPTIONS
100
100
  .TP
101
- .B -e, --eval LINE
102
- Evaluate a LINE of Ruby code.
103
- This evaluation happens immediately as the command-line is being parsed.
101
+ .B \-e, \-\-eval LINE
102
+ Evaluate a LINE of Ruby code. This evaluation happens
103
+ immediately as the command\-line is being parsed.
104
104
  .RS
105
105
  .RE
106
106
  .TP
107
- .B -d, --debug
107
+ .B \-d, \-\-debug
108
108
  Turn on debug mode, the $DEBUG variable is set to true.
109
109
  .RS
110
110
  .RE
111
111
  .TP
112
- .B -w, --warn
112
+ .B \-w, \-\-warn
113
113
  Turn on verbose warnings, the $VERBOSE variable is set to true.
114
114
  .RS
115
115
  .RE
116
116
  .TP
117
- .B -I, --include PATH
118
- specify $LOAD_PATH.
119
- PATH will be prepended to $LOAD_PATH.
117
+ .B \-I, \-\-include PATH
118
+ specify $LOAD_PATH. PATH will be prepended to $LOAD_PATH.
120
119
  The \[aq]:\[aq] character may be used to delimit multiple directories.
121
- This directive may be used more than once.
122
- Modifications to $LOAD_PATH take place immediately and in the order they
123
- were specified on the command-line.
120
+ This directive may be used more than once. Modifications to
121
+ $LOAD_PATH take place immediately and in the order they were
122
+ specified on the command\-line.
124
123
  .RS
125
124
  .RE
126
125
  .TP
127
- .B -r, --require LIBRARY
128
- require a specified LIBRARY before executing the application.
129
- The "require" statement will be executed immediately and in the order
130
- they were specified on the command-line.
126
+ .B \-r, \-\-require LIBRARY
127
+ require a specified LIBRARY before executing the application. The
128
+ "require" statement will be executed immediately and in the order
129
+ they were specified on the command\-line.
131
130
  .RS
132
131
  .RE
133
132
  .SH SIGNALS
134
133
  .PP
135
134
  The following UNIX signals may be sent to the master process:
136
135
  .IP \[bu] 2
137
- HUP - reload config file, app, and gracefully restart all workers
136
+ HUP \- reload config file, app, and gracefully restart all workers
138
137
  .IP \[bu] 2
139
- INT/TERM - quick shutdown, kills all workers immediately
138
+ INT/TERM \- quick shutdown, kills all workers immediately
140
139
  .IP \[bu] 2
141
- QUIT - graceful shutdown, waits for workers to finish their current
142
- request before finishing.
140
+ QUIT \- graceful shutdown, waits for workers to finish their
141
+ current request before finishing.
143
142
  .IP \[bu] 2
144
- USR1 - reopen all logs owned by the master and all workers See
145
- Unicorn::Util.reopen_logs for what is considered a log.
143
+ USR1 \- reopen all logs owned by the master and all workers
144
+ See Unicorn::Util.reopen_logs for what is considered a log.
146
145
  .IP \[bu] 2
147
- USR2 - reexecute the running binary.
148
- A separate QUIT should be sent to the original process once the child is
149
- verified to be up and running.
146
+ USR2 \- reexecute the running binary. A separate QUIT
147
+ should be sent to the original process once the child is verified to
148
+ be up and running.
150
149
  .IP \[bu] 2
151
- WINCH - gracefully stops workers but keep the master running.
150
+ WINCH \- gracefully stops workers but keep the master running.
152
151
  This will only work for daemonized processes.
153
152
  .IP \[bu] 2
154
- TTIN - increment the number of worker processes by one
153
+ TTIN \- increment the number of worker processes by one
155
154
  .IP \[bu] 2
156
- TTOU - decrement the number of worker processes by one
155
+ TTOU \- decrement the number of worker processes by one
157
156
  .PP
158
- See the SIGNALS (http://unicorn.bogomips.org/SIGNALS.html) document for
157
+ See the SIGNALS (https://yhbt.net/unicorn/SIGNALS.html) document for
159
158
  full description of all signals used by Unicorn.
160
159
  .SH RACK ENVIRONMENT
161
160
  .PP
162
161
  Accepted values of RACK_ENV and the middleware they automatically load
163
162
  (outside of RACKUP_FILE) are exactly as those in rackup(1):
164
163
  .IP \[bu] 2
165
- development - loads Rack::CommonLogger, Rack::ShowExceptions, and
166
- Rack::Lint middleware
164
+ development \- loads Rack::CommonLogger, Rack::ShowExceptions, and
165
+ Rack::Lint middleware
167
166
  .IP \[bu] 2
168
- deployment - loads Rack::CommonLogger middleware
167
+ deployment \- loads Rack::CommonLogger middleware
169
168
  .IP \[bu] 2
170
- none - loads no middleware at all, relying entirely on RACKUP_FILE
169
+ none \- loads no middleware at all, relying entirely on RACKUP_FILE
171
170
  .PP
172
- All unrecognized values for RACK_ENV are assumed to be "none".
173
- Production deployments are strongly encouraged to use "deployment" or
174
- "none" for maximum performance.
171
+ All unrecognized values for RACK_ENV are assumed to be
172
+ "none". Production deployments are strongly encouraged to use
173
+ "deployment" or "none" for maximum performance.
175
174
  .PP
176
- As of Unicorn 0.94.0, RACK_ENV is exported as a process-wide environment
177
- variable as well.
178
- While not current a part of the Rack specification as of Rack 1.0.1,
179
- this has become a de facto standard in the Rack world.
175
+ As of Unicorn 0.94.0, RACK_ENV is exported as a process\-wide environment
176
+ variable as well. While not current a part of the Rack specification as
177
+ of Rack 1.0.1, this has become a de facto standard in the Rack world.
180
178
  .PP
181
179
  Note the Rack::ContentLength and Rack::Chunked middlewares are also
182
180
  loaded by "deployment" and "development", but no other values of
183
- RACK_ENV.
184
- If needed, they must be individually specified in the RACKUP_FILE, some
185
- frameworks do not require them.
181
+ RACK_ENV. If needed, they must be individually specified in the
182
+ RACKUP_FILE, some frameworks do not require them.
186
183
  .SH ENVIRONMENT VARIABLES
187
184
  .PP
188
- The RACK_ENV variable is set by the aforementioned -E switch.
189
- All application or library-specific environment variables (e.g.
190
- TMPDIR) may always be set in the Unicorn CONFIG_FILE in addition to the
191
- spawning shell.
192
- When transparently upgrading Unicorn, all environment variables set in
193
- the old master process are inherited by the new master process.
185
+ The RACK_ENV variable is set by the aforementioned \-E switch.
186
+ All application or library\-specific environment variables (e.g. TMPDIR)
187
+ may always be set in the Unicorn CONFIG_FILE in addition to the spawning
188
+ shell. When transparently upgrading Unicorn, all environment variables
189
+ set in the old master process are inherited by the new master process.
194
190
  Unicorn only uses (and will overwrite) the UNICORN_FD environment
195
191
  variable internally when doing transparent upgrades.
196
192
  .PP
197
- UNICORN_FD is a comma-delimited list of one or more file descriptors
198
- used to implement USR2 upgrades.
199
- Init systems may bind listen sockets itself and spawn unicorn with
200
- UNICORN_FD set to the file descriptor numbers of the listen socket(s).
193
+ UNICORN_FD is a comma\-delimited list of one or more file descriptors
194
+ used to implement USR2 upgrades. Init systems may bind listen sockets
195
+ itself and spawn unicorn with UNICORN_FD set to the file descriptor
196
+ numbers of the listen socket(s).
201
197
  .PP
202
198
  As of unicorn 5.0, LISTEN_PID and LISTEN_FDS are used for socket
203
- activation as documented in the sd_listen_fds(3) manpage.
204
- Users relying on this feature do not need to specify a listen socket in
199
+ activation as documented in the sd_listen_fds(3) manpage. Users
200
+ relying on this feature do not need to specify a listen socket in
205
201
  the unicorn config file.
206
202
  .SH SEE ALSO
207
203
  .IP \[bu] 2
208
- unicorn_rails(1)
209
- .IP \[bu] 2
210
204
  \f[I]Rack::Builder\f[] ri/RDoc
211
205
  .IP \[bu] 2
212
206
  \f[I]Unicorn::Configurator\f[] ri/RDoc
207
+ .UR https://yhbt.net/unicorn/Unicorn/Configurator.html
208
+ .UE
213
209
  .IP \[bu] 2
214
- Unicorn RDoc (http://unicorn.bogomips.org/)
210
+ unicorn RDoc
211
+ .UR https://yhbt.net/unicorn/
212
+ .UE
215
213
  .IP \[bu] 2
216
- Rack RDoc (http://www.rubydoc.info/github/rack/rack/)
214
+ Rack RDoc
215
+ .UR https://www.rubydoc.info/github/rack/rack/
216
+ .UE
217
217
  .IP \[bu] 2
218
- Rackup HowTo (https://github.com/rack/rack/wiki/tutorial-rackup-howto)
218
+ Rackup HowTo
219
+ .UR https://github.com/rack/rack/wiki/(tutorial)-rackup-howto
220
+ .UE
219
221
  .SH AUTHORS
220
- The Unicorn Community <unicorn-public@bogomips.org>.
222
+ The Unicorn Community <unicorn-public@yhbt.net>.