From ef9429c6a825a7dd7c12c420a185623fd3ff364b Mon Sep 17 00:00:00 2001 From: Hector Castro Date: Fri, 13 Sep 2013 19:03:44 -0400 Subject: [PATCH] Adds support for installing Riak through a custom package repository. --- .kitchen.yml | 7 +++++++ CHANGELOG.md | 3 ++- README.md | 15 ++++++++++----- attributes/default.rb | 4 ++++ recipes/custom_repository.rb | 7 +++++++ recipes/default.rb | 2 +- 6 files changed, 31 insertions(+), 7 deletions(-) create mode 100644 recipes/custom_repository.rb diff --git a/.kitchen.yml b/.kitchen.yml index 38c4fd5..e533b5b 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -134,6 +134,13 @@ suites: minor: 2 incremental: 1 enterprise_key: <%= (ENV["RIAK_ENTERPRISE_KEY"].nil? ? "" : ENV["RIAK_ENTERPRISE_KEY"]) %> +- name: custom_repository + run_list: + - recipe[minitest-handler] + - recipe[riak] + attributes: + riak: + install_method: "custom_repository" - name: source run_list: - recipe[minitest-handler] diff --git a/CHANGELOG.md b/CHANGELOG.md index d89994e..07ad4dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ -## v2.3.4: +## v2.4.0: +* Added a recipe for installing Riak through a custom package repository. * Made Test Kitchen run faster by enabling the `vagrant-cachier` plugin through the `kitchen-vagrant` driver. * Make default for `cs_version` be `1.4.1` diff --git a/README.md b/README.md index e3ec3fa..96ce07b 100644 --- a/README.md +++ b/README.md @@ -18,19 +18,24 @@ The Riak cookbook can be used just by adding "riak" to the runlist for a node. Package Installation -------------------- -There are two options for package installation: binary and source. If you are using a Red Hat, CentOS, Fedora, Debian or Ubuntu distributions, binary installation is recommended and is the default. If you choose to do a source installation, be sure you are using Erlang/OTP R15B01 or later. +There are two options for package installation: `package` and `custom_repository`. If you are using a Red Hat, CentOS, Fedora, Debian or Ubuntu distributions, `package` installation is recommended and is the default. The package parameters available are version, type and, optionally for source installation, an install prefix: - node['riak']['package']['version']['major'] = "1" - node['riak']['package']['version']['minor'] = "4" - node['riak']['package']['version']['incremental'] = "2" +```ruby +# default.rb +node['riak']['install_method'] = "package" +# package.rb +node['riak']['package']['version']['major'] = "1" +node['riak']['package']['version']['minor'] = "4" +node['riak']['package']['version']['incremental'] = "2" +``` Source Installation ------------------ -The riak::source recipe can be used to install Riak from source. The source installation requires the build-essential and erlang cookbooks. +The `riak::source` recipe can be used to install Riak from source. The source installation requires Erlang/OTP R15B01 or later and the `build-essential` and `erlang` cookbooks. Enterprise Installation ------------------- diff --git a/attributes/default.rb b/attributes/default.rb index f966da6..f2e92bc 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -18,6 +18,10 @@ # include_attribute "riak::package" +# install method +default['riak']['install_method'] = "package" + +# directories default['riak']['bin_dir'] = "/usr/sbin" default['riak']['data_dir'] = "/var/lib/riak" default['riak']['etc_dir'] = "/etc/riak" diff --git a/recipes/custom_repository.rb b/recipes/custom_repository.rb new file mode 100644 index 0000000..96b86fa --- /dev/null +++ b/recipes/custom_repository.rb @@ -0,0 +1,7 @@ +version_str = "#{node['riak']['package']['version']['major']}.#{node['riak']['package']['version']['minor']}" +package_version = "#{version_str}.#{node['riak']['package']['version']['incremental']}-#{node['riak']['package']['version']['build']}" + +package "riak" do + action :install + version package_version +end diff --git a/recipes/default.rb b/recipes/default.rb index 071c6a7..08e610a 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -20,7 +20,7 @@ include_recipe "ulimit" unless node['platform_family'] == "debian" if node['riak']['package']['enterprise_key'].empty? - include_recipe "riak::package" + include_recipe "riak::#{node['riak']['install_method']}" else include_recipe "riak::enterprise_package" end