jubilee 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile +1 -1
- data/Gemfile.lock +1 -7
- data/README.md +21 -21
- data/VERSION +1 -1
- data/java/src/org/jruby/jubilee/RackApplication.java +3 -11
- data/java/src/org/jruby/jubilee/Server.java +1 -1
- data/lib/jubilee/cli.rb +17 -4
- data/lib/jubilee/configuration.rb +7 -5
- data/lib/jubilee/jubilee.jar +0 -0
- data/lib/jubilee/server.rb +2 -2
- data/test/jubilee/test_server.rb +1 -1
- metadata +6 -8
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -15,16 +15,11 @@ GEM
|
|
15
15
|
git (>= 1.2.5)
|
16
16
|
rake
|
17
17
|
rdoc
|
18
|
-
json (1.7.5)
|
19
18
|
json (1.7.5-java)
|
20
19
|
listen (0.5.3)
|
21
20
|
lumberjack (1.0.2)
|
22
21
|
method_source (0.8.1)
|
23
22
|
multipart-post (1.1.5)
|
24
|
-
pry (0.9.10)
|
25
|
-
coderay (~> 1.0.5)
|
26
|
-
method_source (~> 0.8)
|
27
|
-
slop (~> 3.3.1)
|
28
23
|
pry (0.9.10-java)
|
29
24
|
coderay (~> 1.0.5)
|
30
25
|
method_source (~> 0.8)
|
@@ -32,7 +27,6 @@ GEM
|
|
32
27
|
spoon (~> 0.0)
|
33
28
|
rack (1.4.1)
|
34
29
|
rake (10.0.2)
|
35
|
-
rcov (0.9.11)
|
36
30
|
rcov (0.9.11-java)
|
37
31
|
rdoc (3.12)
|
38
32
|
json (~> 1.4)
|
@@ -49,6 +43,6 @@ DEPENDENCIES
|
|
49
43
|
jeweler
|
50
44
|
multipart-post
|
51
45
|
pry
|
52
|
-
rack
|
46
|
+
rack (~> 1.4.1)
|
53
47
|
rcov
|
54
48
|
spoon
|
data/README.md
CHANGED
@@ -3,23 +3,16 @@ Jubilee
|
|
3
3
|
|
4
4
|
A fast rack server build upon [vertx](http://vertx.io)
|
5
5
|
|
6
|
-
Known Issues
|
7
|
-
----------
|
8
|
-
|
9
|
-
* Direct use of HttpServerResponse object in Ruby Response class is
|
10
|
-
potentially slow. see [Improving Java Integration
|
11
|
-
Performance](https://github.com/jruby/jruby/wiki/ImprovingJavaIntegrationPerformance)
|
12
|
-
|
13
6
|
TODO
|
14
7
|
----------
|
15
8
|
|
16
|
-
* Daemon mode
|
17
|
-
*
|
9
|
+
* Daemon mode (WIP)
|
10
|
+
* [TeeInput](https://github.com/defunkt/unicorn/blob/master/lib/unicorn/tee_input.rb)
|
18
11
|
* Site(WIP)
|
19
12
|
* benchmark: Get, static file, post
|
20
13
|
|
21
14
|
* EventBus
|
22
|
-
* WebSocket
|
15
|
+
* WebSocket
|
23
16
|
|
24
17
|
Fixed
|
25
18
|
-----------
|
@@ -39,23 +32,30 @@ Installation
|
|
39
32
|
```gem install jubilee```
|
40
33
|
|
41
34
|
Performance
|
42
|
-
===========
|
43
|
-
|
44
|
-
Get request for test/sinatra_app
|
45
35
|
-----------
|
46
36
|
|
47
|
-
|
48
|
-
(ab -c 20 -n 10000)
|
37
|
+
Get request for [sinatra test app](https://github.com/isaiah/jubilee/tree/master/test/sinatra_app):
|
49
38
|
|
50
|
-
|
51
|
-
puma: 1327rps after warm
|
39
|
+
with ```ab -c 20 -n 10000```
|
52
40
|
|
53
|
-
|
41
|
+
1750rps after warm
|
54
42
|
|
55
|
-
|
56
|
-
-----------
|
43
|
+
unicorn (worker 10): 1440rps
|
57
44
|
|
58
45
|
Requirement
|
59
|
-
|
46
|
+
-----------
|
60
47
|
|
61
48
|
JRuby '~> 1.7.0'
|
49
|
+
|
50
|
+
License
|
51
|
+
--------
|
52
|
+
|
53
|
+
The same as JRuby and vertx
|
54
|
+
|
55
|
+
|
56
|
+
Kudos
|
57
|
+
--------
|
58
|
+
|
59
|
+
Inspired by [this
|
60
|
+
post](http://blog.jayfields.com/2012/05/how-i-open-source.html), I
|
61
|
+
decide to release it early
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
@@ -7,7 +7,6 @@ import org.jruby.jubilee.impl.RubyIORackInput;
|
|
7
7
|
import org.jruby.runtime.builtin.IRubyObject;
|
8
8
|
import org.vertx.java.core.Handler;
|
9
9
|
import org.vertx.java.core.SimpleHandler;
|
10
|
-
import org.vertx.java.core.Vertx;
|
11
10
|
import org.vertx.java.core.buffer.Buffer;
|
12
11
|
import org.vertx.java.core.http.HttpServerRequest;
|
13
12
|
|
@@ -23,15 +22,13 @@ public class RackApplication {
|
|
23
22
|
private IRubyObject app;
|
24
23
|
private boolean ssl;
|
25
24
|
private Buffer bodyBuf;
|
26
|
-
private Vertx vertx;
|
27
25
|
|
28
26
|
private ExecutorService exec;
|
29
27
|
|
30
|
-
public RackApplication(
|
28
|
+
public RackApplication(IRubyObject app, boolean ssl) {
|
31
29
|
this.app = app;
|
32
30
|
this.ssl = ssl;
|
33
31
|
bodyBuf = new Buffer(0);
|
34
|
-
this.vertx = vertx;
|
35
32
|
exec = Executors.newCachedThreadPool();
|
36
33
|
}
|
37
34
|
|
@@ -51,13 +48,8 @@ public class RackApplication {
|
|
51
48
|
RackInput input = new RubyIORackInput(runtime, bodyBuf, bodyLatch);
|
52
49
|
RackEnvironment env = new DefaultRackEnvironment(runtime, request, input, ssl);
|
53
50
|
IRubyObject result = app.callMethod(runtime.getCurrentContext(), "call", env.getEnv());
|
54
|
-
|
55
|
-
|
56
|
-
@Override
|
57
|
-
public void handle() {
|
58
|
-
response.respond(request.response);
|
59
|
-
}
|
60
|
-
});
|
51
|
+
RackResponse response = (RackResponse) JavaEmbedUtils.rubyToJava(runtime, result, RackResponse.class);
|
52
|
+
response.respond(request.response);
|
61
53
|
}
|
62
54
|
};
|
63
55
|
exec.execute(task);
|
@@ -42,7 +42,7 @@ public class Server extends RubyObject {
|
|
42
42
|
if (args.length > 2) {
|
43
43
|
this.ssl = args[2].isTrue();
|
44
44
|
}
|
45
|
-
this.app = new RackApplication(
|
45
|
+
this.app = new RackApplication(args[0], this.ssl);
|
46
46
|
if (args.length > 3)
|
47
47
|
this.keyStorePath = args[3].toString();
|
48
48
|
if (args.length > 4)
|
data/lib/jubilee/cli.rb
CHANGED
@@ -22,7 +22,7 @@ module Jubilee
|
|
22
22
|
parse_options
|
23
23
|
@config = Jubilee::Configuration.new(@options)
|
24
24
|
@config.load
|
25
|
-
server = Jubilee::Server.new(@config.app, {port: @config.port, ssl: @config.ssl})
|
25
|
+
server = Jubilee::Server.new(@config.app, {port: @config.port, ssl: @config.ssl, keystore_path: @config.keystore_path, keystore_password: @config.keystore_password})
|
26
26
|
server.start
|
27
27
|
puts "Jubilee is listening on port #{@config.port}, press Ctrl+C to quit"
|
28
28
|
starter = org.jruby.jubilee.deploy.Starter.new
|
@@ -38,6 +38,9 @@ module Jubilee
|
|
38
38
|
environment: "development"
|
39
39
|
}
|
40
40
|
@parser = OptionParser.new do |o|
|
41
|
+
o.separator ""
|
42
|
+
o.separator "Server options:"
|
43
|
+
|
41
44
|
#o.on "-c", "--config PATH", "Load PATH as a config file" do |arg|
|
42
45
|
# @options[:config_file] = arg
|
43
46
|
#end
|
@@ -50,15 +53,25 @@ module Jubilee
|
|
50
53
|
o.on "-p", "--port PORT", "Defind which PORT the server should bind" do |arg|
|
51
54
|
@options[:port] = arg
|
52
55
|
end
|
56
|
+
o.on "-e", "--environment ENV", "Rack environment" do |arg|
|
57
|
+
@options[:environment] = arg
|
58
|
+
end
|
59
|
+
o.separator ""
|
60
|
+
o.separator "SSL options:"
|
53
61
|
o.on "--ssl", "Enable SSL connection" do
|
54
62
|
@options[:ssl] = true
|
55
63
|
end
|
64
|
+
o.on "--ssl-keystore PATH", "SSL keystore path" do |arg|
|
65
|
+
@options[:keystore_path] = arg
|
66
|
+
end
|
67
|
+
o.on "--ssl-password PASS", "SSL keystore password" do |arg|
|
68
|
+
@options[:keystore_password] = arg
|
69
|
+
end
|
70
|
+
o.separator ""
|
71
|
+
o.separator "Common options:"
|
56
72
|
o.on "--verbose", "Log low level debug information" do
|
57
73
|
@options[:debug] = true
|
58
74
|
end
|
59
|
-
o.on "-e", "--environment ENV", "Rack environment" do |arg|
|
60
|
-
@options[:environment] = arg
|
61
|
-
end
|
62
75
|
o.on "-q", "--quiet" do
|
63
76
|
@options[:quiet] = true
|
64
77
|
end
|
@@ -25,11 +25,14 @@ module Jubilee
|
|
25
25
|
def ssl
|
26
26
|
@options[:ssl]
|
27
27
|
end
|
28
|
+
|
29
|
+
def keystore_path
|
30
|
+
@options[:keystore_path]
|
31
|
+
end
|
28
32
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
#end
|
33
|
+
def keystore_password
|
34
|
+
@options[:keystore_password]
|
35
|
+
end
|
33
36
|
|
34
37
|
private
|
35
38
|
def load_rack_adapter(options, &block)
|
@@ -45,7 +48,6 @@ module Jubilee
|
|
45
48
|
end
|
46
49
|
end
|
47
50
|
app
|
48
|
-
#Rack::Lint.new(Rack::CommonLogger.new(app, STDOUT))
|
49
51
|
end
|
50
52
|
|
51
53
|
end
|
data/lib/jubilee/jubilee.jar
CHANGED
Binary file
|
data/lib/jubilee/server.rb
CHANGED
@@ -3,10 +3,10 @@ module Jubilee
|
|
3
3
|
def initialize(app, opts = {})
|
4
4
|
options = {port: 3215, ssl: false}.merge(opts)
|
5
5
|
if (options[:ssl])
|
6
|
-
if options[:
|
6
|
+
if options[:keystore_path].nil?
|
7
7
|
raise ArgumentError, "Please provide a keystore for ssl"
|
8
8
|
else
|
9
|
-
super(Application.new(app), options[:port], options[:ssl], options[:
|
9
|
+
super(Application.new(app), options[:port], options[:ssl], options[:keystore_path], options[:keystore_password])
|
10
10
|
end
|
11
11
|
else
|
12
12
|
super(Application.new(app), options[:port])
|
data/test/jubilee/test_server.rb
CHANGED
@@ -46,7 +46,7 @@ class TestJubileeServer < MiniTest::Unit::TestCase
|
|
46
46
|
def test_url_scheme_for_https
|
47
47
|
app = lambda { |env| [200, {}, [env['rack.url_scheme']]] }
|
48
48
|
server = Jubilee::Server.new(app, {port:@port, ssl:true,
|
49
|
-
|
49
|
+
keystore_path: File.join(File.dirname(__FILE__), "../../examples/jubilee/server-keystore.jks"),
|
50
50
|
keystore_password: "wibble"})
|
51
51
|
server.start
|
52
52
|
http = Net::HTTP.new @host, @port
|
metadata
CHANGED
@@ -2,30 +2,28 @@
|
|
2
2
|
name: jubilee
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.
|
5
|
+
version: 0.2.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Isaiah Peng
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-12-
|
12
|
+
date: 2012-12-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rack
|
16
16
|
version_requirements: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- -
|
18
|
+
- - ~>
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version:
|
21
|
-
MA==
|
20
|
+
version: 1.4.1
|
22
21
|
none: false
|
23
22
|
requirement: !ruby/object:Gem::Requirement
|
24
23
|
requirements:
|
25
|
-
- -
|
24
|
+
- - ~>
|
26
25
|
- !ruby/object:Gem::Version
|
27
|
-
version:
|
28
|
-
MA==
|
26
|
+
version: 1.4.1
|
29
27
|
none: false
|
30
28
|
prerelease: false
|
31
29
|
type: :runtime
|