racecar 0.5.0.beta2 → 1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 1dc4466a144fa4e914a2e6989d19c32841909e6b
4
- data.tar.gz: f70ce01e975ea49a314bc36d13733f3cd11aed71
2
+ SHA256:
3
+ metadata.gz: 28a2c032c29aeba007b00c13eb0bfec94b2d32bf6a6076235b801c4eee28a6b1
4
+ data.tar.gz: b2f63c4a91f2a9ecfa26d7f4ac1902dc865221a8d0ed203a13dfb59c04dc35f5
5
5
  SHA512:
6
- metadata.gz: b6e6a5fa75b949265456858e8d8c99b3701acf1ad50de51e7aea3daf2d97c6be85c1e56ab8358d6f782b9c771eee4e609e91494c4c5f4cc5b0c2ee41ef25e15e
7
- data.tar.gz: 19894d6636220cfdb7bb9221554d7fe72bb93e3984767dee1c99d354fb94cf779fac42c333640b35def6d453f90004fa191baee69ebc9e7ad8bb71437ebb2033
6
+ metadata.gz: eabaf84b44a70f65ea8fda8ff9e9721f39d342b65c66995b580bfc99d5977d8d675100e01428c0c64b4342d3165e52951b4a08b11cdcd54c6cb93601fca9abf0
7
+ data.tar.gz: 7155e003d823e1cfbdb80b374b8f6b14169c65c3dfaeb9eda734d72cca373a5bc9662616616cf4ee12f3002801c0cbfd0664758a8406fd410867e5aca5f45659
data/.gitignore CHANGED
@@ -7,4 +7,4 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
- /vendor/bundle/
10
+ /vendor/bundle/
@@ -2,10 +2,30 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## racecar v1.2.0
6
+
7
+ * Support for `ssl_client_cert_key_password` (#173).
8
+ * Support for `OAUTHBEARER` authentication (`sasl_oauth_token_provider`) (#178).
9
+
10
+ ## racecar v1.1.0
11
+
12
+ * Require ruby-kafka v1.0 or higher.
13
+ * Add error handling for required libraries (#149).
14
+
15
+ ## racecar v1.0.1
16
+
17
+ * Add `--without-rails` option to boot consumer without Rails (#139).
18
+
19
+ ## racecar v1.0.0
20
+
21
+ Unchanged from v0.5.0.
22
+
5
23
  ## racecar v0.5.0
6
24
 
7
25
  * Add support for manually sending heartbeats with `heartbeat` (#105).
8
26
  * Allow configuring `sasl_over_ssl`.
27
+ * Add current directory to `$LOAD_PATH` only when `--require` option is used (#117).
28
+ * Support for `ssl_verify_hostname` in the configuration (#120)
9
29
 
10
30
  ## racecar v0.4.2
11
31
 
data/README.md CHANGED
@@ -294,6 +294,7 @@ The memory usage limit is roughly estimated as `max_bytes * max_fetch_queue_size
294
294
  * `ssl_ca_cert_file_path` - The path to a valid SSL certificate authority file.
295
295
  * `ssl_client_cert` – A valid SSL client certificate, as a string.
296
296
  * `ssl_client_cert_key` – A valid SSL client certificate key, as a string.
297
+ * `ssl_client_cert_key_password` – The password for the client cert key, as a string (optional).
297
298
 
298
299
  #### SASL encryption, authentication & authorization
299
300
 
@@ -316,6 +317,15 @@ If using SCRAM:
316
317
  * `sasl_scram_password` – The password used to authenticate.
317
318
  * `sasl_scram_mechanism` – The SCRAM mechanism to use, either `sha256` or `sha512`.
318
319
 
320
+ If using OAUTHBEARER:
321
+
322
+ * `sasl_oauth_token_provider`- In order to authenticate using OAUTHBEARER, you must set the client with an instance of a class that implements a token method (the interface is described in Kafka::Sasl::OAuth) which returns an ID/Access token.
323
+ This mechanism is supported in kafka >= 2.0.0 as of KIP-255.
324
+
325
+ See more at [here](https://github.com/zendesk/ruby-kafka/tree/master#oauthbearer).
326
+
327
+ NOTE: `sasl_oauth_token_provider` only works using the `config/racecar.rb` configuration file.
328
+
319
329
  #### Producing messages
320
330
 
321
331
  These settings are related to consumers that _produce messages to Kafka_.
@@ -332,6 +342,9 @@ Racecar supports configuring ruby-kafka's [Datadog](https://www.datadoghq.com/)
332
342
  * `datadog_namespace` – The namespace to use for Datadog metrics.
333
343
  * `datadog_tags` – Tags that should always be set on Datadog metrics.
334
344
 
345
+ #### Consumers Without Rails ####
346
+
347
+ By default, if Rails is detected, it will be automatically started when the consumer is started. There are cases where you might not want or need Rails. You can pass the `--without-rails` option when starting the consumer and Rails won't be started.
335
348
 
336
349
  ### Testing consumers
337
350
 
@@ -3,8 +3,6 @@
3
3
  require "racecar"
4
4
  require "racecar/cli"
5
5
 
6
- $LOAD_PATH.unshift(Dir.pwd)
7
-
8
6
  begin
9
7
  Racecar::Cli.main(ARGV)
10
8
  rescue SignalException => e
@@ -22,6 +22,10 @@ module Racecar
22
22
  @config ||= Config.new
23
23
  end
24
24
 
25
+ def self.config=(config)
26
+ @config = config
27
+ end
28
+
25
29
  def self.configure
26
30
  yield config
27
31
  end
@@ -23,10 +23,10 @@ module Racecar
23
23
  def run
24
24
  $stderr.puts "=> Starting Racecar consumer #{consumer_name}..."
25
25
 
26
- RailsConfigFileLoader.load!
26
+ RailsConfigFileLoader.load! unless config.without_rails?
27
27
 
28
28
  if File.exist?("config/racecar.rb")
29
- require "config/racecar"
29
+ require "./config/racecar"
30
30
  end
31
31
 
32
32
  # Find the consumer class by name.
@@ -94,11 +94,20 @@ module Racecar
94
94
  end
95
95
 
96
96
  def build_parser
97
+ load_path_modified = false
98
+
97
99
  OptionParser.new do |opts|
98
100
  opts.banner = "Usage: racecar MyConsumer [options]"
99
101
 
100
102
  opts.on("-r", "--require STRING", "Require a library before starting the consumer") do |lib|
101
- require lib
103
+ $LOAD_PATH.unshift(Dir.pwd) unless load_path_modified
104
+ load_path_modified = true
105
+ begin
106
+ require lib
107
+ rescue => e
108
+ $stderr.puts "=> #{lib} failed to load: #{e.message}"
109
+ exit
110
+ end
102
111
  end
103
112
 
104
113
  opts.on("-l", "--log STRING", "Log to the specified file") do |logfile|
@@ -73,6 +73,9 @@ module Racecar
73
73
  desc "A valid SSL client certificate key"
74
74
  string :ssl_client_cert_key
75
75
 
76
+ desc "The password for the SSL client certificate key"
77
+ string :ssl_client_cert_key_password
78
+
76
79
  desc "Support for using the CA certs installed on your system by default for SSL. More info, see: https://github.com/zendesk/ruby-kafka/pull/521"
77
80
  boolean :ssl_ca_certs_from_system, default: false
78
81
 
@@ -127,11 +130,20 @@ module Racecar
127
130
  desc "Tags that should always be set on Datadog metrics"
128
131
  list :datadog_tags
129
132
 
133
+ desc "Whether to check the server certificate is valid for the hostname"
134
+ boolean :ssl_verify_hostname, default: true
135
+
136
+ desc "Whether to boot Rails when starting the consumer"
137
+ boolean :without_rails, default: false
138
+
130
139
  # The error handler must be set directly on the object.
131
140
  attr_reader :error_handler
132
141
 
133
142
  attr_accessor :subscriptions, :logger
134
143
 
144
+ # The OAUTHBEARER token provider class.
145
+ attr_accessor :sasl_oauth_token_provider
146
+
135
147
  def initialize(env: ENV)
136
148
  super(env: env)
137
149
  @error_handler = proc {}
@@ -162,6 +174,10 @@ module Racecar
162
174
  if max_pause_timeout && !pause_with_exponential_backoff?
163
175
  raise ConfigError, "`max_pause_timeout` only makes sense when `pause_with_exponential_backoff` is enabled"
164
176
  end
177
+
178
+ if ssl_client_cert_key_password && !ssl_client_cert_key
179
+ raise ConfigError, "`ssl_client_cert_key_password` must be used in conjunction with `ssl_client_cert_key`"
180
+ end
165
181
  end
166
182
 
167
183
  def load_consumer_class(consumer_class)
@@ -27,13 +27,16 @@ module Racecar
27
27
  ssl_ca_cert_file_path: config.ssl_ca_cert_file_path,
28
28
  ssl_client_cert: config.ssl_client_cert,
29
29
  ssl_client_cert_key: config.ssl_client_cert_key,
30
+ ssl_client_cert_key_password: config.ssl_client_cert_key_password,
30
31
  sasl_plain_username: config.sasl_plain_username,
31
32
  sasl_plain_password: config.sasl_plain_password,
32
33
  sasl_scram_username: config.sasl_scram_username,
33
34
  sasl_scram_password: config.sasl_scram_password,
34
35
  sasl_scram_mechanism: config.sasl_scram_mechanism,
36
+ sasl_oauth_token_provider: config.sasl_oauth_token_provider,
35
37
  sasl_over_ssl: config.sasl_over_ssl,
36
38
  ssl_ca_certs_from_system: config.ssl_ca_certs_from_system,
39
+ ssl_verify_hostname: config.ssl_verify_hostname
37
40
  )
38
41
 
39
42
  @consumer = kafka.consumer(
@@ -1,3 +1,3 @@
1
1
  module Racecar
2
- VERSION = "0.5.0.beta2"
2
+ VERSION = "1.2.0"
3
3
  end
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
21
21
  spec.require_paths = ["lib"]
22
22
 
23
23
  spec.add_runtime_dependency "king_konf", "~> 0.3.7"
24
- spec.add_runtime_dependency "ruby-kafka", "~> 0.6"
24
+ spec.add_runtime_dependency "ruby-kafka", "~> 1.0"
25
25
 
26
26
  spec.add_development_dependency "bundler", [">= 1.13", "< 3"]
27
27
  spec.add_development_dependency "rake", "~> 10.0"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: racecar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0.beta2
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Schierbeck
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2019-04-02 00:00:00.000000000 Z
12
+ date: 2020-08-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: king_konf
@@ -31,14 +31,14 @@ dependencies:
31
31
  requirements:
32
32
  - - "~>"
33
33
  - !ruby/object:Gem::Version
34
- version: '0.6'
34
+ version: '1.0'
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - "~>"
40
40
  - !ruby/object:Gem::Version
41
- version: '0.6'
41
+ version: '1.0'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: bundler
44
44
  requirement: !ruby/object:Gem::Requirement
@@ -141,12 +141,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
141
141
  version: '0'
142
142
  required_rubygems_version: !ruby/object:Gem::Requirement
143
143
  requirements:
144
- - - ">"
144
+ - - ">="
145
145
  - !ruby/object:Gem::Version
146
- version: 1.3.1
146
+ version: '0'
147
147
  requirements: []
148
148
  rubyforge_project:
149
- rubygems_version: 2.5.1
149
+ rubygems_version: 2.7.6
150
150
  signing_key:
151
151
  specification_version: 4
152
152
  summary: A framework for running Kafka consumers