Skip to content
This repository has been archived by the owner on Jul 11, 2020. It is now read-only.

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
dwradcliffe committed Jun 20, 2014
1 parent 2f98d03 commit 9117329
Showing 13 changed files with 105 additions and 72 deletions.
3 changes: 2 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
AllCops:
Exclude:
- vendor/**/*
- /**/files/**/*

Encoding:
Enabled: false
@@ -9,4 +10,4 @@ SingleSpaceBeforeFirstArg:
NumericLiterals:
Enabled: false
LineLength:
Max: 100
Enabled: false
2 changes: 1 addition & 1 deletion cookbooks/rubygems-app/recipes/delayed_job.rb
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@
owner: 'deploy',
group: 'deploy',
bundle_command: '/usr/local/bin/bundle',
rails_env: node.chef_environment,
rails_env: node.chef_environment
)
action ::File.exist?('/applications/rubygems/current') ? :enable : :disable
end
10 changes: 5 additions & 5 deletions cookbooks/rubygems-app/recipes/ruby.rb
Original file line number Diff line number Diff line change
@@ -3,16 +3,16 @@
# Recipe:: ruby
#

%w{ ruby2.0 ruby2.0-dev }.each do |pkg|
%w( ruby2.0 ruby2.0-dev ).each do |pkg|
package pkg
end

link "/usr/bin/ruby" do
to "/usr/bin/ruby2.0"
link '/usr/bin/ruby' do
to '/usr/bin/ruby2.0'
end

link "/usr/bin/gem" do
to "/usr/bin/gem2.0"
link '/usr/bin/gem' do
to '/usr/bin/gem2.0'
end

gem_package 'bundler'
45 changes: 25 additions & 20 deletions cookbooks/rubygems-database/recipes/default.rb
Original file line number Diff line number Diff line change
@@ -1,31 +1,36 @@
#
# Cookbook Name:: rubygems-database
# Recipe:: default
#

include_recipe 'rubygems'

node.default['postgresql']['data_directory'] = '/var/lib/pg_data'
node.default['postgresql']['listen_addresses'] = '0.0.0.0'
node.default['postgresql']['ssl'] = false
node.default['postgresql']['work_mem'] = "100MB"
node.default['postgresql']['shared_buffers'] = "24MB"
node.default['postgresql']['work_mem'] = '100MB'
node.default['postgresql']['shared_buffers'] = '24MB'
node.default['postgresql']['users'] = [{
"username" => "postgres",
"password" => "postgres",
"superuser" => true,
"createdb" => true,
"login" => true
'username' => 'postgres',
'password' => 'postgres',
'superuser' => true,
'createdb' => true,
'login' => true
}]
node.default['postgresql']['pg_hba'] = [
{
"type" => "host",
"db" => "rubygems_#{node.chef_environment}",
"user" => "postgres",
"password" => "postgres",
"addr" => "#{search(:node, "name:app01.#{node.chef_environment}.rubygems.org")[0]['ipaddress']}/0",
"method" => "md5"
'type' => 'host',
'db' => "rubygems_#{node.chef_environment}",
'user' => 'postgres',
'password' => 'postgres',
'addr' => "#{search(:node, "name:app01.#{node.chef_environment}.rubygems.org")[0]['ipaddress']}/0",
'method' => 'md5'
},
{
"type" => "local",
"db" => "all",
"user" => "postgres",
"method" => "ident"
'type' => 'local',
'db' => 'all',
'user' => 'postgres',
'method' => 'ident'
}
]

@@ -35,9 +40,9 @@
stage = node.chef_environment

connection_info = {
:host => '127.0.0.1',
:port => 5432,
:username => 'postgres'
host: '127.0.0.1',
port: 5432,
username: 'postgres'
}

postgresql_database_user "rubygems_#{stage}" do
25 changes: 15 additions & 10 deletions cookbooks/rubygems-metrics/recipes/default.rb
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
#
# Cookbook Name:: rubygems-metrics
# Recipe:: default
#

include_recipe 'chef-vault'

librato_creds = ChefVault::Item.load('librato', 'credentials')
librato_creds = chef_vault_item('librato', 'credentials')

node.default['collectd_librato']['email'] = librato_creds['email']
node.default['collectd_librato']['api_token'] = librato_creds['token']

include_recipe "collectd"
include_recipe "collectd-librato"
include_recipe 'collectd'
include_recipe 'collectd-librato'

include_recipe "collectd_plugins::cpu"
include_recipe "collectd_plugins::df"
include_recipe "collectd_plugins::disk"
include_recipe "collectd_plugins::interface"
include_recipe "collectd_plugins::memory"
include_recipe "collectd_plugins::swap"
include_recipe "collectd_plugins::syslog"
include_recipe 'collectd_plugins::cpu'
include_recipe 'collectd_plugins::df'
include_recipe 'collectd_plugins::disk'
include_recipe 'collectd_plugins::interface'
include_recipe 'collectd_plugins::memory'
include_recipe 'collectd_plugins::swap'
include_recipe 'collectd_plugins::syslog'
2 changes: 1 addition & 1 deletion cookbooks/rubygems-motd/recipes/default.rb
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
# Recipe:: default
#

%w{ 00-header 10-help-text 50-landscape-sysinfo 51-cloudguest }.each do |item|
%w( 00-header 10-help-text 50-landscape-sysinfo 51-cloudguest ).each do |item|
motd item do
action :delete
end
2 changes: 1 addition & 1 deletion cookbooks/rubygems-notify/recipes/default.rb
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@

include_recipe 'chef-vault'

slack_creds = ChefVault::Item.load('slack', 'credentials')
slack_creds = chef_vault_item('slack', 'credentials')

node.default['chef_client']['handler']['slack']['team'] = slack_creds['team']
node.default['chef_client']['handler']['slack']['api_key'] = slack_creds['api_key']
19 changes: 9 additions & 10 deletions cookbooks/rubygems-people/recipes/samkottler.rb
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
home = "/home/samkottler"
home = '/home/samkottler'

directory "#{home}/src" do
owner "samkottler"
group "samkottler"
owner 'samkottler'
group 'samkottler'
end

package "tmux" do
package 'tmux' do
action :install
end

git "#{home}/src/dotfiles" do
repository "https://github.com/skottler/dotfiles" do
revision "master"
checkout_branch "master"
repository 'https://github.com/skottler/dotfiles' do
revision 'master'
checkout_branch 'master'
action :sync
user "samkottler"
user 'samkottler'
end
end

%w{ .gitconfig .pryrc .tmux.conf .gemrc .ackrc }.each do |file|
%w( .gitconfig .pryrc .tmux.conf .gemrc .ackrc ).each do |file|
link "#{home}/#{file}" do
to "#{home}/src/dotfiles/#{file}"
end
end

11 changes: 8 additions & 3 deletions cookbooks/rubygems-redis/recipes/default.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
include_recipe "rubygems"
#
# Cookbook Name:: rubygems-redis
# Recipe:: default
#

include_recipe "redisio::install"
include_recipe "redisio::enable"
include_recipe 'rubygems'

include_recipe 'redisio::install'
include_recipe 'redisio::enable'
18 changes: 11 additions & 7 deletions cookbooks/rubygems-sensu/recipes/base.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
#
# Cookbook Name:: rubygems-sensu
# Recipe:: base
#

gem_package 'sensu-plugin' do
gem_binary '/opt/sensu/embedded/bin/gem'
end

package 'nagios-plugins'

%w{ check-procs.rb }.each do |plugin|
%w( check-procs.rb ).each do |plugin|
cookbook_file "/etc/sensu/plugins/#{plugin}" do
source plugin
path "/etc/sensu/plugins/#{plugin}"
@@ -20,38 +25,37 @@
handlers ['slack']
subscribers ['all']
interval 30
additional(:notification => 'There is a high number of procs running', :occurences => 3)
additional(notification: 'There is a high number of procs running', occurences: 3)
end

sensu_check 'check_ssh' do
command '/usr/lib/nagios/plugins/check_ssh localhost'
handlers ['slack']
subscribers ['all']
interval 30
additional(:notification => 'sshd is not running', :occurences => 3)
additional(notification: 'sshd is not running', occurences: 3)
end

sensu_check 'check_apt' do
command '/usr/lib/nagios/plugins/check_apt'
handlers ['slack']
subscribers ['all']
interval 60
additional(:notification => 'There are pending package upgrades', :occurences => 3)
additional(notification: 'There are pending package upgrades', occurences: 3)
end

sensu_check 'check_ntp_time' do
command '/usr/lib/nagios/plugins/check_ntp_time -H localhost'
handlers ['slack']
subscribers ['all']
interval 30
additional(:notification => 'NTP is out of sync', :occurences => 3)
additional(notification: 'NTP is out of sync', occurences: 3)
end

sensu_check 'check_load' do
command "/usr/lib/nagios/plugins/check_load -w #{node['cpu']['total'] * 8}:#{node['cpu']['total'] * 5}:#{node['cpu']['total'] * 2} -c #{node['cpu']['total'] * 10}:#{node['cpu']['total'] * 8}:#{node['cpu']['total'] * 3}"
handlers ['slack']
subscribers ['all']
interval 30
additional(:notification => 'Load is high', :occurences => 3)
additional(notification: 'Load is high', occurences: 3)
end

25 changes: 16 additions & 9 deletions cookbooks/rubygems-sensu/recipes/librato.rb
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
librato_creds = ChefVault::Item.load("librato", "credentials")
#
# Cookbook Name:: rubygems-sensu
# Recipe:: librato
#

template "/etc/sensu/librato-metrics.json" do
source "librato-metrics.json.erb"
path "/etc/sensu/librato-metrics.json"
owner "sensu"
group "sensu"
include_recipe 'chef-vault'

librato_creds = chef_vault_item('librato', 'credentials')

template '/etc/sensu/librato-metrics.json' do
source 'librato-metrics.json.erb'
path '/etc/sensu/librato-metrics.json'
owner 'sensu'
group 'sensu'
variables(
email: librato_creds['email'],
api_key: librato_creds['token']
)
end

cookbook_file "/etc/sensu/handlers/librato-metrics.rb" do
path "/etc/sensu/handlers/librato-metrics.rb"
source "librato-metrics.rb"
cookbook_file '/etc/sensu/handlers/librato-metrics.rb' do
path '/etc/sensu/handlers/librato-metrics.rb'
source 'librato-metrics.rb'
action :create
end
6 changes: 3 additions & 3 deletions cookbooks/rubygems-sensu/recipes/server.rb
Original file line number Diff line number Diff line change
@@ -22,9 +22,9 @@

include_recipe 'sensu::rabbitmq'

apt_preference "rabbitmq-server" do
pin "version 3.1.5"
pin_priority "700"
apt_preference 'rabbitmq-server' do
pin 'version 3.1.5'
pin_priority '700'
end

include_recipe 'sensu::redis'
9 changes: 8 additions & 1 deletion cookbooks/rubygems-sensu/recipes/slack.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
#
# Cookbook Name:: rubygems-sensu
# Recipe:: slack
#

include_recipe 'chef-vault'

# These have to be different than the handler credentials because Slack
# provides a separate token for each integration.
slack_creds = ChefVault::Item.load('sensu', 'credentials')['slack']
slack_creds = chef_vault_item('sensu', 'credentials')['slack']

template '/etc/sensu/slack.json' do
source 'slack.json.erb'

0 comments on commit 9117329

Please sign in to comment.