Skip to content
This repository has been archived by the owner on Mar 8, 2023. It is now read-only.

backmerge for release 1.7.0 #57

Merged
merged 16 commits into from
Dec 2, 2015
Merged
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
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
## 2015-12-02 - 1.7.0 (Feature/Bugfix release)

#### Features:

- (3236f41) #33 add Scientific Linux support
- (ad5d3c1) #37 Server: add parameters `redis_usesocket` `redis_socket` `redis_socketperm` `redis_memsamples`
- (edf870b) #31 Server: add parameters `force_rewrite`
- (e1c2011) #53 Server: add parameters `hash_max_ziplist_entries` and `hash_max_ziplist_value`
- (f1006e2) #48 Server: add parameters `redis_user` and `redis_group`
- (42bb23f) #44 Sentinel: explititly define sentinel pidfile

#### Bugfixes:

- (3e920e3) #35 Server: correct usage of `redis_timeout` in servers
- (f8e44b2) #39 avoid conflicts build-essential
- (75cffe8) #51 prevent default redis-server from automatically start


## 2015-05-11 - 1.6.0 (Feature/Bugfix release)

#### Features:
Expand Down
30 changes: 29 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,18 @@ node 'redis-slave.my.domain' {
}
```

### Example using Hiera

redis::install::redis_package: true
redis::install::redis_version: '2:2.8.17-1+deb8u1'
redis::servers:
'name_server':
requirepass: 'strongpass'
enabled: true
redis_ip: '0.0.0.0'
redis_port: '6800'
redis_log_dir: '/var/log/redis/'

###Setting up sentinel with two monitors

You can create multiple sentinels on one node. But most of the time you will
Expand Down Expand Up @@ -184,7 +196,7 @@ The redis service(s) are configured with the defined type `redis::server`.
####Class: `redis::install`

This class downloads, compiles and installs redis. It does not configure any
redis services. This is done by defimed type redis::server.
redis services. This is done by defined type redis::server.

**Parameters within `redis::install`:**

Expand All @@ -204,6 +216,22 @@ directoy like '/opt/redis-2.8.8/'
Default is '/usr/bin' (string).
The dir to which the newly built redis binaries are copied.

#####`redis_user`

Redis system user. Default: undef (string)
Default 'undef' results to 'root' as redis system user

Some redis install packages create the redis system user by default (at
least SLES and Ubuntu provide redis install packages).
Normally the log directory and the pid directory are created also by
the redis install package. Therefor, these values must be adjusted too.


#####`redis_group`

Redis system group. Default: undef (string)
Default 'undef' results to 'root' as redis system group

####Defined Type: `redis::server`

Used to configure redis instances. You can setup multiple redis servers on the
Expand Down
14 changes: 12 additions & 2 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@
#
# === Parameters
#
# None.
# [*servers*]
# Hash for servers instantiation from hiera
#
class redis inherits redis::params {}
class redis (
# START Hiera Lookups ###
$servers = {},
### END Hiera Lookups ###
) inherits redis::params {

create_resources('redis::server', $servers)

}

14 changes: 13 additions & 1 deletion manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,29 @@
# [*redis_install_dir*]
# The dir to which the newly built redis binaries are copied. Default value is '/usr/bin'.
#
# [*redis_user*]
# The redis system user. Default value is 'undef', which results to 'root' as system user.
#
# [*redis_group*]
# The redis system group. Default value is 'undef', which results to 'root' as system group.
#
class redis::install (
$redis_version = $::redis::params::redis_version,
$redis_build_dir = $::redis::params::redis_build_dir,
$redis_install_dir = $::redis::params::redis_install_dir,
$redis_package = $::redis::params::redis_install_package,
$download_tool = $::redis::params::download_tool
$download_tool = $::redis::params::download_tool,
$redis_user = $::redis::params::redis_user,
$redis_group = $::redis::params::redis_group,
) inherits redis {
if ( $redis_package == true ) {
case $::operatingsystem {
'Debian', 'Ubuntu': {
package { 'redis-server' : ensure => $redis_version, }
service { 'redis-server' :
ensure => stopped,
subscribe => Package['redis-server']
}
}
'Fedora', 'RedHat', 'CentOS', 'OEL', 'OracleLinux', 'Amazon', 'Scientific', 'SLES': {
package { 'redis' : ensure => $redis_version, }
Expand Down
2 changes: 2 additions & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@
$redis_install_dir = '/usr/bin'
$redis_install_package = false
$download_tool = 'curl -s -L'
$redis_user = undef
$redis_group = undef
}
10 changes: 10 additions & 0 deletions manifests/server.pp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@
# Configure Redis replication ping slave period
# [*save*]
# Configure Redis save snapshotting. Example: [[900, 1], [300, 10]]. Default: []
# [*hash_max_ziplist_entries*]
# Threshold for ziplist entries. Default: 512
# [*hash_max_ziplist_value*]
# Threshold for ziplist value. Default: 64
#
# [*force_rewrite*]
#
Expand Down Expand Up @@ -117,8 +121,12 @@
$repl_timeout = 60,
$repl_ping_slave_period = 10,
$save = [],
$hash_max_ziplist_entries = 512,
$hash_max_ziplist_value = 64,
$force_rewrite = false,
) {
$redis_user = $::redis::install::redis_user
$redis_group = $::redis::install::redis_group

$redis_install_dir = $::redis::install::redis_install_dir
$redis_init_script = $::operatingsystem ? {
Expand Down Expand Up @@ -164,6 +172,8 @@
file { "${redis_dir}/redis_${redis_name}":
ensure => directory,
require => Class['redis::install'],
owner => $redis_user,
group => $redis_group,
}

# install and configure logrotate
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
}
],
"name": "dwerder-redis",
"version": "1.6.0",
"version": "1.7.0",
"source": "git clone https://github.com/echocat/puppet-redis.git",
"author": "Daniel Werdermann",
"license": "MPL-2.0",
Expand Down
5 changes: 3 additions & 2 deletions templates/etc/init.d/sles_redis-server.erb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
### END INIT INFO

EXEC=/usr/sbin/redis-server
USER=redis
USER=<%= @redis_user or 'root' %>
GROUP=<%= @redis_group or 'root' %>
STATE=<%= @redis_pid_dir %>
CONF=/etc
PIDFILE=${STATE}/redis_<%= @redis_name %>.pid
Expand All @@ -31,7 +32,7 @@ CONFIG=${CONF}/redis_<%= @redis_name %>.conf
. /etc/rc.status

if [ ! -d $STATE ]; then
install -d $state -o $USER -g $USER -m 0755 $STATE
install -d $state -o $USER -g $GROUP -m 0755 $STATE
fi

start() {
Expand Down
8 changes: 4 additions & 4 deletions templates/etc/redis.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -429,11 +429,11 @@ slowlog-max-len 1024
# small number of entries, and the biggest entry does not exceed a given
# threshold. These thresholds can be configured using the following directives.
<% if @redis_2_6_or_greater -%>
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
hash-max-ziplist-entries <%= @hash_max_ziplist_entries %>
hash-max-ziplist-value <%= @hash_max_ziplist_value %>
<% else -%>
hash-max-zipmap-entries 512
hash-max-zipmap-value 64
hash-max-zipmap-entries <%= @hash_max_ziplist_entries %>
hash-max-zipmap-value <%= @hash_max_ziplist_value %>
<% end -%>

# Similarly to hashes, small lists are also encoded in a special way in order
Expand Down
2 changes: 2 additions & 0 deletions templates/etc/sentinel.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

daemonize yes

pidfile <%= @sentinel_pid_dir %>/redis-sentinel_<%= @sentinel_name %>.pid

logfile <%= @sentinel_log_dir -%>/redis-sentinel_<%= @sentinel_name %>.log

port <%= @sentinel_port -%>
Expand Down