Skip to content
This repository has been archived by the owner on Jan 19, 2022. It is now read-only.

Update to trbs/bucky for upstream source #12

Open
wants to merge 42 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
cd2ea45
change initial project metadata stuffs
MrSecure Jan 7, 2014
e966ded
rename files with bucky in their name or path
MrSecure Jan 7, 2014
174f8a2
replace bucky with bucky2 everywhere
MrSecure Jan 7, 2014
b73c232
force pip source to github/trbs/bucky2
MrSecure Jan 7, 2014
4e92b2f
enable control of run-time user
MrSecure Jan 7, 2014
12b1672
switch init.d file from file to template
MrSecure Jan 7, 2014
83429d7
disable logging, since the nobody user cannot write to the desired lo…
MrSecure Jan 7, 2014
a38229a
module version bump - new feature: run_as_user
MrSecure Jan 7, 2014
f1d6303
remove unused dependency
MrSecure Jan 12, 2014
faa50d0
testing
MrSecure Jan 13, 2014
c9ddec3
fix up nits in Modulefile
MrSecure Jan 13, 2014
c84420f
minor version bump
MrSecure Jan 13, 2014
05924dc
wip: python deps
MrSecure Jan 13, 2014
73bee79
wip: python deps - remove unused lines
MrSecure Jan 13, 2014
2f0c8b0
enable support for statsd namespace features; version bump the module
MrSecure Jan 13, 2014
9080b30
fix variable names for prefixes
MrSecure Jan 19, 2014
ff8c08d
version bump
MrSecure Jan 19, 2014
98481ae
revert all bucky2 references to bucky, minus the changelog
MrSecure Feb 2, 2014
4407e18
remove egg info from source, as puppet handles that automatically
MrSecure Feb 2, 2014
827cd96
switch to exec pip for bucky install
MrSecure Feb 2, 2014
d0eb2be
move exec block into install setup block; re-enable package block to …
MrSecure Feb 2, 2014
a62397d
more tweaking of package handling
MrSecure Feb 2, 2014
41cfff4
more tweaking of package handling
MrSecure Feb 3, 2014
7de5c1b
more tweaking of package handling
MrSecure Feb 3, 2014
14f1a30
more tweaking of package handling
MrSecure Feb 3, 2014
8cd95d8
more tweaking of package handling
MrSecure Feb 3, 2014
88e1106
revert owner / author bits to ispavailability
MrSecure Feb 3, 2014
3148606
clean up source spec in Modulefile
MrSecure Feb 3, 2014
175f242
clean up source spec in Modulefile
MrSecure Feb 3, 2014
fd63311
clean up lint warnings from travis run #31; adjust tests to match new…
MrSecure Feb 3, 2014
425455d
muddling my thru making the rspec tests pass
MrSecure Feb 3, 2014
4466ec0
clean up tests
MrSecure Feb 3, 2014
2bb37e2
add setproctitle pip install
MrSecure Feb 3, 2014
f70bbb4
ensure that setproctitle is installed before bucky
MrSecure Feb 3, 2014
a6d5b3f
revert bucky install to using package/pip, however point to pypi buck…
MrSecure Feb 3, 2014
0693f86
added ordering, dependance to bucky parts being installed
MrSecure Feb 3, 2014
41be5ff
make sure that python-devl is available on CentOS and friends before …
MrSecure Feb 3, 2014
db94b81
add debian/ubuntu package name for python development tools
MrSecure Feb 3, 2014
cd5871a
adjust variable naming to include the correct scoping
MrSecure Feb 3, 2014
83167a3
attempt to diffuse collision between graphite and bucky over Package[…
MrSecure Feb 3, 2014
cd0154f
undo workaround to handle graphite and bucky and python-devel
MrSecure Feb 3, 2014
a959b7a
modify require / before handling
MrSecure Feb 3, 2014
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
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ gemfile: .gemfile
notifications:
email:
- [email protected]
- [email protected]
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
2 Feb 2014 - Realign changes for bucky2 features to follow new upstream bucky project

6 Jan 2014 - Manual fork to support bucky2 (mrsecure)

0.0.2 ( Feb 10 2013 )
Minor fixes and supply of RedHat and Debian based init scripts.
Minor adjustments to readme file
Expand Down
4 changes: 2 additions & 2 deletions Modulefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name 'ispavailability-bucky'
version '0.0.2'
version '0.4.0'
source 'https://github.com/electrical/puppet-bucky'
author 'ispavailability'
license 'Apache License, Version 2.0'
summary 'Module for managing and configuring bucky'
description 'Module for managing and configuring bucky'
project_page 'https://github.com/electrical/puppet-bucky'
dependency 'puppetlabs/stdlib', '>= 3.0.0'
dependency 'footballradar/python', '0.x'

3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@

A puppet module for managing and configuring bucky

https://github.com/cloudant/bucky
https://github.com/trbs/bucky

[![Build Status](https://travis-ci.org/electrical/puppet-bucky.png?branch=master)](https://travis-ci.org/electrical/puppet-bucky)

## Usage

Expand Down
9 changes: 5 additions & 4 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@
class bucky::config {

file { '/etc/bucky':
ensure => directory,
mode => '0644',
owner => 'root',
group => 'root'
ensure => directory,
mode => '0644',
owner => 'root',
group => 'root',
require => Package["${bucky::params::package}"],
}

file { 'bucky_config':
Expand Down
3 changes: 2 additions & 1 deletion manifests/files.pp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
mode => '0755',
owner => 'root',
group => 'root',
source => "puppet:///modules/${module_name}/etc/init.d/${bucky::params::initscript}",
content => template("${module_name}/etc/init.d/${bucky::params::initscript}.erb"),
require => Package["${bucky::params::package}"],
}

}
7 changes: 7 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,16 @@
$autoupgrade = $bucky::params::autoupgrade,
$status = $bucky::params::status,
$version = false,
$run_as_user = $bucky::params::run_as_user,
$statsd_enabled = $bucky::params::statsd_enabled,
$statsd_ip = $bucky::params::statsd_ip,
$statsd_port = $bucky::params::statsd_port,
$statsd_flush_time = $bucky::params::statsd_flush_time,
$statsd_legacy_namespace = $bucky::params::statsd_legacy_namespace,
$statsd_global_prefix = $bucky::params::statsd_global_prefix,
$statsd_prefix_counter = $bucky::params::statsd_prefix_counter,
$statsd_prefix_timer = $bucky::params::statsd_prefix_timer,
$statsd_prefix_gauge = $bucky::params::statsd_prefix_gauge,
$metricsd_enabled = $bucky::params::metricsd_enabled,
$metricsd_ip = $bucky::params::metricsd_ip,
$metricsd_port = $bucky::params::metricsd_port,
Expand Down Expand Up @@ -164,6 +170,7 @@
# we need the software and a working configuration before running a service
Class['bucky::package'] -> Class['bucky::service']
Class['bucky::files'] -> Class['bucky::service']
Class['bucky::config'] -> Class['bucky::service']

} else {

Expand Down
13 changes: 8 additions & 5 deletions manifests/package.pp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@

#### Package management

include python

# set params: in operation
if $bucky::ensure == 'present' {

Expand All @@ -45,17 +43,22 @@
$package_ensure = $bucky::version

}

# set params: removal
} else {
$package_ensure = 'purged'
}

# action
package { $bucky::params::package:
package { 'setproctitle':
ensure => $package_ensure,
provider => 'pip',
require => Package["${bucky::params::requiredpkgs}"]
}

package { $bucky::params::package :
ensure => $package_ensure,
provider => 'pip',
require => Class['python'],
require => Package['setproctitle'],
}

}
11 changes: 11 additions & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
# service status
$status = 'enabled'

# user to run the service
$run_as_user = 'nobody'

#### Config file defaults

Expand All @@ -63,6 +65,13 @@
$statsd_port = '8125'
$statsd_flushtime = '10.0'

# namespace settings
$statsd_legacy_namespace = 'True'
$statsd_global_prefix = 'stats'
$statsd_prefix_counter = 'counters'
$statsd_prefix_timer = 'timers'
$statsd_prefix_gauge = 'gauges'

# graphite
$graphite_host = '127.0.0.1'
$graphite_port = '2003'
Expand All @@ -85,10 +94,12 @@
'CentOS', 'Fedora', 'Scientific', 'RedHat', 'Amazon': {
# main application
$package = [ 'bucky' ]
$requiredpkgs = [ 'python-devel' ]
}
'Debian', 'Ubuntu': {
# main application
$package = [ 'bucky' ]
$requiredpkgs = [ 'python-dev' ]
}
default: {
fail("\"${module_name}\" provides no package default value
Expand Down
36 changes: 21 additions & 15 deletions spec/classes/bucky_init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
it { should contain_class('bucky::service') }

# package.pp
it { should contain_package('bucky').with( { 'provider' => 'pip' } ) }

it { should contain_package('bucky').with_provider('pip') }
it { should contain_package('setproctitle').with_provider('pip') }
# service.pp
it { should contain_service('bucky') }

# files.pp
it { should contain_file('bucky_init').with( { 'source' => 'puppet:///modules/bucky/etc/init.d/bucky.Debian' } ) }
it { should contain_file('bucky_init').with_content(/start-stop-daemon/) }

# config.pp
it { should contain_file('/etc/bucky') }
Expand All @@ -43,13 +43,14 @@
it { should contain_class('bucky::service') }

# package.pp
it { should contain_package('bucky').with( { 'provider' => 'pip' } ) }
it { should contain_package('bucky').with_provider('pip') }
it { should contain_package('setproctitle').with_provider('pip') }

# service.pp
it { should contain_service('bucky') }

# files.pp
it { should contain_file('bucky_init').with( { 'source' => 'puppet:///modules/bucky/etc/init.d/bucky.Debian' } ) }
it { should contain_file('bucky_init').with_content(/start-stop-daemon/) }

# config.pp
it { should contain_file('/etc/bucky') }
Expand All @@ -71,13 +72,14 @@
it { should contain_class('bucky::service') }

# package.pp
it { should contain_package('bucky').with( { 'provider' => 'pip' } ) }
it { should contain_package('bucky').with_provider('pip') }
it { should contain_package('setproctitle').with_provider('pip') }

# service.pp
it { should contain_service('bucky') }

# files.pp
it { should contain_file('bucky_init').with( { 'source' => 'puppet:///modules/bucky/etc/init.d/bucky.RedHat' } ) }
it { should contain_file('bucky_init').with_content(/runuser -s/) }

# config.pp
it { should contain_file('/etc/bucky') }
Expand All @@ -99,13 +101,14 @@
it { should contain_class('bucky::service') }

# package.pp
it { should contain_package('bucky').with( { 'provider' => 'pip' } ) }
it { should contain_package('bucky').with_provider('pip') }
it { should contain_package('setproctitle').with_provider('pip') }

# service.pp
it { should contain_service('bucky') }

# files.pp
it { should contain_file('bucky_init').with( { 'source' => 'puppet:///modules/bucky/etc/init.d/bucky.RedHat' } ) }
it { should contain_file('bucky_init').with_content(/runuser -s/) }

# config.pp
it { should contain_file('/etc/bucky') }
Expand All @@ -127,13 +130,14 @@
it { should contain_class('bucky::service') }

# package.pp
it { should contain_package('bucky').with( { 'provider' => 'pip' } ) }
it { should contain_package('bucky').with_provider('pip') }
it { should contain_package('setproctitle').with_provider('pip') }

# service.pp
it { should contain_service('bucky') }

# files.pp
it { should contain_file('bucky_init').with( { 'source' => 'puppet:///modules/bucky/etc/init.d/bucky.RedHat' } ) }
it { should contain_file('bucky_init').with_content(/runuser -s/) }

# config.pp
it { should contain_file('/etc/bucky') }
Expand All @@ -155,13 +159,14 @@
it { should contain_class('bucky::service') }

# package.pp
it { should contain_package('bucky').with( { 'provider' => 'pip' } ) }
it { should contain_package('bucky').with_provider('pip') }
it { should contain_package('setproctitle').with_provider('pip') }

# service.pp
it { should contain_service('bucky') }

# files.pp
it { should contain_file('bucky_init').with( { 'source' => 'puppet:///modules/bucky/etc/init.d/bucky.RedHat' } ) }
it { should contain_file('bucky_init').with_content(/runuser -s/) }

# config.pp
it { should contain_file('/etc/bucky') }
Expand All @@ -183,13 +188,14 @@
it { should contain_class('bucky::service') }

# package.pp
it { should contain_package('bucky').with( { 'provider' => 'pip' } ) }
it { should contain_package('bucky').with_provider('pip') }
it { should contain_package('setproctitle').with_provider('pip') }

# service.pp
it { should contain_service('bucky') }

# files.pp
it { should contain_file('bucky_init').with( { 'source' => 'puppet:///modules/bucky/etc/init.d/bucky.RedHat' } ) }
it { should contain_file('bucky_init').with_content(/runuser -s/) }

# config.pp
it { should contain_file('/etc/bucky') }
Expand Down
17 changes: 15 additions & 2 deletions templates/etc/bucky/bucky.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,19 @@ statsd_flush_time = <%= scope.lookupvar('bucky::statsd_flushtime') %>
statsd_enabled = False
<%- end -%>

# If the legacy namespace is enabled, the statsd backend uses the
# default prefixes except for counters, which are stored directly
# in stats.NAME for the rate and stats_counts.NAME for the
# absolute count. If legacy names are disabled, the prefixes are
# configurable, and counters are stored under
# stats.counters.{rate,count} by default. Any prefix can be set
# to None to skip it.
statsd_legacy_namespace = <%= scope.lookupvar('bucky::statsd_legacy_namespace') %>
statsd_global_prefix = "<%= scope.lookupvar('bucky::statsd_global_prefix') %>"
statsd_prefix_counter = "<%= scope.lookupvar('bucky::statsd_prefix_counter') %>"
statsd_prefix_timer = "<%= scope.lookupvar('bucky::statsd_prefix_timer') %>"
statsd_prefix_gauge = "<%= scope.lookupvar('bucky::statsd_prefix_gauge') %>"

# Basic Graphite configuration
graphite_ip = "<%= scope.lookupvar('bucky::graphite_host') %>"
graphite_port = <%= scope.lookupvar('bucky::graphite_port') %>
Expand All @@ -80,7 +93,7 @@ graphite_reconnect_delay = <%= scope.lookupvar('bucky::graphite_reconnect_delay'
graphite_pickle_enabled = <%= scope.lookupvar('bucky::graphite_pickle_enable') %>
graphite_pickle_buffer_size = <%= scope.lookupvar('bucky::graphite_pickle_buffer_size') %>

# Bucky provides these settings to allow the system wide
# bucky provides these settings to allow the system wide
# configuration of how metric names are processed before
# sending to Graphite.
#
Expand All @@ -97,7 +110,7 @@ name_replace_char = '<%= scope.lookupvar('bucky::name_replace_char') %>'
# a.a.b.c.c.b would be rewritten as a.b.c.b
name_strip_duplicates = <%= scope.lookupvar('bucky::name_strip_duplicates') %>

# Bucky reverses hostname components to improve the locality
# bucky reverses hostname components to improve the locality
# of metric values in Graphite. For instance, "node.company.tld"
# would be rewritten as "tld.company.node". This setting allows
# for the specification of hostname components that should
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh
#
# /etc/init.d/bucky
# init script for Bucky.
# init script for bucky.
#
# Modified for LSB compliance by Glenn Aaldering <[email protected]>.

Expand All @@ -13,12 +13,12 @@
# Should-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Bucky
# Description: Bucky
# Short-Description: bucky
# Description: bucky
### END INIT INFO

NAME=bucky
DESC="Bucky"
DESC="bucky"
DEFAULT=/etc/default/$NAME

if [ `id -u` -ne 0 ]; then
Expand Down Expand Up @@ -50,7 +50,7 @@ bucky_start() {
log_action_end_msg 3 "Already running"
exit 0
fi
start-stop-daemon --exec $DAEMON -b -S -m -p $PIDFILE -- $CONFIG
start-stop-daemon --exec $DAEMON -b -S -m -p $PIDFILE -c <%= scope.lookupvar('bucky::run_as_user') %> -- $CONFIG
log_end_msg $?
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ lockfile='/var/lock/subsys/bucky'
pidfile='/var/run/bucky.pid'
bucky='/usr/bin/bucky'
config='/etc/bucky/bucky.conf'
logfile='/var/log/bucky.log'

run_user='<%= scope.lookupvar('bucky::run_as_user') %>'

RETVAL=0

Expand All @@ -29,7 +30,8 @@ fi

start() {
echo -n $"Starting bucky daemon: "
$bucky $config >> $logfile 2>&1 &
corelimit="ulimit -S -c 0"
runuser -s /bin/bash $run_user -c "$corelimit > /dev/null 2>&1 ; $bucky $config &"
RETVAL=$?

local PID=`pgrep -f "${bucky} ${config}"`
Expand Down