From 0b6ffca4021bdd8b75906c4ac19f06404901e549 Mon Sep 17 00:00:00 2001 From: John Bellone Date: Wed, 18 Jan 2017 07:58:13 -0500 Subject: [PATCH 1/8] Happy new year! --- LICENSE | 2 +- attributes/default.rb | 2 +- libraries/redis_installation.rb | 2 +- libraries/redis_installation_archive.rb | 2 +- libraries/redis_installation_package.rb | 2 +- libraries/redis_instance.rb | 2 +- libraries/redis_sentinel.rb | 2 +- recipes/default.rb | 2 +- recipes/sentinel.rb | 4 ++-- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/LICENSE b/LICENSE index acb5906..ba51af8 100644 --- a/LICENSE +++ b/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2015-2016, Bloomberg Finance L.P. + Copyright 2015-2017, Bloomberg Finance L.P. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/attributes/default.rb b/attributes/default.rb index 0a49a9a..ae6acec 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -2,7 +2,7 @@ # Cookbook: blp-redis # License: Apache 2.0 # -# Copyright 2015-2016, Bloomberg Finance L.P. +# Copyright 2015-2017, Bloomberg Finance L.P. # default['blp-redis']['provider'] = 'auto' diff --git a/libraries/redis_installation.rb b/libraries/redis_installation.rb index 65c488e..f166525 100644 --- a/libraries/redis_installation.rb +++ b/libraries/redis_installation.rb @@ -2,7 +2,7 @@ # Cookbook: blp-redis # License: Apache 2.0 # -# Copyright 2015-2016, Bloomberg Finance L.P. +# Copyright 2015-2017, Bloomberg Finance L.P. # require 'poise' diff --git a/libraries/redis_installation_archive.rb b/libraries/redis_installation_archive.rb index 1f9c77e..853b35a 100644 --- a/libraries/redis_installation_archive.rb +++ b/libraries/redis_installation_archive.rb @@ -2,7 +2,7 @@ # Cookbook: redis # License: Apache 2.0 # -# Copyright 2015-2016, Bloomberg Finance L.P. +# Copyright 2015-2017, Bloomberg Finance L.P. # require 'poise' diff --git a/libraries/redis_installation_package.rb b/libraries/redis_installation_package.rb index 24c6133..46a5c4a 100644 --- a/libraries/redis_installation_package.rb +++ b/libraries/redis_installation_package.rb @@ -2,7 +2,7 @@ # Cookbook: blp-redis # License: Apache 2.0 # -# Copyright 2015-2016, Bloomberg Finance L.P. +# Copyright 2015-2017, Bloomberg Finance L.P. # require 'poise' diff --git a/libraries/redis_instance.rb b/libraries/redis_instance.rb index 483bb4b..b8155e6 100644 --- a/libraries/redis_instance.rb +++ b/libraries/redis_instance.rb @@ -2,7 +2,7 @@ # Cookbook: blp-redis # License: Apache 2.0 # -# Copyright 2015-2016, Bloomberg Finance L.P. +# Copyright 2015-2017, Bloomberg Finance L.P. # require 'poise_service/service_mixin' diff --git a/libraries/redis_sentinel.rb b/libraries/redis_sentinel.rb index f67ddb3..ee07419 100644 --- a/libraries/redis_sentinel.rb +++ b/libraries/redis_sentinel.rb @@ -2,7 +2,7 @@ # Cookbook: blp-redis # License: Apache 2.0 # -# Copyright 2015-2016, Bloomberg Finance L.P. +# Copyright 2015-2017, Bloomberg Finance L.P. # require 'poise_service/service_mixin' diff --git a/recipes/default.rb b/recipes/default.rb index 08e78f5..a4dcf54 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -2,7 +2,7 @@ # Cookbook: blp-redis # License: Apache 2.0 # -# Copyright 2015-2016, Bloomberg Finance L.P. +# Copyright 2015-2017, Bloomberg Finance L.P. # poise_service_user node['blp-redis']['service_user'] do shell '/bin/bash' diff --git a/recipes/sentinel.rb b/recipes/sentinel.rb index 2059a1f..db14a92 100644 --- a/recipes/sentinel.rb +++ b/recipes/sentinel.rb @@ -2,7 +2,7 @@ # Cookbook: blp-redis # License: Apache 2.0 # -# Copyright 2015-2016, Bloomberg Finance L.P. +# Copyright 2015-2017, Bloomberg Finance L.P. # poise_service_user node['blp-redis']['service_user'] do shell '/bin/bash' @@ -11,7 +11,7 @@ redis_installation node['blp-redis']['sentinel']['service_name'] { version '' } -redis_sentinel node['redis']['sentinel']['service_name'] do +redis_sentinel node['blp-redis']['sentinel']['service_name'] do owner node['blp-redis']['service_owner'] group node['blp-redis']['service_group'] node['blp-redis']['sentinel']['config'].each_pair { |k, v| send(k, v) } From eef280ee3a01f49de1aecff472a1dbbd1e6850bb Mon Sep 17 00:00:00 2001 From: John Bellone Date: Wed, 18 Jan 2017 07:58:26 -0500 Subject: [PATCH 2/8] sentinel: Add support for NAT announce ip/port. Closes #17 --- libraries/redis_sentinel.rb | 2 ++ templates/default/2.8/sentinel.conf.erb | 11 +++++++++++ templates/default/3.0/sentinel.conf.erb | 11 +++++++++++ templates/default/3.2/sentinel.conf.erb | 11 +++++++++++ 4 files changed, 35 insertions(+) diff --git a/libraries/redis_sentinel.rb b/libraries/redis_sentinel.rb index ee07419..4b2ef9b 100644 --- a/libraries/redis_sentinel.rb +++ b/libraries/redis_sentinel.rb @@ -52,6 +52,8 @@ class RedisSentinel < Chef::Resource # @see: https://github.com/antirez/redis/blob/3.2/sentinel.conf attribute(:sentinel_port, kind_of: Integer, default: 26_379) + attribute(:sentinel_announce_ip, kind_of: String) + attribute(:sentinel_announce_port, kind_of: Integer) attribute(:sentinel_master_name, kind_of: String, default: 'mymaster') attribute(:sentinel_monitor, kind_of: String, default: '127.0.0.1 6379 2') attribute(:sentinel_auth, kind_of: String, default: 'changeme') diff --git a/templates/default/2.8/sentinel.conf.erb b/templates/default/2.8/sentinel.conf.erb index b264155..3d57049 100644 --- a/templates/default/2.8/sentinel.conf.erb +++ b/templates/default/2.8/sentinel.conf.erb @@ -6,6 +6,17 @@ port <%= @new_resource.sentinel_port %> <% end %> +# sentinel announce-ip +# sentinel announce-port +# The above two configuration directives are useful in environments where, +# because of NAT, Sentinel is reachable from outside via a non-local address. +<% if @resource.sentinel_announce_ip %> +sentinel announce-ip <%= @resource.sentinel_announce_ip %> +<% end %> +<% if @resource.sentinel_announce_port %> +sentinel announce-port <%= @resource.sentinel_announce_port %> +<% end %> + # dir # Every long running process should have a well-defined working directory. # For Redis Sentinel to chdir to /tmp at startup is the simplest thing diff --git a/templates/default/3.0/sentinel.conf.erb b/templates/default/3.0/sentinel.conf.erb index b264155..3d57049 100644 --- a/templates/default/3.0/sentinel.conf.erb +++ b/templates/default/3.0/sentinel.conf.erb @@ -6,6 +6,17 @@ port <%= @new_resource.sentinel_port %> <% end %> +# sentinel announce-ip +# sentinel announce-port +# The above two configuration directives are useful in environments where, +# because of NAT, Sentinel is reachable from outside via a non-local address. +<% if @resource.sentinel_announce_ip %> +sentinel announce-ip <%= @resource.sentinel_announce_ip %> +<% end %> +<% if @resource.sentinel_announce_port %> +sentinel announce-port <%= @resource.sentinel_announce_port %> +<% end %> + # dir # Every long running process should have a well-defined working directory. # For Redis Sentinel to chdir to /tmp at startup is the simplest thing diff --git a/templates/default/3.2/sentinel.conf.erb b/templates/default/3.2/sentinel.conf.erb index b264155..3d57049 100644 --- a/templates/default/3.2/sentinel.conf.erb +++ b/templates/default/3.2/sentinel.conf.erb @@ -6,6 +6,17 @@ port <%= @new_resource.sentinel_port %> <% end %> +# sentinel announce-ip +# sentinel announce-port +# The above two configuration directives are useful in environments where, +# because of NAT, Sentinel is reachable from outside via a non-local address. +<% if @resource.sentinel_announce_ip %> +sentinel announce-ip <%= @resource.sentinel_announce_ip %> +<% end %> +<% if @resource.sentinel_announce_port %> +sentinel announce-port <%= @resource.sentinel_announce_port %> +<% end %> + # dir # Every long running process should have a well-defined working directory. # For Redis Sentinel to chdir to /tmp at startup is the simplest thing From 750e437bbbc08f140d691e7e681163ec7940551a Mon Sep 17 00:00:00 2001 From: John Bellone Date: Fri, 20 Jan 2017 08:04:00 -0500 Subject: [PATCH 3/8] travis: Use stable version of chefdk. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 6866132..7cae8a7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,7 @@ cache: bundler addons: apt: sources: - - chef-current-trusty + - chef-stable-trusty packages: - chefdk services: docker From 77f8629c475092e375db7c117470058d4c8d7b27 Mon Sep 17 00:00:00 2001 From: John Bellone Date: Tue, 24 Jan 2017 09:59:52 -0500 Subject: [PATCH 4/8] Fix the build for installs. --- attributes/default.rb | 2 - libraries/redis_installation.rb | 8 +-- libraries/redis_installation_package.rb | 15 +---- libraries/redis_instance.rb | 77 ++++++++++++++++-------- libraries/redis_sentinel.rb | 78 +++++++++++++++++-------- recipes/default.rb | 2 +- recipes/sentinel.rb | 2 +- templates/default/systemd.service.erb | 36 ++++++++++++ 8 files changed, 151 insertions(+), 69 deletions(-) create mode 100644 templates/default/systemd.service.erb diff --git a/attributes/default.rb b/attributes/default.rb index ae6acec..1773f63 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -4,8 +4,6 @@ # # Copyright 2015-2017, Bloomberg Finance L.P. # -default['blp-redis']['provider'] = 'auto' - default['blp-redis']['service_name'] = 'redis' default['blp-redis']['service_user'] = 'redis' default['blp-redis']['service_group'] = 'redis' diff --git a/libraries/redis_installation.rb b/libraries/redis_installation.rb index f166525..12e237f 100644 --- a/libraries/redis_installation.rb +++ b/libraries/redis_installation.rb @@ -23,7 +23,7 @@ class RedisInstallation < Chef::Resource # @!attribute version # The version of Redis to install. # @return [String] - attribute(:version, kind_of: String, name_attribute: true) + attribute(:version, kind_of: String) # @return [String] def redis_program @@ -49,12 +49,6 @@ module Provider class RedisInstallation < Chef::Provider include Poise(inversion: :redis_installation) - # Set the default inversion options. - # @private - def self.default_inversion_options(_node, new_resource) - super.merge(version: new_resource.version) - end - def action_create notifying_block do install_redis diff --git a/libraries/redis_installation_package.rb b/libraries/redis_installation_package.rb index 46a5c4a..8092b13 100644 --- a/libraries/redis_installation_package.rb +++ b/libraries/redis_installation_package.rb @@ -17,24 +17,15 @@ module Provider class RedisInstallationPackage < RedisInstallation provides(:package) - # @param [Chef::Node] _node - # @param [Chef::Resource] _resource - # @return [TrueClass, FalseClass] - # @api private def self.provides_auto?(_node, _resource) true end # @param [Chef::Node] node - # @param [Chef::Resource] new_resource + # @param [Chef::Resource] _resource # @api private - def self.default_inversion_options(node, new_resource) - package_version = if new_resource.version.nil? || new_resource.version.empty? - default_package_version(node) - else - resource.version - end - super.merge(package_name: default_package_name(node), version: package_version) + def self.default_inversion_options(node, _resource) + super.merge(package_name: default_package_name(node), version: default_package_version(node)) end # @return [String] diff --git a/libraries/redis_instance.rb b/libraries/redis_instance.rb index b8155e6..c857ab3 100644 --- a/libraries/redis_instance.rb +++ b/libraries/redis_instance.rb @@ -17,7 +17,7 @@ module Resource # @action restart # @since 1.0 class RedisInstance < Chef::Resource - include Poise(parent: :redis_installation, container: true) + include Poise(parent: :redis_installation) provides(:redis_instance) include PoiseService::ServiceMixin @@ -100,11 +100,8 @@ class RedisInstance < Chef::Resource attribute(:client_output_buffer_limit, kind_of: [String, Array], default: ['normal 0 0 0', 'slave 256mb 64mb 60', 'pubsub 32mb 8mb 60']) def default_config_source - if matches = parent.options.fetch('version', '').match(/\d\.\d/) - "#{matches.first}/redis.conf.erb" - else - '3.2/redis.conf.erb' - end + version = parent.provider_for_action(:options).options.fetch(:version, '') + [version.match(/\d\.\d/).to_s, 'redis.conf.erb'].compact.join('/') end end end @@ -121,20 +118,9 @@ class RedisInstance < Chef::Provider def action_enable notifying_block do - [new_resource.directory, ::File.dirname(new_resource.logfile)].each do |dirname| - directory dirname do - recursive true - owner new_resource.user - group new_resource.group - end - end - - file new_resource.config_path do - content new_resource.config_content - owner new_resource.user - group new_resource.group - mode new_resource.config_mode - end + create_directory + create_log_directory + create_redis_config end super end @@ -142,9 +128,54 @@ def action_enable def action_disable super notifying_block do - file new_resource.config_path do - action :delete - end + delete_redis_config + delete_log_directory + delete_directory + end + end + + private + + def create_directory + directory new_resource.directory do + recursive true + owner new_resource.user + group new_resource.group + end + end + + def delete_directory + create_directory.tap do |resource| + resource.action(:delete) + end + end + + def create_log_directory + directory ::File.dirname(new_resource.logfile) do + recursive true + owner new_resource.user + group new_resource.group + end + end + + def delete_log_directory + create_log_directory.tap do |resource| + resource.action(:delete) + end + end + + def create_redis_config + file new_resource.config_path do + content new_resource.config_content + mode new_resource.config_mode + owner new_resource.user + group new_resource.group + end + end + + def delete_redis_config + file new_resource.config_path do + action :delete end end diff --git a/libraries/redis_sentinel.rb b/libraries/redis_sentinel.rb index 4b2ef9b..7a6b3aa 100644 --- a/libraries/redis_sentinel.rb +++ b/libraries/redis_sentinel.rb @@ -17,7 +17,7 @@ module Resource # @action restart # @since 1.0 class RedisSentinel < Chef::Resource - include Poise(parent: :redis_installation, container: true) + include Poise(parent: :redis_installation) provides(:redis_sentinel) include PoiseService::ServiceMixin @@ -64,11 +64,8 @@ class RedisSentinel < Chef::Resource attribute(:sentinel_client_reconfig, kind_of: [String, NilClass], default: nil) def default_config_source - if parent.version - "#{parent.version.match(/\d\.\d/).first}/sentinel.conf.erb" - else - 'sentinel.conf.erb' - end + version = parent.provider_for_action(:options).options.fetch(:version, '') + [version.match(/\d\.\d/).to_s, 'redis.conf.erb'].compact.join('/') end end end @@ -85,20 +82,9 @@ class RedisSentinel < Chef::Provider def action_enable notifying_block do - [new_resource.directory, ::File.dirname(new_resource.logfile)].each do |dirname| - directory dirname do - recursive true - owner new_resource.user - group new_resource.group - end - end - - file new_resource.config_path do - content new_resource.config_content - owner new_resource.user - group new_resource.group - mode new_resource.config_mode - end + create_directory + create_log_directory + create_sentinel_config end super end @@ -106,9 +92,55 @@ def action_enable def action_disable super notifying_block do - file new_resource.config_path do - action :delete - end + delete_sentinel_config + delete_log_directory + delete_directory + end + end + + private + + def create_directory + directory new_resource.directory do + recursive true + owner new_resource.user + group new_resource.group + end + end + + def create_directory + directory ::File.dirname(new_resource.logfile) do + recursive true + owner new_resource.user + group new_resource.group + end + end + + def delete_directory + create_directory.tap do |resource| + resource.action(:delete) + end + end + + def delete_log_directory + create_directory.tap do |resource| + resource.action(:delete) + end + end + + def create_sentinel_config + file new_resource.config_path do + content new_resource.config_content + mode new_resource.config_mode + owner new_resource.user + group new_resource.group + not_if { File.exist?(path) } + end + end + + def delete_sentinel_config + file new_resource.config_path do + action :delete end end diff --git a/recipes/default.rb b/recipes/default.rb index a4dcf54..e6e9b18 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -9,7 +9,7 @@ group node['blp-redis']['service_group'] end -redis_installation node['blp-redis']['service_name'] { version '' } +redis_installation node['blp-redis']['service_name'] redis_instance node['blp-redis']['service_name'] do user node['blp-redis']['service_user'] diff --git a/recipes/sentinel.rb b/recipes/sentinel.rb index db14a92..2fe9d55 100644 --- a/recipes/sentinel.rb +++ b/recipes/sentinel.rb @@ -9,7 +9,7 @@ group node['blp-redis']['service_group'] end -redis_installation node['blp-redis']['sentinel']['service_name'] { version '' } +redis_installation node['blp-redis']['sentinel']['service_name'] redis_sentinel node['blp-redis']['sentinel']['service_name'] do owner node['blp-redis']['service_owner'] diff --git a/templates/default/systemd.service.erb b/templates/default/systemd.service.erb new file mode 100644 index 0000000..4e38698 --- /dev/null +++ b/templates/default/systemd.service.erb @@ -0,0 +1,36 @@ +[Unit] +Description=Advanced key-value store +After=network.target +Description=<%= @name %> + +[Service] +Type=forking +Environment=<%= @environment.map {|key, val| %Q{"#{key}=#{val}"} }.join(' ') %> +ExecStart=<%= @command %> +ExecStop=/bin/kill -s <%= @stop_signal %> $MAINPID +PIDFile=/var/run/redis/redis-server.pid +TimeoutStopSec=0 +Restart=always + +User=<%= @user %> +Group=<%= @group %> +WorkingDirectory=<%= @directory %> +Restart=on-failure + +PrivateTmp=yes +PrivateDevices=yes +ProtectHome=yes +ReadOnlyDirectories=/ +ReadWriteDirectories=-/var/lib/redis +ReadWriteDirectories=-/var/log/redis +ReadWriteDirectories=-/var/run/redis +CapabilityBoundingSet=~CAP_SYS_PTRACE + +# redis-server writes its own config file when in cluster mode so we allow +# writing there (NB. ProtectSystem=true over ProtectSystem=full) +ProtectSystem=true +ReadWritePaths=-/etc/redis + +[Install] +WantedBy=multi-user.target +Alias=redis.service From b2a3d67712715cdcb5218b96609c0be5b05227fa Mon Sep 17 00:00:00 2001 From: John Bellone Date: Tue, 24 Jan 2017 10:13:45 -0500 Subject: [PATCH 5/8] redis: Add 2.4 config file for old platforms. --- templates/default/2.4/redis.conf.erb | 636 +++++++++++++++++++++++++++ 1 file changed, 636 insertions(+) create mode 100644 templates/default/2.4/redis.conf.erb diff --git a/templates/default/2.4/redis.conf.erb b/templates/default/2.4/redis.conf.erb new file mode 100644 index 0000000..73f3aee --- /dev/null +++ b/templates/default/2.4/redis.conf.erb @@ -0,0 +1,636 @@ +# redis.conf + +# Note on units: when memory size is needed, it is possible to specify +# it in the usual form of 1k 5GB 4M and so forth: +# +# 1k => 1000 bytes +# 1kb => 1024 bytes +# 1m => 1000000 bytes +# 1mb => 1024*1024 bytes +# 1g => 1000000000 bytes +# 1gb => 1024*1024*1024 bytes +# +# units are case insensitive so 1GB 1Gb 1gB are all the same. + +# By default Redis does not run as a daemon. Use 'yes' if you need it. +# Note that Redis will write a pid file in /var/run/redis.pid when daemonized. +# Daemonizing is managed by poise-service +daemonize no + +# Accept connections on the specified port, default is 6379. +# If port 0 is specified Redis will not listen on a TCP socket. +<% if @new_resource.port %> +port <%= @new_resource.port %> +<% end %> + +# If you want you can bind a single interface, if the bind option is not +# specified all the interfaces will listen for incoming connections. +<% if @new_resource.bind %> +bind <%= @new_resource.bind %> +<% end %> + +# Specify the path for the unix socket that will be used to listen for +# incoming connections. There is no default, so Redis will not listen +# on a unix socket when not specified. +# +# unixsocket /var/run/redis/redis.sock +# unixsocketperm 755 +<% if @new_resource.unixsocket %> +unixsocket <%= @new_resource.unixsocket %> +<% end %> +<% if @new_resource.unixsocketperm %> +unixsocketperm <%= @new_resource.unixsocketperm %> +<% end %> + +# Close the connection after a client is idle for N seconds (0 to disable) +<% if @new_resource.timeout %> +timeout <%= @new_resource.timeout %> +<% end %> + +# Set server verbosity to 'debug' +# it can be one of: +# debug (a lot of information, useful for development/testing) +# verbose (many rarely useful info, but not a mess like the debug level) +# notice (moderately verbose, what you want in production probably) +# warning (only very important / critical messages are logged) +<% if @new_resource.loglevel %> +loglevel <%= @new_resource.loglevel %> +<% end %> + +# Specify the log file name. Also 'stdout' can be used to force +# Redis to log on the standard output. Note that if you use standard +# output for logging but daemonize, logs will be sent to /dev/null +<% if @new_resource.logfile %> +logfile <%= @new_resource.logfile %> +<% end %> + +# To enable logging to the system logger, just set 'syslog-enabled' to yes, +# and optionally update the other syslog parameters to suit your needs. +# syslog-enabled no +<% if @new_resource.syslog_enabled %> +syslog-enabled <%= @new_resource.syslog_enabled %> +<% end %> + +# Specify the syslog identity. +# syslog-ident redis +<% if @new_resource.syslog_ident %> +syslog-ident <%= @new_resource.syslog_ident %> +<% end %> + +# Specify the syslog facility. Must be USER or between LOCAL0-LOCAL7. +# syslog-facility local0 +<% if @new_resource.syslog_facility %> +syslog-facility <%= @new_resource.syslog_facility %> +<% end %> + +# Set the number of databases. The default database is DB 0, you can select +# a different one on a per-connection basis using SELECT where +# dbid is a number between 0 and 'databases'-1 +<% if @new_resource.databases %> +databases <%= @new_resource.databases.to_s %> +<% end %> + +################################ SNAPSHOTTING ################################# +# +# Save the DB on disk: +# +# save +# +# Will save the DB if both the given number of seconds and the given +# number of write operations against the DB occurred. +# +# In the example below the behaviour will be to save: +# after 900 sec (15 min) if at least 1 key changed +# after 300 sec (5 min) if at least 10 keys changed +# after 60 sec if at least 10000 keys changed +# +# Note: you can disable saving at all commenting all the "save" lines. +# +# It is also possible to remove all the previously configured save +# points by adding a save directive with a single empty string argument +# like in the following example: +# +# save "" +<% if @new_resource.save %> + <% @new_resource.save.each do |s| %> +<%= "save #{s}" %> + <% end %> +<% end %> + +# By default Redis will stop accepting writes if RDB snapshots are enabled +# (at least one save point) and the latest background save failed. +# This will make the user aware (in an hard way) that data is not persisting +# on disk properly, otherwise chances are that no one will notice and some +# distater will happen. +# +# If the background saving process will start working again Redis will +# automatically allow writes again. +# +# However if you have setup your proper monitoring of the Redis server +# and persistence, you may want to disable this feature so that Redis will +# continue to work as usually even if there are problems with disk, +# permissions, and so forth. +<% if @new_resource.stop_writes_on_bgsave_error %> +stop-writes-on-bgsave-error <%= @new_resource.stop_writes_on_bgsave_error %> +<% end %> + +# Compress string objects using LZF when dump .rdb databases? +# For default that's set to 'yes' as it's almost always a win. +# If you want to save some CPU in the saving child set it to 'no' but +# the dataset will likely be bigger if you have compressible values or keys. +<% if @new_resource.rdbcompression %> +rdbcompression <%= @new_resource.rdbcompression %> +<% end %> + +# Since verison 5 of RDB a CRC64 checksum is placed at the end of the file. +# This makes the format more resistant to corruption but there is a performance +# hit to pay (around 10%) when saving and loading RDB files, so you can disable it +# for maximum performances. +# +# RDB files created with checksum disabled have a checksum of zero that will +# tell the loading code to skip the check. +<% if @new_resource.rdbchecksum %> +rdbchecksum <%= @new_resource.rdbchecksum %> +<% end %> + +# The filename where to dump the DB +<% if @new_resource.dbfilename %> +dbfilename <%= @new_resource.dbfilename %> +<% end %> + +# The working directory. +# +# The DB will be written inside this directory, with the filename specified +# above using the 'dbfilename' configuration directive. +# +# Also the Append Only File will be created inside this directory. +# +# Note that you must specify a directory here, not a file name. +<% if @new_resource.directory %> +dir <%= @new_resource.directory %> +<% end %> + +################################# REPLICATION ################################# + +# Master-Slave replication. Use slaveof to make a Redis instance a copy of +# another Redis server. Note that the configuration is local to the slave +# so for example it is possible to configure the slave to save the DB with a +# different interval, or to listen to another port, and so on. +# +# slaveof +<% if @new_resource.slaveof %> + <% if @new_resource.slaveof.kind_of?(Array) %> + <% @new_resource.slaveof.each do |s| %> +<%= "slaveof #{s}" %> + <% end %> + <% else %> +<%= "slaveof #{@new_resource.slaveof}" %> + <% end %> +<% end %> + + +# If the master is password protected (using the "requirepass" configuration +# directive below) it is possible to tell the slave to authenticate before +# starting the replication synchronization process, otherwise the master will +# refuse the slave request. +# +# masterauth +<% if @new_resource.masterauth %> +masterauth <%= @new_resource.masterauth %> +<% end %> + +# When a slave lost the connection with the master, or when the replication +# is still in progress, the slave can act in two different ways: +# +# 1) if slave-serve-stale-data is set to 'yes' (the default) the slave will +# still reply to client requests, possibly with out of date data, or the +# data set may just be empty if this is the first synchronization. +# +# 2) if slave-serve-stale data is set to 'no' the slave will reply with +# an error "SYNC with master in progress" to all the kind of commands +# but to INFO and SLAVEOF. +# +<% if @new_resource.slave_serve_stale_data %> +slave-serve-stale-data <%= @new_resource.slave_serve_stale_data %> +<% end %> + +# You can configure a slave instance to accept writes or not. Writing against +# a slavee instance may be useful to store some ephemeral data (because data +# written on a slave will be easily deleted after resync with the master) but +# may also cause problems if clients are writing to it because of a +# misconfiguration. +# +# Since Redis 2.6 by default slaves are read-only. +# +# Note: read only slaves are not designed to be exposed to untrusted clients +# on the internet. It's just a protection layer against misuse of the instance. +# Still a read only slave exports by default all the administrative commands +# such as CONFIG, DEBUG, and so forth. To a limited extend you can improve +# security of read only slaves using 'rename-command' to shadow all the +# administrative / dangerous commands. +<% if @new_resource.slave_read_only %> +slave-read-only <%= @new_resource.slave_read_only %> +<% end %> + +# Slaves send PINGs to server in a predefined interval. It's possible to change +# this interval with the repl_ping_slave_period option. The default value is 10 +# seconds. +# +# repl-ping-slave-period 10 +<% if @new_resource.repl_ping_slave_period %> +repl-ping-slave-period <%= @new_resource.repl_ping_slave_period %> +<% end %> + +# The following option sets a timeout for both Bulk transfer I/O timeout and +# master data or ping response timeout. The default value is 60 seconds. +# +# It is important to make sure that this value is greater than the value +# specified for repl-ping-slave-period otherwise a timeout will be detected +# every time there is low traffic between the master and the slave. +# +# repl-timeout 60 +<% if @new_resource.repl_timeout %> +repl-timeout <%= @new_resource.repl_timeout %> +<% end %> + +# The slave priority is an integer number published by Redis in the INFO output. +# It is used by Redis Sentinel in order to select a slave to promote into a +# master if the master is no longer working correctly. +# +# A slave with a low priority number is considered better for promotion, so +# for instance if there are three slaves with priority 10, 100, 25 Sentinel will +# pick the one wtih priority 10, that is the lowest. +# +# However a special priority of 0 marks the slave as not able to perform the +# role of master, so a slave with priority of 0 will never be selected by +# Redis Sentinel for promotion. +# +# By default the priority is 100. +<% if @new_resource.slave_priority %> +slave-priority <%= @new_resource.slave_priority.to_s %> +<% end %> + +################################## SECURITY ################################### + +# Require clients to issue AUTH before processing any other +# commands. This might be useful in environments in which you do not trust +# others with access to the host running redis-server. +# +# This should stay commented out for backward compatibility and because most +# people do not need auth (e.g. they run their own servers). +# +# Warning: since Redis is pretty fast an outside user can try up to +# 150k passwords per second against a good box. This means that you should +# use a very strong password otherwise it will be very easy to break. +# +# requirepass foobared +<% if @new_resource.requirepass %> +requirepass <%= @new_resource.requirepass %> +<% end %> +# Command renaming. +# +# It is possible to change the name of dangerous commands in a shared +# environment. For instance the CONFIG command may be renamed into something +# of hard to guess so that it will be still available for internal-use +# tools but not available for general clients. +# +# Example: +# +# rename-command CONFIG b840fc02d524045429941cc15f59e41cb7be6c52 +# +# It is also possible to completely kill a command renaming it into +# an empty string: +# +# rename-command CONFIG "" + +################################### LIMITS #################################### + +# Set the max number of connected clients at the same time. By default +# this limit is set to 10000 clients, however if the Redis server is not +# able ot configure the process file limit to allow for the specified limit +# the max number of allowed clients is set to the current file limit +# minus 32 (as Redis reserves a few file descriptors for internal uses). +# +# Once the limit is reached Redis will close all the new connections sending +# an error 'max number of clients reached'. +# +# maxclients 10000 +<% if @new_resource.maxclients %> +maxclients <%= @new_resource.maxclients %> +<% end %> +# Don't use more memory than the specified amount of bytes. +# When the memory limit is reached Redis will try to remove keys +# accordingly to the eviction policy selected (see maxmemmory-policy). +# +# If Redis can't remove keys according to the policy, or if the policy is +# set to 'noeviction', Redis will start to reply with errors to commands +# that would use more memory, like SET, LPUSH, and so on, and will continue +# to reply to read-only commands like GET. +# +# This option is usually useful when using Redis as an LRU cache, or to set +# an hard memory limit for an instance (using the 'noeviction' policy). +# +# WARNING: If you have slaves attached to an instance with maxmemory on, +# the size of the output buffers needed to feed the slaves are subtracted +# from the used memory count, so that network problems / resyncs will +# not trigger a loop where keys are evicted, and in turn the output +# buffer of slaves is full with DELs of keys evicted triggering the deletion +# of more keys, and so forth until the database is completely emptied. +# +# In short... if you have slaves attached it is suggested that you set a lower +# limit for maxmemory so that there is some free RAM on the system for slave +# output buffers (but this is not needed if the policy is 'noeviction'). +# +<% if @new_resource.maxmemory %> +maxmemory <%= @new_resource.maxmemory %> +<% end %> + +# MAXMEMORY POLICY: how Redis will select what to remove when maxmemory +# is reached? You can select among five behavior: +# +# volatile-lru -> remove the key with an expire set using an LRU algorithm +# allkeys-lru -> remove any key accordingly to the LRU algorithm +# volatile-random -> remove a random key with an expire set +# allkeys-random -> remove a random key, any key +# volatile-ttl -> remove the key with the nearest expire time (minor TTL) +# noeviction -> don't expire at all, just return an error on write operations +# +# Note: with all the kind of policies, Redis will return an error on write +# operations, when there are not suitable keys for eviction. +# +# At the date of writing this commands are: set setnx setex append +# incr decr rpush lpush rpushx lpushx linsert lset rpoplpush sadd +# sinter sinterstore sunion sunionstore sdiff sdiffstore zadd zincrby +# zunionstore zinterstore hset hsetnx hmset hincrby incrby decrby +# getset mset msetnx exec sort +# +# The default is: +# +# maxmemory-policy volatile-lru +<% if @new_resource.maxmemory_policy %> +maxmemory-policy <%= @new_resource.maxmemory_policy %> +<% end %> + +# LRU and minimal TTL algorithms are not precise algorithms but approximated +# algorithms (in order to save memory), so you can select as well the sample +# size to check. For instance for default Redis will check three keys and +# pick the one that was used less recently, you can change the sample size +# using the following configuration directive. +# +# maxmemory-samples 3 +<% if @new_resource.memory_samples %> +memory-samples <%= @new_resource.memory_samples %> +<% end %> + +############################## APPEND ONLY MODE ############################### + +# By default Redis asynchronously dumps the dataset on disk. This mode is +# good enough in many applications, but an issue with the Redis process or +# a power outage may result into a few minutes of writes lost (depending on +# the configured save points). +# +# The Append Only File is an alternative persistence mode that provides +# much better durability. For instance using the default data fsync policy +# (see later in the config file) Redis can lose just one second of writes in a +# dramatic event like a server power outage, or a single write if something +# wrong with the Redis process itself happens, but the operating system is +# still running correctly. +# +# AOF and RDB persistence can be enabled at the same time without problems. +# If the AOF is enabled on startup Redis will load the AOF, that is the file +# with the better durability guarantees. +# +# Please check http://redis.io/topics/persistence for more information. +<% if @new_resource.appendonly %> +appendonly <%= @new_resource.appendonly %> +<% end %> + +# The name of the append only file (default: "appendonly.aof") +# appendfilename appendonly.aof +<% if @new_resource.appendfilename %> +appendfilename <%= @new_resource.appendfilename %> +<% end %> + +# The fsync() call tells the Operating System to actually write data on disk +# instead to wait for more data in the output buffer. Some OS will really flush +# data on disk, some other OS will just try to do it ASAP. +# +# Redis supports three different modes: +# +# no: don't fsync, just let the OS flush the data when it wants. Faster. +# always: fsync after every write to the append only log . Slow, Safest. +# everysec: fsync only one time every second. Compromise. +# +# The default is "everysec" that's usually the right compromise between +# speed and data safety. It's up to you to understand if you can relax this to +# "no" that will let the operating system flush the output buffer when +# it wants, for better performances (but if you can live with the idea of +# some data loss consider the default persistence mode that's snapshotting), +# or on the contrary, use "always" that's very slow but a bit safer than +# everysec. +# +# More details please check the following article: +# http://antirez.com/post/redis-persistence-demystified.html +# +# If unsure, use "everysec". + +# appendfsync always +<% if @new_resource.appendfsync %> +appendfsync <%= @new_resource.appendfsync %> +<% end %> +# appendfsync no + +# When the AOF fsync policy is set to always or everysec, and a background +# saving process (a background save or AOF log background rewriting) is +# performing a lot of I/O against the disk, in some Linux configurations +# Redis may block too long on the fsync() call. Note that there is no fix for +# this currently, as even performing fsync in a different thread will block +# our synchronous write(2) call. +# +# In order to mitigate this problem it's possible to use the following option +# that will prevent fsync() from being called in the main process while a +# BGSAVE or BGREWRITEAOF is in progress. +# +# This means that while another child is saving the durability of Redis is +# the same as "appendfsync none", that in practical terms means that it is +# possible to lost up to 30 seconds of log in the worst scenario (with the +# default Linux settings). +# +# If you have latency problems turn this to "yes". Otherwise leave it as +# "no" that is the safest pick from the point of view of durability. +<% if @new_resource.no_appendfsync_on_rewrite %> +no-appendfsync-on-rewrite <%= @new_resource.no_appendfsync_on_rewrite %> +<% end %> + +# Automatic rewrite of the append only file. +# Redis is able to automatically rewrite the log file implicitly calling +# BGREWRITEAOF when the AOF log size will growth by the specified percentage. +# +# This is how it works: Redis remembers the size of the AOF file after the +# latest rewrite (or if no rewrite happened since the restart, the size of +# the AOF at startup is used). +# +# This base size is compared to the current size. If the current size is +# bigger than the specified percentage, the rewrite is triggered. Also +# you need to specify a minimal size for the AOF file to be rewritten, this +# is useful to avoid rewriting the AOF file even if the percentage increase +# is reached but it is still pretty small. +# +# Specify a percentage of zero in order to disable the automatic AOF +# rewrite feature. +<% if @new_resource.auto_aof_rewrite_percentage %> +auto-aof-rewrite-percentage <%= @new_resource.auto_aof_rewrite_percentage.to_s %> +<% end %> +<% if @new_resource.auto_aof_rewrite_min_size %> +auto-aof-rewrite-min-size <%= @new_resource.auto_aof_rewrite_min_size.to_s %>mb +<% end %> + +################################ LUA SCRIPTING ############################### + +# Max execution time of a Lua script in milliseconds. +# +# If the maximum execution time is reached Redis will log that a script is +# still in execution after the maximum allowed time and will start to +# reply to queries with an error. +# +# When a long running script exceed the maximum execution time only the +# SCRIPT KILL and SHUTDOWN NOSAVE commands are available. The first can be +# used to stop a script that did not yet called write commands. The second +# is the only way to shut down the server in the case a write commands was +# already issue by the script but the user don't want to wait for the natural +# termination of the script. +# +# Set it to 0 or a negative value for unlimited execution without warnings. +<% if @new_resource.lua_time_limit %> +lua-time-limit <%= @new_resource.lua_time_limit.to_s %> +<% end %> + +################################## SLOW LOG ################################### + +# The Redis Slow Log is a system to log queries that exceeded a specified +# execution time. The execution time does not include the I/O operations +# like talking with the client, sending the reply and so forth, +# but just the time needed to actually execute the command (this is the only +# stage of command execution where the thread is blocked and can not serve +# other requests in the meantime). +# +# You can configure the slow log with two parameters: one tells Redis +# what is the execution time, in microseconds, to exceed in order for the +# command to get logged, and the other parameter is the length of the +# slow log. When a new command is logged the oldest one is removed from the +# queue of logged commands. + +# The following time is expressed in microseconds, so 1000000 is equivalent +# to one second. Note that a negative number disables the slow log, while +# a value of zero forces the logging of every command. +<% if @new_resource.slowlog_log_slower_than %> +slowlog-log-slower-than <%= @new_resource.slowlog_log_slower_than.to_s %> +<% end %> + +# There is no limit to this length. Just be aware that it will consume memory. +# You can reclaim memory used by the slow log with SLOWLOG RESET. +<% if @new_resource.slowlog_max_len %> +slowlog-max-len <%= @new_resource.slowlog_max_len.to_s %> +<% end %> + +############################### ADVANCED CONFIG ############################### + +# Hashes are encoded using a memory efficient data structure when they have a +# small number of entries, and the biggest entry does not exceed a given +# threshold. These thresholds can be configured using the following directives. +<% if @new_resource.hash_max_ziplist_entries %> +hash-max-ziplist-entries <%= @new_resource.hash_max_ziplist_entries.to_s %> +<% end %> +<% if @new_resource.hash_max_ziplist_value %> +hash-max-ziplist-value <%= @new_resource.hash_max_ziplist_value.to_s %> +<% end %> + +# Similarly to hashes, small lists are also encoded in a special way in order +# to save a lot of space. The special representation is only used when +# you are under the following limits: +<% if @new_resource.list_max_ziplist_entries %> +list-max-ziplist-entries <%= @new_resource.list_max_ziplist_entries.to_s %> +<% end %> +<% if @new_resource.list_max_ziplist_value %> +list-max-ziplist-value <%= @new_resource.list_max_ziplist_value.to_s %> +<% end %> + +# Sets have a special encoding in just one case: when a set is composed +# of just strings that happens to be integers in radix 10 in the range +# of 64 bit signed integers. +# The following configuration setting sets the limit in the size of the +# set in order to use this special memory saving encoding. +<% if @new_resource.set_max_intset_entries %> +set-max-intset-entries <%= @new_resource.set_max_intset_entries.to_s %> +<% end %> + +# Similarly to hashes and lists, sorted sets are also specially encoded in +# order to save a lot of space. This encoding is only used when the length and +# elements of a sorted set are below the following limits: +<% if @new_resource.zset_max_ziplist_entries %> +zset-max-ziplist-entries <%= @new_resource.zset_max_ziplist_entries.to_s %> +<% end %> +<% if @new_resource.zet_max_ziplist_value %> +zset-max-ziplist-value <%= @new_resource.zet_max_ziplist_value.to_s %> +<% end %> + +# Active rehashing uses 1 millisecond every 100 milliseconds of CPU time in +# order to help rehashing the main Redis hash table (the one mapping top-level +# keys to values). The hash table implementation Redis uses (see dict.c) +# performs a lazy rehashing: the more operation you run into an hash table +# that is rehashing, the more rehashing "steps" are performed, so if the +# server is idle the rehashing is never complete and some more memory is used +# by the hash table. +# +# The default is to use this millisecond 10 times every second in order to +# active rehashing the main dictionaries, freeing memory when possible. +# +# If unsure: +# use "activerehashing no" if you have hard latency requirements and it is +# not a good thing in your environment that Redis can reply form time to time +# to queries with 2 milliseconds delay. +# +# use "activerehashing yes" if you don't have such hard requirements but +# want to free memory asap when possible. +<% if @new_resource.activerehashing %> +activerehashing <%= @new_resource.activerehashing %> +<% end %> + +# The client output buffer limits can be used to force disconnection of clients +# that are not reading data from the server fast enough for some reason (a +# common reason is that a Pub/Sub client can't consume messages as fast as the +# publisher can produce them). +# +# The limit can be set differently for the three different classes of clients: +# +# normal -> normal clients +# slave -> slave clients and MONITOR clients +# pubsub -> clients subcribed to at least one pubsub channel or pattern +# +# The syntax of every client-output-buffer-limit directive is the following: +# +# client-output-buffer-limit +# +# A client is immediately disconnected once the hard limit is reached, or if +# the soft limit is reached and remains reached for the specified number of +# seconds (continuously). +# So for instance if the hard limit is 32 megabytes and the soft limit is +# 16 megabytes / 10 seconds, the client will get disconnected immediately +# if the size of the output buffers reach 32 megabytes, but will also get +# disconnected if the client reaches 16 megabytes and continuously overcomes +# the limit for 10 seconds. +# +# By default normal clients are not limited because they don't receive data +# without asking (in a push way), but just after a request, so only +# asynchronous clients may create a scenario where data is requested faster +# than it can read. +# +# Instead there is a default limit for pubsub and slave clients, since +# subscribers and slaves receive data in a push fashion. +# +# Both the hard or the soft limit can be disabled just setting it to zero. +<% if @new_resource.client_output_buffer_limit %> + <% @new_resource.client_output_buffer_limit.each do |c| %> +<%= "client-output-buffer-limit #{c}" %> + <% end %> +<% end %> From b3472cdf67ce90afd313db4b6802a672625418c8 Mon Sep 17 00:00:00 2001 From: John Bellone Date: Tue, 24 Jan 2017 10:22:00 -0500 Subject: [PATCH 6/8] Fix cookstyle error. --- libraries/redis_sentinel.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/redis_sentinel.rb b/libraries/redis_sentinel.rb index 7a6b3aa..9785d99 100644 --- a/libraries/redis_sentinel.rb +++ b/libraries/redis_sentinel.rb @@ -108,7 +108,7 @@ def create_directory end end - def create_directory + def create_log_directory directory ::File.dirname(new_resource.logfile) do recursive true owner new_resource.user From d4c61ed822bd0df5381760360bf1297f2cea42bd Mon Sep 17 00:00:00 2001 From: John Bellone Date: Tue, 24 Jan 2017 15:56:00 -0500 Subject: [PATCH 7/8] archive: Add default version if resource.verison is nil. --- libraries/redis_installation_archive.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/redis_installation_archive.rb b/libraries/redis_installation_archive.rb index 853b35a..150d793 100644 --- a/libraries/redis_installation_archive.rb +++ b/libraries/redis_installation_archive.rb @@ -24,7 +24,7 @@ class RedisInstallationArchive < RedisInstallation # @api private def self.default_inversion_options(_node, resource) super.merge(prefix: '/opt/redis', - version: resource.version, + version: resource.version || '3.2.3', archive_url: 'http://download.redis.io/releases/redis-%{version}.tar.gz', archive_checksum: default_archive_checksum(resource)) end @@ -50,7 +50,7 @@ def cli_program # @return [String] # @api private def static_folder - ::File.join(options[:prefix], new_resource.version) + ::File.join(options[:prefix], options[:version]) end # @param [Chef::Resource] resource From 658413c59e24140699c25d7852ca9bd31a5b8013 Mon Sep 17 00:00:00 2001 From: John Bellone Date: Mon, 27 Mar 2017 11:58:01 -0400 Subject: [PATCH 8/8] Update kitchen.yml for dokken configuration. --- .kitchen.dokken.yml | 92 --------------------------------------------- .kitchen.yml | 80 +++++++++++++++++++++++++++++---------- .travis.yml | 4 +- README.md | 4 +- metadata.rb | 2 +- 5 files changed, 64 insertions(+), 118 deletions(-) delete mode 100644 .kitchen.dokken.yml diff --git a/.kitchen.dokken.yml b/.kitchen.dokken.yml deleted file mode 100644 index 42648a0..0000000 --- a/.kitchen.dokken.yml +++ /dev/null @@ -1,92 +0,0 @@ ---- -driver: - name: dokken - chef_version: latest - privileged: true -transport: - name: dokken -provisioner: - name: dokken -verifier: - name: inspec -platforms: - - name: centos-7 - named_run_list: centos - driver: - image: centos:7 - platform: rhel - pid_one_command: /usr/lib/systemd/systemd - intermediate_instructions: - - RUN yum -y install lsof which systemd-sysv initscripts sudo - attributes: - poise-service: - redis: - provider: systemd - - name: centos-6 - named_run_list: centos - driver: - image: centos:6 - platform: rhel - pid_one_command: /sbin/init - intermediate_instructions: - - RUN yum -y install which initscripts sudo - - name: ubuntu-16.04 - named_run_list: debian - driver: - image: ubuntu:16.04 - pid_one_command: /bin/systemd - intermediate_instructions: - - RUN /usr/bin/apt-get update -y - - RUN /usr/bin/apt-get install sudo -y - attributes: - poise-service: - redis: - provider: systemd - - name: ubuntu-14.04 - named_run_list: debian - driver: - image: ubuntu:14.04 - pid_one_command: /sbin/init - intermediate_instructions: - - RUN /usr/bin/apt-get update -y - - RUN /usr/bin/apt-get install sudo -y - - name: ubuntu-12.04 - named_run_list: debian - driver: - image: ubuntu:12.04 - pid_one_command: /sbin/init - intermediate_instructions: - - RUN /usr/bin/apt-get update -y - - RUN /usr/bin/apt-get install sudo -y - - name: debian-8 - named_run_list: debian - driver: - image: debian:8 - pid_one_command: /bin/systemd - intermediate_instructions: - - RUN /usr/bin/apt-get update - - RUN /usr/bin/apt-get install lsb-release sudo -y - attributes: - poise-service: - redis: - provider: systemd - - name: debian-7 - named_run_list: debian - driver: - image: debian:7 - pid_one_command: /sbin/init - intermediate_instructions: - - RUN /usr/bin/apt-get update - - RUN /usr/bin/apt-get install lsb-release sudo -y -suites: - - name: default - provisioner: - policyfile: test/fixtures/policies/default.rb - - name: archive - provisioner: - policyfile: test/fixtures/policies/default.rb - attributes: - blp-redis: - provider: archive - options: - version: 3.2.3 diff --git a/.kitchen.yml b/.kitchen.yml index 4ea8db2..8966901 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -1,35 +1,75 @@ --- driver: - name: vagrant + name: dokken + chef_version: latest + privileged: true +transport: + name: dokken provisioner: - name: chef_zero + name: dokken verifier: name: inspec platforms: - - name: ubuntu-16.04 - named_run_list: debian - - name: ubuntu-14.04 - named_run_list: debian - - name: ubuntu-12.04 - named_run_list: debian - - name: centos-7.2 - named_run_list: centos - - name: centos-6.8 + - name: centos-7 named_run_list: centos - - name: centos-5.11 + driver: + image: centos:7 + platform: rhel + pid_one_command: /usr/lib/systemd/systemd + intermediate_instructions: + - RUN yum -y install lsof which systemd-sysv initscripts sudo + attributes: + poise-service: + redis: + provider: systemd + - name: centos-6 named_run_list: centos - - name: ubuntu-14.04 + driver: + image: centos:6 + platform: rhel + pid_one_command: /sbin/init + intermediate_instructions: + - RUN yum -y install which initscripts sudo + - name: ubuntu-16.04 named_run_list: debian - - name: ubuntu-12.04 + driver: + image: ubuntu:16.04 + pid_one_command: /bin/systemd + intermediate_instructions: + - RUN /usr/bin/apt-get update -y + - RUN /usr/bin/apt-get install sudo -y + attributes: + poise-service: + redis: + provider: systemd + - name: ubuntu-14.04 named_run_list: debian - - name: freebsd-10.3 - named_run_list: freebsd - - name: freebsd-9.3 - named_run_list: freebsd - - name: debian-8.5 + driver: + image: ubuntu:14.04 + pid_one_command: /sbin/init + intermediate_instructions: + - RUN /usr/bin/apt-get update -y + - RUN /usr/bin/apt-get install sudo -y + - name: debian-8 named_run_list: debian - - name: debian-7.11 + driver: + image: debian:8 + pid_one_command: /bin/systemd + intermediate_instructions: + - RUN /usr/bin/apt-get update + - RUN /usr/bin/apt-get install lsb-release sudo -y + attributes: + poise-service: + redis: + provider: systemd + - name: debian-7 named_run_list: debian + driver: + image: debian:7 + pid_one_command: /sbin/init + intermediate_instructions: + - RUN /usr/bin/apt-get update + - RUN /usr/bin/apt-get install lsb-release sudo -y suites: - name: default provisioner: diff --git a/.travis.yml b/.travis.yml index 7cae8a7..15958e8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,9 +30,7 @@ before_script: - eval "$(/opt/chefdk/bin/chef shell-init bash)" - /opt/chefdk/embedded/bin/chef gem install kitchen-dokken - /opt/chefdk/embedded/bin/chef --version - - /opt/chefdk/embedded/bin/cookstyle --version - - /opt/chefdk/embedded/bin/foodcritic --version -script: KITCHEN_LOCAL_YAML=.kitchen.dokken.yml kitchen verify ${INSTANCE} +script: kitchen verify ${INSTANCE} after_script: - docker images - docker ps -a diff --git a/README.md b/README.md index 1260cbb..2d27b22 100644 --- a/README.md +++ b/README.md @@ -11,8 +11,8 @@ high-availability for the database. ## Platforms The following platforms are tested using [Test Kitchen][5]: -- Ubuntu 12.04/14.04/16.04 -- CentOS (RHEL) 5/6/7 +- Ubuntu 14.04/16.04 +- CentOS (RHEL) 6/7 ## Basic Usage The [default recipe](recipes/default.rb) installs and configures the diff --git a/metadata.rb b/metadata.rb index 2bd3241..5e92d65 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ description 'Application cookbook which installs and configures Redis.' long_description 'Application cookbook which installs and configures Redis.' version '3.0.0' -chef_version '~> 12.5' +chef_version '>= 12.5' source_url 'https://github.com/bloomberg/redis-cookbook' issues_url 'https://github.com/bloomberg/redis-cookbook/issues'