Skip to content

Commit

Permalink
Merge pull request #4 from innogames/graphite_refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
Felixoid authored Jul 23, 2020
2 parents 6e33060 + 724b6c3 commit 7d86735
Show file tree
Hide file tree
Showing 45 changed files with 2,436 additions and 244 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@
/convert_report.txt
/update_report.txt
.DS_Store
.project
.envrc
/inventory.yaml
38 changes: 23 additions & 15 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,33 +10,41 @@ cache:
before_script:
- bundle -v
- rm Gemfile.lock || true
- gem update --system $RUBYGEMS_VERSION
- "# Update system gems if requested. This is useful to temporarily workaround troubles in the test runner"
- "# Set `rubygems_version` in the .sync.yml to set a value"
- "# Ignore exit code of SIGPIPE'd yes to not fail with shell's pipefail set"
- '[ -z "$RUBYGEMS_VERSION" ] || (yes || true) | gem update --system $RUBYGEMS_VERSION'
- gem --version
- bundle -v
- bundle install --without system_tests --path vendor/bundle --jobs $(nproc)

parallel_spec-Ruby 2.1.9-Puppet ~> 4.0:
stage: unit
image: ruby:2.1.9
syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop-Ruby 2.5.7-Puppet ~> 6:
stage: syntax
image: ruby:2.5.7
script:
- bundle exec rake parallel_spec
- bundle exec rake syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop
variables:
PUPPET_GEM_VERSION: '~> 4.0'
RUBYGEMS_VERSION: '2.7.8'
PUPPET_GEM_VERSION: '~> 6'
tags:
- docker

syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop-Ruby 2.4.4-Puppet ~> 5.5:
stage: syntax
image: ruby:2.4.4
parallel_spec-Ruby 2.5.7-Puppet ~> 6:
stage: unit
image: ruby:2.5.7
script:
- bundle exec rake syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop
- bundle exec rake parallel_spec
variables:
PUPPET_GEM_VERSION: '~> 5.5'
PUPPET_GEM_VERSION: '~> 6'
tags:
- docker

parallel_spec-Ruby 2.4.4-Puppet ~> 5.5:
parallel_spec-Ruby 2.4.5-Puppet ~> 5:
stage: unit
image: ruby:2.4.4
image: ruby:2.4.5
script:
- bundle exec rake parallel_spec
variables:
PUPPET_GEM_VERSION: '~> 5.5'
PUPPET_GEM_VERSION: '~> 5'
tags:
- docker

5 changes: 5 additions & 0 deletions .pdkignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
/convert_report.txt
/update_report.txt
.DS_Store
.project
.envrc
/inventory.yaml
/appveyor.yml
/.fixtures.yml
/Gemfile
Expand All @@ -30,8 +33,10 @@
/.gitlab-ci.yml
/.pdkignore
/Rakefile
/rakelib/
/.rspec
/.rubocop.yml
/.travis.yml
/.yardopts
/spec/
/.vscode/
3 changes: 2 additions & 1 deletion .puppet-lint.rc
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@

--relative
--no-selector_inside_resource-check
21 changes: 18 additions & 3 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
---
require: rubocop-rspec
require:
- rubocop-rspec
- rubocop-i18n
AllCops:
DisplayCopNames: true
TargetRubyVersion: '2.1'
TargetRubyVersion: 2.4.5
Include:
- "./**/*.rb"
Exclude:
Expand All @@ -19,10 +21,13 @@ AllCops:
Metrics/LineLength:
Description: People have wide screens, use them.
Max: 200
GetText:
Enabled: false
GetText/DecorateString:
Description: We don't want to decorate test output.
Exclude:
- spec/*
- spec/**/*
Enabled: false
RSpec/BeforeAfterAll:
Description: Beware of using after(:all) as it may cause state to leak between tests.
A necessary evil in acceptance testing.
Expand All @@ -35,6 +40,10 @@ Style/BlockDelimiters:
Description: Prefer braces for chaining. Mostly an aesthetical choice. Better to
be consistent then.
EnforcedStyle: braces_for_chaining
Style/BracesAroundHashParameters:
Description: Braces are required by Ruby 2.7. Cop removed from RuboCop v0.80.0.
See https://github.com/rubocop-hq/rubocop/pull/7643
Enabled: true
Style/ClassAndModuleChildren:
Description: Compact style reduces the required amount of indentation.
EnforcedStyle: compact
Expand Down Expand Up @@ -84,6 +93,12 @@ Style/MethodCalledOnDoEndBlock:
Enabled: true
Style/StringMethods:
Enabled: true
GetText/DecorateFunctionMessage:
Enabled: false
GetText/DecorateStringFormattingUsingInterpolation:
Enabled: false
GetText/DecorateStringFormattingUsingPercent:
Enabled: false
Layout/EndOfLine:
Enabled: false
Layout/IndentHeredoc:
Expand Down
42 changes: 27 additions & 15 deletions .sync.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,41 @@
---
.gitlab-ci.yml:
custom:
ruby_versions:
# Here we add necessary tag for gitlab runners
# versions should be updated with https://github.com/puppetlabs/pdk-templates/blob/master/config_defaults.yml
# .gitlab-ci.yml['defaults']['ruby_versions']
'2.5.7':
tags:
- docker
'2.4.5':
tags:
- docker
.rubocop.yml:
default_configs:
AllCops:
TargetRubyVersion: '2.4.5'
.travis.yml:
user: innogames
secure: "u/ze96IcjdM627IJADJeVdNb33njyCfmmq5YnAqbL4GSRANTtmsNclZfh+JVzb3sAuRrm7VI11Ri4TlCuX4o/aSGPa7S7ROQFLHVfhWFqmS5Sa/sE3EoRdfyP90QYdaoYSiCfLPgnOhZrNpmhA+anhGvcdcZ5Zn/+IExB1r0mTaLAf2UqZrpdnNlot6zcCsH5qvGCsc0K1SWRFQMgW/7ThrPjXQoXGlJ/45ZjpDjlThu6ZHjJVSwp3d4o4lFZh/fycT0UfD0Yyd04R6pjXEeGp5txVv7lnC4zyawVVRZaWMEqorCeW/akKjVMaXlGxsRVMBpKDjhJRDOoBSpuqQWGJGB9DsqxShhkfV1gx8ofLNwOPW8to+M/Ykm4je7n/mre4B4ObPVb6aHvFIkb+Y4LMT/eLKnt03DnzWQJLTxCftFdBOozDv4p+efQp3rs8MacRLQe58uV4MCzUR72itR49IG4mNbdFJnpKcHwsvLeds+BLcnyBaHtqX7l8Iaam4KiIpWs0l1zaYa7X9SLkkisZq3VpkyQlLlVEQIFLE27aodYT0Ms9ATOZqPyIcUohx/Oe0T30foZ9+3Sb9yrteJdkf4cBbPUn2Ne6JXwefrEoozdHyi+pKcYjQy+LX0epM0hTfyGjnGupUWm2944oKwLf2YcixeNaZP6YJgSDnMeCc="
stages:
- test
Gemfile:
required:
':dependencies':
- gem: xml-simple
':development':
- gem: pdk
Rakefile:
default_disabled_lint_checks:
- selector_inside_resource
- relative
'spec/spec_helper.rb':
mock_with: ':rspec'
spec_overrides: >-
RSpec.configure do |c|
c.after(:suite) do
RSpec::Puppet::Coverage.report!(94)
coverage_limit = 94
RSpec::Puppet::Coverage.report!(coverage_limit) unless RSpec::Puppet::Coverage.results[:total].zero?
end
end
.travis.yml:
user: innogames
secure: "u/ze96IcjdM627IJADJeVdNb33njyCfmmq5YnAqbL4GSRANTtmsNclZfh+JVzb3sAuRrm7VI11Ri4TlCuX4o/aSGPa7S7ROQFLHVfhWFqmS5Sa/sE3EoRdfyP90QYdaoYSiCfLPgnOhZrNpmhA+anhGvcdcZ5Zn/+IExB1r0mTaLAf2UqZrpdnNlot6zcCsH5qvGCsc0K1SWRFQMgW/7ThrPjXQoXGlJ/45ZjpDjlThu6ZHjJVSwp3d4o4lFZh/fycT0UfD0Yyd04R6pjXEeGp5txVv7lnC4zyawVVRZaWMEqorCeW/akKjVMaXlGxsRVMBpKDjhJRDOoBSpuqQWGJGB9DsqxShhkfV1gx8ofLNwOPW8to+M/Ykm4je7n/mre4B4ObPVb6aHvFIkb+Y4LMT/eLKnt03DnzWQJLTxCftFdBOozDv4p+efQp3rs8MacRLQe58uV4MCzUR72itR49IG4mNbdFJnpKcHwsvLeds+BLcnyBaHtqX7l8Iaam4KiIpWs0l1zaYa7X9SLkkisZq3VpkyQlLlVEQIFLE27aodYT0Ms9ATOZqPyIcUohx/Oe0T30foZ9+3Sb9yrteJdkf4cBbPUn2Ne6JXwefrEoozdHyi+pKcYjQy+LX0epM0hTfyGjnGupUWm2944oKwLf2YcixeNaZP6YJgSDnMeCc="
stages:
- test
- name: deploy
if: tag =~ ^v
extras:
- stage: deploy
env: CHECK='build' DEPLOY_TO_FORGE=yes
Rakefile:
default_disabled_lint_checks:
- selector_inside_resource
- relative
37 changes: 21 additions & 16 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,46 @@
---
dist: trusty
os: linux
dist: xenial
language: ruby
cache: bundler
before_install:
- bundle -v
- rm -f Gemfile.lock
- gem update --system $RUBYGEMS_VERSION
- "# Update system gems if requested. This is useful to temporarily workaround troubles in the test runner"
- "# See https://github.com/puppetlabs/pdk-templates/commit/705154d5c437796b821691b707156e1b056d244f for an example of how this was used"
- "# Ignore exit code of SIGPIPE'd yes to not fail with shell's pipefail set"
- '[ -z "$RUBYGEMS_VERSION" ] || (yes || true) | gem update --system $RUBYGEMS_VERSION'
- gem --version
- bundle -v
script:
- 'bundle exec rake $CHECK'
bundler_args: --without system_tests
rvm:
- 2.5.1
env:
global:
- BEAKER_PUPPET_COLLECTION=puppet6 PUPPET_GEM_VERSION="~> 6.0"
- 2.5.7
stages:
- static
- spec
- acceptance
- test
-
if: tag =~ ^v
if: tag =~ ^v\d
name: deploy
matrix:
jobs:
fast_finish: true
include:
-
env: CHECK="syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop"
-
env: CHECK=parallel_spec
env: CHECK="check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop syntax lint metadata_lint"
stage: static
-
env: PUPPET_GEM_VERSION="~> 5.0" CHECK=parallel_spec
rvm: 2.4.4
rvm: 2.4.5
stage: spec
-
env: PUPPET_GEM_VERSION="~> 4.0" CHECK=parallel_spec RUBYGEMS_VERSION=2.7.8
rvm: 2.1.9
env: PUPPET_GEM_VERSION="~> 6.0" CHECK=parallel_spec
rvm: 2.5.7
stage: spec
-
env: CHECK='build' DEPLOY_TO_FORGE=yes
env: DEPLOY_TO_FORGE=yes
stage: deploy
branches:
only:
Expand All @@ -45,7 +50,7 @@ notifications:
email: false
deploy:
provider: puppetforge
user: innogames
username: innogames
password:
secure: "u/ze96IcjdM627IJADJeVdNb33njyCfmmq5YnAqbL4GSRANTtmsNclZfh+JVzb3sAuRrm7VI11Ri4TlCuX4o/aSGPa7S7ROQFLHVfhWFqmS5Sa/sE3EoRdfyP90QYdaoYSiCfLPgnOhZrNpmhA+anhGvcdcZ5Zn/+IExB1r0mTaLAf2UqZrpdnNlot6zcCsH5qvGCsc0K1SWRFQMgW/7ThrPjXQoXGlJ/45ZjpDjlThu6ZHjJVSwp3d4o4lFZh/fycT0UfD0Yyd04R6pjXEeGp5txVv7lnC4zyawVVRZaWMEqorCeW/akKjVMaXlGxsRVMBpKDjhJRDOoBSpuqQWGJGB9DsqxShhkfV1gx8ofLNwOPW8to+M/Ykm4je7n/mre4B4ObPVb6aHvFIkb+Y4LMT/eLKnt03DnzWQJLTxCftFdBOozDv4p+efQp3rs8MacRLQe58uV4MCzUR72itR49IG4mNbdFJnpKcHwsvLeds+BLcnyBaHtqX7l8Iaam4KiIpWs0l1zaYa7X9SLkkisZq3VpkyQlLlVEQIFLE27aodYT0Ms9ATOZqPyIcUohx/Oe0T30foZ9+3Sb9yrteJdkf4cBbPUn2Ne6JXwefrEoozdHyi+pKcYjQy+LX0epM0hTfyGjnGupUWm2944oKwLf2YcixeNaZP6YJgSDnMeCc="
on:
Expand Down
6 changes: 6 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"recommendations": [
"puppet.puppet-vscode",
"rebornix.Ruby"
]
}
22 changes: 12 additions & 10 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,18 @@ ruby_version_segments = Gem::Version.new(RUBY_VERSION.dup).segments
minor_version = ruby_version_segments[0..1].join('.')

group :development do
gem "fast_gettext", '1.1.0', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.1.0')
gem "fast_gettext", require: false if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.1.0')
gem "json_pure", '<= 2.0.1', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.0.0')
gem "json", '= 1.8.1', require: false if Gem::Version.new(RUBY_VERSION.dup) == Gem::Version.new('2.1.9')
gem "json", '<= 2.0.4', require: false if Gem::Version.new(RUBY_VERSION.dup) == Gem::Version.new('2.4.4')
gem "puppet-module-posix-default-r#{minor_version}", require: false, platforms: [:ruby]
gem "puppet-module-posix-dev-r#{minor_version}", require: false, platforms: [:ruby]
gem "puppet-module-win-default-r#{minor_version}", require: false, platforms: [:mswin, :mingw, :x64_mingw]
gem "puppet-module-win-dev-r#{minor_version}", require: false, platforms: [:mswin, :mingw, :x64_mingw]
gem "pdk", require: false
gem "fast_gettext", '1.1.0', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.1.0')
gem "fast_gettext", require: false if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.1.0')
gem "json_pure", '<= 2.0.1', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.0.0')
gem "json", '= 1.8.1', require: false if Gem::Version.new(RUBY_VERSION.dup) == Gem::Version.new('2.1.9')
gem "json", '= 2.0.4', require: false if Gem::Requirement.create('~> 2.4.2').satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
gem "json", '= 2.1.0', require: false if Gem::Requirement.create(['>= 2.5.0', '< 2.7.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
gem "rb-readline", '= 0.5.5', require: false, platforms: [:mswin, :mingw, :x64_mingw]
gem "puppet-module-posix-default-r#{minor_version}", '~> 0.4', require: false, platforms: [:ruby]
gem "puppet-module-posix-dev-r#{minor_version}", '~> 0.4', require: false, platforms: [:ruby]
gem "puppet-module-win-default-r#{minor_version}", '~> 0.4', require: false, platforms: [:mswin, :mingw, :x64_mingw]
gem "puppet-module-win-dev-r#{minor_version}", '~> 0.4', require: false, platforms: [:mswin, :mingw, :x64_mingw]
gem "pdk", require: false
end
group :dependencies do
gem "xml-simple", require: false
Expand Down
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,27 @@ sudo puppetserver gem install xml-simple
See the [examples](./REFERENCE.md#examples)

# Reference

**Classes**

* [`clickhouse`](./REFERENCE.md#clickhouse): this class allows you to install ClickHouse DB's repo, client and server
* [`clickhouse::client`](./REFERENCE.md#clickhouseclient): ClickHouse client class
* [`clickhouse::repo`](./REFERENCE.md#clickhouserepo): installs repository with ClickHouse DBMS
* [`clickhouse::server`](./REFERENCE.md#clickhouseserver): ClickHouse server class
* [`clickhouse::server::config::memory`](./REFERENCE.md#clickhouseserverconfigmemory): Configure memory consumption
* [`clickhouse::server::config::zookeeper`](./REFERENCE.md#clickhouseserverconfigzookeeper): Set proper zookeeper config

**Defined types**

* [`clickhouse::client::config`](./REFERENCE.md#clickhouseclientconfig): generates xml config from hash via ruby xml-simple
* [`clickhouse::error`](./REFERENCE.md#clickhouseerror): Implements error logging with continue of manifests application
* [`clickhouse::server::config`](./REFERENCE.md#clickhouseserverconfig): generates xml config from hash via ruby xml-simple
* [`clickhouse::server::config::profile`](./REFERENCE.md#clickhouseserverconfigprofile): Define ClickHouse profile
* [`clickhouse::server::config::user`](./REFERENCE.md#clickhouseserverconfiguser): Define ClickHouse users

**Resource types**

* [`clickhouse_database`](./REFERENCE.md#clickhouse_database): Manages databases on ClickHouse server

# Limitations
ClickHouse does work only on UNIX-like OS. Theoretically possible to use this module on FreeBSD and Mac OS but should be checked additionally. Feel free to test and open an issue/PR.
Expand Down
Loading

0 comments on commit 7d86735

Please sign in to comment.