Skip to content

Instantly share code, notes, and snippets.

View jsierles's full-sized avatar
🎯
Focusing

Joshua Sierles jsierles

🎯
Focusing
View GitHub Profile
attributes.rb
-------------
apt = Mash.new
apt[:mirror] = Mash.new
apt[:mirror][:base_path] = "/u/mirrors/apt"
recipes/mirror.rb
-----------------
require_recipe "apt"
remote_directory "/var/lib/nagios/notifiers" do
source "notifiers"
files_backup 5
files_owner "nagios"
files_group "nagios"
files_mode 0644
owner "nagios"
group "nagios"
mode 0755
end
A rough outline of the talk:
- live demonstration of a simple cluster of machines (application, database, mail) provisioned by Chef (10 minutes)
- quick review of the reasons why Chef is better than Puppet, capistrano, etc. for managing servers (all ruby, spoke-and-hub rather than 'pushing commands') (5 minutes)
- code examples of the previously run chef 'cookbooks' that setup services (15 minutes)
- quick intro to 'ohai', the read-only system profiling tool that Chef uses to gather information about hosts (5 minutes)
- show how we use Chef server to automatically configure Nagios monitoring (5-10 minutes)
- Q and A
Code used in the talk would be made available on Github prior to the talk.
nagios_service_template "local" do
max_check_attempts 4
normal_check_interval 300
retry_check_interval 60
end
nagios_service_template "local" do
max_check_attempts 4
normal_check_interval 300
retry_check_interval 60
end
if node[:ec2] && node[:ec2][:userdata]
ec2_userdata JSON.parse(node[:userdata])
ec2_userdata.each do |k,v|
send(k.to_s, v)
end
end
#!/bin/sh
#
# EC2 bootstrap
#
mkdir /etc/chef
mkdir /var/chef
cat > /etc/chef/solo.rb <<SOLO
cookbook_path "/var/chef/cookbooks"
from /usr/local/lib/ruby/gems/1.8/gems/passenger-2.0.6/lib/passenger/abstract_server.rb:317:in `__send__'
from /usr/local/lib/ruby/gems/1.8/gems/passenger-2.0.6/lib/passenger/abstract_server.rb:317:in `main_loop'
from /usr/local/lib/ruby/gems/1.8/gems/passenger-2.0.6/lib/passenger/abstract_server.rb:168:in `start_synchronously'
from /usr/local/lib/ruby/gems/1.8/gems/passenger-2.0.6/bin/passenger-spawn-server:46
from /u/apps/backpack/releases/20090310140230/vendor/rails/actionpack/lib/action_controller/cgi_process.rb:175:in `write'
from /u/apps/backpack/releases/20090310140230/vendor/rails/actionpack/lib/action_controller/cgi_process.rb:175:in `out'
from /u/apps/backpack/releases/20090310140230/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:157:in `failsafe_rescue'
from /u/apps/backpack/releases/20090310140230/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:52:in `failsafe_response'
from /u/apps/backpack/releases/20090310140230/vendor/rails/actionpack/lib/action_contro
[Mon Mar 16 10:52:25 2009] [notice] Apache/2.2.9 (Ubuntu) Phusion_Passenger/2.1.2 PHP/5.2.6-2ubuntu4.1 with Suhosin-Patch mod_ssl/2.2.9 OpenSSL/0.9.8g configured -- resuming normal operations
/u/apps/blogcabin/releases/20090316144730/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack.rb:17: warning: already initialized constant VERSION
[ pid=5297 file=Hooks.cpp:527 time=2009-03-16 10:52:36.660 ]:
Unexpected error in mod_passenger: write() failed: Broken pipe (32)
Backtrace:
in 'int Hooks::handleRequest(request_rec*)' (Hooks.cpp:471)
[ pid=5299 file=Hooks.cpp:527 time=2009-03-16 10:52:36.715 ]:
Unexpected error in mod_passenger: write() failed: Broken pipe (32)
Backtrace:
GNU gdb 6.8-debian
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu"...
Attaching to program: /usr/local/lib/ruby/gems/1.8/gems/passenger-2.1.2/ext/apache2/ApplicationPoolServerExecutable, process 8831
Reading symbols from /lib/libpthread.so.0...done.
[Thread debugging using libthread_db enabled]