nutcracker-web 0.0.16 → 0.0.22

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
  SHA256:
3
- metadata.gz: 5cfaf35ebfe172724c2abb8d91ac273112eaec29b00cecc9e4885af424ad17e9
4
- data.tar.gz: 4510246fea3f44312311b80b8029d193599f045c888eaed8721ae6d8b71f2b0e
3
+ metadata.gz: 94b0d83f65e6ff29016550dd2a8367daec0accd56057d2f0f16b3e6ada3baa22
4
+ data.tar.gz: d6de0c293a39e13244855033a53d1f93804dcabc64947f4aed0509c3edbe0d94
5
5
  SHA512:
6
- metadata.gz: fc58f9eca3e31f8ffdb9ecbf52bfea5cfc580c4f2a61f2c5ff148ee301cf9193f563e00cc51160d54616b0ea4af169c8751f821761714ad25bc4d67920851d8c
7
- data.tar.gz: 8de6d844c4fc9355ed27a483211c0ad93e3e364c88b7497d65598e09dcd19e485cbf2b891ca38a1cf0e703ed2c6e436145cd5f429f8981e9a1a38155a3ad114d
6
+ metadata.gz: 63c4f8f59ca50624de119404ac0376f7cdaff825dd9c5e2d66de9d71219f2b2ff0a6f3029c06c28bc25de0eaa73c8e9697ec03b43965c15866926a01eeddc65e
7
+ data.tar.gz: 61e440f29b028297a37618023531558e1f580652e83b03297926cebfd8cca1cb8414bbc9468fbe1ede6c6195debc5c43c70a13aa7c5f6b9396a69fbeaf9c5878
data/Gemfile CHANGED
@@ -10,3 +10,4 @@ gem 'uglifier'
10
10
  gem 'nutcracker', ">=0.4.1.20"
11
11
  gem "rack", ">= 2.0.8"
12
12
  gem 'rake'
13
+ gem 'gem-release'
data/Gemfile.lock CHANGED
@@ -6,7 +6,7 @@ GEM
6
6
  execjs
7
7
  coffee-script-source (1.12.2)
8
8
  concurrent-ruby (1.0.5)
9
- daemons (1.2.6)
9
+ daemons (1.4.1)
10
10
  eco (1.0.0)
11
11
  coffee-script
12
12
  eco-source
@@ -14,13 +14,14 @@ GEM
14
14
  eco-source (1.1.0.rc.1)
15
15
  eventmachine (1.2.7)
16
16
  execjs (2.7.0)
17
+ gem-release (2.2.2)
17
18
  haml (5.0.4)
18
19
  temple (>= 0.8.0)
19
20
  tilt
20
21
  mustermann (1.0.3)
21
22
  nutcracker (0.4.1.22)
22
23
  redis
23
- rack (2.2.2)
24
+ rack (2.2.3)
24
25
  rack-protection (2.0.4)
25
26
  rack
26
27
  rake (13.0.1)
@@ -34,7 +35,7 @@ GEM
34
35
  concurrent-ruby (~> 1.0)
35
36
  rack (> 1, < 3)
36
37
  temple (0.8.0)
37
- thin (1.7.2)
38
+ thin (1.8.1)
38
39
  daemons (~> 1.0, >= 1.0.9)
39
40
  eventmachine (~> 1.0, >= 1.0.4)
40
41
  rack (>= 1, < 3)
@@ -48,6 +49,7 @@ PLATFORMS
48
49
  DEPENDENCIES
49
50
  coffee-script
50
51
  eco
52
+ gem-release
51
53
  haml
52
54
  nutcracker (>= 0.4.1.20)
53
55
  rack (>= 2.0.8)
@@ -58,4 +60,4 @@ DEPENDENCIES
58
60
  uglifier
59
61
 
60
62
  BUNDLED WITH
61
- 1.17.2
63
+ 1.17.3
@@ -25,15 +25,26 @@ module Nutcracker
25
25
  end
26
26
 
27
27
  get '/status' do
28
+ content_type :json
29
+ # return array of maps each map is {instance_ip => [unresposive_node_ports],instance_ip => [unresposive_node_ports]}
30
+ # exaple: [{"127.0.0.1"=>["6370", "6371", "6372", "6373"]}, {"192.168.1.114"=>["6370"]}]
31
+ # return status 500 if there are unresposive_node in the list, if empty return 200
32
+
28
33
  @nutcracker.
29
34
  config.
30
35
  values.
31
- map {|x| x["servers"] + [x["listen"]]}.
36
+ map { |x| x["servers"] + [x["listen"]] }.
37
+ flatten.
38
+ map { |x| x.split(":") }.
39
+ map { |host, port| Thread.new { { host: host, port: port, ok: (TCPSocket.new(host,port).close.nil? rescue false) } } }.
40
+ map(&:value).
41
+ flatten.
42
+ reject { |node_health| node_health[:ok]}. #cleare all healthy nodes from the nodes array
43
+ tap { |unhealthy_nodes| status(500) unless unhealthy_nodes.empty? }.
44
+ group_by{|k| k[:host]}.
45
+ map {|k,v| [k=>v.map { |v| v[:port] }] }.
32
46
  flatten.
33
- map {|x| x.split(":")}.
34
- map {|host, port| Thread.new {TCPSocket.new(host,port).close.nil? rescue false}}.map(&:value).
35
- all?.
36
- tap {|x| status(x ? 200 : 401)}
47
+ to_json
37
48
  end
38
49
 
39
50
  get '/overview.json' do
@@ -62,7 +73,7 @@ module Nutcracker
62
73
  {"clusters" => []}.tap do |data|
63
74
  Queue.new.tap do |q|
64
75
  @external_servers.map do |server|
65
- Thread.new { q.push JSON.parse(open("http://#{server}/overview.json").read) }
76
+ Thread.new { q.push JSON.parse(open("http://#{server}/overview.json").read) rescue nil }
66
77
  end.each(&:join)
67
78
  data["clusters"] += q.pop["clusters"] while not q.empty?
68
79
  end # queue
@@ -1,5 +1,5 @@
1
1
  module Nutcracker
2
2
  module Web
3
- VERSION="0.0.16"
3
+ VERSION="0.0.22"
4
4
  end
5
5
  end
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.16
4
+ version: 0.0.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eran Barak Levi
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-27 00:00:00.000000000 Z
11
+ date: 2021-12-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest
@@ -123,12 +123,10 @@ files:
123
123
  - lib/nutcracker/web.rb
124
124
  - lib/nutcracker/web/app.rb
125
125
  - lib/nutcracker/web/version.rb
126
- - public/assets/application.css
127
- - public/assets/application.js
128
126
  homepage: http://www.kontera.com
129
127
  licenses: []
130
128
  metadata: {}
131
- post_install_message:
129
+ post_install_message:
132
130
  rdoc_options: []
133
131
  require_paths:
134
132
  - lib
@@ -143,8 +141,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
143
141
  - !ruby/object:Gem::Version
144
142
  version: '0'
145
143
  requirements: []
146
- rubygems_version: 3.0.1
147
- signing_key:
144
+ rubygems_version: 3.0.9
145
+ signing_key:
148
146
  specification_version: 4
149
147
  summary: Nutcracker Web Interface
150
148
  test_files: []