unicorn-heroku-wait 4.8.0.1.g0ed2.dirty
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.CHANGELOG.old +25 -0
- data/.document +29 -0
- data/.gitignore +25 -0
- data/.mailmap +26 -0
- data/.manifest +166 -0
- data/.wrongdoc.yml +10 -0
- data/Application_Timeouts +77 -0
- data/CONTRIBUTORS +35 -0
- data/COPYING +674 -0
- data/ChangeLog +4861 -0
- data/DESIGN +97 -0
- data/Documentation/.gitignore +5 -0
- data/Documentation/GNUmakefile +30 -0
- data/Documentation/unicorn.1.txt +178 -0
- data/Documentation/unicorn_rails.1.txt +175 -0
- data/FAQ +53 -0
- data/GIT-VERSION-FILE +1 -0
- data/GIT-VERSION-GEN +39 -0
- data/GNUmakefile +267 -0
- data/HACKING +134 -0
- data/ISSUES +36 -0
- data/KNOWN_ISSUES +79 -0
- data/LATEST +28 -0
- data/LICENSE +67 -0
- data/Links +56 -0
- data/NEWS +2067 -0
- data/PHILOSOPHY +145 -0
- data/README +150 -0
- data/Rakefile +60 -0
- data/SIGNALS +123 -0
- data/Sandbox +103 -0
- data/TODO +5 -0
- data/TUNING +98 -0
- data/bin/unicorn +126 -0
- data/bin/unicorn_rails +209 -0
- data/examples/big_app_gc.rb +2 -0
- data/examples/echo.ru +27 -0
- data/examples/git.ru +13 -0
- data/examples/init.sh +74 -0
- data/examples/logger_mp_safe.rb +25 -0
- data/examples/logrotate.conf +29 -0
- data/examples/nginx.conf +156 -0
- data/examples/unicorn.conf.minimal.rb +13 -0
- data/examples/unicorn.conf.rb +102 -0
- data/ext/unicorn_http/CFLAGS +13 -0
- data/ext/unicorn_http/c_util.h +124 -0
- data/ext/unicorn_http/common_field_optimization.h +111 -0
- data/ext/unicorn_http/ext_help.h +82 -0
- data/ext/unicorn_http/extconf.rb +10 -0
- data/ext/unicorn_http/global_variables.h +97 -0
- data/ext/unicorn_http/httpdate.c +78 -0
- data/ext/unicorn_http/unicorn_http.c +4031 -0
- data/ext/unicorn_http/unicorn_http.rl +1036 -0
- data/ext/unicorn_http/unicorn_http_common.rl +76 -0
- data/lib/unicorn/app/exec_cgi.rb +154 -0
- data/lib/unicorn/app/inetd.rb +109 -0
- data/lib/unicorn/app/old_rails/static.rb +59 -0
- data/lib/unicorn/app/old_rails.rb +35 -0
- data/lib/unicorn/cgi_wrapper.rb +147 -0
- data/lib/unicorn/configurator.rb +679 -0
- data/lib/unicorn/const.rb +44 -0
- data/lib/unicorn/http_request.rb +122 -0
- data/lib/unicorn/http_response.rb +75 -0
- data/lib/unicorn/http_server.rb +803 -0
- data/lib/unicorn/launcher.rb +62 -0
- data/lib/unicorn/oob_gc.rb +71 -0
- data/lib/unicorn/preread_input.rb +33 -0
- data/lib/unicorn/socket_helper.rb +231 -0
- data/lib/unicorn/ssl_client.rb +11 -0
- data/lib/unicorn/ssl_configurator.rb +104 -0
- data/lib/unicorn/ssl_server.rb +42 -0
- data/lib/unicorn/stream_input.rb +146 -0
- data/lib/unicorn/tee_input.rb +126 -0
- data/lib/unicorn/tmpio.rb +29 -0
- data/lib/unicorn/util.rb +89 -0
- data/lib/unicorn/version.rb +1 -0
- data/lib/unicorn/worker.rb +152 -0
- data/lib/unicorn.rb +118 -0
- data/local.mk.sample +59 -0
- data/man/man1/unicorn.1 +211 -0
- data/man/man1/unicorn_rails.1 +210 -0
- data/script/isolate_for_tests +32 -0
- data/setup.rb +1586 -0
- data/t/.gitignore +5 -0
- data/t/GNUmakefile +82 -0
- data/t/README +42 -0
- data/t/bin/content-md5-put +36 -0
- data/t/bin/sha1sum.rb +17 -0
- data/t/bin/unused_listen +40 -0
- data/t/broken-app.ru +12 -0
- data/t/detach.ru +11 -0
- data/t/env.ru +3 -0
- data/t/fails-rack-lint.ru +5 -0
- data/t/heartbeat-timeout.ru +12 -0
- data/t/hijack.ru +42 -0
- data/t/listener_names.ru +4 -0
- data/t/my-tap-lib.sh +201 -0
- data/t/oob_gc.ru +20 -0
- data/t/oob_gc_path.ru +20 -0
- data/t/pid.ru +3 -0
- data/t/preread_input.ru +17 -0
- data/t/rack-input-tests.ru +21 -0
- data/t/sslgen.sh +71 -0
- data/t/t0000-http-basic.sh +50 -0
- data/t/t0001-reload-bad-config.sh +53 -0
- data/t/t0002-config-conflict.sh +49 -0
- data/t/t0002-parser-error.sh +94 -0
- data/t/t0003-working_directory.sh +51 -0
- data/t/t0004-heartbeat-timeout.sh +69 -0
- data/t/t0004-working_directory_broken.sh +24 -0
- data/t/t0005-working_directory_app.rb.sh +40 -0
- data/t/t0006-reopen-logs.sh +83 -0
- data/t/t0006.ru +13 -0
- data/t/t0007-working_directory_no_embed_cli.sh +44 -0
- data/t/t0008-back_out_of_upgrade.sh +110 -0
- data/t/t0009-broken-app.sh +56 -0
- data/t/t0009-winch_ttin.sh +59 -0
- data/t/t0010-reap-logging.sh +55 -0
- data/t/t0011-active-unix-socket.sh +79 -0
- data/t/t0012-reload-empty-config.sh +85 -0
- data/t/t0013-rewindable-input-false.sh +24 -0
- data/t/t0013.ru +12 -0
- data/t/t0014-rewindable-input-true.sh +24 -0
- data/t/t0014.ru +12 -0
- data/t/t0015-configurator-internals.sh +25 -0
- data/t/t0016-trust-x-forwarded-false.sh +30 -0
- data/t/t0017-trust-x-forwarded-true.sh +30 -0
- data/t/t0018-write-on-close.sh +23 -0
- data/t/t0019-max_header_len.sh +49 -0
- data/t/t0020-at_exit-handler.sh +49 -0
- data/t/t0021-process_detach.sh +29 -0
- data/t/t0022-listener_names-preload_app.sh +32 -0
- data/t/t0100-rack-input-tests.sh +124 -0
- data/t/t0116-client_body_buffer_size.sh +80 -0
- data/t/t0116.ru +16 -0
- data/t/t0200-rack-hijack.sh +27 -0
- data/t/t0300-no-default-middleware.sh +20 -0
- data/t/t0600-https-server-basic.sh +48 -0
- data/t/t9000-preread-input.sh +48 -0
- data/t/t9001-oob_gc.sh +47 -0
- data/t/t9002-oob_gc-path.sh +75 -0
- data/t/test-lib.sh +128 -0
- data/t/write-on-close.ru +11 -0
- data/test/aggregate.rb +15 -0
- data/test/benchmark/README +50 -0
- data/test/benchmark/dd.ru +18 -0
- data/test/benchmark/stack.ru +8 -0
- data/test/exec/README +5 -0
- data/test/exec/test_exec.rb +1047 -0
- data/test/test_helper.rb +297 -0
- data/test/unit/test_configurator.rb +175 -0
- data/test/unit/test_droplet.rb +28 -0
- data/test/unit/test_http_parser.rb +854 -0
- data/test/unit/test_http_parser_ng.rb +731 -0
- data/test/unit/test_http_parser_xftrust.rb +38 -0
- data/test/unit/test_request.rb +182 -0
- data/test/unit/test_response.rb +99 -0
- data/test/unit/test_server.rb +268 -0
- data/test/unit/test_signals.rb +188 -0
- data/test/unit/test_sni_hostnames.rb +47 -0
- data/test/unit/test_socket_helper.rb +197 -0
- data/test/unit/test_stream_input.rb +203 -0
- data/test/unit/test_tee_input.rb +294 -0
- data/test/unit/test_upload.rb +306 -0
- data/test/unit/test_util.rb +105 -0
- data/unicorn.gemspec +44 -0
- metadata +328 -0
data/GNUmakefile
ADDED
@@ -0,0 +1,267 @@
|
|
1
|
+
# use GNU Make to run tests in parallel, and without depending on RubyGems
|
2
|
+
all:: test
|
3
|
+
|
4
|
+
RLFLAGS = -G2
|
5
|
+
|
6
|
+
MRI = ruby
|
7
|
+
RUBY = ruby
|
8
|
+
RAKE = rake
|
9
|
+
RAGEL = ragel
|
10
|
+
RSYNC = rsync
|
11
|
+
|
12
|
+
GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
|
13
|
+
@./GIT-VERSION-GEN
|
14
|
+
-include GIT-VERSION-FILE
|
15
|
+
-include local.mk
|
16
|
+
ruby_bin := $(shell which $(RUBY))
|
17
|
+
ifeq ($(DLEXT),) # "so" for Linux
|
18
|
+
DLEXT := $(shell $(RUBY) -rrbconfig -e 'puts RbConfig::CONFIG["DLEXT"]')
|
19
|
+
endif
|
20
|
+
ifeq ($(RUBY_VERSION),)
|
21
|
+
RUBY_VERSION := $(shell $(RUBY) -e 'puts RUBY_VERSION')
|
22
|
+
endif
|
23
|
+
|
24
|
+
RUBY_ENGINE := $(shell $(RUBY) -e 'puts((RUBY_ENGINE rescue "ruby"))')
|
25
|
+
|
26
|
+
isolate_libs := tmp/isolate/$(RUBY_ENGINE)-$(RUBY_VERSION).mk
|
27
|
+
$(isolate_libs): script/isolate_for_tests
|
28
|
+
@$(RUBY) script/isolate_for_tests
|
29
|
+
-include $(isolate_libs)
|
30
|
+
MYLIBS = $(RUBYLIB):$(ISOLATE_LIBS)
|
31
|
+
|
32
|
+
# dunno how to implement this as concisely in Ruby, and hell, I love awk
|
33
|
+
awk_slow := awk '/def test_/{print FILENAME"--"$$2".n"}' 2>/dev/null
|
34
|
+
|
35
|
+
slow_tests := test/unit/test_server.rb test/exec/test_exec.rb \
|
36
|
+
test/unit/test_signals.rb test/unit/test_upload.rb
|
37
|
+
log_suffix = .$(RUBY_ENGINE).$(RUBY_VERSION).log
|
38
|
+
T := $(filter-out $(slow_tests), $(wildcard test/*/test*.rb))
|
39
|
+
T_n := $(shell $(awk_slow) $(slow_tests))
|
40
|
+
T_log := $(subst .rb,$(log_suffix),$(T))
|
41
|
+
T_n_log := $(subst .n,$(log_suffix),$(T_n))
|
42
|
+
test_prefix = $(CURDIR)/test/$(RUBY_ENGINE)-$(RUBY_VERSION)
|
43
|
+
|
44
|
+
ext := ext/unicorn_http
|
45
|
+
c_files := $(ext)/unicorn_http.c $(ext)/httpdate.c $(wildcard $(ext)/*.h)
|
46
|
+
rl_files := $(wildcard $(ext)/*.rl)
|
47
|
+
base_bins := unicorn unicorn_rails
|
48
|
+
bins := $(addprefix bin/, $(base_bins))
|
49
|
+
man1_rdoc := $(addsuffix _1, $(base_bins))
|
50
|
+
man1_bins := $(addsuffix .1, $(base_bins))
|
51
|
+
man1_paths := $(addprefix man/man1/, $(man1_bins))
|
52
|
+
rb_files := $(bins) $(shell find lib ext -type f -name '*.rb')
|
53
|
+
inst_deps := $(c_files) $(rb_files) GNUmakefile test/test_helper.rb
|
54
|
+
|
55
|
+
ragel: $(ext)/unicorn_http.c
|
56
|
+
$(ext)/unicorn_http.c: $(rl_files)
|
57
|
+
cd $(@D) && $(RAGEL) unicorn_http.rl -C $(RLFLAGS) -o $(@F)
|
58
|
+
$(ext)/Makefile: $(ext)/extconf.rb $(c_files)
|
59
|
+
cd $(@D) && $(RUBY) extconf.rb
|
60
|
+
$(ext)/unicorn_http.$(DLEXT): $(ext)/Makefile
|
61
|
+
$(MAKE) -C $(@D)
|
62
|
+
lib/unicorn_http.$(DLEXT): $(ext)/unicorn_http.$(DLEXT)
|
63
|
+
@mkdir -p lib
|
64
|
+
install -m644 $< $@
|
65
|
+
http: lib/unicorn_http.$(DLEXT)
|
66
|
+
|
67
|
+
test-install: $(test_prefix)/.stamp
|
68
|
+
$(test_prefix)/.stamp: $(inst_deps)
|
69
|
+
mkdir -p $(test_prefix)/.ccache
|
70
|
+
tar cf - $(inst_deps) GIT-VERSION-GEN | \
|
71
|
+
(cd $(test_prefix) && tar xf -)
|
72
|
+
$(MAKE) -C $(test_prefix) clean
|
73
|
+
$(MAKE) -C $(test_prefix) http shebang RUBY="$(RUBY)"
|
74
|
+
> $@
|
75
|
+
|
76
|
+
# this is only intended to be run within $(test_prefix)
|
77
|
+
shebang: $(bins)
|
78
|
+
$(MRI) -i -p -e '$$_.gsub!(%r{^#!.*$$},"#!$(ruby_bin)")' $^
|
79
|
+
|
80
|
+
t_log := $(T_log) $(T_n_log)
|
81
|
+
test: $(T) $(T_n)
|
82
|
+
@cat $(t_log) | $(MRI) test/aggregate.rb
|
83
|
+
@$(RM) $(t_log)
|
84
|
+
|
85
|
+
test-exec: $(wildcard test/exec/test_*.rb)
|
86
|
+
test-unit: $(wildcard test/unit/test_*.rb)
|
87
|
+
$(slow_tests): $(test_prefix)/.stamp
|
88
|
+
@$(MAKE) $(shell $(awk_slow) $@)
|
89
|
+
|
90
|
+
test-integration: $(test_prefix)/.stamp
|
91
|
+
$(MAKE) -C t
|
92
|
+
|
93
|
+
check: test test-integration
|
94
|
+
test-all: check
|
95
|
+
|
96
|
+
TEST_OPTS = -v
|
97
|
+
check_test = grep '0 failures, 0 errors' $(t) >/dev/null
|
98
|
+
ifndef V
|
99
|
+
quiet_pre = @echo '* $(arg)$(extra)';
|
100
|
+
quiet_post = >$(t) 2>&1 && $(check_test)
|
101
|
+
else
|
102
|
+
# we can't rely on -o pipefail outside of bash 3+,
|
103
|
+
# so we use a stamp file to indicate success and
|
104
|
+
# have rm fail if the stamp didn't get created
|
105
|
+
stamp = $@$(log_suffix).ok
|
106
|
+
quiet_pre = @echo $(RUBY) $(arg) $(TEST_OPTS); ! test -f $(stamp) && (
|
107
|
+
quiet_post = && > $(stamp) )2>&1 | tee $(t); \
|
108
|
+
rm $(stamp) 2>/dev/null && $(check_test)
|
109
|
+
endif
|
110
|
+
|
111
|
+
# not all systems have setsid(8), we need it because we spam signals
|
112
|
+
# stupidly in some tests...
|
113
|
+
rb_setsid := $(RUBY) -e 'Process.setsid' -e 'exec *ARGV'
|
114
|
+
|
115
|
+
# TRACER='strace -f -o $(t).strace -s 100000'
|
116
|
+
run_test = $(quiet_pre) \
|
117
|
+
$(rb_setsid) $(TRACER) $(RUBY) -w $(arg) $(TEST_OPTS) $(quiet_post) || \
|
118
|
+
(sed "s,^,$(extra): ," >&2 < $(t); exit 1)
|
119
|
+
|
120
|
+
%.n: arg = $(subst .n,,$(subst --, -n ,$@))
|
121
|
+
%.n: t = $(subst .n,$(log_suffix),$@)
|
122
|
+
%.n: export PATH := $(test_prefix)/bin:$(PATH)
|
123
|
+
%.n: export RUBYLIB := $(test_prefix):$(test_prefix)/lib:$(MYLIBS)
|
124
|
+
%.n: $(test_prefix)/.stamp
|
125
|
+
$(run_test)
|
126
|
+
|
127
|
+
$(T): arg = $@
|
128
|
+
$(T): t = $(subst .rb,$(log_suffix),$@)
|
129
|
+
$(T): export PATH := $(test_prefix)/bin:$(PATH)
|
130
|
+
$(T): export RUBYLIB := $(test_prefix):$(test_prefix)/lib:$(MYLIBS)
|
131
|
+
$(T): $(test_prefix)/.stamp
|
132
|
+
$(run_test)
|
133
|
+
|
134
|
+
install: $(bins) $(ext)/unicorn_http.c
|
135
|
+
$(prep_setup_rb)
|
136
|
+
$(RM) lib/unicorn_http.$(DLEXT)
|
137
|
+
$(RM) -r .install-tmp
|
138
|
+
mkdir .install-tmp
|
139
|
+
cp -p bin/* .install-tmp
|
140
|
+
$(RUBY) setup.rb all
|
141
|
+
$(RM) $^
|
142
|
+
mv .install-tmp/* bin/
|
143
|
+
$(RM) -r .install-tmp
|
144
|
+
$(prep_setup_rb)
|
145
|
+
|
146
|
+
setup_rb_files := .config InstalledFiles
|
147
|
+
prep_setup_rb := @-$(RM) $(setup_rb_files);$(MAKE) -C $(ext) clean
|
148
|
+
|
149
|
+
clean:
|
150
|
+
-$(MAKE) -C $(ext) clean
|
151
|
+
-$(MAKE) -C Documentation clean
|
152
|
+
$(RM) $(ext)/Makefile lib/unicorn_http.$(DLEXT)
|
153
|
+
$(RM) $(setup_rb_files) $(t_log)
|
154
|
+
$(RM) -r $(test_prefix) man
|
155
|
+
|
156
|
+
man html:
|
157
|
+
$(MAKE) -C Documentation install-$@
|
158
|
+
|
159
|
+
pkg_extra := GIT-VERSION-FILE lib/unicorn/version.rb ChangeLog LATEST NEWS \
|
160
|
+
$(ext)/unicorn_http.c $(man1_paths)
|
161
|
+
|
162
|
+
ChangeLog: GIT-VERSION-FILE .wrongdoc.yml
|
163
|
+
wrongdoc prepare
|
164
|
+
|
165
|
+
.manifest: ChangeLog $(ext)/unicorn_http.c man
|
166
|
+
(git ls-files && for i in $@ $(pkg_extra); do echo $$i; done) | \
|
167
|
+
LC_ALL=C sort > $@+
|
168
|
+
cmp $@+ $@ || mv $@+ $@
|
169
|
+
$(RM) $@+
|
170
|
+
|
171
|
+
doc: .document $(ext)/unicorn_http.c man html .wrongdoc.yml
|
172
|
+
for i in $(man1_rdoc); do echo > $$i; done
|
173
|
+
find bin lib -type f -name '*.rbc' -exec rm -f '{}' ';'
|
174
|
+
$(RM) -r doc
|
175
|
+
wrongdoc all
|
176
|
+
install -m644 COPYING doc/COPYING
|
177
|
+
install -m644 $(shell LC_ALL=C grep '^[A-Z]' .document) doc/
|
178
|
+
install -m644 $(man1_paths) doc/
|
179
|
+
tar cf - $$(git ls-files examples/) | (cd doc && tar xf -)
|
180
|
+
$(RM) $(man1_rdoc)
|
181
|
+
|
182
|
+
# publishes docs to http://unicorn.bogomips.org
|
183
|
+
publish_doc:
|
184
|
+
-git set-file-times
|
185
|
+
$(MAKE) doc
|
186
|
+
find doc/images -type f | \
|
187
|
+
TZ=UTC xargs touch -d '1970-01-01 00:00:02' doc/rdoc.css
|
188
|
+
$(MAKE) doc_gz
|
189
|
+
chmod 644 $$(find doc -type f)
|
190
|
+
$(RSYNC) -av doc/ unicorn.bogomips.org:/srv/unicorn/
|
191
|
+
git ls-files | xargs touch
|
192
|
+
|
193
|
+
# Create gzip variants of the same timestamp as the original so nginx
|
194
|
+
# "gzip_static on" can serve the gzipped versions directly.
|
195
|
+
doc_gz: docs = $(shell find doc -type f ! -regex '^.*\.\(gif\|jpg\|png\|gz\)$$')
|
196
|
+
doc_gz:
|
197
|
+
for i in $(docs); do \
|
198
|
+
gzip --rsyncable -9 < $$i > $$i.gz; touch -r $$i $$i.gz; done
|
199
|
+
|
200
|
+
ifneq ($(VERSION),)
|
201
|
+
rfproject := mongrel
|
202
|
+
rfpackage := unicorn
|
203
|
+
pkggem := pkg/$(rfpackage)-$(VERSION).gem
|
204
|
+
pkgtgz := pkg/$(rfpackage)-$(VERSION).tgz
|
205
|
+
release_notes := release_notes-$(VERSION)
|
206
|
+
release_changes := release_changes-$(VERSION)
|
207
|
+
|
208
|
+
release-notes: $(release_notes)
|
209
|
+
release-changes: $(release_changes)
|
210
|
+
$(release_changes):
|
211
|
+
wrongdoc release_changes > $@+
|
212
|
+
$(VISUAL) $@+ && test -s $@+ && mv $@+ $@
|
213
|
+
$(release_notes):
|
214
|
+
wrongdoc release_notes > $@+
|
215
|
+
$(VISUAL) $@+ && test -s $@+ && mv $@+ $@
|
216
|
+
|
217
|
+
# ensures we're actually on the tagged $(VERSION), only used for release
|
218
|
+
verify:
|
219
|
+
test x"$(shell umask)" = x0022
|
220
|
+
git rev-parse --verify refs/tags/v$(VERSION)^{}
|
221
|
+
git diff-index --quiet HEAD^0
|
222
|
+
test `git rev-parse --verify HEAD^0` = \
|
223
|
+
`git rev-parse --verify refs/tags/v$(VERSION)^{}`
|
224
|
+
|
225
|
+
fix-perms:
|
226
|
+
git ls-tree -r HEAD | awk '/^100644 / {print $$NF}' | xargs chmod 644
|
227
|
+
git ls-tree -r HEAD | awk '/^100755 / {print $$NF}' | xargs chmod 755
|
228
|
+
|
229
|
+
gem: $(pkggem)
|
230
|
+
|
231
|
+
install-gem: $(pkggem)
|
232
|
+
gem install $(CURDIR)/$<
|
233
|
+
|
234
|
+
$(pkggem): .manifest fix-perms
|
235
|
+
gem build $(rfpackage).gemspec
|
236
|
+
mkdir -p pkg
|
237
|
+
mv $(@F) $@
|
238
|
+
|
239
|
+
$(pkgtgz): distdir = $(basename $@)
|
240
|
+
$(pkgtgz): HEAD = v$(VERSION)
|
241
|
+
$(pkgtgz): .manifest fix-perms
|
242
|
+
@test -n "$(distdir)"
|
243
|
+
$(RM) -r $(distdir)
|
244
|
+
mkdir -p $(distdir)
|
245
|
+
tar cf - $$(cat .manifest) | (cd $(distdir) && tar xf -)
|
246
|
+
cd pkg && tar cf - $(basename $(@F)) | gzip -9 > $(@F)+
|
247
|
+
mv $@+ $@
|
248
|
+
|
249
|
+
package: $(pkgtgz) $(pkggem)
|
250
|
+
|
251
|
+
release: verify package $(release_notes) $(release_changes)
|
252
|
+
# make tgz release on RubyForge
|
253
|
+
rubyforge add_release -f -n $(release_notes) -a $(release_changes) \
|
254
|
+
$(rfproject) $(rfpackage) $(VERSION) $(pkgtgz)
|
255
|
+
# push gem to Gemcutter
|
256
|
+
gem push $(pkggem)
|
257
|
+
# in case of gem downloads from RubyForge releases page
|
258
|
+
-rubyforge add_file \
|
259
|
+
$(rfproject) $(rfpackage) $(VERSION) $(pkggem)
|
260
|
+
$(RAKE) fm_update VERSION=$(VERSION)
|
261
|
+
else
|
262
|
+
gem install-gem: GIT-VERSION-FILE
|
263
|
+
$(MAKE) $@ VERSION=$(GIT_VERSION)
|
264
|
+
endif
|
265
|
+
|
266
|
+
.PHONY: .FORCE-GIT-VERSION-FILE doc $(T) $(slow_tests) man
|
267
|
+
.PHONY: test-install
|
data/HACKING
ADDED
@@ -0,0 +1,134 @@
|
|
1
|
+
= Unicorn Hacker's Guide
|
2
|
+
|
3
|
+
== Polyglot Infrastructure
|
4
|
+
|
5
|
+
Like Mongrel, we use Ruby where it makes sense, and Ragel with C where
|
6
|
+
it helps performance. All of the code that actually runs your Rack
|
7
|
+
application is written Ruby, Ragel or C.
|
8
|
+
|
9
|
+
As far as tests and documentation goes, we're not afraid to embrace Unix
|
10
|
+
and use traditional Unix tools where they make sense and get the job
|
11
|
+
done.
|
12
|
+
|
13
|
+
=== Tests
|
14
|
+
|
15
|
+
Tests are good, but slow tests make development slow, so we make tests
|
16
|
+
faster (in parallel) with GNU make (instead of Rake) and avoiding
|
17
|
+
RubyGems.
|
18
|
+
|
19
|
+
Users of GNU-based systems (such as GNU/Linux) usually have GNU make
|
20
|
+
installed as "make" instead of "gmake".
|
21
|
+
|
22
|
+
Since we don't load RubyGems by default, loading Rack properly requires
|
23
|
+
setting up RUBYLIB to point to where Rack is located. Not loading
|
24
|
+
RubyGems drastically lowers the time to run the full test suite. You
|
25
|
+
may setup a "local.mk" file in the top-level working directory to setup
|
26
|
+
your RUBYLIB and any other environment variables. A "local.mk.sample"
|
27
|
+
file is provided for reference.
|
28
|
+
|
29
|
+
Running the entire test suite with 4 tests in parallel:
|
30
|
+
|
31
|
+
gmake -j4 check
|
32
|
+
|
33
|
+
Running just one unit test:
|
34
|
+
|
35
|
+
gmake test/unit/test_http_parser.rb
|
36
|
+
|
37
|
+
Running just one test case in a unit test:
|
38
|
+
|
39
|
+
gmake test/unit/test_http_parser.rb--test_parse_simple.n
|
40
|
+
|
41
|
+
=== HttpServer
|
42
|
+
|
43
|
+
We strive to write as little code as possible while still maintaining
|
44
|
+
readability. However, readability and flexibility may be sacrificed for
|
45
|
+
performance in hot code paths. For Ruby, less code generally means
|
46
|
+
faster code.
|
47
|
+
|
48
|
+
Memory allocation should be minimized as much as practically possible.
|
49
|
+
Buffers for IO#readpartial are preallocated in the hot paths to avoid
|
50
|
+
building up garbage. Hash assignments use frozen strings to avoid the
|
51
|
+
duplication behind-the-scenes.
|
52
|
+
|
53
|
+
We spend as little time as possible inside signal handlers and instead
|
54
|
+
defer handling them for predictability and robustness. Most of the
|
55
|
+
Unix-specific things are in the Unicorn::HttpServer class. Unix systems
|
56
|
+
programming experience will come in handy (or be learned) here.
|
57
|
+
|
58
|
+
=== Documentation
|
59
|
+
|
60
|
+
We use RDoc 2.5.x with Darkfish for documentation as much as possible,
|
61
|
+
if you're on Ruby 1.8 you want to install the latest "rdoc" gem. Due to
|
62
|
+
the lack of RDoc-to-manpage converters we know about, we're writing
|
63
|
+
manpages in Markdown and converting to troff/HTML with Pandoc.
|
64
|
+
|
65
|
+
Please wrap documentation at 72 characters-per-line or less (long URLs
|
66
|
+
are exempt) so it is comfortably readable from terminals.
|
67
|
+
|
68
|
+
When referencing mailing list posts, use
|
69
|
+
"http://mid.gmane.org/$MESSAGE_ID" if possible since the Message-ID
|
70
|
+
remains searchable even if Gmane becomes unavailable.
|
71
|
+
|
72
|
+
=== Ruby/C Compatibility
|
73
|
+
|
74
|
+
We target Ruby 1.8.6+, 1.9 and will target Rubinius as it becomes
|
75
|
+
production-ready. We need the Ruby implementation to support fork,
|
76
|
+
exec, pipe, UNIX signals, access to integer file descriptors and
|
77
|
+
ability to use unlinked files.
|
78
|
+
|
79
|
+
All of our C code is OS-independent and should run on compilers
|
80
|
+
supported by the versions of Ruby we target.
|
81
|
+
|
82
|
+
=== Ragel Compatibility
|
83
|
+
|
84
|
+
We target the latest released version of Ragel and will update our code
|
85
|
+
to keep up with new releases. Packaged tarballs and gems include the
|
86
|
+
generated source code so they will remain usable if compatibility is
|
87
|
+
broken.
|
88
|
+
|
89
|
+
== Contributing
|
90
|
+
|
91
|
+
Contributions are welcome in the form of patches, pull requests, code
|
92
|
+
review, testing, documentation, user support or any other feedback is
|
93
|
+
welcome. The mailing list is the central coordination point for all
|
94
|
+
user and developer feedback and bug reports.
|
95
|
+
|
96
|
+
=== Submitting Patches
|
97
|
+
|
98
|
+
Follow conventions already established in the code and do not exceed 80
|
99
|
+
characters per line.
|
100
|
+
|
101
|
+
Inline patches (from "git format-patch -M") to the mailing list are
|
102
|
+
preferred because they allow code review and comments in the reply to
|
103
|
+
the patch.
|
104
|
+
|
105
|
+
We will adhere to mostly the same conventions for patch submissions as
|
106
|
+
git itself. See the Documentation/SubmittingPatches document
|
107
|
+
distributed with git on on patch submission guidelines to follow. Just
|
108
|
+
don't email the git mailing list or maintainer with Unicorn patches :)
|
109
|
+
|
110
|
+
== Building a Gem
|
111
|
+
|
112
|
+
In order to build the gem, you must install the following components:
|
113
|
+
|
114
|
+
* wrongdoc
|
115
|
+
* pandoc
|
116
|
+
|
117
|
+
You can build the Unicorn gem with the following command:
|
118
|
+
|
119
|
+
gmake gem
|
120
|
+
|
121
|
+
== Running Development Versions
|
122
|
+
|
123
|
+
It is easy to install the contents of your git working directory:
|
124
|
+
|
125
|
+
Via RubyGems (RubyGems 1.3.5+ recommended for prerelease versions):
|
126
|
+
|
127
|
+
gmake install-gem
|
128
|
+
|
129
|
+
Without RubyGems (via setup.rb):
|
130
|
+
|
131
|
+
gmake install
|
132
|
+
|
133
|
+
It is not at all recommended to mix a RubyGems installation with an
|
134
|
+
installation done without RubyGems, however.
|
data/ISSUES
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
= Issues
|
2
|
+
|
3
|
+
The {mailing list}[mailto:mongrel-unicorn@rubyforge.org] is the best
|
4
|
+
place to report bugs, submit patches and/or obtain support after you
|
5
|
+
have searched the mailing list archives and
|
6
|
+
{documentation}[http://unicorn.bogomips.org].
|
7
|
+
|
8
|
+
* No subscription is needed to post to the mailing list,
|
9
|
+
let us know that we need to Cc: replies to you if you're unsubscribed.
|
10
|
+
* Do not {top post}[http://catb.org/jargon/html/T/top-post.html] in replies
|
11
|
+
* Quote only the relevant portions of the message you're replying to
|
12
|
+
* Do not send HTML mail
|
13
|
+
|
14
|
+
If your issue is of a sensitive nature or you're just shy in public,
|
15
|
+
then feel free to email us privately at mailto:unicorn@bogomips.org
|
16
|
+
instead and your issue will be handled discreetly.
|
17
|
+
|
18
|
+
If you don't get a response within a few days, we may have forgotten
|
19
|
+
about it so feel free to ask again.
|
20
|
+
|
21
|
+
== Submitting Patches
|
22
|
+
|
23
|
+
See the HACKING document (and additionally, the
|
24
|
+
Documentation/SubmittingPatches document distributed with git) on
|
25
|
+
guidelines for patch submission.
|
26
|
+
|
27
|
+
== Mailing List Info
|
28
|
+
|
29
|
+
* subscribe: http://rubyforge.org/mailman/listinfo/mongrel-unicorn
|
30
|
+
* post: mailto:mongrel-unicorn@rubyforge.org
|
31
|
+
* private: mailto:unicorn@bogomips.org
|
32
|
+
|
33
|
+
== Mailing List Archives
|
34
|
+
|
35
|
+
* nntp://news.gmane.org/gmane.comp.lang.ruby.unicorn.general
|
36
|
+
* http://rubyforge.org/pipermail/mongrel-unicorn
|
data/KNOWN_ISSUES
ADDED
@@ -0,0 +1,79 @@
|
|
1
|
+
= Known Issues
|
2
|
+
|
3
|
+
Occasionally odd {issues}[link:ISSUES.html] arise without a transparent or
|
4
|
+
acceptable solution. Those issues are documented here.
|
5
|
+
|
6
|
+
* Some libraries/applications may install signal handlers which conflict
|
7
|
+
with signal handlers unicorn uses. Leaving "preload_app false"
|
8
|
+
(the default) will allow unicorn to always override existing signal
|
9
|
+
handlers.
|
10
|
+
|
11
|
+
* Issues with FreeBSD jails can be worked around as documented by Tatsuya Ono:
|
12
|
+
http://mid.gmane.org/CAHBuKRj09FdxAgzsefJWotexw-7JYZGJMtgUp_dhjPz9VbKD6Q@mail.gmail.com
|
13
|
+
|
14
|
+
* PRNGs (pseudo-random number generators) loaded before forking
|
15
|
+
(e.g. "preload_app true") may need to have their internal state
|
16
|
+
reset in the after_fork hook. Starting with \Unicorn 3.6.1, we
|
17
|
+
have builtin workarounds for Kernel#rand and OpenSSL::Random users,
|
18
|
+
but applications may use other PRNGs.
|
19
|
+
|
20
|
+
* Under some versions of Ruby 1.8, it is necessary to call +srand+ in an
|
21
|
+
after_fork hook to get correct random number generation. We have a builtin
|
22
|
+
workaround for this starting with \Unicorn 3.6.1
|
23
|
+
|
24
|
+
See http://redmine.ruby-lang.org/issues/show/4338
|
25
|
+
|
26
|
+
* On Ruby 1.8 prior to Ruby 1.8.7-p248, *BSD platforms have a broken
|
27
|
+
stdio that causes failure for file uploads larger than 112K. Upgrade
|
28
|
+
your version of Ruby or continue using Unicorn 1.x/3.4.x.
|
29
|
+
|
30
|
+
* For notes on sandboxing tools such as Bundler or Isolate,
|
31
|
+
see the {Sandbox}[link:Sandbox.html] page.
|
32
|
+
|
33
|
+
* nginx with "sendfile on" under FreeBSD 8 is broken when
|
34
|
+
uploads are buffered to disk. Disabling sendfile is required to
|
35
|
+
work around this bug which should be fixed in newer versions of FreeBSD.
|
36
|
+
|
37
|
+
* When using "preload_app true", with apps using background threads
|
38
|
+
need to restart them in the after_fork hook because threads are never
|
39
|
+
shared with child processes. Additionally, any synchronization
|
40
|
+
primitives (Mutexes, Monitors, ConditionVariables) should be
|
41
|
+
reinitialized in case they are held during fork time to avoid
|
42
|
+
deadlocks. The core Ruby Logger class needlessly uses a MonitorMutex
|
43
|
+
which can be disabled with a {monkey patch}[link:examples/logger_mp_safe.rb]
|
44
|
+
|
45
|
+
== Known Issues (Old)
|
46
|
+
|
47
|
+
* Under Ruby 1.9.1, methods like Array#shuffle and Array#sample will
|
48
|
+
segfault if called after forking. Upgrade to Ruby 1.9.2 or call
|
49
|
+
"Kernel.rand" in your after_fork hook to reinitialize the random
|
50
|
+
number generator.
|
51
|
+
|
52
|
+
See http://redmine.ruby-lang.org/issues/show/2962 for more details
|
53
|
+
|
54
|
+
* Rails 2.3.2 bundles its own version of Rack. This may cause subtle
|
55
|
+
bugs when simultaneously loaded with the system-wide Rack Rubygem
|
56
|
+
which Unicorn depends on. Upgrading to Rails 2.3.4 (or later) is
|
57
|
+
strongly recommended for all Rails 2.3.x users for this (and security
|
58
|
+
reasons). Rails 2.2.x series (or before) did not bundle Rack and are
|
59
|
+
should be unnaffected. If there is any reason which forces your
|
60
|
+
application to use Rails 2.3.2 and you have no other choice, then
|
61
|
+
you may edit your Unicorn gemspec and remove the Rack dependency.
|
62
|
+
|
63
|
+
ref: http://mid.gmane.org/20091014221552.GA30624@dcvr.yhbt.net
|
64
|
+
Note: the workaround described in the article above only made
|
65
|
+
the issue more subtle and we didn't notice them immediately.
|
66
|
+
|
67
|
+
* WONTFIX: code reloading and restarts with Sinatra 0.3.x (and likely older
|
68
|
+
versions) apps is broken. The workaround is to force production
|
69
|
+
mode to disable code reloading as well as disabling "run" in your
|
70
|
+
Sinatra application:
|
71
|
+
set :env, :production
|
72
|
+
set :run, false
|
73
|
+
Since this is no longer an issue with Sinatra 0.9.x apps, this will not be
|
74
|
+
fixed on our end. Since Unicorn is itself the application launcher, the
|
75
|
+
at_exit handler used in old Sinatra always caused Mongrel to be launched
|
76
|
+
whenever a Unicorn worker was about to exit.
|
77
|
+
|
78
|
+
Also remember we're capable of replacing the running binary without dropping
|
79
|
+
any connections regardless of framework :)
|
data/LATEST
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
=== unicorn 4.8.0 - big internal changes, but compatible / 2014-01-11 07:34 UTC
|
2
|
+
|
3
|
+
This release contains fairly major internal workings of master-to-worker
|
4
|
+
notifications. The master process no longer sends signals to workers
|
5
|
+
for most tasks. This works around some compatibility issues with some
|
6
|
+
versions of the "pg" gem (and potentially any other code which may not
|
7
|
+
handle EINTR properly). One extra benefit is it also helps stray
|
8
|
+
workers notice a rare, unexpected master death more easily. Workers
|
9
|
+
continue to (and will always) accept existing signals for compatibility
|
10
|
+
with tools/scripts which may signal workers.
|
11
|
+
|
12
|
+
PID file are always written early (even on upgrade) again to avoid
|
13
|
+
breaking strange monitoring setups which use PID files. Keep in mind we
|
14
|
+
have always discouraged monitoring based on PID files as they are
|
15
|
+
fragile.
|
16
|
+
|
17
|
+
We now avoid bubbling IOError to the Rack app on premature client
|
18
|
+
disconnects when streaming the input body. This is usually not a
|
19
|
+
problem with nginx, but may be on some LAN setups without nginx).
|
20
|
+
|
21
|
+
Thanks to Sam Saffron, Jimmy Soho, Rodrigo Rosenfeld Rosas,
|
22
|
+
Michael Fischer, and Andrew Hobson for their help with this release.
|
23
|
+
|
24
|
+
Note: the unicorn mailing list will be moved/changed soon due to the
|
25
|
+
RubyForge shutdown. unicorn will always rely only on Free Software.
|
26
|
+
There will never be any sign-up requirements nor terms-of-service to
|
27
|
+
agree to when communicating with us.
|
28
|
+
|
data/LICENSE
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
Unicorn is copyrighted free software by all contributors, see logs in
|
2
|
+
revision control for names and email addresses of all of them.
|
3
|
+
|
4
|
+
You can redistribute it and/or modify it under either the terms of the
|
5
|
+
GNU General Public License (GPL) as published by the Free Software
|
6
|
+
Foundation (FSF), either version 2 of the License, or (at your option)
|
7
|
+
any later version. We currently prefer the GPLv3 or later for
|
8
|
+
derivative works, but the GPLv2 is fine.
|
9
|
+
|
10
|
+
The complete texts of the GPLv2 and GPLv3 are below:
|
11
|
+
GPLv2 - http://www.gnu.org/licenses/gpl-2.0.txt
|
12
|
+
GPLv3 - http://www.gnu.org/licenses/gpl-3.0.txt
|
13
|
+
|
14
|
+
You may (against our _preference_) also use the Ruby 1.8 license terms
|
15
|
+
which we inherited from the original Mongrel project when we forked it:
|
16
|
+
|
17
|
+
=== Ruby 1.8-specific terms (if you're not using the GPL)
|
18
|
+
|
19
|
+
1. You may make and give away verbatim copies of the source form of the
|
20
|
+
software without restriction, provided that you duplicate all of the
|
21
|
+
original copyright notices and associated disclaimers.
|
22
|
+
|
23
|
+
2. You may modify your copy of the software in any way, provided that
|
24
|
+
you do at least ONE of the following:
|
25
|
+
|
26
|
+
a) place your modifications in the Public Domain or otherwise make them
|
27
|
+
Freely Available, such as by posting said modifications to Usenet or an
|
28
|
+
equivalent medium, or by allowing the author to include your
|
29
|
+
modifications in the software.
|
30
|
+
|
31
|
+
b) use the modified software only within your corporation or
|
32
|
+
organization.
|
33
|
+
|
34
|
+
c) rename any non-standard executables so the names do not conflict with
|
35
|
+
standard executables, which must also be provided.
|
36
|
+
|
37
|
+
d) make other distribution arrangements with the author.
|
38
|
+
|
39
|
+
3. You may distribute the software in object code or executable
|
40
|
+
form, provided that you do at least ONE of the following:
|
41
|
+
|
42
|
+
a) distribute the executables and library files of the software,
|
43
|
+
together with instructions (in the manual page or equivalent) on where
|
44
|
+
to get the original distribution.
|
45
|
+
|
46
|
+
b) accompany the distribution with the machine-readable source of the
|
47
|
+
software.
|
48
|
+
|
49
|
+
c) give non-standard executables non-standard names, with
|
50
|
+
instructions on where to get the original software distribution.
|
51
|
+
|
52
|
+
d) make other distribution arrangements with the author.
|
53
|
+
|
54
|
+
4. You may modify and include the part of the software into any other
|
55
|
+
software (possibly commercial). But some files in the distribution
|
56
|
+
are not written by the author, so that they are not under this terms.
|
57
|
+
|
58
|
+
5. The scripts and library files supplied as input to or produced as
|
59
|
+
output from the software do not automatically fall under the
|
60
|
+
copyright of the software, but belong to whomever generated them,
|
61
|
+
and may be sold commercially, and may be aggregated with this
|
62
|
+
software.
|
63
|
+
|
64
|
+
6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
|
65
|
+
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
66
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
67
|
+
PURPOSE.
|
data/Links
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
= Related Projects
|
2
|
+
|
3
|
+
If you're interested in \Unicorn, you may be interested in some of the projects
|
4
|
+
listed below. If you have any links to add/change/remove, please tell us at
|
5
|
+
mailto:mongrel-unicorn@rubyforge.org!
|
6
|
+
|
7
|
+
== Disclaimer
|
8
|
+
|
9
|
+
The \Unicorn project is not responsible for the content in these links.
|
10
|
+
Furthermore, the \Unicorn project has never, does not and will never endorse:
|
11
|
+
|
12
|
+
* any for-profit entities or services
|
13
|
+
* any non-{Free Software}[http://www.gnu.org/philosophy/free-sw.html]
|
14
|
+
|
15
|
+
The existence of these links does not imply endorsement of any entities
|
16
|
+
or services behind them.
|
17
|
+
|
18
|
+
=== For use with \Unicorn
|
19
|
+
|
20
|
+
* {Bluepill}[https://github.com/arya/bluepill] -
|
21
|
+
a simple process monitoring tool written in Ruby
|
22
|
+
|
23
|
+
* {golden_brindle}[https://github.com/simonoff/golden_brindle] - tool to
|
24
|
+
manage multiple \Unicorn instances/applications on a single server
|
25
|
+
|
26
|
+
* {raindrops}[http://raindrops.bogomips.org/] - real-time stats for
|
27
|
+
preforking Rack servers
|
28
|
+
|
29
|
+
* {UnXF}[http://bogomips.org/unxf/] Un-X-Forward* the Rack environment,
|
30
|
+
useful since unicorn is designed to be deployed behind a reverse proxy.
|
31
|
+
|
32
|
+
=== \Unicorn is written to work with
|
33
|
+
|
34
|
+
* {Rack}[http://rack.rubyforge.org/] - a minimal interface between webservers
|
35
|
+
supporting Ruby and Ruby frameworks
|
36
|
+
|
37
|
+
* {Ruby}[http://ruby-lang.org/] - the programming language of Rack and \Unicorn
|
38
|
+
|
39
|
+
* {nginx}[http://nginx.org/] - the reverse proxy for use with \Unicorn
|
40
|
+
|
41
|
+
* {kgio}[http://bogomips.org/kgio/] - the I/O library written for \Unicorn
|
42
|
+
|
43
|
+
=== Derivatives
|
44
|
+
|
45
|
+
* {Green Unicorn}[http://gunicorn.org/] - a Python version of \Unicorn
|
46
|
+
|
47
|
+
* {Rainbows!}[http://rainbows.rubyforge.org/] - \Unicorn for sleepy
|
48
|
+
apps and slow clients.
|
49
|
+
|
50
|
+
=== Prior Work
|
51
|
+
|
52
|
+
* {Mongrel}[http://mongrel.rubyforge.org/] - the awesome webserver \Unicorn is
|
53
|
+
based on
|
54
|
+
|
55
|
+
* {david}[http://bogomips.org/david.git] - a tool to explain why you need
|
56
|
+
nginx in front of \Unicorn
|