rainbows 4.6.2 → 4.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 18b464dce48ebcb62061b4bc42c1863d36ae9640
4
- data.tar.gz: fb5949f53907773edd0780220ff6cb4370eaa980
3
+ metadata.gz: 696829a7735d042f66084bbbf36e17658edd8a78
4
+ data.tar.gz: 8ca5eb73b0c23373c9ac41a23866506de6b6b649
5
5
  SHA512:
6
- metadata.gz: 8edf76b627694e71e09a147a7ed493cfd8441075f850ea95365c967a7c078de4a75f34997d8abc36f318317016e76e71b369bcd297911f8ff1cdfc971a38470b
7
- data.tar.gz: 0b4f40e1e1e3416aac356bca4886955ec72ecc31b8b73060314533603ca522781bd5c68443a06c00a68b73af350175dca893d33ee197e737e034163000bb9759
6
+ metadata.gz: cb200f3630bf46e0a3be33a6dcd132f3f555eb72cdfd65145781d2488ccbfa3fc8f7b35db3c3d5e9ab4aa8707ddd373b80efe5129b4a13e54df2483939bd4ad4
7
+ data.tar.gz: b08b512c0fc0f71f78efa8000cb150cbc7a5ece957b1f1a51bc7dda11e73f488d4f865752932b94b1b07fb66b93d08093fc8780620347a516b389af1964d46ad
data/.document CHANGED
@@ -1,4 +1,3 @@
1
- ChangeLog
2
1
  DEPLOY
3
2
  FAQ
4
3
  lib/rainbows.rb
data/.gitignore CHANGED
@@ -11,7 +11,7 @@
11
11
  log/
12
12
  pkg/
13
13
  /vendor
14
- /NEWS
14
+ /NEWS*
15
15
  /ChangeLog
16
16
  /.manifest
17
17
  /GIT-VERSION-FILE
@@ -19,4 +19,6 @@ pkg/
19
19
  /LATEST
20
20
  tags
21
21
  TAGS
22
+ /Summary
23
+ /rainbows_1
22
24
  /lib/rainbows/version.rb
@@ -2,10 +2,17 @@
2
2
  cgit_url: http://bogomips.org/rainbows.git
3
3
  git_url: git://bogomips.org/rainbows.git
4
4
  rdoc_url: http://rainbows.bogomips.org/
5
- changelog_start: v0.97.0
6
5
  merge_html:
7
6
  rainbows_1: Documentation/rainbows.1.html
8
7
  Summary: Documentation/comparison.html
9
8
  public_email: rainbows-public@bogomips.org
10
9
  private_email: rainbows@bogomips.org
10
+ noindex:
11
+ - TODO
12
+ - LATEST
13
+ - Unicorn
14
+ - Unicorn::Configurator
15
+ - Unicorn::SocketHelper
16
+ - EM
17
+ - Revactor
11
18
  ml_url: http://bogomips.org/rainbows-public/
data/DEPLOY CHANGED
@@ -13,26 +13,26 @@ processing of the request body as it is being uploaded.
13
13
  In this case, haproxy or any similar (non-request-body-buffering) load
14
14
  balancer should be used to balance requests between different machines.
15
15
 
16
- == nginx proxying to \Rainbows! or Unicorn
16
+ == nginx proxying to \Rainbows! or unicorn
17
17
 
18
18
  For high-traffic applications, routing slow actions to \Rainbows! with
19
19
  nginx is recommended as nginx can serve static files faster and nginx
20
- can forward fast actions to Unicorn.
20
+ can forward fast actions to unicorn.
21
21
 
22
22
  static files
23
23
  |
24
24
  nginx |--> slow actions --> Rainbows!
25
25
  |
26
- `--> fast actions --> Unicorn
26
+ `--> fast actions --> unicorn
27
27
 
28
28
  Be sure to set <tt>proxy_buffering off</tt> in nginx for "slow actions"
29
- if you have Comet applications (but not for Unicorn).
29
+ if you have Comet applications (but not for unicorn).
30
30
 
31
31
  == Denial-of-Service Concerns
32
32
 
33
33
  Since \Rainbows! is designed to talk to slow clients with long-held
34
34
  connections, it may be subject to brute force denial-of-service attacks.
35
- In Unicorn and Mongrel, we've already enabled the "httpready" accept
35
+ In unicorn and Mongrel, we've already enabled the "httpready" accept
36
36
  filter for FreeBSD and the TCP_DEFER_ACCEPT option in Linux; but it is
37
37
  still possible to build clients that work around and fool these
38
38
  mechanisms.
data/FAQ CHANGED
@@ -1,10 +1,10 @@
1
1
  = Frequently Asked Questions about \Rainbows!
2
2
 
3
- === Why is \Rainbows! a separate project from Unicorn?
3
+ === Why is \Rainbows! a separate project from unicorn?
4
4
 
5
- \Rainbows! is for the odd, corner-case requests that Unicorn is poorly
5
+ \Rainbows! is for the odd, corner-case requests that unicorn is poorly
6
6
  suited for. More scalable concurrency models introduce additional
7
- complexity that Unicorn users and developers are uncomfortable with for
7
+ complexity that unicorn users and developers are uncomfortable with for
8
8
  the common cases.
9
9
 
10
10
 
@@ -15,7 +15,7 @@ models, or are just too lazy to deal with them for the majority of
15
15
  requests we service.
16
16
 
17
17
 
18
- === Isn't "rainbows" a branch of Unicorn?
18
+ === Isn't "rainbows" a branch of unicorn?
19
19
 
20
20
  That functionality is now in the Revactor model of \Rainbows!
21
21
  However, \Revactor is not recommended since it is dormant
@@ -23,7 +23,7 @@ upstream and requires your application (and all its libraries)
23
23
  to cooperate with \Revactor for concurrency.
24
24
 
25
25
 
26
- === What happened to the "gossamer" branch of Unicorn?
26
+ === What happened to the "gossamer" branch of unicorn?
27
27
 
28
28
  It became the ThreadPool model of \Rainbows!
29
29
 
@@ -39,7 +39,7 @@ ease-of-debugging, compatibility, performance, and memory usage.
39
39
  === Should I put \Rainbows! behind nginx to serve slow clients?
40
40
 
41
41
  It is optional. You can still use nginx to route certain requests to
42
- Unicorn and others to \Rainbows! nginx will always outperform
42
+ unicorn and others to \Rainbows! nginx will always outperform
43
43
  \Rainbows! in both pure reverse proxy applications and for serving
44
44
  static files, but \Rainbows! is for hosting applications that are more
45
45
  easily-implemented in Ruby than C.
@@ -64,7 +64,7 @@ requires a extra {patch}[http://haproxy.1wt.eu/download/patches/].
64
64
  If you don't need streaming "rack.input", then nginx is a great HTTPS
65
65
  reverse proxy.
66
66
 
67
- Refer to the {Unicorn FAQ}[http://unicorn.bogomips.org/FAQ.html] on how
67
+ Refer to the {unicorn FAQ}[http://unicorn.bogomips.org/FAQ.html] on how
68
68
  to ensure redirects go to "https://" URLs.
69
69
 
70
70
 
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
- DEF_VER = "v4.6.2"
2
+ DEF_VER = "v4.7.0"
3
3
  CONSTANT = "Rainbows::Const::RAINBOWS_VERSION"
4
4
  RVF = "lib/rainbows/version.rb"
5
5
  GVF = "GIT-VERSION-FILE"
@@ -2,23 +2,16 @@
2
2
  all::
3
3
  # RSYNC_DEST := rubyforge.org:/var/www/gforge-projects/rainbows
4
4
  RSYNC_DEST := rainbows.bogomips.org:/srv/rainbows
5
- rfproject := rainbows
6
5
  rfpackage := rainbows
6
+ PLACEHOLDERS := rainbows_1 Summary
7
7
 
8
8
  man-rdoc: man html
9
9
  $(MAKE) -C Documentation comparison.html
10
- for i in $(man1_rdoc); do echo > $$i; done
11
10
  doc:: man-rdoc
12
11
  include pkg.mk
13
- ifneq ($(VERSION),)
14
- release::
15
- $(RAKE) publish_news VERSION=$(VERSION)
16
- $(RAKE) fm_update VERSION=$(VERSION)
17
- endif
18
12
 
19
13
  base_bins := rainbows
20
14
  bins := $(addprefix bin/, $(base_bins))
21
- man1_rdoc := $(addsuffix _1, $(base_bins))
22
15
  man1_bins := $(addsuffix .1, $(base_bins))
23
16
  man1_paths := $(addprefix man/man1/, $(man1_bins))
24
17
 
@@ -30,10 +23,6 @@ man html:
30
23
 
31
24
  pkg_extra += $(man1_paths) lib/rainbows/version.rb
32
25
 
33
- doc::
34
- cat Documentation/comparison.css >> doc/rdoc.css
35
- $(RM) $(man1_rdoc)
36
-
37
26
  lib/rainbows/version.rb: GIT-VERSION-FILE
38
27
 
39
28
  all:: test
data/HACKING CHANGED
@@ -6,10 +6,8 @@ All tests are written in POSIX shell. See README file in the t/ directory.
6
6
 
7
7
  === Documentation
8
8
 
9
- We use RDoc 3.9.x with Darkfish for documentation as much as possible,
10
- if you're on Ruby 1.8 you want to install the latest "rdoc" gem. Due to
11
- the lack of RDoc-to-manpage converters we know about, we're writing
12
- manpages in Markdown and converting to troff/HTML with Pandoc.
9
+ Due to the lack of RDoc-to-manpage converters we know about, we're
10
+ writing manpages in Markdown and converting to troff/HTML with Pandoc.
13
11
 
14
12
  Please wrap documentation at 72 characters-per-line or less (long URLs
15
13
  are exempt) so it is comfortably readable from terminals.
@@ -48,7 +46,7 @@ Please Cc: everyone on replies, as not everyone is subscribed.
48
46
 
49
47
  In order to build the gem, you must install the following components:
50
48
 
51
- * wrongdoc
49
+ * olddoc (RubyGem)
52
50
  * pandoc
53
51
 
54
52
  You can build the Unicorn gem with the following command:
data/README CHANGED
@@ -1,11 +1,15 @@
1
- = Rainbows! - Unicorn for sleepy apps and slow clients
1
+ = Rainbows! - unicorn for sleepy apps and slow clients
2
2
 
3
3
  \Rainbows! is an HTTP server for sleepy Rack applications. It is based on
4
- Unicorn, but designed to handle applications that expect long
4
+ unicorn, but designed to handle applications that expect long
5
5
  request/response times and/or slow clients.
6
6
 
7
+ If you're on GNU/Linux and overwhelmed by options in \Rainbows!,
8
+ consider {yahns}[http://yahns.yhbt.net/] as it has fewer options
9
+ and more energy-efficient during non-peak traffic.
10
+
7
11
  For Rack applications not heavily bound by slow external network
8
- dependencies, consider Unicorn instead as it simpler and easier to
12
+ dependencies, consider unicorn instead as it simpler and easier to
9
13
  debug.
10
14
 
11
15
  If you're on a small system, or write extremely tight and reliable code
data/SIGNALS CHANGED
@@ -5,7 +5,7 @@ the signals Rainbows! uses internally to communicate with the worker
5
5
  processes are documented here as well. With the exception of TTIN/TTOU,
6
6
  signal handling matches the behavior of and {nginx}[http://nginx.net/]
7
7
  so it should be possible to easily share process management scripts
8
- between \Rainbows!, Unicorn and nginx.
8
+ between \Rainbows!, unicorn and nginx.
9
9
 
10
10
  === Master Process
11
11
 
@@ -60,7 +60,7 @@ automatically respawned.
60
60
 
61
61
  * USR1 - Reopen all logs owned by the worker process.
62
62
  See Unicorn::Util.reopen_logs for what is considered a log.
63
- Unlike Unicorn, log files are reopened immediately in \Rainbows!
63
+ Unlike unicorn, log files are reopened immediately in \Rainbows!
64
64
  since worker processes are likely to be serving multiple clients
65
65
  simutaneously, we can't wait for all of them to finish.
66
66
 
@@ -68,7 +68,7 @@ automatically respawned.
68
68
 
69
69
  You may replace a running instance of rainbows with a new one without
70
70
  losing any incoming connections. Doing so will reload all of your
71
- application code, Unicorn/Rainbows! config, Ruby executable, and all
71
+ application code, unicorn/Rainbows! config, Ruby executable, and all
72
72
  libraries. The only things that will not change (due to OS limitations)
73
73
  are:
74
74
 
data/Sandbox CHANGED
@@ -1,6 +1,6 @@
1
1
  = Tips for using \Rainbows! with Sandbox installation tools
2
2
 
3
- Most {tips for Unicorn}[http://unicorn.bogomips.org/Sandbox.html]
3
+ Most {tips for unicorn}[http://unicorn.bogomips.org/Sandbox.html]
4
4
  for Bundler and Isolate apply to \Rainbows! as well.
5
5
 
6
6
  == TLDR (Bundler)
@@ -10,7 +10,7 @@ to simplify your deployments and only deploy one server?
10
10
  == {sendfile}[http://rubygems.org/gems/sendfile] RubyGem
11
11
 
12
12
  To enable the "sendfile" gem, just make sure you have 1.1.0 or later and
13
- "require" it in your \Rainbows!/Unicorn config file (not your Rack
13
+ "require" it in your \Rainbows!/unicorn config file (not your Rack
14
14
  config.ru):
15
15
 
16
16
  require 'sendfile' # that's it! nothing else to do
data/Summary CHANGED
@@ -0,0 +1 @@
1
+ olddoc_placeholder
@@ -0,0 +1 @@
1
+ t/README
@@ -93,6 +93,9 @@ module Rainbows
93
93
  @readers.clear
94
94
  tmp.each { |s| s.close rescue nil }.clear
95
95
  @at_quit.each { |task| task.call }
96
+
97
+ # XXX hack to break out of IO.select in worker_loop for some models
98
+ Process.kill(:QUIT, $$)
96
99
  end
97
100
  false
98
101
  end
@@ -128,8 +128,13 @@ module Rainbows::Response
128
128
  unless IO.method_defined?(:trysendfile)
129
129
  module CopyStream
130
130
  def write_body_file(body, range)
131
+ # ensure sendfile gets used for SyncClose objects:
132
+ if !body.kind_of?(IO) && body.respond_to?(:to_path)
133
+ body = body.to_path
134
+ end
135
+
131
136
  range ? COPY_STREAM.copy_stream(body, self, range[1], range[0]) :
132
- COPY_STREAM.copy_stream(body, self, nil, 0)
137
+ COPY_STREAM.copy_stream(body, self)
133
138
  end
134
139
  end
135
140
  include CopyStream
@@ -31,7 +31,7 @@ class Rainbows::SyncClose
31
31
  # called by the writer thread to wake up the original thread (in #initialize)
32
32
  def close
33
33
  @body.close
34
- ensure
35
- @mutex.synchronize { @cv.signal }
34
+ ensure
35
+ @mutex.synchronize { @cv.signal }
36
36
  end
37
37
  end
data/pkg.mk CHANGED
@@ -1,7 +1,8 @@
1
1
  RUBY = ruby
2
2
  RAKE = rake
3
3
  RSYNC = rsync
4
- WRONGDOC = wrongdoc
4
+ OLDDOC = olddoc
5
+ RDOC = rdoc
5
6
 
6
7
  GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
7
8
  @./GIT-VERSION-GEN
@@ -48,10 +49,10 @@ else
48
49
  build:
49
50
  endif
50
51
 
51
- pkg_extra += GIT-VERSION-FILE NEWS ChangeLog LATEST
52
- ChangeLog: GIT-VERSION-FILE .wrongdoc.yml
53
- $(WRONGDOC) prepare
54
- NEWS LATEST: ChangeLog
52
+ pkg_extra += GIT-VERSION-FILE NEWS LATEST
53
+ NEWS: GIT-VERSION-FILE .olddoc.yml
54
+ $(OLDDOC) prepare
55
+ LATEST: NEWS
55
56
 
56
57
  manifest:
57
58
  $(RM) .manifest
@@ -63,28 +64,20 @@ manifest:
63
64
  cmp $@+ $@ || mv $@+ $@
64
65
  $(RM) $@+
65
66
 
66
- doc:: .document .wrongdoc.yml $(pkg_extra)
67
+ doc:: .document .olddoc.yml $(pkg_extra) $(PLACEHOLDERS)
67
68
  -find lib -type f -name '*.rbc' -exec rm -f '{}' ';'
68
69
  -find ext -type f -name '*.rbc' -exec rm -f '{}' ';'
69
70
  $(RM) -r doc
70
- $(WRONGDOC) all
71
+ $(RDOC) -f oldweb
72
+ $(OLDDOC) merge
71
73
  install -m644 COPYING doc/COPYING
74
+ install -m644 NEWS doc/NEWS
75
+ install -m644 NEWS.atom.xml doc/NEWS.atom.xml
72
76
  install -m644 $(shell LC_ALL=C grep '^[A-Z]' .document) doc/
73
77
 
74
78
  ifneq ($(VERSION),)
75
79
  pkggem := pkg/$(rfpackage)-$(VERSION).gem
76
80
  pkgtgz := pkg/$(rfpackage)-$(VERSION).tgz
77
- release_notes := release_notes-$(VERSION)
78
- release_changes := release_changes-$(VERSION)
79
-
80
- release-notes: $(release_notes)
81
- release-changes: $(release_changes)
82
- $(release_changes):
83
- $(WRONGDOC) release_changes > $@+
84
- $(VISUAL) $@+ && test -s $@+ && mv $@+ $@
85
- $(release_notes):
86
- $(WRONGDOC) release_notes > $@+
87
- $(VISUAL) $@+ && test -s $@+ && mv $@+ $@
88
81
 
89
82
  # ensures we're actually on the tagged $(VERSION), only used for release
90
83
  verify:
@@ -120,23 +113,9 @@ $(pkgtgz): manifest fix-perms
120
113
 
121
114
  package: $(pkgtgz) $(pkggem)
122
115
 
123
- test-release:: verify package $(release_notes) $(release_changes)
124
- # make tgz release on RubyForge
125
- @echo rubyforge add_release -f \
126
- -n $(release_notes) -a $(release_changes) \
127
- $(rfproject) $(rfpackage) $(VERSION) $(pkgtgz)
128
- @echo gem push $(pkggem)
129
- @echo rubyforge add_file \
130
- $(rfproject) $(rfpackage) $(VERSION) $(pkggem)
131
- release:: verify package $(release_notes) $(release_changes)
132
- # make tgz release on RubyForge
133
- rubyforge add_release -f -n $(release_notes) -a $(release_changes) \
134
- $(rfproject) $(rfpackage) $(VERSION) $(pkgtgz)
116
+ release:: verify package
135
117
  # push gem to RubyGems.org
136
118
  gem push $(pkggem)
137
- # in case of gem downloads from RubyForge releases page
138
- rubyforge add_file \
139
- $(rfproject) $(rfpackage) $(VERSION) $(pkggem)
140
119
  else
141
120
  gem install-gem: GIT-VERSION-FILE
142
121
  $(MAKE) $@ VERSION=$(GIT_VERSION)
@@ -154,8 +133,6 @@ ifneq ($(RSYNC_DEST),)
154
133
  publish_doc:
155
134
  -git set-file-times
156
135
  $(MAKE) doc
157
- find doc/images -type f | \
158
- TZ=UTC xargs touch -d '1970-01-01 00:00:06' doc/rdoc.css
159
136
  $(MAKE) doc_gz
160
137
  $(RSYNC) -av doc/ $(RSYNC_DEST)/
161
138
  git ls-files | xargs touch
@@ -163,7 +140,7 @@ endif
163
140
 
164
141
  # Create gzip variants of the same timestamp as the original so nginx
165
142
  # "gzip_static on" can serve the gzipped versions directly.
166
- doc_gz: docs = $(shell find doc -type f ! -regex '^.*\.\(gif\|jpg\|png\|gz\)$$')
143
+ doc_gz: docs = $(shell find doc -type f ! -regex '^.*\.gz$$')
167
144
  doc_gz:
168
145
  for i in $(docs); do \
169
146
  gzip --rsyncable -9 < $$i > $$i.gz; touch -r $$i $$i.gz; done
@@ -171,5 +148,10 @@ check-warnings:
171
148
  @(for i in $$(git ls-files '*.rb'| grep -v '^setup\.rb$$'); \
172
149
  do $(RUBY) -d -W2 -c $$i; done) | grep -v '^Syntax OK$$' || :
173
150
 
151
+ ifneq ($(PLACEHOLDERS),)
152
+ $(PLACEHOLDERS):
153
+ echo olddoc_placeholder > $@
154
+ endif
155
+
174
156
  .PHONY: all .FORCE-GIT-VERSION-FILE doc test $(test_units) manifest
175
157
  .PHONY: check-warnings
@@ -1,8 +1,8 @@
1
1
  # -*- encoding: binary -*-
2
2
  ENV["VERSION"] or abort "VERSION= must be specified"
3
3
  manifest = File.readlines('.manifest').map! { |x| x.chomp! }
4
- require 'wrongdoc'
5
- extend Wrongdoc::Gemspec
4
+ require 'olddoc'
5
+ extend Olddoc::Gemspec
6
6
  name, summary, title = readme_metadata
7
7
 
8
8
  Gem::Specification.new do |s|
@@ -10,16 +10,13 @@ Gem::Specification.new do |s|
10
10
  s.version = ENV["VERSION"].dup
11
11
 
12
12
  s.authors = ["#{name} hackers"]
13
- s.date = Time.now.utc.strftime('%Y-%m-%d')
14
13
  s.description = readme_description
15
14
  s.email = %q{rainbows-public@bogomips.org}
16
15
  s.executables = %w(rainbows)
17
16
  s.extra_rdoc_files = extra_rdoc_files(manifest)
18
17
  s.files = manifest
19
- s.homepage = Wrongdoc.config[:rdoc_url]
18
+ s.homepage = Olddoc.config['rdoc_url']
20
19
  s.summary = summary
21
- s.rdoc_options = rdoc_options
22
- s.rubyforge_project = %q{rainbows}
23
20
 
24
21
  # we want a newer Rack for a valid HeaderHash#each
25
22
  s.add_dependency(%q<rack>, ['~> 1.1'])
@@ -27,13 +24,13 @@ Gem::Specification.new do |s|
27
24
  # kgio 2.5 has kgio_wait_* methods that take optional timeout args
28
25
  s.add_dependency(%q<kgio>, ['~> 2.5'])
29
26
 
30
- # we need Unicorn for the HTTP parser and process management
27
+ # we need unicorn for the HTTP parser and process management
31
28
  # we need unicorn 4.8.0+ since we depend on undocumented/unsupported
32
29
  # unicorn internals.
33
30
  s.add_dependency(%q<unicorn>, ["~> 4.8"])
34
31
 
35
32
  s.add_development_dependency(%q<isolate>, "~> 3.1")
36
- s.add_development_dependency(%q<wrongdoc>, "~> 1.8")
33
+ s.add_development_dependency(%q<olddoc>, "~> 1.0")
37
34
 
38
35
  # optional runtime dependencies depending on configuration
39
36
  # see t/test_isolate.rb for the exact versions we've tested with
@@ -56,7 +53,11 @@ Gem::Specification.new do |s|
56
53
  # NeverBlock, currently only available on http://gems.github.com/
57
54
  # s.add_dependency(%q<espace-neverblock>, ["~> 0.1.6.1"])
58
55
 
59
- # We inherited the Ruby 1.8 license from Mongrel, so we're stuck with it.
60
- # GPLv3 is preferred.
61
- s.licenses = ["GPLv2+", "Ruby 1.8"]
56
+ # Note: To avoid ambiguity, we intentionally avoid the SPDX-compatible
57
+ # 'Ruby' here since Ruby 1.9.3 switched to BSD-2-Clause license while
58
+ # we already inherited our license from Mongrel during Ruby 1.8.
59
+ # We cannot automatically switch licenses when Ruby changes their license,
60
+ # so we remain optionally-licensed under the terms of Ruby 1.8 despite
61
+ # not having a good way to specify this in an SPDX-compatible way...
62
+ s.licenses = ['GPL-2.0+', 'Nonstandard'] # Nonstandard = 'Ruby 1.8'
62
63
  end
@@ -29,7 +29,6 @@ models += WriterThreadPool
29
29
  models += WriterThreadSpawn
30
30
  models += ThreadPool
31
31
  models += ThreadSpawn
32
- models += Coolio
33
32
 
34
33
  models += StreamResponseEpoll
35
34
 
@@ -42,12 +41,16 @@ ifeq ($(RUBY_ENGINE),ruby)
42
41
  endif
43
42
  models += FiberSpawn
44
43
  models += FiberPool
45
- models += CoolioThreadPool
46
- models += CoolioThreadSpawn
47
- models += CoolioFiberSpawn
48
44
 
49
- models += EventMachine
50
- models += NeverBlock
45
+ RUBY_LE_2_1 := $(shell $(RUBY) -e 'puts(RUBY_VERSION.to_f <= 2.1)')
46
+ ifeq ($(RUBY_LE_2_1), true)
47
+ models += Coolio
48
+ models += CoolioThreadPool
49
+ models += CoolioThreadSpawn
50
+ models += CoolioFiberSpawn
51
+ models += EventMachine
52
+ models += NeverBlock
53
+ endif
51
54
  endif
52
55
  endif
53
56
 
@@ -10,6 +10,7 @@ class ClosablePipe < ::IO
10
10
  end
11
11
 
12
12
  def close
13
+ return if closed? # idempotent for Ruby 2.3.0 compatibility
13
14
  super
14
15
  $stdout.syswrite "path_info=#{@env['PATH_INFO']}\n"
15
16
  end
@@ -16,32 +16,34 @@ $stdout.reopen($stderr)
16
16
  lock = File.open(__FILE__, "rb")
17
17
  lock.flock(File::LOCK_EX)
18
18
  Isolate.now!(opts) do
19
- gem 'kgio', '2.9.2'
20
- gem 'rack', '1.5.2'
21
- gem 'kcar', '0.4.0'
19
+ gem 'kgio', '2.10.0'
20
+ gem 'rack', '1.6.4'
21
+ gem 'kcar', '0.5.0'
22
22
  gem 'raindrops', '0.13.0'
23
- gem 'unicorn', '4.8.3'
23
+ gem 'unicorn', '4.9.0'
24
24
 
25
25
  if engine == "ruby"
26
- gem 'sendfile', '1.2.1'
27
- gem 'cool.io', '1.1.0'
28
-
29
- gem 'eventmachine', '1.0.3'
30
- gem 'async_sinatra', '1.0.0'
31
-
32
- gem 'neverblock', '0.1.6.2'
26
+ gem 'sendfile', '1.2.2'
27
+ gem 'eventmachine', '1.0.8'
28
+ gem 'async_sinatra', '1.2.0'
29
+ if RUBY_VERSION.to_f < 2.2
30
+ gem 'cool.io', '1.1.0'
31
+ gem 'neverblock', '0.1.6.2'
32
+ end
33
33
  end
34
34
 
35
35
  if defined?(::Fiber) && engine == "ruby"
36
- gem 'revactor', '0.1.5'
37
- gem 'rack-fiber_pool', '0.9.2'
36
+ if RUBY_VERSION.to_f < 2.2
37
+ gem 'revactor', '0.1.5'
38
+ gem 'rack-fiber_pool', '0.9.2' # depends on EM
39
+ end
38
40
  end
39
41
 
40
42
  if RUBY_PLATFORM =~ /linux/
41
- gem 'sleepy_penguin', '3.3.0'
43
+ gem 'sleepy_penguin', '3.4.1'
42
44
 
43
45
  # is 2.6.32 new enough?
44
- gem 'io_splice', '4.2.0' if `uname -r`.strip > '2.6.32'
46
+ gem 'io_splice', '4.4.0' if `uname -r`.strip > '2.6.32'
45
47
  end
46
48
  end
47
49
 
data/vs_Unicorn CHANGED
@@ -1,11 +1,11 @@
1
- = \Rainbows! is like Unicorn, but Different...
1
+ = \Rainbows! is like unicorn, but Different...
2
2
 
3
- While \Rainbows! depends on Unicorn for its process/socket management,
3
+ While \Rainbows! depends on unicorn for its process/socket management,
4
4
  HTTP parser and configuration language; \Rainbows! is more ambitious.
5
5
 
6
6
  == Architectural Diagrams
7
7
 
8
- === Unicorn uses a 1:1 mapping of processes to clients
8
+ === unicorn uses a 1:1 mapping of processes to clients
9
9
 
10
10
  unicorn master
11
11
  \_ unicorn worker[0]
@@ -52,16 +52,16 @@ In both cases, workers share common listen sockets with the master and
52
52
  pull connections off the listen queue only if the worker has resources
53
53
  available.
54
54
 
55
- == Differences from Unicorn
55
+ == Differences from unicorn
56
56
 
57
- * log rotation is handled immediately in \Rainbows! whereas Unicorn has
57
+ * log rotation is handled immediately in \Rainbows! whereas unicorn has
58
58
  the luxury of delaying it until the current request is finished
59
59
  processing to prevent log entries for one request to be split across
60
60
  files.
61
61
 
62
62
  * load balancing between workers is imperfect, certain worker processes
63
63
  may be servicing more requests than others so it is important to not
64
- set +worker_connections+ too high. Unicorn worker processes can never
64
+ set +worker_connections+ too high. unicorn worker processes can never
65
65
  be servicing more than one request at once.
66
66
 
67
67
  * speculative, non-blocking accept() is not used, this is to help
@@ -72,10 +72,10 @@ available.
72
72
  * Less heavily-tested and inherently more complex.
73
73
 
74
74
 
75
- == Similarities with Unicorn
75
+ == Similarities with unicorn
76
76
 
77
77
  While some similarities are obvious (we depend on and subclass off
78
- Unicorn code), some things are not:
78
+ unicorn code), some things are not:
79
79
 
80
80
  * Does not attempt to accept() connections when pre-configured limits
81
81
  are hit (+worker_connections+). This will first help balance load
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rainbows
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.6.2
4
+ version: 4.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rainbows! hackers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-12 00:00:00.000000000 Z
11
+ date: 2015-10-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -67,29 +67,28 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '3.1'
69
69
  - !ruby/object:Gem::Dependency
70
- name: wrongdoc
70
+ name: olddoc
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '1.8'
75
+ version: '1.0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '1.8'
82
+ version: '1.0'
83
83
  description: |-
84
84
  \Rainbows! is an HTTP server for sleepy Rack applications. It is based on
85
- Unicorn, but designed to handle applications that expect long
85
+ unicorn, but designed to handle applications that expect long
86
86
  request/response times and/or slow clients.
87
87
  email: rainbows-public@bogomips.org
88
88
  executables:
89
89
  - rainbows
90
90
  extensions: []
91
91
  extra_rdoc_files:
92
- - ChangeLog
93
92
  - DEPLOY
94
93
  - FAQ
95
94
  - lib/rainbows.rb
@@ -127,6 +126,7 @@ extra_rdoc_files:
127
126
  - LATEST
128
127
  - LICENSE
129
128
  - NEWS
129
+ - rainbows_1
130
130
  - README
131
131
  - SIGNALS
132
132
  - TODO
@@ -141,13 +141,11 @@ files:
141
141
  - ".document"
142
142
  - ".gitignore"
143
143
  - ".manifest"
144
- - ".wrongdoc.yml"
144
+ - ".olddoc.yml"
145
145
  - COPYING
146
- - ChangeLog
147
146
  - DEPLOY
148
147
  - Documentation/.gitignore
149
148
  - Documentation/GNUmakefile
150
- - Documentation/comparison.css
151
149
  - Documentation/comparison.haml
152
150
  - Documentation/rainbows.1.txt
153
151
  - FAQ
@@ -159,7 +157,6 @@ files:
159
157
  - LICENSE
160
158
  - NEWS
161
159
  - README
162
- - Rakefile
163
160
  - SIGNALS
164
161
  - Sandbox
165
162
  - Static_Files
@@ -280,6 +277,7 @@ files:
280
277
  - man/man1/rainbows.1
281
278
  - pkg.mk
282
279
  - rainbows.gemspec
280
+ - rainbows_1
283
281
  - setup.rb
284
282
  - t/.gitignore
285
283
  - t/GNUmakefile
@@ -382,7 +380,6 @@ files:
382
380
  - t/t0041-optional-pool-size.sh
383
381
  - t/t0042-client_header_buffer_size.sh
384
382
  - t/t0043-quit-keepalive-disconnect.sh
385
- - t/t0044-autopush.sh
386
383
  - t/t0045-client_max_header_size.sh
387
384
  - t/t0050-response-body-close-has-env.sh
388
385
  - t/t0100-rack-input-hammer-chunked.sh
@@ -429,15 +426,11 @@ files:
429
426
  - vs_Unicorn
430
427
  homepage: http://rainbows.bogomips.org/
431
428
  licenses:
432
- - GPLv2+
433
- - Ruby 1.8
429
+ - GPL-2.0+
430
+ - Nonstandard
434
431
  metadata: {}
435
432
  post_install_message:
436
- rdoc_options:
437
- - "-t"
438
- - Rainbows! - Unicorn for sleepy apps and slow clients
439
- - "-W"
440
- - http://bogomips.org/rainbows.git/tree/%s
433
+ rdoc_options: []
441
434
  require_paths:
442
435
  - lib
443
436
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -451,9 +444,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
451
444
  - !ruby/object:Gem::Version
452
445
  version: '0'
453
446
  requirements: []
454
- rubyforge_project: rainbows
455
- rubygems_version: 2.2.2
447
+ rubyforge_project:
448
+ rubygems_version: 2.5.0
456
449
  signing_key:
457
450
  specification_version: 4
458
- summary: "- Unicorn for sleepy apps and slow clients"
451
+ summary: "- unicorn for sleepy apps and slow clients"
459
452
  test_files: []
@@ -1,6 +0,0 @@
1
- /* help to make this look nice would be greatly appreciated */
2
- .comparison {
3
- margin: 1em;
4
- border: 1px solid;
5
- width: 100%;
6
- }
data/Rakefile DELETED
@@ -1,71 +0,0 @@
1
- # -*- encoding: binary -*-
2
- autoload :Gem, 'rubygems'
3
- autoload :Tempfile, 'tempfile'
4
- require 'wrongdoc'
5
-
6
- cgit_url = Wrongdoc.config[:cgit_url]
7
- git_url = Wrongdoc.config[:git_url]
8
-
9
- desc "read news article from STDIN and post to rubyforge"
10
- task :publish_news do
11
- require 'rubyforge'
12
- spec = Gem::Specification.load('rainbows.gemspec')
13
- tmp = Tempfile.new('rf-news')
14
- _, subject, body = `git cat-file tag v#{spec.version}`.split(/\n\n/, 3)
15
- tmp.puts subject
16
- tmp.puts
17
- tmp.puts spec.description.strip
18
- tmp.puts ""
19
- tmp.puts "* #{spec.homepage}"
20
- tmp.puts "* #{spec.email}"
21
- tmp.puts "* #{git_url}"
22
- tmp.print "\nChanges:\n\n"
23
- tmp.puts body
24
- tmp.flush
25
- system(ENV["VISUAL"], tmp.path) or abort "#{ENV["VISUAL"]} failed: #$?"
26
- msg = File.readlines(tmp.path)
27
- subject = msg.shift
28
- blank = msg.shift
29
- blank == "\n" or abort "no newline after subject!"
30
- subject.strip!
31
- body = msg.join("").strip!
32
-
33
- rf = RubyForge.new.configure
34
- rf.login
35
- rf.post_news('rainbows', subject, body)
36
- end
37
-
38
- desc "post to FM"
39
- task :fm_update do
40
- require 'net/http'
41
- require 'net/netrc'
42
- require 'json'
43
- version = ENV['VERSION'] or abort "VERSION= needed"
44
- uri = URI.parse('https://freecode.com/projects/rainbows/releases.json')
45
- rc = Net::Netrc.locate('rainbows-fm') or abort "~/.netrc not found"
46
- api_token = rc.password
47
- _, subject, body = `git cat-file tag v#{version}`.split(/\n\n/, 3)
48
- tmp = Tempfile.new('fm-changelog')
49
- tmp.puts subject
50
- tmp.puts
51
- tmp.puts body
52
- tmp.flush
53
- system(ENV["VISUAL"], tmp.path) or abort "#{ENV["VISUAL"]} failed: #$?"
54
- changelog = File.read(tmp.path).strip
55
-
56
- req = {
57
- "auth_code" => api_token,
58
- "release" => {
59
- "tag_list" => "Stable",
60
- "version" => version,
61
- "changelog" => changelog,
62
- },
63
- }.to_json
64
- if ! changelog.strip.empty? && version =~ %r{\A[\d\.]+\d+\z}
65
- Net::HTTP.start(uri.host, uri.port, :use_ssl => true) do |http|
66
- p http.post(uri.path, req, {'Content-Type'=>'application/json'})
67
- end
68
- else
69
- warn "not updating freshmeat for v#{version}"
70
- end
71
- end
data/Test_Suite DELETED
@@ -1,63 +0,0 @@
1
- = \Rainbows! test suite - YES OUR TEST SUITE IS CONCURRENT!
2
-
3
- These are all integration tests that start the server on random, unused
4
- TCP ports or Unix domain sockets. They're all designed to run
5
- concurrently with other tests to minimize test time, but tests may be
6
- run independently as well.
7
-
8
- We write our tests primarily in Bourne shell because that's what we're
9
- comfortable writing integration tests with. This test suite is also
10
- easily portable to non-Ruby web servers.
11
-
12
- == Requirements
13
-
14
- * {Ruby 1.8 or 1.9}[http://www.ruby-lang.org/] (duh!)
15
- * {isolate ~> 2.1.0}[http://github.com/jbarnette/isolate] - for dependencies
16
- * {GNU make}[http://www.gnu.org/software/make/]
17
- * {socat}[http://www.dest-unreach.org/socat/]
18
- * {curl >= 7.18.0}[http://curl.haxx.se/]
19
- * standard UNIX shell utilities (Bourne sh, awk, sed, grep, ...)
20
-
21
- We do not use bashisms or any non-portable, non-POSIX constructs
22
- in our shell code. We use the "pipefail" option if available and
23
- mainly test with {ksh}[http://kornshell.com/], but occasionally
24
- with {dash}[http://gondor.apana.org.au/~herbert/dash/] and
25
- {bash}[http://www.gnu.org/software/bash/], too.
26
-
27
- == Running Tests
28
-
29
- *BSD users: use "gmake" instead of "make"
30
-
31
- To run the entire test suite with 8 tests running at once:
32
-
33
- make -j8
34
-
35
- To run one individual test for all concurrency models:
36
-
37
- make t0000-simple-http.sh
38
-
39
- To run one individual test for one concurrency model:
40
-
41
- make Revactor.t0000-simple-http.sh
42
-
43
- To run all tests for one concurrency model:
44
-
45
- make EventMachine
46
-
47
- You may also increase verbosity by setting the "V" variable for
48
- GNU make. To disable trapping of stdout/stderr:
49
-
50
- make V=1
51
-
52
- To enable the "set -x" option in shell scripts to trace execution
53
-
54
- make V=2
55
-
56
- == Performance
57
-
58
- Some of the tests are rather I/O intensive due to the rewindability
59
- requirement of "rack.input" in the Rack specification and the somewhat
60
- complicated (but awesome!) nature of the TeeInput class leading us to
61
- test it very heavily. If you have lots of RAM and a large tmpfs
62
- partition, it is advisable to set your TMPDIR and also make the t/trash/
63
- directory a symlink to a directory inside in your TMPDIR.
@@ -1,121 +0,0 @@
1
- #!/bin/sh
2
- . ./test-lib.sh
3
- STRACE=$(which strace 2>/dev/null || :)
4
- if ! test -x "$STRACE"
5
- then
6
- t_info "strace not found, skipping $T"
7
- exit 0
8
- fi
9
- if test x"$(uname -s)" != xLinux
10
- then
11
- t_info "Linux is the only supported OS for $T"
12
- exit 0
13
- fi
14
-
15
- # these buffer internally in external libraries, so we can't detect when
16
- # to use TCP_CORK
17
- skip_models EventMachine NeverBlock
18
- skip_models StreamResponseEpoll
19
- skip_models Coolio CoolioThreadPool CoolioThreadSpawn
20
- skip_models Revactor Rev RevThreadPool RevThreadSpawn
21
-
22
- # not sure why, but we don't have time to care about Ruby 1.8 too much
23
- case $RUBY_VERSION in
24
- 1.8.*) skip_models WriterThreadSpawn WriterThreadPool ;;
25
- esac
26
-
27
- t_plan 13 "Kgio autopush tests"
28
-
29
- start_strace () {
30
- # dbgcat strace_out
31
- > $strace_out
32
- sleep 1
33
- strace -p $worker_pid -e '!futex' -f -o $strace_out &
34
- strace_pid=$!
35
- while ! test -s $strace_out; do sleep 1; done
36
- }
37
-
38
- check_TCP_CORK () {
39
- nr=0
40
- while test 2 -gt $(grep TCP_CORK $strace_out | count_lines)
41
- do
42
- nr=$(( $nr + 1 ))
43
- if test $nr -gt 30
44
- then
45
- dbgcat strace_out
46
- die "waited too long ($nr seconds) for TCP_CORK"
47
- fi
48
- sleep 1
49
- done
50
-
51
- test 2 -eq $(grep TCP_CORK $strace_out | count_lines)
52
- fgrep 'SOL_TCP, TCP_CORK, [0],' $strace_out
53
- fgrep 'SOL_TCP, TCP_CORK, [1],' $strace_out
54
- }
55
-
56
- t_begin "setup and start" && {
57
- rainbows_setup $model 1 1
58
- rtmpfiles strace_out
59
- ed -s $unicorn_config <<EOF
60
- ,s/^listen.*/listen "$listen", :tcp_nodelay => true, :tcp_nopush => true/
61
- w
62
- EOF
63
- rainbows -D large-file-response.ru -c $unicorn_config -E none
64
- rainbows_wait_start
65
- }
66
-
67
- t_begin "read worker pid" && {
68
- worker_pid=$(curl -sSf http://$listen/pid)
69
- kill -0 $worker_pid
70
- }
71
-
72
- t_begin "start strace on worker" && start_strace
73
-
74
- t_begin "reading RSS uncorks" && {
75
- curl -sSf http://$listen/rss >/dev/null
76
- }
77
-
78
- t_begin "restart strace on worker" && {
79
- kill $strace_pid
80
- wait
81
- start_strace
82
- }
83
-
84
- t_begin "reading static file uncorks" && {
85
- curl -sSf http://$listen/random_blob >/dev/null
86
- check_TCP_CORK
87
- }
88
-
89
- t_begin "stop strace on worker" && {
90
- kill $strace_pid
91
- wait
92
- }
93
-
94
- t_begin "enable sendfile" && {
95
- echo >> $unicorn_config 'require "sendfile"'
96
- kill -HUP $rainbows_pid
97
- test xSTART = x"$(cat $fifo)"
98
- }
99
-
100
- t_begin "reread worker pid" && {
101
- worker_pid=$(curl -sSf http://$listen/pid)
102
- kill -0 $worker_pid
103
- }
104
-
105
- t_begin "restart strace on the worker" && start_strace
106
-
107
- t_begin "HTTP/1.x GET on static file with sendfile uncorks" && {
108
- curl -sSf http://$listen/random_blob >/dev/null
109
- check_TCP_CORK
110
- }
111
-
112
- t_begin "killing succeeds" && {
113
- kill $strace_pid
114
- wait
115
- # dbgcat strace_out
116
- kill $rainbows_pid
117
- }
118
-
119
- t_begin "check stderr" && check_stderr
120
-
121
- t_done