schema_registry_cli 0.1.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 +7 -0
- data/.gitignore +13 -0
- data/.rspec +3 -0
- data/.travis.yml +7 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +64 -0
- data/README.md +123 -0
- data/Rakefile +44 -0
- data/bin/console +14 -0
- data/bin/run_registry +3 -0
- data/bin/setup +8 -0
- data/bundle +1 -0
- data/docker-compose.yml +165 -0
- data/lib/schema_registry_cli/endpoints.rb +126 -0
- data/lib/schema_registry_cli/version.rb +3 -0
- data/lib/schema_registry_cli.rb +79 -0
- data/schema_registry_cli.gemspec +30 -0
- metadata +116 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 82ef2f2b338f6f97677113c2214fd8f23833f41474a4a7bc1cd45c0ccba6c5a2
|
|
4
|
+
data.tar.gz: 531942fe5845eaecdaa178f9957cdf5114a0d48be51ba2012782d93bfe2ff07a
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 343a4aae885d052837a3977358c0e5837d9448aad630de9de862b9a45ade661ec9212c23edc6e64c2119818f544c15a4e30adec2c1270b12bc19e8befd8b70c6
|
|
7
|
+
data.tar.gz: 99ed5ceeaebb936dc1b6d17de4e968349756a26c48efecdb42bca5bdcd6029b00d1c32aa2352b95df0c3d1ee05748afa2318f2e864b7c297a72a31800bc09026
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
|
10
|
+
orientation.
|
|
11
|
+
|
|
12
|
+
## Our Standards
|
|
13
|
+
|
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
|
15
|
+
include:
|
|
16
|
+
|
|
17
|
+
* Using welcoming and inclusive language
|
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
|
19
|
+
* Gracefully accepting constructive criticism
|
|
20
|
+
* Focusing on what is best for the community
|
|
21
|
+
* Showing empathy towards other community members
|
|
22
|
+
|
|
23
|
+
Examples of unacceptable behavior by participants include:
|
|
24
|
+
|
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
|
26
|
+
advances
|
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
|
28
|
+
* Public or private harassment
|
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
|
30
|
+
address, without explicit permission
|
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
32
|
+
professional setting
|
|
33
|
+
|
|
34
|
+
## Our Responsibilities
|
|
35
|
+
|
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
|
38
|
+
response to any instances of unacceptable behavior.
|
|
39
|
+
|
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
|
44
|
+
threatening, offensive, or harmful.
|
|
45
|
+
|
|
46
|
+
## Scope
|
|
47
|
+
|
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
|
49
|
+
when an individual is representing the project or its community. Examples of
|
|
50
|
+
representing a project or community include using an official project e-mail
|
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
|
53
|
+
further defined and clarified by project maintainers.
|
|
54
|
+
|
|
55
|
+
## Enforcement
|
|
56
|
+
|
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
58
|
+
reported by contacting the project team at arturictus@gmail.com. All
|
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
|
63
|
+
|
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
|
66
|
+
members of the project's leadership.
|
|
67
|
+
|
|
68
|
+
## Attribution
|
|
69
|
+
|
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
|
72
|
+
|
|
73
|
+
[homepage]: http://contributor-covenant.org
|
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
schema_registry_cli (0.1.0)
|
|
5
|
+
wrappi (~> 0.2.6)
|
|
6
|
+
|
|
7
|
+
GEM
|
|
8
|
+
remote: https://rubygems.org/
|
|
9
|
+
specs:
|
|
10
|
+
addressable (2.6.0)
|
|
11
|
+
public_suffix (>= 2.0.2, < 4.0)
|
|
12
|
+
diff-lcs (1.3)
|
|
13
|
+
domain_name (0.5.20190701)
|
|
14
|
+
unf (>= 0.0.5, < 1.0.0)
|
|
15
|
+
erlash (0.1.1)
|
|
16
|
+
fusu
|
|
17
|
+
fusu (0.2.1)
|
|
18
|
+
http (2.2.2)
|
|
19
|
+
addressable (~> 2.3)
|
|
20
|
+
http-cookie (~> 1.0)
|
|
21
|
+
http-form_data (~> 1.0.1)
|
|
22
|
+
http_parser.rb (~> 0.6.0)
|
|
23
|
+
http-cookie (1.0.3)
|
|
24
|
+
domain_name (~> 0.5)
|
|
25
|
+
http-form_data (1.0.3)
|
|
26
|
+
http_parser.rb (0.6.0)
|
|
27
|
+
miller (0.1.1)
|
|
28
|
+
erlash (~> 0.1)
|
|
29
|
+
public_suffix (3.1.1)
|
|
30
|
+
rake (10.5.0)
|
|
31
|
+
retryable (3.0.4)
|
|
32
|
+
rspec (3.8.0)
|
|
33
|
+
rspec-core (~> 3.8.0)
|
|
34
|
+
rspec-expectations (~> 3.8.0)
|
|
35
|
+
rspec-mocks (~> 3.8.0)
|
|
36
|
+
rspec-core (3.8.2)
|
|
37
|
+
rspec-support (~> 3.8.0)
|
|
38
|
+
rspec-expectations (3.8.4)
|
|
39
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
40
|
+
rspec-support (~> 3.8.0)
|
|
41
|
+
rspec-mocks (3.8.1)
|
|
42
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
43
|
+
rspec-support (~> 3.8.0)
|
|
44
|
+
rspec-support (3.8.2)
|
|
45
|
+
unf (0.1.4)
|
|
46
|
+
unf_ext
|
|
47
|
+
unf_ext (0.0.7.6)
|
|
48
|
+
wrappi (0.2.6)
|
|
49
|
+
fusu (~> 0.2.1)
|
|
50
|
+
http (~> 2.2)
|
|
51
|
+
miller (~> 0.1.1)
|
|
52
|
+
retryable
|
|
53
|
+
|
|
54
|
+
PLATFORMS
|
|
55
|
+
ruby
|
|
56
|
+
|
|
57
|
+
DEPENDENCIES
|
|
58
|
+
bundler (~> 1.17)
|
|
59
|
+
rake (~> 10.0)
|
|
60
|
+
rspec (~> 3.0)
|
|
61
|
+
schema_registry_cli!
|
|
62
|
+
|
|
63
|
+
BUNDLED WITH
|
|
64
|
+
1.17.1
|
data/README.md
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# SchemaRegistryCli
|
|
2
|
+
|
|
3
|
+
Ruby Client for Confluent Schema registry (https://github.com/confluentinc/schema-registry)[https://github.com/confluentinc/schema-registry]
|
|
4
|
+
|
|
5
|
+
This gem is builded with (wrappi)[https://github.com/arturictus/wrappi] you can check more documentation of how to use it there.
|
|
6
|
+
|
|
7
|
+
## TODO
|
|
8
|
+
|
|
9
|
+
- [ ] Add cache
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
Add this line to your application's Gemfile:
|
|
14
|
+
|
|
15
|
+
```ruby
|
|
16
|
+
gem 'schema_registry_cli'
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
And then execute:
|
|
20
|
+
|
|
21
|
+
$ bundle
|
|
22
|
+
|
|
23
|
+
Or install it yourself as:
|
|
24
|
+
|
|
25
|
+
$ gem install schema_registry_cli
|
|
26
|
+
|
|
27
|
+
## Config
|
|
28
|
+
|
|
29
|
+
Setup is a `Wrappi::Client` check more documentation at:
|
|
30
|
+
|
|
31
|
+
- (table of configs)[https://github.com/arturictus/wrappi#client]
|
|
32
|
+
- (extended docs)[https://github.com/arturictus/wrappi#client-1]
|
|
33
|
+
|
|
34
|
+
```ruby
|
|
35
|
+
SchemaRegistryCli.setup do |config|
|
|
36
|
+
config.domain = "http://my-registry.com:8081"
|
|
37
|
+
end
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Usage
|
|
41
|
+
|
|
42
|
+
### Helpers
|
|
43
|
+
|
|
44
|
+
```ruby
|
|
45
|
+
req = SchemaRegistryCli.register('kafka-key', 'string')
|
|
46
|
+
req.body # => {"id":1}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Every helper returns an instance of `Wrappi::Endpoint` check documentation at: (wrappi usage)[https://github.com/arturictus/wrappi#usage]
|
|
50
|
+
|
|
51
|
+
___methods:___
|
|
52
|
+
|
|
53
|
+
- register(subject, schema)
|
|
54
|
+
- subjects
|
|
55
|
+
- subject_versions(subject)
|
|
56
|
+
- fetch_schema(id)
|
|
57
|
+
- fetch_version(subject, version)
|
|
58
|
+
- latest_version(subject)
|
|
59
|
+
- delete_version(subject, version)
|
|
60
|
+
- delete_subject(subject)
|
|
61
|
+
- check_registered(subject, schema)
|
|
62
|
+
- test_compatibility(subject, schema)
|
|
63
|
+
- sr_config
|
|
64
|
+
- update_config(value)
|
|
65
|
+
- update_subject_compatibility(value)
|
|
66
|
+
|
|
67
|
+
### Internal Classes
|
|
68
|
+
|
|
69
|
+
You can use the internal classes. They are `Wrappi::Endpoint`s. (wrappi)[https://github.com/arturictus/wrappi#usage]
|
|
70
|
+
Declarations and ruby docs (here)[lib/schema_registry_cli/endpoints.rb]
|
|
71
|
+
|
|
72
|
+
```ruby
|
|
73
|
+
req = SchemaRegistryCli::Register.new(subject: "kafka-key", schema: "{\"type\": \"string\"}")
|
|
74
|
+
req.body #=> {"id":1}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
classes available:
|
|
78
|
+
|
|
79
|
+
- Register
|
|
80
|
+
- Subjects
|
|
81
|
+
- SubjectVersions
|
|
82
|
+
- FetchSchema
|
|
83
|
+
- FetchVersion
|
|
84
|
+
- LatestVersion
|
|
85
|
+
- DeleteVersion
|
|
86
|
+
- DeleteSubject
|
|
87
|
+
- CheckRegistered
|
|
88
|
+
- TestCompatibility
|
|
89
|
+
- SRConfig
|
|
90
|
+
- UpdateConfig
|
|
91
|
+
- UpdateSubjectCompatibility
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
### Rake
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
rake -T
|
|
98
|
+
|
|
99
|
+
rake schema_registry_cli:delete_all_schemas # [DESTRUCTIVE] this will delete all schemas
|
|
100
|
+
rake schema_registry_cli:show_latest # show last version of all registered schemas
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Development
|
|
104
|
+
|
|
105
|
+
run schema registry locally:
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
bin/run_registry
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
run tests:
|
|
112
|
+
|
|
113
|
+
```
|
|
114
|
+
bundle exec rspec
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Contributing
|
|
118
|
+
|
|
119
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/arturictus/schema_registry_cli. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
|
120
|
+
|
|
121
|
+
## Code of Conduct
|
|
122
|
+
|
|
123
|
+
Everyone interacting in the SchemaRegistryCli project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/arturictus/schema_registry_cli/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
require "bundler/gem_tasks"
|
|
2
|
+
require "rspec/core/rake_task"
|
|
3
|
+
require 'yaml'
|
|
4
|
+
|
|
5
|
+
RSpec::Core::RakeTask.new(:spec)
|
|
6
|
+
|
|
7
|
+
task :default => :spec
|
|
8
|
+
|
|
9
|
+
namespace :schema_registry_cli do
|
|
10
|
+
task :load_app do
|
|
11
|
+
require 'schema_registry_cli'
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
task :confirm do
|
|
15
|
+
confirm_token = "y"
|
|
16
|
+
puts "Current url for schema registry is:"
|
|
17
|
+
puts ""
|
|
18
|
+
puts SchemaRegistryCli.setup.domain
|
|
19
|
+
puts ""
|
|
20
|
+
puts "This task is destructive! Are you sure you want to continue? [y/N]"
|
|
21
|
+
input = STDIN.gets.chomp
|
|
22
|
+
raise "Aborting. You entered #{input}" unless input == confirm_token
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
desc "show last version of all registered schemas"
|
|
26
|
+
task show_latest: :load_app do
|
|
27
|
+
SchemaRegistryCli.subjects.call!.body.each do |subject|
|
|
28
|
+
response = SchemaRegistryCli.latest_version(subject).call!.body
|
|
29
|
+
puts response.to_yaml
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
desc "[DESTRUCTIVE] this will delete all schemas"
|
|
34
|
+
# USAGE skipping prompt
|
|
35
|
+
# echo "y" | bundle exec rake schema_registry_cli:delete_all_schemas
|
|
36
|
+
task delete_all_schemas: [:load_app, :confirm] do
|
|
37
|
+
puts "Deleting all schemas ..."
|
|
38
|
+
subjs = SchemaRegistryCli::Subjects.call!
|
|
39
|
+
subjs.body.each do |s|
|
|
40
|
+
puts "Deleting subject: #{s}"
|
|
41
|
+
SchemaRegistryCli::DeleteSubject.call!(subject: s)
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
data/bin/console
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require "bundler/setup"
|
|
4
|
+
require "schema_registry_cli"
|
|
5
|
+
|
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
|
8
|
+
|
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
|
10
|
+
# require "pry"
|
|
11
|
+
# Pry.start
|
|
12
|
+
|
|
13
|
+
require "irb"
|
|
14
|
+
IRB.start(__FILE__)
|
data/bin/run_registry
ADDED
data/bin/setup
ADDED
data/bundle
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Y exec rake schema_registry_cli:delete_all_schemas
|
data/docker-compose.yml
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
version: '2.1'
|
|
2
|
+
|
|
3
|
+
services:
|
|
4
|
+
zoo1:
|
|
5
|
+
image: zookeeper:3.4.9
|
|
6
|
+
restart: unless-stopped
|
|
7
|
+
hostname: zoo1
|
|
8
|
+
ports:
|
|
9
|
+
- "2181:2181"
|
|
10
|
+
environment:
|
|
11
|
+
ZOO_MY_ID: 1
|
|
12
|
+
ZOO_PORT: 2181
|
|
13
|
+
ZOO_SERVERS: server.1=zoo1:2888:3888
|
|
14
|
+
volumes:
|
|
15
|
+
- ./full-stack/zoo1/data:/data
|
|
16
|
+
- ./full-stack/zoo1/datalog:/datalog
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
kafka1:
|
|
20
|
+
image: confluentinc/cp-kafka:5.3.0
|
|
21
|
+
hostname: kafka1
|
|
22
|
+
ports:
|
|
23
|
+
- "9092:9092"
|
|
24
|
+
environment:
|
|
25
|
+
KAFKA_ADVERTISED_LISTENERS: LISTENER_DOCKER_INTERNAL://kafka1:19092,LISTENER_DOCKER_EXTERNAL://${DOCKER_HOST_IP:-127.0.0.1}:9092
|
|
26
|
+
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: LISTENER_DOCKER_INTERNAL:PLAINTEXT,LISTENER_DOCKER_EXTERNAL:PLAINTEXT
|
|
27
|
+
KAFKA_INTER_BROKER_LISTENER_NAME: LISTENER_DOCKER_INTERNAL
|
|
28
|
+
KAFKA_ZOOKEEPER_CONNECT: "zoo1:2181"
|
|
29
|
+
KAFKA_BROKER_ID: 1
|
|
30
|
+
KAFKA_LOG4J_LOGGERS: "kafka.controller=INFO,kafka.producer.async.DefaultEventHandler=INFO,state.change.logger=INFO"
|
|
31
|
+
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
|
|
32
|
+
volumes:
|
|
33
|
+
- ./full-stack/kafka1/data:/var/lib/kafka/data
|
|
34
|
+
depends_on:
|
|
35
|
+
- zoo1
|
|
36
|
+
|
|
37
|
+
kafka-schema-registry:
|
|
38
|
+
image: confluentinc/cp-schema-registry:5.3.0
|
|
39
|
+
hostname: kafka-schema-registry
|
|
40
|
+
ports:
|
|
41
|
+
- "8081:8081"
|
|
42
|
+
environment:
|
|
43
|
+
SCHEMA_REGISTRY_KAFKASTORE_BOOTSTRAP_SERVERS: PLAINTEXT://kafka1:19092
|
|
44
|
+
SCHEMA_REGISTRY_HOST_NAME: kafka-schema-registry
|
|
45
|
+
SCHEMA_REGISTRY_LISTENERS: http://0.0.0.0:8081
|
|
46
|
+
depends_on:
|
|
47
|
+
- zoo1
|
|
48
|
+
- kafka1
|
|
49
|
+
|
|
50
|
+
schema-registry-ui:
|
|
51
|
+
image: landoop/schema-registry-ui:0.9.4
|
|
52
|
+
hostname: kafka-schema-registry-ui
|
|
53
|
+
ports:
|
|
54
|
+
- "8001:8000"
|
|
55
|
+
environment:
|
|
56
|
+
SCHEMAREGISTRY_URL: http://kafka-schema-registry:8081/
|
|
57
|
+
PROXY: "true"
|
|
58
|
+
depends_on:
|
|
59
|
+
- kafka-schema-registry
|
|
60
|
+
|
|
61
|
+
kafka-rest-proxy:
|
|
62
|
+
image: confluentinc/cp-kafka-rest:5.3.0
|
|
63
|
+
hostname: kafka-rest-proxy
|
|
64
|
+
ports:
|
|
65
|
+
- "8082:8082"
|
|
66
|
+
environment:
|
|
67
|
+
# KAFKA_REST_ZOOKEEPER_CONNECT: zoo1:2181
|
|
68
|
+
KAFKA_REST_LISTENERS: http://0.0.0.0:8082/
|
|
69
|
+
KAFKA_REST_SCHEMA_REGISTRY_URL: http://kafka-schema-registry:8081/
|
|
70
|
+
KAFKA_REST_HOST_NAME: kafka-rest-proxy
|
|
71
|
+
KAFKA_REST_BOOTSTRAP_SERVERS: PLAINTEXT://kafka1:19092
|
|
72
|
+
depends_on:
|
|
73
|
+
- zoo1
|
|
74
|
+
- kafka1
|
|
75
|
+
- kafka-schema-registry
|
|
76
|
+
|
|
77
|
+
kafka-topics-ui:
|
|
78
|
+
image: landoop/kafka-topics-ui:0.9.4
|
|
79
|
+
hostname: kafka-topics-ui
|
|
80
|
+
ports:
|
|
81
|
+
- "8000:8000"
|
|
82
|
+
environment:
|
|
83
|
+
KAFKA_REST_PROXY_URL: "http://kafka-rest-proxy:8082/"
|
|
84
|
+
PROXY: "true"
|
|
85
|
+
depends_on:
|
|
86
|
+
- zoo1
|
|
87
|
+
- kafka1
|
|
88
|
+
- kafka-schema-registry
|
|
89
|
+
- kafka-rest-proxy
|
|
90
|
+
|
|
91
|
+
kafka-connect:
|
|
92
|
+
image: confluentinc/cp-kafka-connect:5.3.0
|
|
93
|
+
hostname: kafka-connect
|
|
94
|
+
ports:
|
|
95
|
+
- "8083:8083"
|
|
96
|
+
environment:
|
|
97
|
+
CONNECT_BOOTSTRAP_SERVERS: "kafka1:19092"
|
|
98
|
+
CONNECT_REST_PORT: 8083
|
|
99
|
+
CONNECT_GROUP_ID: compose-connect-group
|
|
100
|
+
CONNECT_CONFIG_STORAGE_TOPIC: docker-connect-configs
|
|
101
|
+
CONNECT_OFFSET_STORAGE_TOPIC: docker-connect-offsets
|
|
102
|
+
CONNECT_STATUS_STORAGE_TOPIC: docker-connect-status
|
|
103
|
+
CONNECT_KEY_CONVERTER: io.confluent.connect.avro.AvroConverter
|
|
104
|
+
CONNECT_KEY_CONVERTER_SCHEMA_REGISTRY_URL: 'http://kafka-schema-registry:8081'
|
|
105
|
+
CONNECT_VALUE_CONVERTER: io.confluent.connect.avro.AvroConverter
|
|
106
|
+
CONNECT_VALUE_CONVERTER_SCHEMA_REGISTRY_URL: 'http://kafka-schema-registry:8081'
|
|
107
|
+
CONNECT_INTERNAL_KEY_CONVERTER: "org.apache.kafka.connect.json.JsonConverter"
|
|
108
|
+
CONNECT_INTERNAL_VALUE_CONVERTER: "org.apache.kafka.connect.json.JsonConverter"
|
|
109
|
+
CONNECT_REST_ADVERTISED_HOST_NAME: "kafka-connect"
|
|
110
|
+
CONNECT_LOG4J_ROOT_LOGLEVEL: "INFO"
|
|
111
|
+
CONNECT_LOG4J_LOGGERS: "org.apache.kafka.connect.runtime.rest=WARN,org.reflections=ERROR"
|
|
112
|
+
CONNECT_CONFIG_STORAGE_REPLICATION_FACTOR: "1"
|
|
113
|
+
CONNECT_OFFSET_STORAGE_REPLICATION_FACTOR: "1"
|
|
114
|
+
CONNECT_STATUS_STORAGE_REPLICATION_FACTOR: "1"
|
|
115
|
+
CONNECT_PLUGIN_PATH: '/usr/share/java,/etc/kafka-connect/jars'
|
|
116
|
+
volumes:
|
|
117
|
+
- ./connectors:/etc/kafka-connect/jars/
|
|
118
|
+
depends_on:
|
|
119
|
+
- zoo1
|
|
120
|
+
- kafka1
|
|
121
|
+
- kafka-schema-registry
|
|
122
|
+
- kafka-rest-proxy
|
|
123
|
+
|
|
124
|
+
kafka-connect-ui:
|
|
125
|
+
image: landoop/kafka-connect-ui:0.9.4
|
|
126
|
+
hostname: kafka-connect-ui
|
|
127
|
+
ports:
|
|
128
|
+
- "8003:8000"
|
|
129
|
+
environment:
|
|
130
|
+
CONNECT_URL: "http://kafka-connect:8083/"
|
|
131
|
+
PROXY: "true"
|
|
132
|
+
depends_on:
|
|
133
|
+
- kafka-connect
|
|
134
|
+
|
|
135
|
+
ksql-server:
|
|
136
|
+
image: confluentinc/cp-ksql-server:5.3.0
|
|
137
|
+
hostname: ksql-server
|
|
138
|
+
ports:
|
|
139
|
+
- "8088:8088"
|
|
140
|
+
environment:
|
|
141
|
+
KSQL_BOOTSTRAP_SERVERS: PLAINTEXT://kafka1:19092
|
|
142
|
+
KSQL_LISTENERS: http://0.0.0.0:8088/
|
|
143
|
+
KSQL_KSQL_SERVICE_ID: ksql-server_
|
|
144
|
+
depends_on:
|
|
145
|
+
- zoo1
|
|
146
|
+
- kafka1
|
|
147
|
+
|
|
148
|
+
zoonavigator-web:
|
|
149
|
+
image: elkozmon/zoonavigator-web:0.5.1
|
|
150
|
+
ports:
|
|
151
|
+
- "8004:8000"
|
|
152
|
+
environment:
|
|
153
|
+
API_HOST: "zoonavigator-api"
|
|
154
|
+
API_PORT: 9000
|
|
155
|
+
links:
|
|
156
|
+
- zoonavigator-api
|
|
157
|
+
depends_on:
|
|
158
|
+
- zoonavigator-api
|
|
159
|
+
|
|
160
|
+
zoonavigator-api:
|
|
161
|
+
image: elkozmon/zoonavigator-api:0.5.1
|
|
162
|
+
environment:
|
|
163
|
+
SERVER_HTTP_PORT: 9000
|
|
164
|
+
depends_on:
|
|
165
|
+
- zoo1
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
module SchemaRegistryCli
|
|
2
|
+
class Register < Endpoint
|
|
3
|
+
# Register a new version of a schema under the subject "Kafka-key"
|
|
4
|
+
# example:
|
|
5
|
+
# req = Register.new(subject: "kafka-key", schema: "{\"type\": \"string\"}")
|
|
6
|
+
# req.body #=> {"id":1}
|
|
7
|
+
path "subjects/:subject/versions"
|
|
8
|
+
verb :post
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class Subjects < Endpoint
|
|
13
|
+
# List all subjects
|
|
14
|
+
# example:
|
|
15
|
+
# req = Subjects.new
|
|
16
|
+
# req.body #=> ["Kafka-value","Kafka-key"]
|
|
17
|
+
path "subjects"
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class SubjectVersions < Endpoint
|
|
22
|
+
# List all schema versions registered under the subject "kafka-key"
|
|
23
|
+
# example:
|
|
24
|
+
# req = SubjectVersions.new(subject: "kafka-key")
|
|
25
|
+
# req.body #=> [1]
|
|
26
|
+
path 'subjects/:subject/versions'
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class FetchSchema < Endpoint
|
|
31
|
+
# Fetch a schema by globally unique id
|
|
32
|
+
# example:
|
|
33
|
+
# req = FetchSchema.new(id: 1)
|
|
34
|
+
# req.body
|
|
35
|
+
# #=> {"schema":"\"string\""}
|
|
36
|
+
path 'schemas/ids/:id'
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class FetchVersion < Endpoint
|
|
41
|
+
# Fetch version 1 of the schema registered under subject "Kafka-value"
|
|
42
|
+
# example:
|
|
43
|
+
# req = FetchVersion.new(subject: "kafka-value", version: 1)
|
|
44
|
+
# req.body
|
|
45
|
+
# #=> {"subject":"Kafka-value","version":1,"id":1,"schema":"\"string\""}
|
|
46
|
+
path 'subjects/:subject/versions/:version'
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
class LatestVersion < Endpoint
|
|
51
|
+
# Fetch the most recently registered schema under subject "Kafka-value"
|
|
52
|
+
# example:
|
|
53
|
+
# req = LatestVersion.new(subject: "kafka-value")
|
|
54
|
+
# req.body
|
|
55
|
+
# #=> {"subject":"Kafka-value","version":1,"id":1,"schema":"\"string\""}
|
|
56
|
+
path 'subjects/:subject/versions/latest'
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
class DeleteVersion < Endpoint
|
|
61
|
+
# Delete version 3 of the schema registered under subject "Kafka-value"
|
|
62
|
+
# example:
|
|
63
|
+
# req = DeleteVersion.new(subject: "Kafka-value", version: 3)
|
|
64
|
+
# req.body #=> 3
|
|
65
|
+
path 'subjects/:subject/versions/:version'
|
|
66
|
+
verb :delete
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
class DeleteSubject < Endpoint
|
|
71
|
+
# Delete all versions of the schema registered under subject "Kafka-value"
|
|
72
|
+
# example:
|
|
73
|
+
# req = DeleteSubject.new(subject: "Kafka-value")
|
|
74
|
+
# req.body #=> [1, 2, 3, 4, 5]
|
|
75
|
+
path 'subjects/:subject'
|
|
76
|
+
verb :delete
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
class CheckRegistered < Endpoint
|
|
81
|
+
# Check whether a schema has been registered under subject "Kafka-key"
|
|
82
|
+
# example:
|
|
83
|
+
# req = CheckRegistered.new(subject: "Kafka-key", schema: "{\"type\": \"string\"}")
|
|
84
|
+
# req.body
|
|
85
|
+
# #=> {"subject":"Kafka-key","version":1,"id":1,"schema":"\"string\""}
|
|
86
|
+
path 'subjects/:subject'
|
|
87
|
+
verb :post
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
class TestCompatibility < Endpoint
|
|
92
|
+
# Test compatibility of a schema with the latest schema under subject "Kafka-value"
|
|
93
|
+
# example:
|
|
94
|
+
# req = TestCompatibility.new(subject: "Kafka-value", schema: "{\"type\": \"string\"}")
|
|
95
|
+
# req.body #=> {"is_compatible":true}
|
|
96
|
+
path "compatibility/subjects/:subject/versions/latest"
|
|
97
|
+
verb :post
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
class SRConfig < Endpoint
|
|
101
|
+
# Get top level config
|
|
102
|
+
# example:
|
|
103
|
+
# req = SRConfig.new
|
|
104
|
+
# req.body #=> {"compatibilityLevel":"BACKWARD"}
|
|
105
|
+
path 'config'
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
class UpdateConfig < Endpoint
|
|
110
|
+
# Update compatibility requirements globally
|
|
111
|
+
# example:
|
|
112
|
+
# req = UpdateConfig.new(compatibility: "NONE")
|
|
113
|
+
# req.body #=> {"compatibility":"NONE"}
|
|
114
|
+
path 'config'
|
|
115
|
+
verb :put
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
class UpdateSubjectCompatibility < Endpoint
|
|
119
|
+
# Update compatibility requirements under the subject "Kafka-value"
|
|
120
|
+
# example:
|
|
121
|
+
# req = UpdateSubjectCompatibility.new(subject: "Kafka-value", compatibility: "BACKWARD")
|
|
122
|
+
# req.body #=> {"compatibility":"BACKWARD"}
|
|
123
|
+
path 'config/:subject'
|
|
124
|
+
verb :put
|
|
125
|
+
end
|
|
126
|
+
end
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
require "schema_registry_cli/version"
|
|
2
|
+
require 'wrappi'
|
|
3
|
+
|
|
4
|
+
module SchemaRegistryCli
|
|
5
|
+
# Ruby client for confluent schema registry
|
|
6
|
+
# https://github.com/confluentinc/schema-registry
|
|
7
|
+
#
|
|
8
|
+
class Client < Wrappi::Client
|
|
9
|
+
setup do |config|
|
|
10
|
+
config.domain = 'http://localhost:8081/'
|
|
11
|
+
config.headers = {
|
|
12
|
+
'Content-Type' => 'application/vnd.schemaregistry.v1+json'
|
|
13
|
+
}
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def self.setup
|
|
18
|
+
Client
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
class Endpoint < Wrappi::Endpoint
|
|
22
|
+
client Client
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def self.register(subject, schema)
|
|
26
|
+
Register.new(schema: schema.to_json, subject: subject)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def self.subjects
|
|
30
|
+
Subjects.new
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def self.subject_versions(subject)
|
|
34
|
+
SubjectVersions.new(subject: subject)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def self.fetch_schema(id)
|
|
38
|
+
FetchSchema.new(id: id)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def self.fetch_version(subject, version)
|
|
42
|
+
FetchVersion.new(subject: subject, version: version)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def self.latest_version(subject)
|
|
46
|
+
LatestVersion.new(subject: subject)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def self.delete_version(subject, version)
|
|
50
|
+
DeleteVersion.new(subject: subject, version: version)
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def self.delete_subject(subject)
|
|
54
|
+
DeleteSubject.new(subject: subject)
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def self.check_registered(subject, body)
|
|
58
|
+
CheckRegistered.new(schema: body.to_json, subject: subject)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def self.test_compatibility(subject, schema)
|
|
62
|
+
TestCompatibility.new(subject: subject, schema: schema.to_json)
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def self.sr_config
|
|
66
|
+
SRConfig.new
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def self.update_config(value)
|
|
70
|
+
UpdateConfig.new(compatibility: value)
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def self.update_subject_compatibility(value)
|
|
74
|
+
UpdateSubjectCompatibility.new(subject: subject, compatibility: value)
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
require 'schema_registry_cli/endpoints'
|
|
79
|
+
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
|
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require "schema_registry_cli/version"
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = "schema_registry_cli"
|
|
8
|
+
spec.version = SchemaRegistryCli::VERSION
|
|
9
|
+
spec.authors = ["Artur Panach"]
|
|
10
|
+
spec.email = ["arturictus@gmail.com"]
|
|
11
|
+
|
|
12
|
+
spec.summary = %q{Ruby client for confluent schema registry}
|
|
13
|
+
spec.description = %q{Ruby client for confluent schema registry: https://github.com/confluentinc/schema-registry}
|
|
14
|
+
spec.homepage = "https://github.com/arturictus/schema_registry_cli"
|
|
15
|
+
|
|
16
|
+
# Specify which files should be added to the gem when it is released.
|
|
17
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
18
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
|
19
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
20
|
+
end
|
|
21
|
+
spec.bindir = "exe"
|
|
22
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
23
|
+
spec.require_paths = ["lib"]
|
|
24
|
+
|
|
25
|
+
spec.add_development_dependency "bundler", "~> 1.17"
|
|
26
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
|
27
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
|
28
|
+
spec.add_dependency "wrappi", "~> 0.2.6"
|
|
29
|
+
|
|
30
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: schema_registry_cli
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Artur Panach
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: exe
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2019-08-26 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: bundler
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '1.17'
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '1.17'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: rake
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '10.0'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '10.0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: rspec
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - "~>"
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '3.0'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - "~>"
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '3.0'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: wrappi
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - "~>"
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: 0.2.6
|
|
62
|
+
type: :runtime
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - "~>"
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: 0.2.6
|
|
69
|
+
description: 'Ruby client for confluent schema registry: https://github.com/confluentinc/schema-registry'
|
|
70
|
+
email:
|
|
71
|
+
- arturictus@gmail.com
|
|
72
|
+
executables: []
|
|
73
|
+
extensions: []
|
|
74
|
+
extra_rdoc_files: []
|
|
75
|
+
files:
|
|
76
|
+
- ".gitignore"
|
|
77
|
+
- ".rspec"
|
|
78
|
+
- ".travis.yml"
|
|
79
|
+
- CODE_OF_CONDUCT.md
|
|
80
|
+
- Gemfile
|
|
81
|
+
- Gemfile.lock
|
|
82
|
+
- README.md
|
|
83
|
+
- Rakefile
|
|
84
|
+
- bin/console
|
|
85
|
+
- bin/run_registry
|
|
86
|
+
- bin/setup
|
|
87
|
+
- bundle
|
|
88
|
+
- docker-compose.yml
|
|
89
|
+
- lib/schema_registry_cli.rb
|
|
90
|
+
- lib/schema_registry_cli/endpoints.rb
|
|
91
|
+
- lib/schema_registry_cli/version.rb
|
|
92
|
+
- schema_registry_cli.gemspec
|
|
93
|
+
homepage: https://github.com/arturictus/schema_registry_cli
|
|
94
|
+
licenses: []
|
|
95
|
+
metadata: {}
|
|
96
|
+
post_install_message:
|
|
97
|
+
rdoc_options: []
|
|
98
|
+
require_paths:
|
|
99
|
+
- lib
|
|
100
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
101
|
+
requirements:
|
|
102
|
+
- - ">="
|
|
103
|
+
- !ruby/object:Gem::Version
|
|
104
|
+
version: '0'
|
|
105
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
106
|
+
requirements:
|
|
107
|
+
- - ">="
|
|
108
|
+
- !ruby/object:Gem::Version
|
|
109
|
+
version: '0'
|
|
110
|
+
requirements: []
|
|
111
|
+
rubyforge_project:
|
|
112
|
+
rubygems_version: 2.7.6
|
|
113
|
+
signing_key:
|
|
114
|
+
specification_version: 4
|
|
115
|
+
summary: Ruby client for confluent schema registry
|
|
116
|
+
test_files: []
|