itamae-plugin-recipe-kafka 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/.gitignore +60 -0
- data/.rspec +2 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/LICENSE +21 -0
- data/README.md +74 -0
- data/Rakefile +30 -0
- data/Vagrantfile +33 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/ci/build.sh +8 -0
- data/ci/setup.sh +17 -0
- data/exe/itamae-plugin-recipe-kafka +3 -0
- data/itamae-plugin-recipe-kafka.gemspec +31 -0
- data/lib/itamae-plugin-recipe-kafka.rb +1 -0
- data/lib/itamae/plugin/recipe/kafka.rb +11 -0
- data/lib/itamae/plugin/recipe/kafka/config.rb +45 -0
- data/lib/itamae/plugin/recipe/kafka/default.rb +5 -0
- data/lib/itamae/plugin/recipe/kafka/dependency.rb +23 -0
- data/lib/itamae/plugin/recipe/kafka/install.rb +25 -0
- data/lib/itamae/plugin/recipe/kafka/systemd.rb +30 -0
- data/lib/itamae/plugin/recipe/kafka/templates/config/broker.properties.erb +39 -0
- data/lib/itamae/plugin/recipe/kafka/templates/config/zookeeper.properties.erb +4 -0
- data/lib/itamae/plugin/recipe/kafka/templates/java.sh.erb +2 -0
- data/lib/itamae/plugin/recipe/kafka/templates/kafka.sh.erb +2 -0
- data/lib/itamae/plugin/recipe/kafka/templates/systemd/kafka-broker.service.erb +16 -0
- data/lib/itamae/plugin/recipe/kafka/templates/systemd/kafka-zookeeper.service.erb +16 -0
- data/lib/itamae/plugin/recipe/kafka/version.rb +9 -0
- data/recipes/install.rb +1 -0
- data/recipes/node.yml +26 -0
- data/wercker.yml +21 -0
- metadata +160 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ba1518af73878095eda7422e44d865785555bc50
|
4
|
+
data.tar.gz: b6e353948fbfb6f481a8db68a5dfc0dab25216fc
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4dd3d4f0f66ce01964f2afe43833144edaaf406c6f9b52f7f78a4b66593f1aea40fc09643fd27a715b9438fee9f54438b0fe91eedacae443d719a80a233eae04
|
7
|
+
data.tar.gz: 30fbaed65934da6d738d8f5ad57d3e31c1653737af672f2d85732af1981ff1f431c9a5e9b232950f0678869cde1e0b37bd6316aedc29cd770e0ec724b68d8fe5
|
data/.gitignore
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/spec/examples.txt
|
9
|
+
/test/tmp/
|
10
|
+
/test/version_tmp/
|
11
|
+
/tmp/
|
12
|
+
|
13
|
+
# Used by dotenv library to load environment variables.
|
14
|
+
# .env
|
15
|
+
|
16
|
+
## Specific to RubyMotion:
|
17
|
+
.dat*
|
18
|
+
.repl_history
|
19
|
+
build/
|
20
|
+
*.bridgesupport
|
21
|
+
build-iPhoneOS/
|
22
|
+
build-iPhoneSimulator/
|
23
|
+
|
24
|
+
## Specific to RubyMotion (use of CocoaPods):
|
25
|
+
#
|
26
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
27
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
28
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
29
|
+
#
|
30
|
+
# vendor/Pods/
|
31
|
+
|
32
|
+
## Documentation cache and generated files:
|
33
|
+
/.yardoc/
|
34
|
+
/_yardoc/
|
35
|
+
/doc/
|
36
|
+
/rdoc/
|
37
|
+
|
38
|
+
## Environment normalization:
|
39
|
+
/.bundle/
|
40
|
+
/vendor/bundle
|
41
|
+
/lib/bundler/man/
|
42
|
+
|
43
|
+
# for a library or gem, you might want to ignore these files since the code is
|
44
|
+
# intended to run in multiple environments; otherwise, check them in:
|
45
|
+
Gemfile.lock
|
46
|
+
# .ruby-version
|
47
|
+
# .ruby-gemset
|
48
|
+
|
49
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
50
|
+
.rvmrc
|
51
|
+
|
52
|
+
# rspec failure tracking
|
53
|
+
.rspec_status
|
54
|
+
|
55
|
+
# for vagrant
|
56
|
+
.vagrant
|
57
|
+
|
58
|
+
# for editor
|
59
|
+
*.swp
|
60
|
+
*~
|
data/.rspec
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 ohr486@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/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2017 ohr486
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Itamae::Plugin::Recipe::Kafka
|
2
|
+
|
3
|
+
[![wercker status](https://app.wercker.com/status/d16fa27024405f7773d708eda82e5f61/m/master "wercker status")](https://app.wercker.com/project/byKey/d16fa27024405f7773d708eda82e5f61)
|
4
|
+
|
5
|
+
Itamae plugin to install kafka and ksql
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'itamae-plugin-recipe-kafka'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install itamae-plugin-recipe-kafka
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
### Recipe
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
# your recipe
|
29
|
+
include_recipe "kafka::install"
|
30
|
+
```
|
31
|
+
|
32
|
+
### Node
|
33
|
+
|
34
|
+
```yaml
|
35
|
+
# node.yml
|
36
|
+
scala:
|
37
|
+
# target scala version
|
38
|
+
# see: https://github.com/ohr486/itamae-plugin-recipe-scala
|
39
|
+
version: 2.12.3
|
40
|
+
|
41
|
+
kafka:
|
42
|
+
# target kafka version
|
43
|
+
version: 1.0.0
|
44
|
+
# target scala major.minor version
|
45
|
+
kafka_scala_version: 2.12
|
46
|
+
config:
|
47
|
+
zookeeper:
|
48
|
+
host: your.zookeeper.host
|
49
|
+
port: 2181 # zookeeper port
|
50
|
+
kafka:
|
51
|
+
# kafka server config
|
52
|
+
host-name1:
|
53
|
+
id: 1 # host-name1's broker id
|
54
|
+
host: your.kafka.host1
|
55
|
+
port: 9091 # kafka server port for host1
|
56
|
+
host-name2:
|
57
|
+
id: 2 # host-name2's broker id
|
58
|
+
host: your.kafka.host2
|
59
|
+
port: 9092 # kafka server port for host2
|
60
|
+
...
|
61
|
+
```
|
62
|
+
|
63
|
+
## Testing
|
64
|
+
|
65
|
+
requirements [Vagrant](https://www.vagrantup.com/)
|
66
|
+
|
67
|
+
```sh
|
68
|
+
bundle exec rake itamae:default
|
69
|
+
bundle exec rake spec:default
|
70
|
+
```
|
71
|
+
|
72
|
+
## License
|
73
|
+
|
74
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
require "rspec/core/rake_task"
|
3
|
+
|
4
|
+
task :spec => "spec:all"
|
5
|
+
task :itamae => "itamae:all"
|
6
|
+
|
7
|
+
HOSTS = %w(centos7 aws)
|
8
|
+
|
9
|
+
namespace :spec do
|
10
|
+
task :all => HOSTS
|
11
|
+
|
12
|
+
HOSTS.each do |host|
|
13
|
+
RSpec::Core::RakeTask.new(host.to_sym) do |t|
|
14
|
+
puts "Running tests to #{host} ..."
|
15
|
+
ENV["TARGET_HOST"] = host
|
16
|
+
t.pattern = "spec/*_spec.rb"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
namespace :itamae do
|
22
|
+
task :all => HOSTS
|
23
|
+
|
24
|
+
HOSTS.each do |host|
|
25
|
+
desc "Running itamae to #{host}"
|
26
|
+
task host do
|
27
|
+
sh "itamae ssh --host=#{host} --vagrant --node-yaml=recipes/node.yml recipes/install.rb"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/Vagrantfile
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# -*- mode: ruby -*-
|
2
|
+
# vi: set ft=ruby :
|
3
|
+
|
4
|
+
Vagrant.configure("2") do |config|
|
5
|
+
config.vm.provider :digital_ocean do |provider, override|
|
6
|
+
override.ssh.private_key_path = "~/.ssh/id_rsa"
|
7
|
+
override.vm.box = "digital_ocean"
|
8
|
+
override.vm.box_url = "https://github.com/smdahlen/vagrant-digitalocean/raw/master/box/digital_ocean.box"
|
9
|
+
provider.token = ENV["DIGITALOCEAN_ACCESS_TOKEN"]
|
10
|
+
provider.region = "nyc3"
|
11
|
+
provider.size = "512MB"
|
12
|
+
|
13
|
+
if ENV["WERCKER"] == "true"
|
14
|
+
provider.ssh_key_name = "wercker-vagrant"
|
15
|
+
else
|
16
|
+
provider.ssh_key_name = "local"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
config.vm.provider "virtualbox" do |vb|
|
21
|
+
vb.gui = false
|
22
|
+
vb.memory = "512"
|
23
|
+
end
|
24
|
+
|
25
|
+
config.vm.define "centos7" do |c|
|
26
|
+
c.vm.box = "centos/7"
|
27
|
+
c.vm.provider :digital_ocean do |provider, override|
|
28
|
+
provider.image = "centos-7-x64"
|
29
|
+
end
|
30
|
+
c.vm.hostname = "centos7"
|
31
|
+
c.vm.hostname += "-#{ENV["WERCKER_RUN_ID"]}" if ENV["WERCKER_RUN_ID"]
|
32
|
+
end
|
33
|
+
end
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "itamae/plugin/recipe/kafka"
|
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/setup
ADDED
data/ci/build.sh
ADDED
data/ci/setup.sh
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/bin/bash -xe
|
2
|
+
|
3
|
+
wget -q https://releases.hashicorp.com/vagrant/1.9.8/vagrant_1.9.8_x86_64.rpm
|
4
|
+
rpm -i vagrant_1.9.8_x86_64.rpm
|
5
|
+
vagrant plugin install vagrant-digitalocean
|
6
|
+
|
7
|
+
gem uninstall bundler --all --force
|
8
|
+
gem install bundler --no-document
|
9
|
+
|
10
|
+
# put ssh keys
|
11
|
+
mkdir -m 700 -p $HOME/.ssh
|
12
|
+
set +x
|
13
|
+
echo -e "$DIGITALOCEAN_KEY_PRIVATE" > $HOME/.ssh/id_rsa
|
14
|
+
echo -e "$DIGITALOCEAN_KEY_PUBLIC" > $HOME/.ssh/id_rsa.pub
|
15
|
+
set -x
|
16
|
+
|
17
|
+
chmod 600 $HOME/.ssh/id_rsa
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "itamae/plugin/recipe/kafka/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "itamae-plugin-recipe-kafka"
|
8
|
+
spec.version = Itamae::Plugin::Recipe::Kafka::VERSION
|
9
|
+
spec.authors = ["ohr486"]
|
10
|
+
spec.email = ["ohr486@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Itamae plugin to install kafka}
|
13
|
+
spec.description = %q{Itamae plugin to install kafka}
|
14
|
+
spec.homepage = "https://github.com/ohr486/itamae-plugin-recipe-kafka"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
18
|
+
f.match(%r{^(test|spec|features)/})
|
19
|
+
end
|
20
|
+
spec.bindir = "exe"
|
21
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
|
+
spec.require_paths = ["lib"]
|
23
|
+
|
24
|
+
spec.add_dependency "itamae", "~> 1.2"
|
25
|
+
spec.add_dependency "itamae-plugin-recipe-scala", "~> 0.0.1"
|
26
|
+
|
27
|
+
spec.add_development_dependency "bundler", "~> 1.15"
|
28
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
29
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
30
|
+
spec.add_development_dependency "serverspec"
|
31
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require "itamae/plugin/recipe/kafka"
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# --- SETTINGS ---
|
2
|
+
|
3
|
+
kafka_version = node[:kafka][:version]
|
4
|
+
scala_version = node[:kafka][:scala_version]
|
5
|
+
kafka_config = node[:kafka][:config]
|
6
|
+
|
7
|
+
directory "/usr/local/kafka" do
|
8
|
+
mode "0755"
|
9
|
+
owner "root"
|
10
|
+
group "root"
|
11
|
+
end
|
12
|
+
|
13
|
+
directory "/usr/local/kafka/config" do
|
14
|
+
mode "0755"
|
15
|
+
owner "root"
|
16
|
+
group "root"
|
17
|
+
end
|
18
|
+
|
19
|
+
kafka_config[:kafka].keys.each do |host|
|
20
|
+
template "/usr/local/kafka/config/broker#{kafka_config[:kafka][host][:id]}.properties" do
|
21
|
+
action :create
|
22
|
+
source "templates/config/broker.properties.erb"
|
23
|
+
owner "root"
|
24
|
+
group "root"
|
25
|
+
mode "644"
|
26
|
+
variables(host: host, kafka_config: kafka_config)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
template "/usr/local/kafka/config/zookeeper.properties" do
|
31
|
+
action :create
|
32
|
+
source "templates/config/zookeeper.properties.erb"
|
33
|
+
owner "root"
|
34
|
+
group "root"
|
35
|
+
mode "644"
|
36
|
+
end
|
37
|
+
|
38
|
+
template "/etc/profile.d/kafka.sh" do
|
39
|
+
action :create
|
40
|
+
source "templates/kafka.sh.erb"
|
41
|
+
owner "root"
|
42
|
+
group "root"
|
43
|
+
mode "644"
|
44
|
+
variables(kafka_path: "/usr/local/kafka/kafka_#{scala_version}-#{kafka_version}")
|
45
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
%w(kafka kafka-*).each do |pkg|
|
2
|
+
package pkg do
|
3
|
+
action :remove
|
4
|
+
end
|
5
|
+
end
|
6
|
+
|
7
|
+
%w(
|
8
|
+
wget
|
9
|
+
unzip
|
10
|
+
java-1.8.0-openjdk-devel
|
11
|
+
maven
|
12
|
+
).each do |pkg|
|
13
|
+
package pkg do
|
14
|
+
action :install
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
case node[:platform]
|
19
|
+
when "redhat", "fedra", "amazon"
|
20
|
+
# TODO: add if need
|
21
|
+
else
|
22
|
+
raise "Sorry, unsupported platfrom."
|
23
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# --- SETTINGS ---
|
2
|
+
|
3
|
+
kafka_version = node[:kafka][:version]
|
4
|
+
scala_version = node[:kafka][:scala_version]
|
5
|
+
kafka_config = node[:kafka][:config]
|
6
|
+
|
7
|
+
directory "/usr/local/kafka" do
|
8
|
+
mode "0755"
|
9
|
+
owner "root"
|
10
|
+
group "root"
|
11
|
+
end
|
12
|
+
|
13
|
+
# --- INSTALL ---
|
14
|
+
|
15
|
+
execute "# get kafka tar" do
|
16
|
+
not_if "test -e /usr/local/kafka/kafka_#{scala_version}-#{kafka_version}.tgz"
|
17
|
+
cwd "/usr/local/kafka"
|
18
|
+
command "wget -q http://apache.mirror.anlx.net/kafka/#{kafka_version}/kafka_#{scala_version}-#{kafka_version}.tgz"
|
19
|
+
end
|
20
|
+
|
21
|
+
execute "# unzip tar" do
|
22
|
+
not_if "test -e /usr/local/kafka/kafka_#{scala_version}-#{kafka_version}"
|
23
|
+
cwd "/usr/local/kafka"
|
24
|
+
command "tar xzvf kafka_#{scala_version}-#{kafka_version}.tgz"
|
25
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# --- SETTINGS ---
|
2
|
+
|
3
|
+
kafka_version = node[:kafka][:version]
|
4
|
+
scala_version = node[:kafka][:scala_version]
|
5
|
+
kafka_config = node[:kafka][:config]
|
6
|
+
|
7
|
+
# --- SYSTEMD ---
|
8
|
+
|
9
|
+
template "/etc/systemd/system/kafka-zookeeper.service" do
|
10
|
+
action :create
|
11
|
+
source "templates/systemd/kafka-zookeeper.service.erb"
|
12
|
+
owner "root"
|
13
|
+
group "root"
|
14
|
+
mode "644"
|
15
|
+
variables(scala_version: scala_version, kafka_version: kafka_version)
|
16
|
+
end
|
17
|
+
|
18
|
+
kafka_config[:kafka].keys.each do |host|
|
19
|
+
template "/etc/systemd/system/kafka-broker#{kafka_config[:kafka][host][:id]}.service" do
|
20
|
+
action :create
|
21
|
+
source "templates/systemd/kafka-broker.service.erb"
|
22
|
+
owner "root"
|
23
|
+
group "root"
|
24
|
+
mode "644"
|
25
|
+
variables(
|
26
|
+
host: host, kafka_config: kafka_config, id: kafka_config[:kafka][host][:id],
|
27
|
+
scala_version: scala_version, kafka_version: kafka_version
|
28
|
+
)
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
### Server Basics
|
2
|
+
broker.id=<%= @kafka_config[:kafka][@host][:id] %>
|
3
|
+
#delete.topic.enable=true
|
4
|
+
|
5
|
+
### Socket Server Settings
|
6
|
+
listeners=PLAINTEXT://<%= @kafka_config[:kafka][@host][:host] %>:<%= @kafka_config[:kafka][@host][:port] %>
|
7
|
+
advertised.listeners=PLAINTEXT://<%= @kafka_config[:kafka][@host][:host] %>:<%= @kafka_config[:kafka][@host][:port] %>
|
8
|
+
#listener.security.protocol.map=PLAINTEXT:PLAINTEXT,SSL:SSL,SASL_PLAINTEXT:SASL_PLAINTEXT,SASL_SSL:SASL_SSL
|
9
|
+
num.network.threads=3
|
10
|
+
num.io.threads=8
|
11
|
+
socket.send.buffer.bytes=102400
|
12
|
+
socket.receive.buffer.bytes=102400
|
13
|
+
socket.request.max.bytes=104857600
|
14
|
+
|
15
|
+
### Log Basics
|
16
|
+
log.dirs=/tmp/kafka-logs
|
17
|
+
num.partitions=1
|
18
|
+
num.recovery.threads.per.data.dir=1
|
19
|
+
|
20
|
+
### Internal Topic Settings
|
21
|
+
offsets.topic.replication.factor=1
|
22
|
+
transaction.state.log.replication.factor=1
|
23
|
+
transaction.state.log.min.isr=1
|
24
|
+
|
25
|
+
### Log Flush Policy
|
26
|
+
#log.flush.interval.messages=10000
|
27
|
+
#log.flush.interval.ms=1000
|
28
|
+
|
29
|
+
### Log Retention Policy
|
30
|
+
log.retention.hours=168
|
31
|
+
log.segment.bytes=1073741824
|
32
|
+
log.retention.check.interval.ms=300000
|
33
|
+
|
34
|
+
### Zookeeper
|
35
|
+
zookeeper.connect=<%= @kafka_config[:zookeeper][:host]%>:<%= @kafka_config[:zookeeper][:port] %>
|
36
|
+
zookeeper.connection.timeout.ms=6000
|
37
|
+
|
38
|
+
### Group Coordinator Settings
|
39
|
+
group.initial.rebalance.delay.ms=0
|
@@ -0,0 +1,16 @@
|
|
1
|
+
[Unit]
|
2
|
+
Description=Apache Kafka Broker Manager
|
3
|
+
Documentation=http://kafka.apache.org/documentation.html
|
4
|
+
|
5
|
+
[Service]
|
6
|
+
Type=simple
|
7
|
+
PIDFile=/var/run/kafka-broker.pid
|
8
|
+
User=root
|
9
|
+
Group=root
|
10
|
+
ExecStart=/usr/local/kafka/kafka_<%= @scala_version %>-<%= @kafka_version %>/bin/kafka-server-start.sh /usr/local/kafka/config/broker<%= @id %>.properties
|
11
|
+
ExecStop=/usr/local/kafka/kafka_<%= @scala_version %>-<%= @kafka_version %>/bin/kafka-server-stop.sh
|
12
|
+
Restart=on-failure
|
13
|
+
SyslogIdentifier=kafka
|
14
|
+
|
15
|
+
[Install]
|
16
|
+
WantedBy=multi-user.target
|
@@ -0,0 +1,16 @@
|
|
1
|
+
[Unit]
|
2
|
+
Description=Apache Kafka Zookeeper Manager
|
3
|
+
Documentation=http://kafka.apache.org/documentation.html
|
4
|
+
|
5
|
+
[Service]
|
6
|
+
Type=simple
|
7
|
+
PIDFile=/var/run/kafka-zookpper.pid
|
8
|
+
User=root
|
9
|
+
Group=root
|
10
|
+
ExecStart=/usr/local/kafka/kafka_<%= @scala_version %>-<%= @kafka_version %>/bin/zookeeper-server-start.sh /usr/local/kafka/config/zookeeper.properties
|
11
|
+
ExecStop=/usr/local/kafka/kafka_<%= @scala_version %>-<%= @kafka_version %>/bin/zookeeper-server-stop.sh
|
12
|
+
Restart=on-failure
|
13
|
+
SyslogIdentifier=kafka
|
14
|
+
|
15
|
+
[Install]
|
16
|
+
WantedBy=multi-user.target
|
data/recipes/install.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
include_recipe "kafka::default"
|
data/recipes/node.yml
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
scala:
|
2
|
+
version: 2.12.3
|
3
|
+
|
4
|
+
kafka:
|
5
|
+
version: 1.0.0
|
6
|
+
scala_version: 2.12
|
7
|
+
config:
|
8
|
+
zookeeper:
|
9
|
+
host: host.zookeeper
|
10
|
+
port: 2181
|
11
|
+
kafka:
|
12
|
+
host1:
|
13
|
+
id: 1
|
14
|
+
host: host.broker1
|
15
|
+
port: 9091
|
16
|
+
host2:
|
17
|
+
id: 2
|
18
|
+
host: host.broker2
|
19
|
+
port: 9092
|
20
|
+
host3:
|
21
|
+
id: 3
|
22
|
+
host: host.broker3
|
23
|
+
port: 9093
|
24
|
+
|
25
|
+
ksql:
|
26
|
+
version: 0.1-pre10
|
data/wercker.yml
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
box: drecom/centos-ruby:2.3.1
|
2
|
+
no-response-timeout: 60
|
3
|
+
command-timeout: 60
|
4
|
+
|
5
|
+
default: &default
|
6
|
+
after-steps:
|
7
|
+
- script:
|
8
|
+
name: remove all vms
|
9
|
+
code: vagrant destroy -f
|
10
|
+
|
11
|
+
build-centos7:
|
12
|
+
<<: *default
|
13
|
+
steps:
|
14
|
+
- script:
|
15
|
+
name: setup
|
16
|
+
code: ./ci/setup.sh
|
17
|
+
- bundle-install:
|
18
|
+
jobs: 4
|
19
|
+
- script:
|
20
|
+
name: build CentOS 7.0
|
21
|
+
code: ./ci/build.sh centos7
|
metadata
ADDED
@@ -0,0 +1,160 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: itamae-plugin-recipe-kafka
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- ohr486
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-01-09 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: itamae
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.2'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.2'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: itamae-plugin-recipe-scala
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.0.1
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.0.1
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.15'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.15'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: serverspec
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
description: Itamae plugin to install kafka
|
98
|
+
email:
|
99
|
+
- ohr486@gmail.com
|
100
|
+
executables:
|
101
|
+
- itamae-plugin-recipe-kafka
|
102
|
+
extensions: []
|
103
|
+
extra_rdoc_files: []
|
104
|
+
files:
|
105
|
+
- ".gitignore"
|
106
|
+
- ".rspec"
|
107
|
+
- CODE_OF_CONDUCT.md
|
108
|
+
- Gemfile
|
109
|
+
- LICENSE
|
110
|
+
- README.md
|
111
|
+
- Rakefile
|
112
|
+
- Vagrantfile
|
113
|
+
- bin/console
|
114
|
+
- bin/setup
|
115
|
+
- ci/build.sh
|
116
|
+
- ci/setup.sh
|
117
|
+
- exe/itamae-plugin-recipe-kafka
|
118
|
+
- itamae-plugin-recipe-kafka.gemspec
|
119
|
+
- lib/itamae-plugin-recipe-kafka.rb
|
120
|
+
- lib/itamae/plugin/recipe/kafka.rb
|
121
|
+
- lib/itamae/plugin/recipe/kafka/config.rb
|
122
|
+
- lib/itamae/plugin/recipe/kafka/default.rb
|
123
|
+
- lib/itamae/plugin/recipe/kafka/dependency.rb
|
124
|
+
- lib/itamae/plugin/recipe/kafka/install.rb
|
125
|
+
- lib/itamae/plugin/recipe/kafka/systemd.rb
|
126
|
+
- lib/itamae/plugin/recipe/kafka/templates/config/broker.properties.erb
|
127
|
+
- lib/itamae/plugin/recipe/kafka/templates/config/zookeeper.properties.erb
|
128
|
+
- lib/itamae/plugin/recipe/kafka/templates/java.sh.erb
|
129
|
+
- lib/itamae/plugin/recipe/kafka/templates/kafka.sh.erb
|
130
|
+
- lib/itamae/plugin/recipe/kafka/templates/systemd/kafka-broker.service.erb
|
131
|
+
- lib/itamae/plugin/recipe/kafka/templates/systemd/kafka-zookeeper.service.erb
|
132
|
+
- lib/itamae/plugin/recipe/kafka/version.rb
|
133
|
+
- recipes/install.rb
|
134
|
+
- recipes/node.yml
|
135
|
+
- wercker.yml
|
136
|
+
homepage: https://github.com/ohr486/itamae-plugin-recipe-kafka
|
137
|
+
licenses:
|
138
|
+
- MIT
|
139
|
+
metadata: {}
|
140
|
+
post_install_message:
|
141
|
+
rdoc_options: []
|
142
|
+
require_paths:
|
143
|
+
- lib
|
144
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
145
|
+
requirements:
|
146
|
+
- - ">="
|
147
|
+
- !ruby/object:Gem::Version
|
148
|
+
version: '0'
|
149
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
150
|
+
requirements:
|
151
|
+
- - ">="
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
version: '0'
|
154
|
+
requirements: []
|
155
|
+
rubyforge_project:
|
156
|
+
rubygems_version: 2.6.13
|
157
|
+
signing_key:
|
158
|
+
specification_version: 4
|
159
|
+
summary: Itamae plugin to install kafka
|
160
|
+
test_files: []
|