anycable 0.6.1 → 0.6.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +43 -2
  3. data/bin/anycable +1 -1
  4. data/bin/anycabled +30 -0
  5. data/lib/anycable/cli.rb +1 -1
  6. data/lib/anycable/config.rb +4 -2
  7. data/lib/anycable/exceptions_handling.rb +9 -3
  8. data/lib/anycable/handler/capture_exceptions.rb +4 -4
  9. data/lib/anycable/server.rb +22 -6
  10. data/lib/anycable/version.rb +1 -1
  11. metadata +5 -53
  12. data/.github/ISSUE_TEMPLATE.md +0 -25
  13. data/.github/PULL_REQUEST_TEMPLATE.md +0 -31
  14. data/.gitignore +0 -40
  15. data/.hound.yml +0 -3
  16. data/.rubocop.yml +0 -71
  17. data/.travis.yml +0 -16
  18. data/Gemfile +0 -8
  19. data/Makefile +0 -5
  20. data/PITCHME.md +0 -139
  21. data/PITCHME.yaml +0 -1
  22. data/Rakefile +0 -8
  23. data/anycable.gemspec +0 -35
  24. data/assets/Memory3.png +0 -0
  25. data/assets/Memory5.png +0 -0
  26. data/assets/RTT3.png +0 -0
  27. data/assets/RTT5.png +0 -0
  28. data/assets/Scheme1.png +0 -0
  29. data/assets/Scheme2.png +0 -0
  30. data/assets/cpu_chart.gif +0 -0
  31. data/assets/cpu_chart2.gif +0 -0
  32. data/assets/evlms.png +0 -0
  33. data/benchmarks/.gitignore +0 -2
  34. data/benchmarks/2017-02-12.md +0 -308
  35. data/benchmarks/2018-03-04.md +0 -192
  36. data/benchmarks/2018-05-27-rpc-bench.md +0 -57
  37. data/benchmarks/2018-10-27.md +0 -181
  38. data/benchmarks/HowTo.md +0 -23
  39. data/benchmarks/ansible.cfg +0 -9
  40. data/benchmarks/assets/2018-10-27-action-cable-rss.png +0 -0
  41. data/benchmarks/assets/2018-10-27-action-cable-rtt.png +0 -0
  42. data/benchmarks/assets/2018-10-27-anycable-rss.png +0 -0
  43. data/benchmarks/assets/2018-10-27-anycable-rtt.png +0 -0
  44. data/benchmarks/assets/2018-10-27-async-rss.png +0 -0
  45. data/benchmarks/assets/2018-10-27-async-rtt.png +0 -0
  46. data/benchmarks/assets/2018-10-27-falcon-cable-rss.png +0 -0
  47. data/benchmarks/assets/2018-10-27-falcon-cable-rtt.png +0 -0
  48. data/benchmarks/assets/2018-10-27-iodine-cable-rss.png +0 -0
  49. data/benchmarks/assets/2018-10-27-iodine-cable-rtt.png +0 -0
  50. data/benchmarks/assets/2018-10-27-plezi-rss.png +0 -0
  51. data/benchmarks/assets/2018-10-27-plezi-rtt.png +0 -0
  52. data/benchmarks/bench.png +0 -0
  53. data/benchmarks/benchmark.yml +0 -69
  54. data/benchmarks/hosts +0 -5
  55. data/benchmarks/rtt_plot.py +0 -74
  56. data/benchmarks/rtt_plot_test.py +0 -16
  57. data/benchmarks/servers.yml +0 -58
  58. data/circle.yml +0 -8
  59. data/etc/bug_report_template.rb +0 -76
  60. data/protos/rpc.proto +0 -55
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cff0f2d872c485fc15f3046b2fdacbb9cfce2d3e7e312b8f0461dc20f2e52a41
4
- data.tar.gz: 586fe6c97d6063512020bde66aaf3a0d8c2dc4a33ca508beb67295a18f121618
3
+ metadata.gz: 9044b4ce81ea84415ac896ea46c96ad55da523edc3251aa07d7e2490c3a4745e
4
+ data.tar.gz: 1bfe649fe5bfac2276496668f7fa3e588f38a6c1b0e603d16a3b3695f08a8363
5
5
  SHA512:
6
- metadata.gz: f055860a0a5a10eb3954bc6dd5088e66cc948eefe3b853a6fee63ea9ed5e7fafa2827e4fda6f67eeca3efe6efccc2d69eb59f6e8ee11d969be4ef027e73727a8
7
- data.tar.gz: c53d21ea1beb3443451839ceb69e318c840b04564e35379adebd65ccfc4f708666c8c78514a805f16e564508aa190ad81a27329334826016f2bc08bc5aa16fde
6
+ metadata.gz: 415117187f998d7704e9a2d1a305b0fb8cc55b2cdaf58a37292043675bc499e32b806cd2a5a574210f54f16ea91fa7f072cc87d37afec860f13c1abbc9978813
7
+ data.tar.gz: 5ed3809fe24065e2d029e4cfd92f794112ed1b08cf3ed312e56f5a97cd5e23b51be4f9425303e55b18d9cb41d9143ce639ab60556c34511746994ba9c4d78027
@@ -2,6 +2,47 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## 0.6.2 (2019-03-15)
6
+
7
+ - Add GRPC service method name and message content to exception notifications ([@sponomarev][])
8
+
9
+ `Anycable.capture_exception` allows accessing GRPC service method name and message content
10
+ on which an exception was captured. It can be used for exceptions grouping in your tracker and
11
+ providing additional data to investigate a root of a problem.
12
+
13
+ Example:
14
+
15
+ ```ruby
16
+ AnyCable.capture_exception do |ex, method, message|
17
+ Honeybadger.notify(ex, component: "any_cable", action: method, params: message)
18
+ end
19
+ ```
20
+
21
+ Usage of a handler proc with just a single argument is preserved for the sake of compatibility.
22
+
23
+ - Add deprecation warning to default host usage ([@sponomarev][])
24
+
25
+ Exposing AnyCable publicly is considered to be harmful and planned to be changed
26
+ in future versions.
27
+
28
+ - Allow running the server as a detachable daemon ([@sponomarev][])
29
+
30
+ Server is fully managed by the binary itself.
31
+
32
+ ```
33
+ # Start anycable daemon
34
+ $ bundle exec anycabled start
35
+
36
+ # Pass cli options to anycable through daemon. Separate daemon options and anycable options with `--`
37
+ $ bundle exec anycabled start -- --rpc-host 127.0.0.1:31337
38
+
39
+ # Stop anycable daemon
40
+ $ bundle exec anycabled stop
41
+
42
+ # See more anycable daemon options
43
+ $ bundle exec anycabled
44
+ ```
45
+
5
46
  ## 0.6.1 (2019-01-05)
6
47
 
7
48
  - [Fix #63](https://github.com/anycable/anycable-rails/issues/63) Load `anyway_config` after application boot to make sure that all frameworks dependent functionality is loaded. ([@palkan][])
@@ -116,7 +157,7 @@ Minor fixes.
116
157
 
117
158
  - [#28](https://github.com/anycable/anycable/issues/28) Support arbitrary headers. ([@palkan][])
118
159
 
119
- Previously we hardcoded only "Cookie" header. Now we add all passed headers by WebSocket server to request env.
160
+ Previously we hardcoded only "Cookie" header. Now we add all passed headers by WebSocket server to request env.
120
161
 
121
162
  - [#27](https://github.com/anycable/anycable/issues/27) Add `error_msg` to RPC responses. ([@palkan][])
122
163
 
@@ -130,7 +171,7 @@ We provide `error_msg` only when request status is `ERROR`.
130
171
 
131
172
  - [#25](https://github.com/anycable/anycable/issues/25) Improve logging and exceptions handling. ([@palkan][])
132
173
 
133
- Default logger logs to STDOUT with `info` level by default but can be configured to log to file with
174
+ Default logger logs to STDOUT with `info` level by default but can be configured to log to file with
134
175
  any severity.
135
176
 
136
177
  GRPC logging is turned off by default (can be turned on through `log_grpc` configuration parameter).
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require_relative "../lib/anycable/cli"
3
+ require "anycable/cli"
4
4
 
5
5
  begin
6
6
  cli = AnyCable::CLI.new
@@ -0,0 +1,30 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "anycable/cli"
4
+
5
+ begin
6
+ require "daemons"
7
+ rescue LoadError
8
+ raise <<~MSG
9
+ You need to add gem 'daemons' to your Gemfile if you want to use `anycabled`:
10
+
11
+ # Gemfile
12
+ gem "daemons", "~> 1.3", require: false
13
+ MSG
14
+ end
15
+
16
+ options = {
17
+ dir: "tmp/pids",
18
+ log_output: false
19
+ }
20
+
21
+ # Preserve current directory. We need it inside the server.
22
+ current_dir = Dir.pwd
23
+
24
+ # Clean ARGV from daemon command and args
25
+ _, _, args = Daemons::Controller.split_argv(ARGV)
26
+
27
+ Daemons.run_proc("anycable", options) do
28
+ Dir.chdir current_dir
29
+ AnyCable::CLI.new.run(args)
30
+ end
@@ -23,7 +23,7 @@ module AnyCable
23
23
  attr_reader :server, :health_server
24
24
 
25
25
  # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
26
- def run(args)
26
+ def run(args = {})
27
27
  @at_stop = []
28
28
 
29
29
  extra_options = parse_cli_options!(args)
@@ -8,10 +8,12 @@ module AnyCable
8
8
  class Config < Anyway::Config
9
9
  config_name :anycable
10
10
 
11
+ DefaultHostWrapper = Class.new(String)
12
+
11
13
  attr_config(
12
14
  ### gRPC options
13
- rpc_host: "[::]:50051",
14
- # For defaults see https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/generic/rpc_server.rb#L162-L170
15
+ rpc_host: DefaultHostWrapper.new("[::]:50051"),
16
+ # For defaults see https://github.com/grpc/grpc/blob/51f0d35509bcdaba572d422c4f856208162022de/src/ruby/lib/grpc/generic/rpc_server.rb#L186-L216
15
17
  rpc_pool_size: GRPC::RpcServer::DEFAULT_POOL_SIZE,
16
18
  rpc_max_waiting_requests: GRPC::RpcServer::DEFAULT_MAX_WAITING_REQUESTS,
17
19
  rpc_poll_period: GRPC::RpcServer::DEFAULT_POLL_PERIOD,
@@ -4,15 +4,15 @@ module AnyCable
4
4
  module ExceptionsHandling # :nodoc:
5
5
  class << self
6
6
  def add_handler(block)
7
- handlers << block
7
+ handlers << procify(block)
8
8
  end
9
9
 
10
10
  alias << add_handler
11
11
 
12
- def notify(exp)
12
+ def notify(exp, method_name, message)
13
13
  handlers.each do |handler|
14
14
  begin
15
- handler.call(exp)
15
+ handler.call(exp, method_name, message)
16
16
  rescue StandardError => exp
17
17
  AnyCable.logger.error "!!! EXCEPTION HANDLER THREW AN ERROR !!!"
18
18
  AnyCable.logger.error exp
@@ -23,6 +23,12 @@ module AnyCable
23
23
 
24
24
  private
25
25
 
26
+ def procify(block)
27
+ return block unless block.lambda?
28
+
29
+ proc { |*args| block.call(*args.take(block.arity)) }
30
+ end
31
+
26
32
  def handlers
27
33
  @handlers ||= []
28
34
  end
@@ -18,16 +18,16 @@ module AnyCable
18
18
 
19
19
  RESPONSE_CLASS.keys.each do |mid|
20
20
  module_eval <<~CODE, __FILE__, __LINE__ + 1
21
- def #{mid}(*)
22
- capture_exceptions(:#{mid}) { super }
21
+ def #{mid}(message, *)
22
+ capture_exceptions(:#{mid}, message) { super }
23
23
  end
24
24
  CODE
25
25
  end
26
26
 
27
- def capture_exceptions(method_name)
27
+ def capture_exceptions(method_name, message)
28
28
  yield
29
29
  rescue StandardError => exp
30
- AnyCable::ExceptionsHandling.notify(exp)
30
+ AnyCable::ExceptionsHandling.notify(exp, method_name.to_s, message.to_h)
31
31
 
32
32
  RESPONSE_CLASS.fetch(method_name).new(
33
33
  status: AnyCable::Status::ERROR,
@@ -12,8 +12,8 @@ module AnyCable
12
12
  #
13
13
  # Basic example:
14
14
  #
15
- # # create new server listening on [::]:50051 (default host)
16
- # server = AnyCable::Server.new(host: "[::]:50051")
15
+ # # create new server listening on the loopback interface with 50051 port
16
+ # server = AnyCable::Server.new(host: "127.0.0.1:50051")
17
17
  #
18
18
  # # run gRPC server in bakground
19
19
  # server.start
@@ -25,7 +25,7 @@ module AnyCable
25
25
  # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
26
26
  def start(**options)
27
27
  warn <<~DEPRECATION
28
- Using AnyCable::Server.start is deprecated!
28
+ DEPRECATION WARNING: Using AnyCable::Server.start is deprecated!
29
29
  Please, use anycable CLI instead.
30
30
 
31
31
  See https://docs.anycable.io/#upgrade_to_0_6_0
@@ -63,11 +63,9 @@ module AnyCable
63
63
  # rubocop:enable Metrics/AbcSize, Metrics/MethodLength
64
64
  end
65
65
 
66
- DEFAULT_HOST = "0.0.0.0:50051"
67
-
68
66
  attr_reader :grpc_server, :host
69
67
 
70
- def initialize(host: DEFAULT_HOST, logger: AnyCable.logger, **options)
68
+ def initialize(host:, logger: AnyCable.logger, **options)
71
69
  @logger = logger
72
70
  @host = host
73
71
  @grpc_server = build_server(options)
@@ -80,6 +78,8 @@ module AnyCable
80
78
 
81
79
  raise "Cannot re-start stopped server" if stopped?
82
80
 
81
+ check_default_host
82
+
83
83
  logger.info "RPC server is starting..."
84
84
 
85
85
  @start_thread = Thread.new { grpc_server.run }
@@ -132,5 +132,21 @@ module AnyCable
132
132
  )
133
133
  health_checker
134
134
  end
135
+
136
+ def check_default_host
137
+ return unless host.is_a?(Anycable::Config::DefaultHostWrapper)
138
+
139
+ warn <<~DEPRECATION
140
+ DEPRECATION WARNING: You're using default rpc_host configuration which starts AnyCable RPC
141
+ server on all available interfaces including external IPv4 and IPv6.
142
+ This is about to be changed to loopback interface only in future versions.
143
+
144
+ Please, consider switching to the loopback interface or set "[::]:50051"
145
+ explicitly in your configuration, if you want to continue with the current
146
+ behavior and supress this message.
147
+
148
+ See https://docs.anycable.io/#/configuration
149
+ DEPRECATION
150
+ end
135
151
  end
136
152
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AnyCable
4
- VERSION = "0.6.1"
4
+ VERSION = "0.6.2"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: anycable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - palkan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-06 00:00:00.000000000 Z
11
+ date: 2019-03-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: anyway_config
@@ -155,63 +155,17 @@ email:
155
155
  - dementiev.vm@gmail.com
156
156
  executables:
157
157
  - anycable
158
+ - anycabled
158
159
  extensions: []
159
160
  extra_rdoc_files: []
160
161
  files:
161
- - ".github/ISSUE_TEMPLATE.md"
162
- - ".github/PULL_REQUEST_TEMPLATE.md"
163
- - ".gitignore"
164
- - ".hound.yml"
165
- - ".rubocop.yml"
166
- - ".travis.yml"
167
162
  - CHANGELOG.md
168
- - Gemfile
169
163
  - MIT-LICENSE
170
- - Makefile
171
- - PITCHME.md
172
- - PITCHME.yaml
173
164
  - README.md
174
- - Rakefile
175
- - anycable.gemspec
176
- - assets/Memory3.png
177
- - assets/Memory5.png
178
- - assets/RTT3.png
179
- - assets/RTT5.png
180
- - assets/Scheme1.png
181
- - assets/Scheme2.png
182
- - assets/cpu_chart.gif
183
- - assets/cpu_chart2.gif
184
- - assets/evlms.png
185
- - benchmarks/.gitignore
186
- - benchmarks/2017-02-12.md
187
- - benchmarks/2018-03-04.md
188
- - benchmarks/2018-05-27-rpc-bench.md
189
- - benchmarks/2018-10-27.md
190
- - benchmarks/HowTo.md
191
- - benchmarks/ansible.cfg
192
- - benchmarks/assets/2018-10-27-action-cable-rss.png
193
- - benchmarks/assets/2018-10-27-action-cable-rtt.png
194
- - benchmarks/assets/2018-10-27-anycable-rss.png
195
- - benchmarks/assets/2018-10-27-anycable-rtt.png
196
- - benchmarks/assets/2018-10-27-async-rss.png
197
- - benchmarks/assets/2018-10-27-async-rtt.png
198
- - benchmarks/assets/2018-10-27-falcon-cable-rss.png
199
- - benchmarks/assets/2018-10-27-falcon-cable-rtt.png
200
- - benchmarks/assets/2018-10-27-iodine-cable-rss.png
201
- - benchmarks/assets/2018-10-27-iodine-cable-rtt.png
202
- - benchmarks/assets/2018-10-27-plezi-rss.png
203
- - benchmarks/assets/2018-10-27-plezi-rtt.png
204
- - benchmarks/bench.png
205
- - benchmarks/benchmark.yml
206
- - benchmarks/hosts
207
- - benchmarks/rtt_plot.py
208
- - benchmarks/rtt_plot_test.py
209
- - benchmarks/servers.yml
210
165
  - bin/anycable
166
+ - bin/anycabled
211
167
  - bin/console
212
168
  - bin/setup
213
- - circle.yml
214
- - etc/bug_report_template.rb
215
169
  - lib/anycable.rb
216
170
  - lib/anycable/broadcast_adapters.rb
217
171
  - lib/anycable/broadcast_adapters/redis.rb
@@ -228,7 +182,6 @@ files:
228
182
  - lib/anycable/server.rb
229
183
  - lib/anycable/socket.rb
230
184
  - lib/anycable/version.rb
231
- - protos/rpc.proto
232
185
  homepage: http://github.com/anycable/anycable
233
186
  licenses:
234
187
  - MIT
@@ -248,8 +201,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
248
201
  - !ruby/object:Gem::Version
249
202
  version: '0'
250
203
  requirements: []
251
- rubyforge_project:
252
- rubygems_version: 2.7.6
204
+ rubygems_version: 3.0.2
253
205
  signing_key:
254
206
  specification_version: 4
255
207
  summary: AnyCable is a polyglot replacement for ActionCable-compatible servers
@@ -1,25 +0,0 @@
1
- <!--
2
- First of all, thanks for your report/suggestion/whatever!
3
-
4
- This template is for bug reports. If you are reporting a bug, please continue on. If you are here for another reason,
5
- feel free to skip the rest of this template.
6
- -->
7
-
8
- ### Tell us about your environment
9
-
10
- **Ruby version:**
11
-
12
- **`anycable` gem version:**
13
-
14
- **`grpc` gem version:**
15
-
16
- ### What did you do?
17
-
18
- ### What did you expect to happen?
19
-
20
- ### What actually happened?
21
-
22
- <!--
23
- Please, provide reproduction script (using this template (https://github.com/anycable/anycable/blob/master/etc/bug_report_template.rb)
24
- when submitting bugs if possible.
25
- -->
@@ -1,31 +0,0 @@
1
- <!--
2
- First of all, thanks for contributing!
3
-
4
- If it's a typo fix or minor documentation update feel free to skip the rest of this template!
5
- -->
6
-
7
- <!--
8
- If it's a bug fix, then link it to the issue, for example:
9
-
10
- Fixes #xxx
11
- -->
12
-
13
-
14
- <!--
15
- Otherwise, describe the changes:
16
-
17
- ### What is the purpose of this pull request?
18
-
19
- ### What changes did you make? (overview)
20
-
21
- ### Is there anything you'd like reviewers to focus on?
22
-
23
- -->
24
-
25
- <!--
26
- Please ensure your PR is ready:
27
-
28
- - Include tests for this change
29
- - Add Changelog entry
30
- - Update documentation for this change (if appropriate)
31
- -->
data/.gitignore DELETED
@@ -1,40 +0,0 @@
1
- # Numerous always-ignore extensions
2
- *.diff
3
- *.err
4
- *.orig
5
- *.log
6
- *.rej
7
- *.swo
8
- *.swp
9
- *.vi
10
- *~
11
- *.sass-cache
12
- *.iml
13
- .idea/
14
-
15
- # Sublime
16
- *.sublime-project
17
- *.sublime-workspace
18
-
19
- # OS or Editor folders
20
- .DS_Store
21
- .cache
22
- .project
23
- .settings
24
- .tmproj
25
- Thumbs.db
26
-
27
- .bundle/
28
- log/*.log
29
- *.gz
30
- pkg/
31
- spec/dummy/db/*.sqlite3
32
- spec/dummy/db/*.sqlite3-journal
33
- spec/dummy/tmp/
34
-
35
- Gemfile.lock
36
- Gemfile.local
37
- .rspec
38
- *.gem
39
- tmp/
40
- coverage/