flipp-ruby-kafka-temp-fork 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.circleci/config.yml +97 -0
- data/.dockerignore +2 -0
- data/.gitignore +41 -0
- data/.gitmodules +0 -0
- data/.rspec +1 -0
- data/.rubocop.yml +56 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.md +466 -0
- data/Dockerfile +21 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +207 -0
- data/Guardfile +22 -0
- data/README.md +102 -0
- data/Rakefile +13 -0
- data/bin/flipp_ruby_kafka +4 -0
- data/deploy/artifactory.sh +8 -0
- data/deploy/config.json +4 -0
- data/docker-compose.yml +89 -0
- data/docs/UPGRADE_1.0.md +39 -0
- data/flipp-ruby-kafka.gemspec +34 -0
- data/kafkateria/factories/my_schema.rb +16 -0
- data/kafkateria/factories/my_schema_with_id.rb +16 -0
- data/lib/flipp_ruby_kafka.rb +73 -0
- data/lib/flipp_ruby_kafka/flipp_datadog_metrics.rb +15 -0
- data/lib/flipp_ruby_kafka/test_helpers.rb +59 -0
- data/lib/flipp_ruby_kafka/utils/platform_schema_validation.rb +77 -0
- data/lib/flipp_ruby_kafka/utils/platform_topic_validation.rb +41 -0
- data/lib/flipp_ruby_kafka/version.rb +5 -0
- data/lib/generators/flipp_ruby_kafka/schema_validation/schema_validation_generator.rb +23 -0
- data/lib/generators/flipp_ruby_kafka/topic_validation/topic_validation_generator.rb +22 -0
- data/spec/flipp_ruby_kafka_spec.rb +8 -0
- data/spec/integration/send_kafka_spec.rb +63 -0
- data/spec/phobos.yml +73 -0
- data/spec/schemas/com/my-namespace/MySchema-key.avsc +13 -0
- data/spec/schemas/com/my-namespace/MySchema.avsc +18 -0
- data/spec/schemas/com/my-namespace/MySchemaWithDateTimes.avsc +33 -0
- data/spec/schemas/com/my-namespace/MySchemaWithId.avsc +28 -0
- data/spec/spec_helper.rb +39 -0
- data/spec/utils/platform_schema_validation_spec.rb +54 -0
- data/spec/utils/platform_topic_validation_spec.rb +50 -0
- metadata +262 -0
data/Dockerfile
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
FROM 421990735784.dkr.ecr.us-east-1.amazonaws.com/flipp/ruby-base:2.5-stretch
|
2
|
+
|
3
|
+
RUN apt-get install -yq libpq-dev net-tools mysql-client wait-for-it
|
4
|
+
ENV DOCKERIZE_VERSION v0.6.1
|
5
|
+
RUN wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
|
6
|
+
&& tar -C /usr/local/bin -xzvf dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
|
7
|
+
&& rm dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz
|
8
|
+
|
9
|
+
WORKDIR /opt/flipp_ruby_kafka
|
10
|
+
COPY flipp-ruby-kafka.gemspec /opt/flipp_ruby_kafka/flipp-ruby-kafka.gemspec
|
11
|
+
COPY lib/flipp_ruby_kafka/version.rb /opt/flipp_ruby_kafka/lib/flipp_ruby_kafka/version.rb
|
12
|
+
COPY Gemfile /opt/flipp_ruby_kafka/Gemfile
|
13
|
+
COPY Gemfile.lock /opt/flipp_ruby_kafka/Gemfile.lock
|
14
|
+
|
15
|
+
RUN bundle install
|
16
|
+
|
17
|
+
ADD . .
|
18
|
+
|
19
|
+
ENTRYPOINT ["bundle", "exec"]
|
20
|
+
|
21
|
+
CMD ["bundle", "exec", "rspec"]
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,207 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
flipp-ruby-kafka-temp-fork (0.0.1)
|
5
|
+
ddtrace (>= 0.11)
|
6
|
+
deimos-temp-fork (>= 0.0.2)
|
7
|
+
flipp-ruby-dogstatsd (~> 1.0)
|
8
|
+
railties (>= 3)
|
9
|
+
|
10
|
+
GEM
|
11
|
+
remote: https://flipplib.jfrog.io/flipplib/api/gems/flipp-gems/
|
12
|
+
specs:
|
13
|
+
actionpack (6.1.4)
|
14
|
+
actionview (= 6.1.4)
|
15
|
+
activesupport (= 6.1.4)
|
16
|
+
rack (~> 2.0, >= 2.0.9)
|
17
|
+
rack-test (>= 0.6.3)
|
18
|
+
rails-dom-testing (~> 2.0)
|
19
|
+
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
20
|
+
actionview (6.1.4)
|
21
|
+
activesupport (= 6.1.4)
|
22
|
+
builder (~> 3.1)
|
23
|
+
erubi (~> 1.4)
|
24
|
+
rails-dom-testing (~> 2.0)
|
25
|
+
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
26
|
+
activesupport (6.1.4)
|
27
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
28
|
+
i18n (>= 1.6, < 2)
|
29
|
+
minitest (>= 5.1)
|
30
|
+
tzinfo (~> 2.0)
|
31
|
+
zeitwerk (~> 2.3)
|
32
|
+
ast (2.4.2)
|
33
|
+
avro (1.9.2)
|
34
|
+
multi_json
|
35
|
+
avro_turf (0.11.0)
|
36
|
+
avro (>= 1.7.7, < 1.10)
|
37
|
+
excon (~> 0.45)
|
38
|
+
builder (3.2.4)
|
39
|
+
coderay (1.1.3)
|
40
|
+
concurrent-ruby (1.1.9)
|
41
|
+
concurrent-ruby-ext (1.1.9)
|
42
|
+
concurrent-ruby (= 1.1.9)
|
43
|
+
crass (1.0.6)
|
44
|
+
ddtrace (0.52.0)
|
45
|
+
ffi (~> 1.0)
|
46
|
+
msgpack
|
47
|
+
deimos-temp-fork (0.0.2)
|
48
|
+
avro_turf (~> 0.11)
|
49
|
+
fig_tree (~> 0.0.2)
|
50
|
+
phobos_temp_fork
|
51
|
+
sigurd (~> 0.0.1)
|
52
|
+
diff-lcs (1.4.4)
|
53
|
+
dogstatsd-ruby (3.0.0)
|
54
|
+
erubi (1.10.0)
|
55
|
+
excon (0.85.0)
|
56
|
+
exponential-backoff (0.0.4)
|
57
|
+
ffi (1.15.3)
|
58
|
+
fig_tree (0.0.2)
|
59
|
+
activesupport (>= 3.0.0)
|
60
|
+
flipp-ruby-dogstatsd (1.0.8)
|
61
|
+
activesupport (>= 3.0)
|
62
|
+
dogstatsd-ruby (~> 3.0.0)
|
63
|
+
flipp_ruby_style (0.1.4)
|
64
|
+
rubocop (~> 0.76)
|
65
|
+
rubocop-performance (~> 1.5)
|
66
|
+
rubocop-rails (~> 2.3)
|
67
|
+
rubocop-rspec (~> 1.27)
|
68
|
+
thor
|
69
|
+
formatador (0.3.0)
|
70
|
+
guard (2.18.0)
|
71
|
+
formatador (>= 0.2.4)
|
72
|
+
listen (>= 2.7, < 4.0)
|
73
|
+
lumberjack (>= 1.0.12, < 2.0)
|
74
|
+
nenv (~> 0.1)
|
75
|
+
notiffany (~> 0.0)
|
76
|
+
pry (>= 0.13.0)
|
77
|
+
shellany (~> 0.0)
|
78
|
+
thor (>= 0.18.1)
|
79
|
+
guard-compat (1.2.1)
|
80
|
+
guard-rspec (4.7.3)
|
81
|
+
guard (~> 2.1)
|
82
|
+
guard-compat (~> 1.1)
|
83
|
+
rspec (>= 2.99.0, < 4.0)
|
84
|
+
guard-rubocop (1.4.0)
|
85
|
+
guard (~> 2.0)
|
86
|
+
rubocop (< 2.0)
|
87
|
+
i18n (1.8.10)
|
88
|
+
concurrent-ruby (~> 1.0)
|
89
|
+
listen (3.6.0)
|
90
|
+
rb-fsevent (~> 0.10, >= 0.10.3)
|
91
|
+
rb-inotify (~> 0.9, >= 0.9.10)
|
92
|
+
little-plugger (1.1.4)
|
93
|
+
logging (2.3.0)
|
94
|
+
little-plugger (~> 1.1)
|
95
|
+
multi_json (~> 1.14)
|
96
|
+
loofah (2.12.0)
|
97
|
+
crass (~> 1.0.2)
|
98
|
+
nokogiri (>= 1.5.9)
|
99
|
+
lumberjack (1.2.8)
|
100
|
+
method_source (1.0.0)
|
101
|
+
minitest (5.14.4)
|
102
|
+
msgpack (1.4.2)
|
103
|
+
multi_json (1.15.0)
|
104
|
+
nenv (0.3.0)
|
105
|
+
nokogiri (1.12.3-x86_64-darwin)
|
106
|
+
racc (~> 1.4)
|
107
|
+
notiffany (0.1.3)
|
108
|
+
nenv (~> 0.1)
|
109
|
+
shellany (~> 0.0)
|
110
|
+
parallel (1.20.1)
|
111
|
+
parser (3.0.2.0)
|
112
|
+
ast (~> 2.4.1)
|
113
|
+
phobos_temp_fork (0.0.1)
|
114
|
+
activesupport (>= 3.0.0)
|
115
|
+
concurrent-ruby (>= 1.0.2)
|
116
|
+
concurrent-ruby-ext (>= 1.0.2)
|
117
|
+
exponential-backoff
|
118
|
+
logging
|
119
|
+
thor
|
120
|
+
pry (0.14.1)
|
121
|
+
coderay (~> 1.1)
|
122
|
+
method_source (~> 1.0)
|
123
|
+
racc (1.5.2)
|
124
|
+
rack (2.2.3)
|
125
|
+
rack-test (1.1.0)
|
126
|
+
rack (>= 1.0, < 3)
|
127
|
+
rails-dom-testing (2.0.3)
|
128
|
+
activesupport (>= 4.2.0)
|
129
|
+
nokogiri (>= 1.6)
|
130
|
+
rails-html-sanitizer (1.3.0)
|
131
|
+
loofah (~> 2.3)
|
132
|
+
railties (6.1.4)
|
133
|
+
actionpack (= 6.1.4)
|
134
|
+
activesupport (= 6.1.4)
|
135
|
+
method_source
|
136
|
+
rake (>= 0.13)
|
137
|
+
thor (~> 1.0)
|
138
|
+
rainbow (3.0.0)
|
139
|
+
rake (13.0.6)
|
140
|
+
rb-fsevent (0.11.0)
|
141
|
+
rb-inotify (0.10.1)
|
142
|
+
ffi (~> 1.0)
|
143
|
+
regexp_parser (2.1.1)
|
144
|
+
rexml (3.2.5)
|
145
|
+
rspec (3.10.0)
|
146
|
+
rspec-core (~> 3.10.0)
|
147
|
+
rspec-expectations (~> 3.10.0)
|
148
|
+
rspec-mocks (~> 3.10.0)
|
149
|
+
rspec-core (3.10.1)
|
150
|
+
rspec-support (~> 3.10.0)
|
151
|
+
rspec-expectations (3.10.1)
|
152
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
153
|
+
rspec-support (~> 3.10.0)
|
154
|
+
rspec-mocks (3.10.2)
|
155
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
156
|
+
rspec-support (~> 3.10.0)
|
157
|
+
rspec-support (3.10.2)
|
158
|
+
rspec_junit_formatter (0.4.1)
|
159
|
+
rspec-core (>= 2, < 4, != 2.12.0)
|
160
|
+
rubocop (0.93.1)
|
161
|
+
parallel (~> 1.10)
|
162
|
+
parser (>= 2.7.1.5)
|
163
|
+
rainbow (>= 2.2.2, < 4.0)
|
164
|
+
regexp_parser (>= 1.8)
|
165
|
+
rexml
|
166
|
+
rubocop-ast (>= 0.6.0)
|
167
|
+
ruby-progressbar (~> 1.7)
|
168
|
+
unicode-display_width (>= 1.4.0, < 2.0)
|
169
|
+
rubocop-ast (1.10.0)
|
170
|
+
parser (>= 3.0.1.1)
|
171
|
+
rubocop-performance (1.10.2)
|
172
|
+
rubocop (>= 0.90.0, < 2.0)
|
173
|
+
rubocop-ast (>= 0.4.0)
|
174
|
+
rubocop-rails (2.9.1)
|
175
|
+
activesupport (>= 4.2.0)
|
176
|
+
rack (>= 1.1)
|
177
|
+
rubocop (>= 0.90.0, < 2.0)
|
178
|
+
rubocop-rspec (1.44.1)
|
179
|
+
rubocop (~> 0.87)
|
180
|
+
rubocop-ast (>= 0.7.1)
|
181
|
+
ruby-progressbar (1.11.0)
|
182
|
+
shellany (0.0.1)
|
183
|
+
sigurd (0.0.3)
|
184
|
+
concurrent-ruby (~> 1)
|
185
|
+
exponential-backoff
|
186
|
+
thor (1.1.0)
|
187
|
+
tzinfo (2.0.4)
|
188
|
+
concurrent-ruby (~> 1.0)
|
189
|
+
unicode-display_width (1.7.0)
|
190
|
+
zeitwerk (2.4.2)
|
191
|
+
|
192
|
+
PLATFORMS
|
193
|
+
x86_64-darwin-20
|
194
|
+
|
195
|
+
DEPENDENCIES
|
196
|
+
flipp-ruby-kafka-temp-fork!
|
197
|
+
flipp_ruby_style
|
198
|
+
guard (~> 2)
|
199
|
+
guard-rspec (~> 4)
|
200
|
+
guard-rubocop (~> 1)
|
201
|
+
rspec (~> 3)
|
202
|
+
rspec_junit_formatter (~> 0.3)
|
203
|
+
rubocop (~> 0.58)
|
204
|
+
rubocop-rspec (~> 1.27)
|
205
|
+
|
206
|
+
BUNDLED WITH
|
207
|
+
2.2.3
|
data/Guardfile
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# A sample Guardfile
|
4
|
+
# More info at https://github.com/guard/guard#readme
|
5
|
+
|
6
|
+
guard :rspec do
|
7
|
+
watch(%r{^spec/.+_spec\.rb$})
|
8
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
9
|
+
watch('spec/spec_helper.rb') { 'spec' }
|
10
|
+
|
11
|
+
# Rails example
|
12
|
+
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
13
|
+
watch(%r{^app/(.*)(\.erb|\.haml|\.slim)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
|
14
|
+
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
|
15
|
+
watch(%r{^spec/support/(.+)\.rb$}) { 'spec' }
|
16
|
+
watch('config/routes.rb') { 'spec/routing' }
|
17
|
+
end
|
18
|
+
|
19
|
+
guard :rubocop do
|
20
|
+
watch(/.+\.rb$/)
|
21
|
+
watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
|
22
|
+
end
|
data/README.md
ADDED
@@ -0,0 +1,102 @@
|
|
1
|
+
# FlippRubyKafka
|
2
|
+
|
3
|
+
Flipp's best practices for using Kafka producers and consumers.
|
4
|
+
Built on top of Deimos, and also integrates
|
5
|
+
DataDog metrics and APM.
|
6
|
+
|
7
|
+
See the Deimos gem for most configuration and usage.
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Add this line to your application's Gemfile:
|
12
|
+
```ruby
|
13
|
+
gem 'flipp-ruby-kafka', require: 'flipp_ruby_kafka'
|
14
|
+
```
|
15
|
+
|
16
|
+
And then execute:
|
17
|
+
|
18
|
+
$ bundle
|
19
|
+
|
20
|
+
Or install it yourself as:
|
21
|
+
|
22
|
+
$ gem install flipp-ruby-kafka
|
23
|
+
|
24
|
+
## Versioning
|
25
|
+
|
26
|
+
We use semver for this gem. Any change in previous behavior is denoted
|
27
|
+
with a bump in the minor version (0.4 -> 0.5). Patch versions are for
|
28
|
+
bugfixes or new functionality which does not affect existing code. You
|
29
|
+
should be locking your Gemfile to the minor version:
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
gem 'flipp-ruby-kafka', '~> 0.4', require: 'flipp_ruby_kafka'
|
33
|
+
```
|
34
|
+
|
35
|
+
## Configuration
|
36
|
+
|
37
|
+
FlippRubyKafka comes with configuration out of the box for the Flipp
|
38
|
+
Microservice Platform. Your application configuration should look something
|
39
|
+
like this (in e.g. `config/initializers/flipp_ruby_kafka.rb`):
|
40
|
+
|
41
|
+
```ruby
|
42
|
+
FlippRubyKafka.configure do
|
43
|
+
producers.schema_namespace 'com.flipp.my_app'
|
44
|
+
# For integration testing - see below
|
45
|
+
kafkateria_url ENV['KAFKATERIA_URL']
|
46
|
+
end
|
47
|
+
FlippRubyKafka.configure_datadog
|
48
|
+
```
|
49
|
+
|
50
|
+
FlippRubyKafka also changes the default for a number of settings to make
|
51
|
+
your configuration smaller in the 80% case. The following are the setting
|
52
|
+
defaults:
|
53
|
+
|
54
|
+
Config name|Default
|
55
|
+
-----------|-------
|
56
|
+
logger|Clone of Rails logger
|
57
|
+
schema.backend|`:avro_validation` for development, `:avro_schema_registry` otherwise
|
58
|
+
schema.path|`"#{Rails.root}/app/schemas"`
|
59
|
+
schema.registry_url|`ENV['KAFKA_SCHEMA_REGISTRY'] \|\| 'http://localhost:8081'`
|
60
|
+
consumers.report_lag|true for staging/production, false for development/test
|
61
|
+
consumers.fatal_error|true if ActiveRecord connection is not active
|
62
|
+
kafka.seed_brokers|`ENV['KAFKA_SSL_BROKERS'] \|\| 'localhost:9092'`
|
63
|
+
kafka.ssl.enabled|true for staging/production, false for development/test
|
64
|
+
kafka.ssl.ca_cert|'/var/certs/kafka-broker-ca-public-cert'
|
65
|
+
kafka.ssl.client_cert|'/var/certs/kafka-client-public-key'
|
66
|
+
kafka.ssl.client_cert_key|'/var/certs/kafka-client-private-key-decrypted'
|
67
|
+
kafka.ssl.verify_hostname|false
|
68
|
+
kafkaeria_url|'http://localhost:3000'
|
69
|
+
|
70
|
+
## Running consumers
|
71
|
+
|
72
|
+
FlippRubyKafka aliases `rake deimos:start` to `rake phobos:start`
|
73
|
+
to support legacy applications.
|
74
|
+
|
75
|
+
## Testing
|
76
|
+
|
77
|
+
FlippRubyKafka has helper methods for sending API requests to
|
78
|
+
[Kafkateria](https://github.com/wishabi/kafkateria):
|
79
|
+
|
80
|
+
```ruby
|
81
|
+
|
82
|
+
kafkateria_delete_topic('my-topic')
|
83
|
+
|
84
|
+
kafkateria_produce_messages(
|
85
|
+
topic: 'my-topic',
|
86
|
+
num_messages: 5,
|
87
|
+
traits: %i(indexed),
|
88
|
+
values: { merchant_id: 1 }
|
89
|
+
)
|
90
|
+
```
|
91
|
+
|
92
|
+
Make sure to set `config.kafkateria_url` when configuring FlippRubyKafka
|
93
|
+
to enable this.
|
94
|
+
|
95
|
+
## Additional Tools
|
96
|
+
|
97
|
+
FlippRubyKafka provides generators to hook into the platform build's features. These generate JSON config files to be used by the build script:
|
98
|
+
|
99
|
+
* `rails g flipp_ruby_kafka:schema_validation` will generate a `schema_validation.json`
|
100
|
+
* `rails g flipp_ruby_kafka:topic_validation` will generate a `topic_validation.json`
|
101
|
+
|
102
|
+
You can run both scripts in your build step - as long as the files are persisted to your workspace, you can use them in your deploy or in your separate validation steps.
|
data/Rakefile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'bundler/gem_tasks'
|
4
|
+
begin
|
5
|
+
require 'rspec/core/rake_task'
|
6
|
+
|
7
|
+
RSpec::Core::RakeTask.new(:spec)
|
8
|
+
task(default: :spec)
|
9
|
+
rescue LoadError # rubocop:disable Lint/HandleExceptions
|
10
|
+
# no rspec available
|
11
|
+
end
|
12
|
+
|
13
|
+
import('./lib/tasks/phobos.rake')
|
@@ -0,0 +1,8 @@
|
|
1
|
+
cd ./deploy
|
2
|
+
|
3
|
+
#download latest deploy script
|
4
|
+
aws s3 cp "s3://flipp-platform-production/deploy/library-builder/library-builder-deploy.sh" library-builder-deploy.sh
|
5
|
+
chmod +x library-builder-deploy.sh
|
6
|
+
|
7
|
+
#Execute the deployment Scripts
|
8
|
+
./library-builder-deploy.sh
|
data/deploy/config.json
ADDED
data/docker-compose.yml
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
version: '3.6'
|
2
|
+
services:
|
3
|
+
mysql:
|
4
|
+
image: mysql:5.7
|
5
|
+
expose:
|
6
|
+
- 3306
|
7
|
+
environment:
|
8
|
+
- MYSQL_ALLOW_EMPTY_PASSWORD=yes
|
9
|
+
- MYSQL_DATABASE=test
|
10
|
+
- TZ=America/Toronto
|
11
|
+
|
12
|
+
postgres:
|
13
|
+
image: postgres:11.1
|
14
|
+
expose:
|
15
|
+
- 5432
|
16
|
+
environment:
|
17
|
+
POSTGRES_PASSWORD: root
|
18
|
+
|
19
|
+
test:
|
20
|
+
volumes:
|
21
|
+
- .:/var/app
|
22
|
+
depends_on:
|
23
|
+
- kafka-broker
|
24
|
+
- mysql
|
25
|
+
- postgres
|
26
|
+
- kafkateria
|
27
|
+
build: .
|
28
|
+
environment:
|
29
|
+
- "DEFAULT_TIMEOUT=${DEFAULT_TIMEOUT}"
|
30
|
+
- MYSQL_HOST=mysql
|
31
|
+
- PG_HOST=postgres
|
32
|
+
- KAFKATERIA_URL=http://kafkateria:3000
|
33
|
+
- SCHEMA_REGISTRY=http://schema-registry:8081
|
34
|
+
- KAFKA_SEED_BROKER=kafka-broker:9092
|
35
|
+
command: dockerize -wait tcp://mysql:3306 -wait tcp://postgres:5432 -timeout 1m rspec
|
36
|
+
|
37
|
+
zookeeper:
|
38
|
+
image: wurstmeister/zookeeper:latest
|
39
|
+
ports:
|
40
|
+
- 2181:2181
|
41
|
+
|
42
|
+
schema-registry:
|
43
|
+
image: confluentinc/cp-schema-registry
|
44
|
+
hostname: schema-registry
|
45
|
+
depends_on:
|
46
|
+
- zookeeper
|
47
|
+
- kafka-broker
|
48
|
+
ports:
|
49
|
+
- "8081:8081"
|
50
|
+
environment:
|
51
|
+
SCHEMA_REGISTRY_HOST_NAME: schema-registry
|
52
|
+
SCHEMA_REGISTRY_KAFKASTORE_CONNECTION_URL: 'zookeeper:2181'
|
53
|
+
|
54
|
+
kafka-broker:
|
55
|
+
image: confluentinc/cp-enterprise-kafka
|
56
|
+
hostname: kafka-broker
|
57
|
+
depends_on:
|
58
|
+
- zookeeper
|
59
|
+
ports:
|
60
|
+
- "9092:9092"
|
61
|
+
environment:
|
62
|
+
KAFKA_BROKER_ID: 1
|
63
|
+
KAFKA_ZOOKEEPER_CONNECT: 'zookeeper:2181'
|
64
|
+
KAFKA_ADVERTISED_LISTENERS: 'PLAINTEXT://kafka-broker:9092'
|
65
|
+
KAFKA_METRIC_REPORTERS: io.confluent.metrics.reporter.ConfluentMetricsReporter
|
66
|
+
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
|
67
|
+
KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0
|
68
|
+
CONFLUENT_METRICS_REPORTER_BOOTSTRAP_SERVERS: kafka-broker:9092
|
69
|
+
CONFLUENT_METRICS_REPORTER_ZOOKEEPER_CONNECT: zookeeper:2181
|
70
|
+
CONFLUENT_METRICS_REPORTER_TOPIC_REPLICAS: 1
|
71
|
+
CONFLUENT_METRICS_ENABLE: 'true'
|
72
|
+
CONFLUENT_SUPPORT_CUSTOMER_ID: 'anonymous'
|
73
|
+
|
74
|
+
kafkateria:
|
75
|
+
image: 421990735784.dkr.ecr.us-east-1.amazonaws.com/flipp/kafkateria:latest
|
76
|
+
hostname: kafkateria
|
77
|
+
ports:
|
78
|
+
- "3000:3000"
|
79
|
+
environment:
|
80
|
+
SCHEMA_REGISTRY: 'http://schema-registry:8081'
|
81
|
+
KAFKA_SEED_BROKER: 'kafka-broker:9092'
|
82
|
+
depends_on:
|
83
|
+
- kafka-broker
|
84
|
+
- schema-registry
|
85
|
+
volumes:
|
86
|
+
- ./kafkateria/factories:/var/app/external/factories
|
87
|
+
- ./spec/schemas:/var/app/external/schemas
|
88
|
+
command:
|
89
|
+
rails s -p3000
|