Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add percona support, add kitchen and tests with serverspec #14

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,21 @@
.bundle
.vagrant
# Berksfile.lock
*~
*#
.#*
\#*#
.*.sw[a-z]
*.un~
/cookbooks

# Bundler
# Gemfile.lock
bin/*
.bundle/*

.kitchen/
.kitchen.local.yml

test/nodes

Berksfile.lock
47 changes: 47 additions & 0 deletions .kitchen.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
driver:
name: vagrant
require_chef_omnibus: true

platforms:
- name: ubuntu-16.04
driver_config:
box: bento/ubuntu-16.04
- name: debian-8
driver_config:
box: bento/debian-8.6

suites:
- name: mariadb-10.1
run_list:
- recipe[mysqld::mariadb_repository]
- recipe[mysqld::default]
attributes:
mysqld:
db_install: 'mariadb'
root_password: 'abcdef01234567890'
repository:
mariadb:
version: '10.1'
- name: mariadb-10.2
run_list:
- recipe[mysqld::mariadb_repository]
- recipe[mysqld::default]
attributes:
mysqld:
db_install: 'mariadb'
root_password: 'abcdef01234567890'
repository:
mariadb:
version: '10.2'
- name: percona-5.7
run_list:
- recipe[mysqld::percona_repository]
- recipe[mysqld::default]
attributes:
mysqld:
db_install: 'percona'
root_password: 'abcdef01234567890'
repository:
percona:
version: '5.7'
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ cache: bundler
rvm:
- 2.3.1
script:
- bundle exec rubocop
- bundle exec cookstyle
- cd spec/recipes && bundle exec rspec *.rb; cd -
3 changes: 3 additions & 0 deletions Berksfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source 'https://supermarket.chef.io'

metadata
3 changes: 2 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
source 'https://rubygems.org'

gem 'rubocop'
gem 'cookstyle'
gem 'foodcritic'
gem 'rspec'
gem 'chefspec'
gem 'berkshelf'
57 changes: 41 additions & 16 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ GEM
specs:
addressable (2.4.0)
ast (2.3.0)
backports (3.6.8)
berkshelf (5.1.0)
addressable (~> 2.3, >= 2.3.4)
berkshelf-api-client (>= 2.0.2, < 4.0)
Expand Down Expand Up @@ -37,10 +38,10 @@ GEM
celluloid-io (0.16.2)
celluloid (>= 0.16.0)
nio4r (>= 1.1.0)
chef (12.14.89)
chef (12.15.19)
addressable
bundler (>= 1.10)
chef-config (= 12.14.89)
chef-config (= 12.15.19)
chef-zero (>= 4.8)
diff-lcs (~> 1.2, >= 1.2.4)
erubis (~> 2.7)
Expand All @@ -66,7 +67,7 @@ GEM
specinfra (~> 2.10)
syslog-logger (~> 1.6)
uuidtools (~> 2.1.5)
chef-config (12.14.89)
chef-config (12.15.19)
addressable
fuzzyurl
mixlib-config (~> 2.0)
Expand All @@ -77,21 +78,35 @@ GEM
mixlib-log (~> 1.3)
rack (~> 2.0)
uuidtools (~> 2.1)
chefspec (5.2.0)
chefspec (5.3.0)
chef (>= 12.0)
fauxhai (~> 3.6)
rspec (~> 3.0)
cleanroom (1.0.0)
cookstyle (0.0.1)
rubocop (= 0.39.0)
cucumber-core (2.0.0)
backports (~> 3.6)
gherkin (~> 4.0)
diff-lcs (1.2.5)
erubis (2.7.0)
faraday (0.9.2)
multipart-post (>= 1.2, < 3)
fauxhai (3.9.0)
fauxhai (3.10.0)
net-ssh
ffi (1.9.14)
ffi-yajl (2.3.0)
libyajl2 (~> 1.2)
foodcritic (8.1.0)
cucumber-core (>= 1.3)
erubis
nokogiri (>= 1.5, < 2.0)
rake
rufus-lru (~> 1.0)
treetop (~> 1.4)
yajl-ruby (~> 1.1)
fuzzyurl (0.9.0)
gherkin (4.0.0)
hashie (3.4.6)
highline (1.7.8)
hitimes (1.2.4)
Expand All @@ -100,6 +115,7 @@ GEM
ipaddress (0.8.3)
json (2.0.2)
libyajl2 (1.2.0)
mini_portile2 (2.1.0)
minitar (0.5.4)
mixlib-archive (0.2.0)
mixlib-log
Expand All @@ -109,7 +125,7 @@ GEM
mixlib-config (2.2.4)
mixlib-log (1.7.1)
mixlib-shellout (2.2.7)
molinillo (0.5.1)
molinillo (0.5.3)
multi_json (1.12.1)
multipart-post (2.0.0)
net-scp (1.2.1)
Expand All @@ -124,9 +140,11 @@ GEM
net-ssh-gateway (>= 1.2.0)
net-telnet (0.1.1)
nio4r (1.2.1)
octokit (4.3.0)
nokogiri (1.6.8.1)
mini_portile2 (~> 2.1.0)
octokit (4.4.1)
sawyer (~> 0.7.0, >= 0.5.3)
ohai (8.20.0)
ohai (8.21.0)
chef-config (>= 12.5.0.alpha.1, < 13)
ffi (~> 1.9)
ffi-yajl (~> 2.2)
Expand All @@ -141,10 +159,12 @@ GEM
parser (2.3.1.4)
ast (~> 2.2)
plist (3.2.0)
polyglot (0.3.5)
powerpack (0.1.1)
proxifier (1.0.3)
rack (2.0.1)
rainbow (2.1.0)
rake (11.3.0)
retryable (2.0.4)
ridley (5.1.0)
addressable
Expand All @@ -168,7 +188,7 @@ GEM
rspec-core (~> 3.5.0)
rspec-expectations (~> 3.5.0)
rspec-mocks (~> 3.5.0)
rspec-core (3.5.3)
rspec-core (3.5.4)
rspec-support (~> 3.5.0)
rspec-expectations (3.5.0)
diff-lcs (>= 1.2.0, < 2.0)
Expand All @@ -183,27 +203,28 @@ GEM
rspec_junit_formatter (0.2.3)
builder (< 4)
rspec-core (>= 2, < 4, != 2.12.0)
rubocop (0.43.0)
parser (>= 2.3.1.1, < 3.0)
rubocop (0.39.0)
parser (>= 2.3.0.7, < 3.0)
powerpack (~> 0.1)
rainbow (>= 1.99.1, < 3.0)
ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.0, >= 1.0.1)
ruby-progressbar (1.8.1)
rufus-lru (1.1.0)
sawyer (0.7.0)
addressable (>= 2.3.5, < 2.5)
faraday (~> 0.8, < 0.10)
semverse (2.0.0)
serverspec (2.36.1)
serverspec (2.37.2)
multi_json
rspec (~> 3.0)
rspec-its
specinfra (~> 2.53)
sfl (2.2)
sfl (2.3)
solve (3.0.1)
molinillo (~> 0.4)
semverse (>= 1.1, < 3.0)
specinfra (2.63.1)
specinfra (2.66.0)
net-scp
net-ssh (>= 2.7, < 4.0)
net-telnet
Expand All @@ -213,21 +234,25 @@ GEM
thor (0.19.1)
timers (4.0.4)
hitimes
treetop (1.6.8)
polyglot (~> 0.3)
unicode-display_width (1.1.1)
uuidtools (2.1.5)
varia_model (0.6.0)
buff-extensions (~> 2.0)
hashie (>= 2.0.2, < 4.0.0)
wmi-lite (1.0.0)
yajl-ruby (1.3.0)

PLATFORMS
ruby

DEPENDENCIES
berkshelf
chefspec
cookstyle
foodcritic
rspec
rubocop

BUNDLED WITH
1.12.5
1.13.2
29 changes: 24 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ following attributes:
```ruby
node['mysqld']['my.cnf_path']
node['mysqld']['service_name']
node['mysqld']['mysql_packages'] # When node['mysqld']['use_mariadb'] == false
node['mysqld']['mariadb_packages']
node['mysqld']['mariadb_galera_packages'] # When using mariadb_galera_install recipe
node['mysqld']['mysql']['packages']
node['mysqld']['mariadb']['packages']
node['mysqld']['mariadb']['galera_packages'] # When using mariadb_galera_install recipe
```

The configuration is stored in the ```node['mysqld']['my.cnf']``` hash, and can be adapted like so
Expand Down Expand Up @@ -88,6 +88,14 @@ node['mysqld']['root_password'] = 'yourpass'
```


If you want to install percona/mysql instead of mariadb you can change the following attribute:

```ruby
node['mysqld']['db_install']
```

Valid values are `percona`, `mysql` or `mariadb`


## Recipes

Expand All @@ -105,8 +113,19 @@ Sets up official MariaDB repository to install packages from.
Configure it using the following attributes

```ruby
node['mysqld']['repository']['version'] # Defaults to '10.1'
node['mysqld']['repository']['mirror'] # Defaults to HostEurope mirror
node['mysqld']['repository']['mariadb']['version'] # Defaults to '10.1'
node['mysqld']['repository']['mariadb']['mirror'] # Defaults to HostEurope mirror
```

### percona\_repository

Sets up official Perconad repository to install packages from. This is called by default
if you set `node['mysqld']['db_install']` to percona.
Configure it using the following attributes

```ruby
node['mysqld']['repository']['percona']['version'] # Defaults to '5.7'
node['mysqld']['repository']['percona']['mirror'] # Defaults to Percona Main Mirror.
```

### install
Expand Down
26 changes: 26 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env rake

require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:unit) do |t|
t.pattern = ['test/unit/**/*_spec.rb']
end

require 'foodcritic'
FoodCritic::Rake::LintTask.new do |t|
t.options = { fail_tags: ['any'] }
end

require 'cookstyle'
require 'rubocop/rake_task'
RuboCop::RakeTask.new do |task|
task.options << '--display-cop-names'
end

begin
require 'kitchen/rake_tasks'
Kitchen::RakeTasks.new
rescue LoadError
puts '>>>>> Kitchen gem not loaded, omitting tasks' unless ENV['CI']
end

task default: [:foodcritic, :rubocop]
Loading