nutcracker-web 0.0.11 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -2
- data/bin/nutcracker-web +10 -1
- data/lib/nutcracker/web.rb +7 -3
- data/lib/nutcracker/web/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a68ef6fab5dfe24a946ad3635ead23d202fe0b1a
|
4
|
+
data.tar.gz: b1616956dae393130c512b7a4647d8ca11efd1bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c5c2ff1a47e7f7f450e6c0bb7f7f49b8ea3c487acb0c37ba07ab61aa879274586483e3eb5369bd326c65e78e596b2d648d2b6bd3cb311a7a42a2b8078a8a4f5
|
7
|
+
data.tar.gz: 76dadbaf0103052dc6cf640068aa7248fb359bdc3e2eb9a87abe3151079109b7e06b8c7d39818e7020c5c9f8f658b7e4a65f8862d6c3f49cca7f0b1cabfd5738
|
data/README.md
CHANGED
@@ -20,8 +20,7 @@ $ nutcracker-web --help
|
|
20
20
|
Usage: nutcracker-web [web-options] -- [nutcracker-options]
|
21
21
|
|
22
22
|
[web-options]
|
23
|
-
|
24
|
-
-s, --stats-port PORT Nutcracker stats port - 22222
|
23
|
+
-u, --stats-uri URI Nutcracker stats uri, default is tcp://localhost:22222
|
25
24
|
-c, --config FILE Nutcracker cluster config file
|
26
25
|
-p, --port PORT Web interface listening port
|
27
26
|
-b, --backend BACKEND Web server to use ( needs to be Rack compliant )
|
data/bin/nutcracker-web
CHANGED
@@ -3,13 +3,14 @@ $:.unshift File.expand_path('../../lib',__FILE__)
|
|
3
3
|
|
4
4
|
require 'nutcracker'
|
5
5
|
require 'nutcracker/web'
|
6
|
+
require 'nutcracker/web/version'
|
6
7
|
require 'optparse'
|
7
8
|
require 'fileutils'
|
8
9
|
require 'socket'
|
9
10
|
require 'open3'
|
10
11
|
require 'uri'
|
11
12
|
|
12
|
-
options = { stats_uri: URI("tcp://localhost:22222") }
|
13
|
+
options = { stats_uri: URI("tcp://localhost:22222"), context: "/"}
|
13
14
|
|
14
15
|
OptionParser.new do |opts|
|
15
16
|
opts.set_summary_indent " "
|
@@ -34,6 +35,10 @@ OptionParser.new do |opts|
|
|
34
35
|
opts.on("-b","--backend BACKEND", "Web server to use ( needs to be Rack compliant )") do |v|
|
35
36
|
options[:server] = v
|
36
37
|
end
|
38
|
+
|
39
|
+
opts.on("-x", "--context CONTEXT", "Web Interface URL context, default /") do |v|
|
40
|
+
options[:context] = "/#{v}".squeeze("/")
|
41
|
+
end
|
37
42
|
|
38
43
|
opts.on("-d", "--daemonize","run in background") do
|
39
44
|
options[:daemonize] = true
|
@@ -47,6 +52,10 @@ OptionParser.new do |opts|
|
|
47
52
|
options[:max_memory] = v
|
48
53
|
end
|
49
54
|
|
55
|
+
opts.on("-v", "--version", "Print version and exit") do
|
56
|
+
abort "Nutcracker-Web, Ver. #{Nutcracker::Web::VERSION}"
|
57
|
+
end
|
58
|
+
|
50
59
|
opts.on("-i","--pid FILE","pid file") do |v|
|
51
60
|
options[:pid] = v
|
52
61
|
options[:nutcracker_pid] = v + ".nutcracker"
|
data/lib/nutcracker/web.rb
CHANGED
@@ -2,18 +2,22 @@ require "rack"
|
|
2
2
|
|
3
3
|
module Nutcracker
|
4
4
|
module Web
|
5
|
-
def self.start(nutcracker,
|
5
|
+
def self.start(nutcracker, o = {})
|
6
6
|
@thread = Thread.new do
|
7
7
|
Thread.current.abort_on_exception=true
|
8
|
+
|
9
|
+
app = Rack::URLMap.new(o[:context] =>
|
10
|
+
App.new(nutcracker, o.fetch(:external_servers,[])))
|
11
|
+
|
8
12
|
Rack::Server.start(
|
9
13
|
{
|
10
|
-
:app =>
|
14
|
+
:app => app,
|
11
15
|
:environment => 'production',
|
12
16
|
:pid => nil,
|
13
17
|
:Port => 9292,
|
14
18
|
:Host => '0.0.0.0',
|
15
19
|
:AccessLog => []
|
16
|
-
}.merge(
|
20
|
+
}.merge(o)
|
17
21
|
)
|
18
22
|
end
|
19
23
|
self
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nutcracker-web
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eran Barak Levi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|