racecar 0.5.0.beta1 → 0.5.0.beta2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +1 -0
- data/README.md +40 -4
- data/lib/racecar/cli.rb +4 -4
- data/lib/racecar/config.rb +3 -0
- data/lib/racecar/runner.rb +1 -0
- data/lib/racecar/version.rb +1 -1
- data/racecar.gemspec +1 -1
- metadata +11 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 1dc4466a144fa4e914a2e6989d19c32841909e6b
|
4
|
+
data.tar.gz: f70ce01e975ea49a314bc36d13733f3cd11aed71
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b6e6a5fa75b949265456858e8d8c99b3701acf1ad50de51e7aea3daf2d97c6be85c1e56ab8358d6f782b9c771eee4e609e91494c4c5f4cc5b0c2ee41ef25e15e
|
7
|
+
data.tar.gz: 19894d6636220cfdb7bb9221554d7fe72bb93e3984767dee1c99d354fb94cf779fac42c333640b35def6d453f90004fa191baee69ebc9e7ad8bb71437ebb2033
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -205,8 +205,6 @@ The first time you execute `racecar` with a consumer class a _consumer group_ wi
|
|
205
205
|
|
206
206
|
### Producing messages
|
207
207
|
|
208
|
-
**WARNING:** This is an alpha feature, and could cause weird and unpredictable errors. Use with caution.
|
209
|
-
|
210
208
|
Consumers can produce messages themselves, allowing for powerful stream processing applications that transform and filter message streams. The API for this is simple:
|
211
209
|
|
212
210
|
```ruby
|
@@ -252,8 +250,8 @@ end
|
|
252
250
|
|
253
251
|
* `brokers` – A list of Kafka brokers in the cluster that you're consuming from. Defaults to `localhost` on port 9092, the default Kafka port.
|
254
252
|
* `client_id` – A string used to identify the client in logs and metrics.
|
255
|
-
* `group_id` – The group id to use for a given group of consumers. Note that this _must_ be different for each consumer class. If left blank a group id is generated based on the consumer class name
|
256
|
-
* `group_id_prefix` – A prefix used when generating consumer group names. For instance, if you set the prefix to be `kevin.` and your consumer class is named `BaconConsumer`, the resulting consumer group will be named `kevin.
|
253
|
+
* `group_id` – The group id to use for a given group of consumers. Note that this _must_ be different for each consumer class. If left blank a group id is generated based on the consumer class name such that (for example) a consumer with the class name `BaconConsumer` would default to a group id of `bacon-consumer`.
|
254
|
+
* `group_id_prefix` – A prefix used when generating consumer group names. For instance, if you set the prefix to be `kevin.` and your consumer class is named `BaconConsumer`, the resulting consumer group will be named `kevin.bacon-consumer`.
|
257
255
|
|
258
256
|
#### Logging
|
259
257
|
|
@@ -385,6 +383,44 @@ If you've ever used Heroku you'll recognize the format – indeed, deploying to
|
|
385
383
|
|
386
384
|
With Foreman, you can easily run these processes locally by executing `foreman run`; in production you'll want to _export_ to another process management format such as Upstart or Runit. [capistrano-foreman](https://github.com/hyperoslo/capistrano-foreman) allows you to do this with Capistrano.
|
387
385
|
|
386
|
+
#### Deploying to Kubernetes
|
387
|
+
|
388
|
+
If you run your applications in Kubernetes, use the following [Deployment](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/) spec as a starting point:
|
389
|
+
|
390
|
+
```yaml
|
391
|
+
apiVersion: apps/v1
|
392
|
+
kind: Deployment
|
393
|
+
metadata:
|
394
|
+
name: my-racecar-deployment
|
395
|
+
labels:
|
396
|
+
app: my-racecar
|
397
|
+
spec:
|
398
|
+
replicas: 3 # <-- this will give us three consumers in the group.
|
399
|
+
selector:
|
400
|
+
matchLabels:
|
401
|
+
app: my-racecar
|
402
|
+
strategy:
|
403
|
+
type: Recreate # <-- this is the important part.
|
404
|
+
template:
|
405
|
+
metadata:
|
406
|
+
labels:
|
407
|
+
app: my-racecar
|
408
|
+
spec:
|
409
|
+
containers:
|
410
|
+
- name: my-racecar
|
411
|
+
image: my-racecar-image
|
412
|
+
command: ["bundle", "exec", "racecar", "MyConsumer"]
|
413
|
+
env: # <-- you can configure the consumer using environment variables!
|
414
|
+
- name: RACECAR_BROKERS
|
415
|
+
value: kafka1,kafka2,kafka3
|
416
|
+
- name: RACECAR_OFFSET_COMMIT_INTERVAL
|
417
|
+
value: 5
|
418
|
+
```
|
419
|
+
|
420
|
+
The important part is the `strategy.type` value, which tells Kubernetes how to upgrade from one version of your Deployment to another. Many services use so-called _rolling updates_, where some but not all containers are replaced with the new version. This is done so that, if the new version doesn't work, the old version is still there to serve most of the requests. For Kafka consumers, this doesn't work well. The reason is that every time a consumer joins or leaves a group, every other consumer in the group needs to stop and synchronize the list of partitions assigned to each group member. So if the group is updated in a rolling fashion, this synchronization would occur over and over again, causing undesirable double-processing of messages as consumers would start only to be synchronized shortly after.
|
421
|
+
|
422
|
+
Instead, the `Recreate` update strategy should be used. It completely tears down the existing containers before starting all of the new containers simultaneously, allowing for a single synchronization stage and a much faster, more stable deployment update.
|
423
|
+
|
388
424
|
|
389
425
|
#### Running consumers in the background
|
390
426
|
|
data/lib/racecar/cli.rb
CHANGED
@@ -143,10 +143,10 @@ module Racecar
|
|
143
143
|
require "kafka/datadog"
|
144
144
|
|
145
145
|
datadog = Kafka::Datadog
|
146
|
-
datadog.host = config.datadog_host
|
147
|
-
datadog.port = config.datadog_port
|
148
|
-
datadog.namespace = config.datadog_namespace
|
149
|
-
datadog.tags = config.datadog_tags
|
146
|
+
datadog.host = config.datadog_host unless config.datadog_host.nil?
|
147
|
+
datadog.port = config.datadog_port unless config.datadog_port.nil?
|
148
|
+
datadog.namespace = config.datadog_namespace unless config.datadog_namespace.nil?
|
149
|
+
datadog.tags = config.datadog_tags unless config.datadog_tags.nil?
|
150
150
|
end
|
151
151
|
end
|
152
152
|
end
|
data/lib/racecar/config.rb
CHANGED
@@ -100,6 +100,9 @@ module Racecar
|
|
100
100
|
desc "The SCRAM mechanism to use, either `sha256` or `sha512`"
|
101
101
|
string :sasl_scram_mechanism, allowed_values: ["sha256", "sha512"]
|
102
102
|
|
103
|
+
desc "Whether to use SASL over SSL."
|
104
|
+
boolean :sasl_over_ssl, default: true
|
105
|
+
|
103
106
|
desc "The file in which to store the Racecar process' PID when daemonized"
|
104
107
|
string :pidfile
|
105
108
|
|
data/lib/racecar/runner.rb
CHANGED
@@ -32,6 +32,7 @@ module Racecar
|
|
32
32
|
sasl_scram_username: config.sasl_scram_username,
|
33
33
|
sasl_scram_password: config.sasl_scram_password,
|
34
34
|
sasl_scram_mechanism: config.sasl_scram_mechanism,
|
35
|
+
sasl_over_ssl: config.sasl_over_ssl,
|
35
36
|
ssl_ca_certs_from_system: config.ssl_ca_certs_from_system,
|
36
37
|
)
|
37
38
|
|
data/lib/racecar/version.rb
CHANGED
data/racecar.gemspec
CHANGED
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.add_runtime_dependency "king_konf", "~> 0.3.7"
|
24
24
|
spec.add_runtime_dependency "ruby-kafka", "~> 0.6"
|
25
25
|
|
26
|
-
spec.add_development_dependency "bundler", "
|
26
|
+
spec.add_development_dependency "bundler", [">= 1.13", "< 3"]
|
27
27
|
spec.add_development_dependency "rake", "~> 10.0"
|
28
28
|
spec.add_development_dependency "rspec", "~> 3.0"
|
29
29
|
end
|
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: 0.5.0.beta2
|
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-
|
12
|
+
date: 2019-04-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: king_konf
|
@@ -43,16 +43,22 @@ dependencies:
|
|
43
43
|
name: bundler
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
|
-
- - "
|
46
|
+
- - ">="
|
47
47
|
- !ruby/object:Gem::Version
|
48
48
|
version: '1.13'
|
49
|
+
- - "<"
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: '3'
|
49
52
|
type: :development
|
50
53
|
prerelease: false
|
51
54
|
version_requirements: !ruby/object:Gem::Requirement
|
52
55
|
requirements:
|
53
|
-
- - "
|
56
|
+
- - ">="
|
54
57
|
- !ruby/object:Gem::Version
|
55
58
|
version: '1.13'
|
59
|
+
- - "<"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3'
|
56
62
|
- !ruby/object:Gem::Dependency
|
57
63
|
name: rake
|
58
64
|
requirement: !ruby/object:Gem::Requirement
|
@@ -140,7 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
140
146
|
version: 1.3.1
|
141
147
|
requirements: []
|
142
148
|
rubyforge_project:
|
143
|
-
rubygems_version: 2.
|
149
|
+
rubygems_version: 2.5.1
|
144
150
|
signing_key:
|
145
151
|
specification_version: 4
|
146
152
|
summary: A framework for running Kafka consumers
|