racecar 0.5.0 → 1.2.1

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: 6fde169c433c5dba0489cdd53a08481f92ecc5408183686c2dc76ef87ba2f891
4
- data.tar.gz: af73f24f824cb981ec47123c29ff5727ec9b4f54d0e65be67af28f27ddd4a9fb
3
+ metadata.gz: 5d02ea2aa60d2c35df3d9b16571e1bc7552fc0125f7c17dce6c2599c322c0787
4
+ data.tar.gz: 207a860bbe56b1e20f29d0a9d37cef2e47fa21b9232224cdfe38449ca16ec7f3
5
5
  SHA512:
6
- metadata.gz: 6636e6281a994b53540ea168d1fc60aaada88ff9883cc6303b763d70ffb8c0ac20f1e0398d86d37a7ac819cfba60c7906c627fa3ca0b7ddc744d2113da84ae4f
7
- data.tar.gz: af1b70a229444a89d4a3948abcd97b973052dc97f2e0bbf0e50dc88e3c20d0f4df684f0fd432587bc28f03a4460039f8545cae6e190993981e3228c3b1798da3
6
+ metadata.gz: 5cc66fc91f13067bd7106f0d05af602e198f9c3bbb52943a0582fee255ff0bb7521b5c120ed3e519a46744475b41ed4979bb1a070255faec7ef00ef414e36f3b
7
+ data.tar.gz: 3b931445476dd4f0cf1900b22c43cc912fae377942d1b5ee6c0f81e3b7cc9b148e3e828a0004171ce46c0c161e4f5754bdb6e00391bd1fbf824f0489643c0b56
data/CHANGELOG.md CHANGED
@@ -2,6 +2,28 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## racecar v1.2.1
6
+
7
+ * Require king_konf v1.0 or higher.
8
+
9
+ ## racecar v1.2.0
10
+
11
+ * Support for `ssl_client_cert_key_password` (#173).
12
+ * Support for `OAUTHBEARER` authentication (`sasl_oauth_token_provider`) (#178).
13
+
14
+ ## racecar v1.1.0
15
+
16
+ * Require ruby-kafka v1.0 or higher.
17
+ * Add error handling for required libraries (#149).
18
+
19
+ ## racecar v1.0.1
20
+
21
+ * Add `--without-rails` option to boot consumer without Rails (#139).
22
+
23
+ ## racecar v1.0.0
24
+
25
+ Unchanged from v0.5.0.
26
+
5
27
  ## racecar v0.5.0
6
28
 
7
29
  * Add support for manually sending heartbeats with `heartbeat` (#105).
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
 
data/lib/racecar.rb CHANGED
@@ -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
data/lib/racecar/cli.rb CHANGED
@@ -23,7 +23,7 @@ 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
29
  require "./config/racecar"
@@ -102,7 +102,12 @@ module Racecar
102
102
  opts.on("-r", "--require STRING", "Require a library before starting the consumer") do |lib|
103
103
  $LOAD_PATH.unshift(Dir.pwd) unless load_path_modified
104
104
  load_path_modified = true
105
- require lib
105
+ begin
106
+ require lib
107
+ rescue => e
108
+ $stderr.puts "=> #{lib} failed to load: #{e.message}"
109
+ exit
110
+ end
106
111
  end
107
112
 
108
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
 
@@ -130,11 +133,17 @@ module Racecar
130
133
  desc "Whether to check the server certificate is valid for the hostname"
131
134
  boolean :ssl_verify_hostname, default: true
132
135
 
136
+ desc "Whether to boot Rails when starting the consumer"
137
+ boolean :without_rails, default: false
138
+
133
139
  # The error handler must be set directly on the object.
134
140
  attr_reader :error_handler
135
141
 
136
142
  attr_accessor :subscriptions, :logger
137
143
 
144
+ # The OAUTHBEARER token provider class.
145
+ attr_accessor :sasl_oauth_token_provider
146
+
138
147
  def initialize(env: ENV)
139
148
  super(env: env)
140
149
  @error_handler = proc {}
@@ -165,6 +174,10 @@ module Racecar
165
174
  if max_pause_timeout && !pause_with_exponential_backoff?
166
175
  raise ConfigError, "`max_pause_timeout` only makes sense when `pause_with_exponential_backoff` is enabled"
167
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
168
181
  end
169
182
 
170
183
  def load_consumer_class(consumer_class)
@@ -27,11 +27,13 @@ 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,
37
39
  ssl_verify_hostname: config.ssl_verify_hostname
@@ -1,3 +1,3 @@
1
1
  module Racecar
2
- VERSION = "0.5.0"
2
+ VERSION = "1.2.1"
3
3
  end
data/racecar.gemspec CHANGED
@@ -20,8 +20,8 @@ Gem::Specification.new do |spec|
20
20
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
21
  spec.require_paths = ["lib"]
22
22
 
23
- spec.add_runtime_dependency "king_konf", "~> 0.3.7"
24
- spec.add_runtime_dependency "ruby-kafka", "~> 0.7.8"
23
+ spec.add_runtime_dependency "king_konf", "~> 1.0"
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
4
+ version: 1.2.1
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-07-15 00:00:00.000000000 Z
12
+ date: 2021-04-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: king_konf
@@ -17,28 +17,28 @@ dependencies:
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: 0.3.7
20
+ version: '1.0'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: 0.3.7
27
+ version: '1.0'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: ruby-kafka
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
32
  - - "~>"
33
33
  - !ruby/object:Gem::Version
34
- version: 0.7.8
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.7.8
41
+ version: '1.0'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: bundler
44
44
  requirement: !ruby/object:Gem::Requirement
@@ -145,7 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
145
145
  - !ruby/object:Gem::Version
146
146
  version: '0'
147
147
  requirements: []
148
- rubygems_version: 3.0.3
148
+ rubygems_version: 3.1.2
149
149
  signing_key:
150
150
  specification_version: 4
151
151
  summary: A framework for running Kafka consumers