diff --git a/.kitchen.yml b/.kitchen.yml index c02b3a8..0c4ba7c 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -11,12 +11,15 @@ provisioner: platforms: - name: ubuntu-12.04 + - name: debian-7.8 - name: centos-6.6 - - name: centos-5.11 - name: oel-6.6 driver: box: rafacas/oel66-plain box_url: https://atlas.hashicorp.com/rafacas/boxes/oel66-plain/versions/1.0.0/providers/virtualbox.box + - name: ami-2014.03 + driver: + box_url: http://images.geekandi.com/amazon-linux/vagrant-amazon-linux64-2014.03-public-virtualbox.box suites: - name: default @@ -39,6 +42,7 @@ suites: environment: dev excludes: - oel-6.6 + - ami-2014.03 - name: default-305 driver: @@ -62,6 +66,7 @@ suites: environment: dev excludes: - oel-6.6 + - ami-2014.03 - name: replica driver: @@ -83,6 +88,7 @@ suites: environment: dev excludes: - oel-6.6 + - ami-2014.03 - name: configsvr driver: @@ -104,6 +110,7 @@ suites: environment: dev excludes: - oel-6.6 + - ami-2014.03 - name: mongos driver: @@ -123,6 +130,9 @@ suites: provisioner: client_rb: environment: dev + excludes: + - oel-6.6 + - ami-2014.03 - name: wired-tiger driver: @@ -144,6 +154,7 @@ suites: environment: dev excludes: - oel-6.6 + - ami-2014.03 - name: mms-automation-agent driver: @@ -165,6 +176,8 @@ suites: environment: dev excludes: - oel-6.6 + - ami-2014.03 + - debian-7.8 - name: mms-monitoring-agent driver: @@ -185,4 +198,29 @@ suites: client_rb: environment: dev excludes: - - oel-6.6 \ No newline at end of file + - oel-6.6 + - ami-2014.03 + - debian-7.8 + + - name: ami-default + driver: + vm_hostname: mongo3 + run_list: + - recipe[mongodb3::default] + attributes: + mongodb3: + version: 3.0.7 + chef_client: + config: + force_logger: true + log_level: info + build-essential: + compile_time: false + provisioner: + client_rb: + environment: dev + excludes: + - ubuntu-12.04 + - centos-6.6 + - oel-6.6 + - debian-7.8 diff --git a/CHANGELOG.md b/CHANGELOG.md index 7d7f20b..6cdc654 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # mongodb3 Cookbook CHANGELOG +## 3.0.0 +* Update the default MongoDB package version to 3.0.7 +* Update README.md #8 +* Make keyserver configurable and fix faraday (berkshelf version bump) #11 +* Adding support for Amazon Linux and Debian 7.8 #10 +* Removing support for CentOS 5 : It seems like, there is some issue on package that MongoDB provided. +* Removing kitchen test of mongos for oel-6.6 : There was no 3.0.7-1.el6 of mongos package for Oracle Linux 6.6 (Test failure). I'll keep testing and bring it back later. + +NOTICE : +* Current version 3.0.0 is not supporting mongos 3.0.7 for Oracle Linux 6.6. The package version 3.0.7-1.el6 of mongodb-org-shell package wasn't existing (Test failure). +* Current version 3.0.0 is not supporting automation and monitoring mms agent installation for Debian 7.8 + ## 2.0.0 WARNING : `mms-agent` recipe has been deprecated at this version. diff --git a/Gemfile b/Gemfile index 461eff4..b48097a 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,6 @@ source 'https://rubygems.org' -gem 'berkshelf', '~> 3.2.4' +gem 'berkshelf', '~> 4.0.1' gem 'test-kitchen', '~> 1.4.0' gem 'foodcritic', '4.0.0' diff --git a/README.md b/README.md index ed836be..cfa318a 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,8 @@ # mongodb3 cookbook -WARNING : `mms-agent` recipe has been deprecated. - [![Build Status](https://travis-ci.org/sunggun-yu/chef-mongodb3.svg?branch=master)](https://travis-ci.org/sunggun-yu/chef-mongodb3) -Install and configure the MongoDB 3.0.x +Install and configure the MongoDB 3 * Install and configure the mongod (or configure the config server for shard cluster) * Install and configure the mongos @@ -12,21 +10,37 @@ Install and configure the MongoDB 3.0.x * Install the MMS Automation Agent * Install the MMS Monitoring Agent +NOTICE : +* Current version 3.0.0 is not supporting mongos 3.0.7 for Oracle Linux 6.6. The package version 3.0.7-1.el6 of mongodb-org-shell package wasn't existing (Test failure). +* Current version 3.0.0 is not supporting automation and monitoring mms agent installation for Debian 7.8 + ## Supported Platforms * Ubuntu 12.04, 14.04 -* CentOS 5.11, 6.6 +* Debian 7.8 +* CentOS 6.6 * Oralce 6.6 +* Amazon Linux ## Attributes ### Cookbook Attributes +mongodb3 cookbook uses the package installation of mongodb3 such as yum or apt. and these attributes are used for setting default values in order to provide the correct installation of mongodb3. typically, you can modify cookbook attributes if you need. however, I do not recommend to modify these attributes if you want to use package that is provided from MongoDB. WARNING : Please do not set the user and group attribute on your side. This cook book let installing user and group by mongodb package (except `mongos` and `mms-monitoring-agent` recipe). The user and group name will be set by condition in default attribute because mongodb package installs different user and group name by platform. ``` # MongoDB version to install -default['mongodb3']['version'] = '3.0.4' +default['mongodb3']['version'] = '3.0.7' +default['mongodb3']['package']['version'] = Actual package version to install. It builds from version attribute. + +# Package repository url +default['mongodb3']['package']['repo']['url'] = Package repository url + +# Attribute for apt_repository +default['mongodb3']['package']['repo']['apt']['keyserver'] = key server url for ubuntu or debian +default['mongodb3']['package']['repo']['apt']['key'] = '7F0CEB10' +default['mongodb3']['package']['repo']['apt']['components'] = `multiverse` for ubuntu. `main` for debian # MongoDB user:group : PLEASE DO NOT SET THE USER AND GROUP ATTRIBUTE default['mongodb3']['user'] = 'mongod' | 'mongodb' diff --git a/attributes/default.rb b/attributes/default.rb index f7ad334..37b4c78 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -18,7 +18,39 @@ # # MongoDB version to install -default['mongodb3']['version'] = '3.0.4' +default['mongodb3']['version'] = '3.0.7' + +# Setup default package version attribute to install +pkg_version = node['mongodb3']['version'] +case node['platform_family'] + when 'rhel', 'fedora' + pkg_version = "#{node['mongodb3']['version']}-1.el#{node.platform_version.to_i}" # ~FC019 + if node['platform'] == 'amazon' + pkg_version = "#{node['mongodb3']['version']}-1.amzn1" # ~FC019 + end +end + +# Setup default package repo url attribute for each platform family or platform +case node['platform'] + when 'redhat', 'oracle','centos', 'fedora' + pkg_repo = "https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.0/#{node['kernel']['machine'] =~ /x86_64/ ? 'x86_64' : 'i686'}" + when 'amazon' + pkg_repo = 'https://repo.mongodb.org/yum/amazon/2013.03/mongodb-org/3.0/x86_64/' + when 'ubuntu' + pkg_repo = 'http://repo.mongodb.org/apt/ubuntu' + when 'debian' + pkg_repo = 'http://repo.mongodb.org/apt/debian' +end + +# Setup apt variables +case node['platform'] + when 'ubuntu' + apt_repo_keyserver = 'hkp://keyserver.ubuntu.com:80' + apt_repo_component = ['multiverse'] + when 'debian' + apt_repo_keyserver = 'keyserver.ubuntu.com' + apt_repo_component = ['main'] +end # Default attribute for MongoDB installation case node['platform_family'] @@ -36,6 +68,17 @@ config_processManagement_fork = nil end +# MongoDB package repo url +default['mongodb3']['package']['repo']['url'] = pkg_repo + +# MongoDB apt keyserver and key +default['mongodb3']['package']['repo']['apt']['keyserver'] = apt_repo_keyserver +default['mongodb3']['package']['repo']['apt']['key'] = '7F0CEB10' +default['mongodb3']['package']['repo']['apt']['components'] = apt_repo_component + +# MongoDB package version to install +default['mongodb3']['package']['version'] = pkg_version + # MongoDB user:group default['mongodb3']['user'] = mongo_user default['mongodb3']['group'] = mongo_group @@ -49,6 +92,9 @@ # Key file contents default['mongodb3']['config']['key_file_content'] = nil +# Key server +default['mongodb3']['keyserver'] = 'hkp://keyserver.ubuntu.com:80' + # Mongod config # The default value of the attribute is referred to the MongoDB documentation. # The attribute value of nil will be removed from mongod config file. diff --git a/metadata.rb b/metadata.rb index 978f1a4..229d038 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,12 +4,14 @@ license 'Apache 2.0' description 'Installs/Configures mongodb3' long_description 'Installs/Configures mongodb3' -version '2.0.0' +version '3.0.0' supports 'ubuntu', '= 12.04' +supports 'debian', '= 7.8' supports 'redhat', '= 6.6' supports 'centos', '= 6.6' supports 'oracle', '= 6.6' +supports 'amazon' depends 'apt' depends 'yum' diff --git a/recipes/default.rb b/recipes/default.rb index fc49069..cfeac40 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -22,17 +22,9 @@ # Install MongoDB package install_package = %w(mongodb-org-server mongodb-org-shell mongodb-org-tools) -# Setup package version to install -case node['platform_family'] - when 'rhel', 'fedora' - package_version = "#{node['mongodb3']['version']}-1.el#{node.platform_version.to_i}" # ~FC019 - when 'debian' - package_version = node['mongodb3']['version'] -end - install_package.each do |pkg| package pkg do - version package_version + version node['mongodb3']['package']['version'] action :install end end diff --git a/recipes/mongos.rb b/recipes/mongos.rb index 2b5f53d..48b3ff6 100644 --- a/recipes/mongos.rb +++ b/recipes/mongos.rb @@ -22,17 +22,9 @@ # Install Mongos package install_package = %w(mongodb-org-shell mongodb-org-mongos mongodb-org-tools) -# Setup package version to install -case node['platform_family'] - when 'rhel', 'fedora' - package_version = "#{node['mongodb3']['version']}-1.el#{node.platform_version.to_i}" # ~FC019 - when 'debian' - package_version = node['mongodb3']['version'] -end - install_package.each do |pkg| package pkg do - version package_version + version node['mongodb3']['package']['version'] action :install end end diff --git a/recipes/package_repo.rb b/recipes/package_repo.rb index f7a5da7..dad4af6 100644 --- a/recipes/package_repo.rb +++ b/recipes/package_repo.rb @@ -22,7 +22,7 @@ when 'rhel', 'fedora' yum_repository 'mongodb-org-3.0' do description 'MongoDB Repository' - baseurl "https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.0/#{node['kernel']['machine'] =~ /x86_64/ ? 'x86_64' : 'i686'}" + baseurl node['mongodb3']['package']['repo']['url'] action :create gpgcheck false enabled true @@ -30,11 +30,11 @@ end when 'debian' apt_repository 'mongodb' do - uri 'http://repo.mongodb.org/apt/ubuntu' + uri node['mongodb3']['package']['repo']['url'] distribution "#{node['lsb']['codename']}/mongodb-org/stable" - components ['multiverse'] - keyserver 'hkp://keyserver.ubuntu.com:80' - key '7F0CEB10' + components node['mongodb3']['package']['repo']['apt']['components'] + keyserver node['mongodb3']['package']['repo']['apt']['keyserver'] + key node['mongodb3']['package']['repo']['apt']['key'] action :add end include_recipe 'apt' diff --git a/test/integration/default/serverspec/default_spec.rb b/test/integration/default/serverspec/default_spec.rb index 59f5c2e..3e0fc0d 100644 --- a/test/integration/default/serverspec/default_spec.rb +++ b/test/integration/default/serverspec/default_spec.rb @@ -53,5 +53,5 @@ # Test mongod process starts with expected mongodb config file describe command('mongo --eval "db.version()"') do - its(:stdout) { should contain('3.0.4') } + its(:stdout) { should contain('3.0.7') } end