unicorn 0.2.3 → 0.4.1
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.
- data/.document +1 -1
- data/.gitignore +1 -0
- data/CHANGELOG +1 -0
- data/DESIGN +4 -0
- data/GNUmakefile +30 -6
- data/Manifest +62 -3
- data/README +52 -42
- data/SIGNALS +17 -17
- data/TODO +27 -5
- data/bin/unicorn +15 -13
- data/bin/unicorn_rails +59 -22
- data/ext/unicorn/http11/http11.c +25 -104
- data/ext/unicorn/http11/http11_parser.c +24 -23
- data/ext/unicorn/http11/http11_parser.h +1 -3
- data/ext/unicorn/http11/http11_parser.rl +2 -1
- data/lib/unicorn.rb +58 -44
- data/lib/unicorn/app/old_rails.rb +23 -0
- data/lib/unicorn/app/old_rails/static.rb +58 -0
- data/lib/unicorn/cgi_wrapper.rb +151 -0
- data/lib/unicorn/configurator.rb +71 -31
- data/lib/unicorn/const.rb +9 -34
- data/lib/unicorn/http_request.rb +63 -66
- data/lib/unicorn/http_response.rb +6 -1
- data/lib/unicorn/socket.rb +15 -2
- data/test/benchmark/README +55 -0
- data/test/benchmark/big_request.rb +35 -0
- data/test/benchmark/dd.ru +18 -0
- data/test/benchmark/request.rb +47 -0
- data/test/benchmark/response.rb +29 -0
- data/test/exec/test_exec.rb +41 -157
- data/test/rails/app-1.2.3/.gitignore +2 -0
- data/test/rails/app-1.2.3/app/controllers/application.rb +4 -0
- data/test/rails/app-1.2.3/app/controllers/foo_controller.rb +34 -0
- data/test/rails/app-1.2.3/app/helpers/application_helper.rb +2 -0
- data/test/rails/app-1.2.3/config/boot.rb +9 -0
- data/test/rails/app-1.2.3/config/database.yml +12 -0
- data/test/rails/app-1.2.3/config/environment.rb +10 -0
- data/test/rails/app-1.2.3/config/environments/development.rb +7 -0
- data/test/rails/app-1.2.3/config/environments/production.rb +3 -0
- data/test/rails/app-1.2.3/config/routes.rb +4 -0
- data/test/rails/app-1.2.3/db/.gitignore +0 -0
- data/test/rails/app-1.2.3/public/404.html +1 -0
- data/test/rails/app-1.2.3/public/500.html +1 -0
- data/test/rails/app-2.0.2/.gitignore +2 -0
- data/test/rails/app-2.0.2/app/controllers/application.rb +2 -0
- data/test/rails/app-2.0.2/app/controllers/foo_controller.rb +34 -0
- data/test/rails/app-2.0.2/app/helpers/application_helper.rb +2 -0
- data/test/rails/app-2.0.2/config/boot.rb +9 -0
- data/test/rails/app-2.0.2/config/database.yml +12 -0
- data/test/rails/app-2.0.2/config/environment.rb +14 -0
- data/test/rails/app-2.0.2/config/environments/development.rb +6 -0
- data/test/rails/app-2.0.2/config/environments/production.rb +3 -0
- data/test/rails/app-2.0.2/config/routes.rb +4 -0
- data/test/rails/app-2.0.2/db/.gitignore +0 -0
- data/test/rails/app-2.0.2/public/404.html +1 -0
- data/test/rails/app-2.0.2/public/500.html +1 -0
- data/test/rails/app-2.2.2/.gitignore +2 -0
- data/test/rails/app-2.2.2/app/controllers/application.rb +2 -0
- data/test/rails/app-2.2.2/app/controllers/foo_controller.rb +34 -0
- data/test/rails/app-2.2.2/app/helpers/application_helper.rb +2 -0
- data/test/rails/app-2.2.2/config/boot.rb +109 -0
- data/test/rails/app-2.2.2/config/database.yml +12 -0
- data/test/rails/app-2.2.2/config/environment.rb +14 -0
- data/test/rails/app-2.2.2/config/environments/development.rb +5 -0
- data/test/rails/app-2.2.2/config/environments/production.rb +3 -0
- data/test/rails/app-2.2.2/config/routes.rb +4 -0
- data/test/rails/app-2.2.2/db/.gitignore +0 -0
- data/test/rails/app-2.2.2/public/404.html +1 -0
- data/test/rails/app-2.2.2/public/500.html +1 -0
- data/test/rails/app-2.3.2.1/.gitignore +2 -0
- data/test/rails/app-2.3.2.1/app/controllers/application_controller.rb +3 -0
- data/test/rails/app-2.3.2.1/app/controllers/foo_controller.rb +34 -0
- data/test/rails/app-2.3.2.1/app/helpers/application_helper.rb +2 -0
- data/test/rails/app-2.3.2.1/config/boot.rb +107 -0
- data/test/rails/app-2.3.2.1/config/database.yml +12 -0
- data/test/rails/app-2.3.2.1/config/environment.rb +14 -0
- data/test/rails/app-2.3.2.1/config/environments/development.rb +5 -0
- data/test/rails/app-2.3.2.1/config/environments/production.rb +4 -0
- data/test/rails/app-2.3.2.1/config/routes.rb +4 -0
- data/test/rails/app-2.3.2.1/db/.gitignore +0 -0
- data/test/rails/app-2.3.2.1/public/404.html +1 -0
- data/test/rails/app-2.3.2.1/public/500.html +1 -0
- data/test/rails/test_rails.rb +243 -0
- data/test/test_helper.rb +149 -2
- data/test/unit/test_configurator.rb +46 -0
- data/test/unit/test_http_parser.rb +77 -36
- data/test/unit/test_request.rb +2 -0
- data/test/unit/test_response.rb +20 -4
- data/test/unit/test_server.rb +30 -1
- data/test/unit/test_socket_helper.rb +159 -0
- data/unicorn.gemspec +5 -5
- metadata +68 -5
- data/test/benchmark/previous.rb +0 -11
- data/test/benchmark/simple.rb +0 -11
- data/test/benchmark/utils.rb +0 -82
data/.document
CHANGED
data/.gitignore
CHANGED
data/CHANGELOG
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
v0.4.1 - Rails support, per-listener backlog and {snd,rcv}buf
|
|
1
2
|
v0.2.3 - Unlink Tempfiles after use (they were closed, just not unlinked)
|
|
2
3
|
v0.2.2 - small bug fixes, fix Rack multi-value headers (Set-Cookie:)
|
|
3
4
|
v0.2.1 - Fix broken Manifest that cause unicorn_rails to not be bundled
|
data/DESIGN
CHANGED
|
@@ -79,3 +79,7 @@
|
|
|
79
79
|
* If the master process dies unexpectedly for any reason,
|
|
80
80
|
workers will notice within :timeout/2 seconds and follow
|
|
81
81
|
the master to its death.
|
|
82
|
+
|
|
83
|
+
* There is never any explicit real-time dependency or communication
|
|
84
|
+
between the worker processes themselves nor to the master process.
|
|
85
|
+
Synchronization is handled entirely by the OS kernel.
|
data/GNUmakefile
CHANGED
|
@@ -13,12 +13,15 @@ endif
|
|
|
13
13
|
# dunno how to implement this as concisely in Ruby, and hell, I love awk
|
|
14
14
|
awk_slow := awk '/def test_/{print FILENAME"--"$$2".n"}' 2>/dev/null
|
|
15
15
|
|
|
16
|
+
rails_vers := $(subst test/rails/app-,,$(wildcard test/rails/app-*))
|
|
16
17
|
slow_tests := test/unit/test_server.rb test/exec/test_exec.rb
|
|
17
18
|
log_suffix = .$(RUBY_VERSION).log
|
|
18
|
-
|
|
19
|
+
T_r := $(wildcard test/rails/test*.rb)
|
|
20
|
+
T := $(filter-out $(slow_tests) $(T_r), $(wildcard test/*/test*.rb))
|
|
19
21
|
T_n := $(shell $(awk_slow) $(slow_tests))
|
|
20
22
|
T_log := $(subst .rb,$(log_suffix),$(T))
|
|
21
23
|
T_n_log := $(subst .n,$(log_suffix),$(T_n))
|
|
24
|
+
T_r_log := $(subst .r,$(log_suffix),$(T_r))
|
|
22
25
|
test_prefix = $(CURDIR)/test/install-$(RUBY_VERSION)
|
|
23
26
|
|
|
24
27
|
http11_deps := $(addprefix ext/unicorn/http11/, \
|
|
@@ -49,22 +52,23 @@ install-test:
|
|
|
49
52
|
$(MAKE) -C $(test_prefix) http11 shebang
|
|
50
53
|
|
|
51
54
|
# this is only intended to be run within $(test_prefix)
|
|
52
|
-
shebang: bin/unicorn
|
|
53
|
-
$(ruby) -i -p -e '$$_.gsub!(%r{^#!.*$$},"#!$(ruby_bin)")'
|
|
55
|
+
shebang: bin/unicorn bin/unicorn_rails
|
|
56
|
+
$(ruby) -i -p -e '$$_.gsub!(%r{^#!.*$$},"#!$(ruby_bin)")' $^
|
|
54
57
|
|
|
55
58
|
t_log := $(T_log) $(T_n_log)
|
|
56
59
|
test: $(T) $(T_n)
|
|
57
60
|
@cat $(t_log) | $(ruby) test/aggregate.rb
|
|
58
61
|
@$(RM) $(t_log)
|
|
59
62
|
|
|
60
|
-
|
|
63
|
+
test-exec: $(wildcard test/exec/test_*.rb)
|
|
64
|
+
test-unit: $(wildcard test/unit/test_*.rb)
|
|
61
65
|
$(slow_tests):
|
|
62
66
|
@$(MAKE) $(shell $(awk_slow) $@)
|
|
63
67
|
|
|
64
68
|
TEST_OPTS = -v
|
|
65
|
-
run_test = @echo '*** $(arg) ***'; \
|
|
69
|
+
run_test = @echo '*** $(arg)$(extra) ***'; \
|
|
66
70
|
setsid $(ruby) $(arg) $(TEST_OPTS) >$(t) 2>&1 || \
|
|
67
|
-
(
|
|
71
|
+
(sed "s,^,$(extra): ," >&2 < $(t); exit 1)
|
|
68
72
|
|
|
69
73
|
%.n: arg = $(subst .n,,$(subst --, -n ,$@))
|
|
70
74
|
%.n: t = $(subst .n,$(log_suffix),$@)
|
|
@@ -108,4 +112,24 @@ Manifest:
|
|
|
108
112
|
doc: .document
|
|
109
113
|
rdoc -Na -m README -t "$(shell sed -ne '1s/^= //p' README)"
|
|
110
114
|
|
|
115
|
+
rails_git_url = git://github.com/rails/rails.git
|
|
116
|
+
rails_git := vendor/rails.git
|
|
117
|
+
$(rails_git)/info/cloned-stamp:
|
|
118
|
+
git clone --mirror -q $(rails_git_url) $(rails_git)
|
|
119
|
+
> $@
|
|
120
|
+
|
|
121
|
+
rails_tests := $(addsuffix .r,$(addprefix $(T_r).,$(rails_vers)))
|
|
122
|
+
test-rails: $(rails_tests)
|
|
123
|
+
$(T_r).%.r: t = $(addsuffix $(log_suffix),$@)
|
|
124
|
+
$(T_r).%.r: rv = $(subst .r,,$(subst $(T_r).,,$@))
|
|
125
|
+
$(T_r).%.r: extra = ' 'v$(rv)
|
|
126
|
+
$(T_r).%.r: arg = $(T_r)
|
|
127
|
+
$(T_r).%.r: export PATH := $(test_prefix)/bin:$(PATH)
|
|
128
|
+
$(T_r).%.r: export RUBYLIB := $(test_prefix)/lib:$(RUBYLIB)
|
|
129
|
+
$(T_r).%.r: export UNICORN_RAILS_TEST_VERSION = $(rv)
|
|
130
|
+
$(T_r).%.r: export RAILS_GIT_REPO = $(CURDIR)/$(rails_git)
|
|
131
|
+
$(T_r).%.r: $(test_prefix)/.stamp $(rails_git)/info/cloned-stamp
|
|
132
|
+
$(run_test)
|
|
133
|
+
@sed 's,^,$(rv): ,' < $(t)
|
|
134
|
+
|
|
111
135
|
.PHONY: doc $(T) $(slow_tests) Manifest
|
data/Manifest
CHANGED
|
@@ -21,6 +21,9 @@ ext/unicorn/http11/http11_parser.rl
|
|
|
21
21
|
ext/unicorn/http11/http11_parser_common.rl
|
|
22
22
|
lib/unicorn.rb
|
|
23
23
|
lib/unicorn/app/exec_cgi.rb
|
|
24
|
+
lib/unicorn/app/old_rails.rb
|
|
25
|
+
lib/unicorn/app/old_rails/static.rb
|
|
26
|
+
lib/unicorn/cgi_wrapper.rb
|
|
24
27
|
lib/unicorn/configurator.rb
|
|
25
28
|
lib/unicorn/const.rb
|
|
26
29
|
lib/unicorn/http_request.rb
|
|
@@ -30,11 +33,66 @@ lib/unicorn/socket.rb
|
|
|
30
33
|
lib/unicorn/util.rb
|
|
31
34
|
setup.rb
|
|
32
35
|
test/aggregate.rb
|
|
33
|
-
test/benchmark/
|
|
34
|
-
test/benchmark/
|
|
35
|
-
test/benchmark/
|
|
36
|
+
test/benchmark/README
|
|
37
|
+
test/benchmark/big_request.rb
|
|
38
|
+
test/benchmark/dd.ru
|
|
39
|
+
test/benchmark/request.rb
|
|
40
|
+
test/benchmark/response.rb
|
|
36
41
|
test/exec/README
|
|
37
42
|
test/exec/test_exec.rb
|
|
43
|
+
test/rails/app-1.2.3/.gitignore
|
|
44
|
+
test/rails/app-1.2.3/app/controllers/application.rb
|
|
45
|
+
test/rails/app-1.2.3/app/controllers/foo_controller.rb
|
|
46
|
+
test/rails/app-1.2.3/app/helpers/application_helper.rb
|
|
47
|
+
test/rails/app-1.2.3/config/boot.rb
|
|
48
|
+
test/rails/app-1.2.3/config/database.yml
|
|
49
|
+
test/rails/app-1.2.3/config/environment.rb
|
|
50
|
+
test/rails/app-1.2.3/config/environments/development.rb
|
|
51
|
+
test/rails/app-1.2.3/config/environments/production.rb
|
|
52
|
+
test/rails/app-1.2.3/config/routes.rb
|
|
53
|
+
test/rails/app-1.2.3/db/.gitignore
|
|
54
|
+
test/rails/app-1.2.3/public/404.html
|
|
55
|
+
test/rails/app-1.2.3/public/500.html
|
|
56
|
+
test/rails/app-2.0.2/.gitignore
|
|
57
|
+
test/rails/app-2.0.2/app/controllers/application.rb
|
|
58
|
+
test/rails/app-2.0.2/app/controllers/foo_controller.rb
|
|
59
|
+
test/rails/app-2.0.2/app/helpers/application_helper.rb
|
|
60
|
+
test/rails/app-2.0.2/config/boot.rb
|
|
61
|
+
test/rails/app-2.0.2/config/database.yml
|
|
62
|
+
test/rails/app-2.0.2/config/environment.rb
|
|
63
|
+
test/rails/app-2.0.2/config/environments/development.rb
|
|
64
|
+
test/rails/app-2.0.2/config/environments/production.rb
|
|
65
|
+
test/rails/app-2.0.2/config/routes.rb
|
|
66
|
+
test/rails/app-2.0.2/db/.gitignore
|
|
67
|
+
test/rails/app-2.0.2/public/404.html
|
|
68
|
+
test/rails/app-2.0.2/public/500.html
|
|
69
|
+
test/rails/app-2.2.2/.gitignore
|
|
70
|
+
test/rails/app-2.2.2/app/controllers/application.rb
|
|
71
|
+
test/rails/app-2.2.2/app/controllers/foo_controller.rb
|
|
72
|
+
test/rails/app-2.2.2/app/helpers/application_helper.rb
|
|
73
|
+
test/rails/app-2.2.2/config/boot.rb
|
|
74
|
+
test/rails/app-2.2.2/config/database.yml
|
|
75
|
+
test/rails/app-2.2.2/config/environment.rb
|
|
76
|
+
test/rails/app-2.2.2/config/environments/development.rb
|
|
77
|
+
test/rails/app-2.2.2/config/environments/production.rb
|
|
78
|
+
test/rails/app-2.2.2/config/routes.rb
|
|
79
|
+
test/rails/app-2.2.2/db/.gitignore
|
|
80
|
+
test/rails/app-2.2.2/public/404.html
|
|
81
|
+
test/rails/app-2.2.2/public/500.html
|
|
82
|
+
test/rails/app-2.3.2.1/.gitignore
|
|
83
|
+
test/rails/app-2.3.2.1/app/controllers/application_controller.rb
|
|
84
|
+
test/rails/app-2.3.2.1/app/controllers/foo_controller.rb
|
|
85
|
+
test/rails/app-2.3.2.1/app/helpers/application_helper.rb
|
|
86
|
+
test/rails/app-2.3.2.1/config/boot.rb
|
|
87
|
+
test/rails/app-2.3.2.1/config/database.yml
|
|
88
|
+
test/rails/app-2.3.2.1/config/environment.rb
|
|
89
|
+
test/rails/app-2.3.2.1/config/environments/development.rb
|
|
90
|
+
test/rails/app-2.3.2.1/config/environments/production.rb
|
|
91
|
+
test/rails/app-2.3.2.1/config/routes.rb
|
|
92
|
+
test/rails/app-2.3.2.1/db/.gitignore
|
|
93
|
+
test/rails/app-2.3.2.1/public/404.html
|
|
94
|
+
test/rails/app-2.3.2.1/public/500.html
|
|
95
|
+
test/rails/test_rails.rb
|
|
38
96
|
test/test_helper.rb
|
|
39
97
|
test/tools/trickletest.rb
|
|
40
98
|
test/unit/test_configurator.rb
|
|
@@ -42,4 +100,5 @@ test/unit/test_http_parser.rb
|
|
|
42
100
|
test/unit/test_request.rb
|
|
43
101
|
test/unit/test_response.rb
|
|
44
102
|
test/unit/test_server.rb
|
|
103
|
+
test/unit/test_socket_helper.rb
|
|
45
104
|
test/unit/test_upload.rb
|
data/README
CHANGED
|
@@ -1,36 +1,48 @@
|
|
|
1
|
-
= Unicorn:
|
|
1
|
+
= Unicorn: Unix + LAN/localhost-optimized fork of Mongrel
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
proxy we know of that meets this requirement.
|
|
3
|
+
Unicorn is designed to only serve fast clients. See the PHILOSOPHY
|
|
4
|
+
and DESIGN documents for more details regarding this.
|
|
6
5
|
|
|
7
6
|
== Features
|
|
8
7
|
|
|
9
|
-
*
|
|
10
|
-
|
|
11
|
-
multiple processes yourself.
|
|
8
|
+
* Built on the solid Mongrel code base and takes full advantage
|
|
9
|
+
of functionality exclusive to Unix-like operating systems.
|
|
12
10
|
|
|
13
|
-
*
|
|
11
|
+
* Mostly written in Ruby, only the HTTP parser (stolen and trimmed
|
|
12
|
+
down from Mongrel) is written in C. Unicorn is compatible with
|
|
13
|
+
both Ruby 1.8 and 1.9.
|
|
14
|
+
|
|
15
|
+
* Process management: Unicorn will reap and restart workers that
|
|
16
|
+
die from broken apps. There is no need to manage multiple processes
|
|
17
|
+
yourself.
|
|
18
|
+
|
|
19
|
+
* Load balancing is done entirely by the operating system kernel.
|
|
20
|
+
Requests never pile up behind a busy worker.
|
|
21
|
+
|
|
22
|
+
* Does not care if your application is thread-safe or not, workers
|
|
14
23
|
all run within their own isolated address space and only serve one
|
|
15
24
|
client at a time...
|
|
16
25
|
|
|
17
|
-
*
|
|
18
|
-
|
|
19
|
-
after_fork hook for easy debugging.
|
|
26
|
+
* Supports all Rack applications, along with pre-Rack versions of
|
|
27
|
+
Ruby on Rails via a Rack wrapper.
|
|
20
28
|
|
|
21
|
-
*
|
|
29
|
+
* Builtin log rotation of all log files in your application via USR1
|
|
30
|
+
signal.
|
|
22
31
|
|
|
23
32
|
* nginx-style binary re-execution without losing connections.
|
|
24
|
-
You can upgrade
|
|
25
|
-
and even your Ruby interpreter as long as
|
|
33
|
+
You can upgrade Unicorn, your entire application, libraries
|
|
34
|
+
and even your Ruby interpreter as long as Unicorn is
|
|
26
35
|
installed in the same path.
|
|
27
36
|
|
|
28
37
|
* before_fork and after_fork hooks in case your application
|
|
29
38
|
has special needs when dealing with forked processes.
|
|
30
39
|
|
|
31
|
-
*
|
|
40
|
+
* Can be used with copy-on-write-friendly memory management
|
|
41
|
+
to save memory.
|
|
32
42
|
|
|
33
|
-
*
|
|
43
|
+
* Able to listen on multiple interfaces including UNIX sockets,
|
|
44
|
+
each worker process can also bind to a private port via the
|
|
45
|
+
after_fork hook for easy debugging.
|
|
34
46
|
|
|
35
47
|
== License
|
|
36
48
|
|
|
@@ -41,6 +53,8 @@ Mongrel is copyright 2007 Zed A. Shaw and contributors. It is licensed
|
|
|
41
53
|
under the Ruby license and the GPL2. See the include LICENSE file for
|
|
42
54
|
details.
|
|
43
55
|
|
|
56
|
+
Unicorn is 100% Free Software.
|
|
57
|
+
|
|
44
58
|
== Install
|
|
45
59
|
|
|
46
60
|
The library consists of a C extension so you'll need a C compiler or at
|
|
@@ -74,45 +88,41 @@ your web browser and download the latest snapshot tarballs here:
|
|
|
74
88
|
|
|
75
89
|
=== non-Rails Rack applications
|
|
76
90
|
|
|
77
|
-
|
|
78
|
-
Optionally, it can use a config file for unicorn-specific options
|
|
79
|
-
specified by the --config-file/-c command-line switch. See
|
|
80
|
-
Unicorn::Configurator for the syntax of the unicorn-specific
|
|
81
|
-
config options.
|
|
82
|
-
|
|
83
|
-
In APP_ROOT, just run:
|
|
91
|
+
In APP_ROOT, run:
|
|
84
92
|
|
|
85
93
|
unicorn
|
|
86
94
|
|
|
87
|
-
|
|
88
|
-
is a preforking webserver, you do not have to worry about thread-safety
|
|
89
|
-
of your application or libraries. However, your Rack application may use
|
|
90
|
-
threads internally (and should even be able to continue running threads
|
|
91
|
-
after the request is complete).
|
|
92
|
-
|
|
93
|
-
=== Rack-enabled versions of Rails (v2.3.2+)
|
|
95
|
+
=== for Rails applications (should work for all 1.2 or later versions)
|
|
94
96
|
|
|
95
97
|
In RAILS_ROOT, run:
|
|
96
98
|
|
|
97
99
|
unicorn_rails
|
|
98
100
|
|
|
101
|
+
Unicorn will bind to all interfaces TCP port 8080 by default.
|
|
102
|
+
You may use the '-l/--listen' switch to bind to a different
|
|
103
|
+
address:port or a UNIX socket.
|
|
104
|
+
|
|
105
|
+
=== Configuration File(s)
|
|
106
|
+
|
|
107
|
+
Unicorn will look for the config.ru file used by rackup in APP_ROOT.
|
|
108
|
+
|
|
109
|
+
For deployments, it can use a config file for Unicorn-specific options
|
|
110
|
+
specified by the --config-file/-c command-line switch. See
|
|
111
|
+
Unicorn::Configurator for the syntax of the Unicorn-specific options.
|
|
112
|
+
The default settings are designed for maximum out-of-the-box
|
|
113
|
+
compatibility with existing applications.
|
|
114
|
+
|
|
99
115
|
Most command-line options for other Rack applications (above) are also
|
|
100
|
-
supported.
|
|
101
|
-
|
|
102
|
-
functionality of the `unicorn' launcher.
|
|
116
|
+
supported. Run `unicorn -h` or `unicorn_rails -h` to see command-line
|
|
117
|
+
options.
|
|
103
118
|
|
|
104
119
|
== Disclaimer
|
|
105
120
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
fork()+exec() cgit.
|
|
121
|
+
Like the creatures themselves, production deployments of Unicorn are rare.
|
|
122
|
+
There is NO WARRANTY whatsoever if anything goes wrong, but let us know and
|
|
123
|
+
we'll try our best to fix it.
|
|
110
124
|
|
|
111
|
-
|
|
112
|
-
Of course there is NO WARRANTY whatsoever if anything goes wrong, but
|
|
113
|
-
let us know and we'll try our best to fix it. Unicorn is still in the
|
|
114
|
-
early stages and testing + feedback would be *greatly* appreciated;
|
|
115
|
-
maybe you'll get Rainbows as a reward!
|
|
125
|
+
Rainbows are NOT included.
|
|
116
126
|
|
|
117
127
|
== Known Issues
|
|
118
128
|
|
data/SIGNALS
CHANGED
|
@@ -61,27 +61,27 @@ The procedure is exactly like that of nginx:
|
|
|
61
61
|
of unicorn running now, both of which will have workers servicing
|
|
62
62
|
requests. Your process tree should look something like this:
|
|
63
63
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
64
|
+
unicorn master (old)
|
|
65
|
+
\_ unicorn worker[0]
|
|
66
|
+
\_ unicorn worker[1]
|
|
67
|
+
\_ unicorn worker[2]
|
|
68
|
+
\_ unicorn worker[3]
|
|
69
|
+
\_ unicorn master
|
|
70
|
+
\_ unicorn worker[0]
|
|
71
|
+
\_ unicorn worker[1]
|
|
72
|
+
\_ unicorn worker[2]
|
|
73
|
+
\_ unicorn worker[3]
|
|
74
|
+
|
|
75
|
+
3. You can now send WINCH to the old master process so only the new workers
|
|
76
76
|
serve requests. If your unicorn process is bound to an interactive
|
|
77
77
|
terminal, you can skip this step. Step 5 will be more difficult but
|
|
78
78
|
you can also skip it if your process is not daemonized.
|
|
79
79
|
|
|
80
|
-
|
|
80
|
+
4. You should now ensure that everything is running correctly with the
|
|
81
81
|
new workers as the old workers die off.
|
|
82
82
|
|
|
83
|
-
|
|
83
|
+
5. If everything seems ok, then send QUIT to the old master. You're done!
|
|
84
84
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
85
|
+
If something is broken, then send HUP to the old master to reload
|
|
86
|
+
the config and restart its workers. Then send QUIT to the new master
|
|
87
|
+
process.
|
data/TODO
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
== 1.0.0
|
|
2
|
+
|
|
3
|
+
* tests for preload_app boolean
|
|
4
|
+
|
|
5
|
+
* reexec_worker_processes config option:
|
|
6
|
+
This is the number of worker processes to startup initially
|
|
7
|
+
when being reexecuted.
|
|
8
|
+
|
|
9
|
+
Default: worker_processes/2 + 1
|
|
10
|
+
|
|
11
|
+
* integration tests with nginx including bad client handling
|
|
12
|
+
|
|
13
|
+
* tests for timeout
|
|
14
|
+
|
|
15
|
+
* manpages (why do so few Ruby executables come with proper manpages?)
|
|
16
|
+
|
|
17
|
+
== 1.1.0
|
|
18
|
+
|
|
19
|
+
* Transfer-Encoding: chunked request handling. Testcase:
|
|
20
|
+
|
|
21
|
+
curl -T- http://host:port/path < file_from_stdin
|
|
22
|
+
|
|
23
|
+
* code cleanups (launchers)
|
|
24
|
+
|
|
25
|
+
* Pure Ruby HTTP parser
|
|
26
|
+
|
|
27
|
+
* Rubinius support?
|
data/bin/unicorn
CHANGED
|
@@ -6,8 +6,8 @@ env = "development"
|
|
|
6
6
|
daemonize = false
|
|
7
7
|
listeners = []
|
|
8
8
|
options = { :listeners => listeners }
|
|
9
|
-
host = Unicorn::Const::DEFAULT_HOST
|
|
10
|
-
|
|
9
|
+
host, port = Unicorn::Const::DEFAULT_HOST, Unicorn::Const::DEFAULT_PORT
|
|
10
|
+
set_listener = false
|
|
11
11
|
|
|
12
12
|
opts = OptionParser.new("", 24, ' ') do |opts|
|
|
13
13
|
opts.banner = "Usage: #{File.basename($0)} " \
|
|
@@ -46,11 +46,13 @@ opts = OptionParser.new("", 24, ' ') do |opts|
|
|
|
46
46
|
opts.on("-o", "--host HOST",
|
|
47
47
|
"listen on HOST (default: #{Unicorn::Const::DEFAULT_HOST})") do |h|
|
|
48
48
|
host = h
|
|
49
|
+
set_listener = true
|
|
49
50
|
end
|
|
50
51
|
|
|
51
52
|
opts.on("-p", "--port PORT",
|
|
52
53
|
"use PORT (default: #{Unicorn::Const::DEFAULT_PORT})") do |p|
|
|
53
54
|
port = p.to_i
|
|
55
|
+
set_listener = true
|
|
54
56
|
end
|
|
55
57
|
|
|
56
58
|
opts.on("-E", "--env ENVIRONMENT",
|
|
@@ -103,22 +105,25 @@ opts = OptionParser.new("", 24, ' ') do |opts|
|
|
|
103
105
|
opts.parse! ARGV
|
|
104
106
|
end
|
|
105
107
|
|
|
108
|
+
config = ARGV[0] || "config.ru"
|
|
109
|
+
abort "configuration file #{config} not found" unless File.exist?(config)
|
|
110
|
+
|
|
111
|
+
if config =~ /\.ru$/
|
|
112
|
+
# parse embedded command-line options in config.ru comments
|
|
113
|
+
if File.open(config, "rb") { |fp| fp.sysread(fp.stat.size) } =~ /^#\\(.*)/
|
|
114
|
+
opts.parse! $1.split(/\s+/)
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
|
|
106
118
|
require 'pp' if $DEBUG
|
|
107
119
|
|
|
108
120
|
# require Rack as late as possible in case $LOAD_PATH is modified
|
|
109
121
|
# in config.ru or command-line
|
|
110
122
|
require 'rack'
|
|
111
123
|
|
|
112
|
-
config = ARGV[0] || "config.ru"
|
|
113
|
-
abort "configuration file #{config} not found" unless File.exist?(config)
|
|
114
|
-
|
|
115
124
|
inner_app = case config
|
|
116
125
|
when /\.ru$/
|
|
117
126
|
raw = File.open(config, "rb") { |fp| fp.sysread(fp.stat.size) }
|
|
118
|
-
# parse embedded command-line options in config.ru comments
|
|
119
|
-
if raw[/^#\\(.*)/]
|
|
120
|
-
opts.parse! $1.split(/\s+/)
|
|
121
|
-
end
|
|
122
127
|
lambda { || eval("Rack::Builder.new {(#{raw}\n)}.to_app", nil, config) }
|
|
123
128
|
else
|
|
124
129
|
lambda do ||
|
|
@@ -148,10 +153,7 @@ else
|
|
|
148
153
|
inner_app
|
|
149
154
|
end
|
|
150
155
|
|
|
151
|
-
if
|
|
152
|
-
listener = "#{host}:#{port}"
|
|
153
|
-
listeners << listener
|
|
154
|
-
end
|
|
156
|
+
listeners << "#{host}:#{port}" if set_listener
|
|
155
157
|
|
|
156
158
|
if $DEBUG
|
|
157
159
|
pp({
|