Skip to content

Instantly share code, notes, and snippets.

View miah's full-sized avatar
🍕
Dreaming of pizza.

Miah Johnson miah

🍕
Dreaming of pizza.
View GitHub Profile
@miah
miah / curl
Created February 27, 2012 16:47
southwest inflight wireless = community.opscode.com 500 :(
[miahjohnson@default]$: curl -v community.opscode.com
* About to connect() to community.opscode.com port 80 (#0)
* Trying 184.106.28.83... connected
* Connected to community.opscode.com (184.106.28.83) port 80 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.21.4 (universal-apple-darwin11.0) libcurl/7.21.4 OpenSSL/0.9.8r zlib/1.2.5
> Host: community.opscode.com
> Accept: */*
>
* HTTP 1.0, assume close after body
#include_recipes
include_recipe "route53"
# Translate the role into a shortname.
role_trans = {
"memcached" => "mc",
"wordpress" => "wp",
"rails" => "rails",
"lb" => "lb",
"monitoring" => "mon",
@miah
miah / source.rb
Created April 5, 2012 06:08
haproxy
#
# Cookbook Name:: haproxy
# Recipe:: source
#
# Copyright 2012, CX Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
"server" : {
"observe" : "layer7",
"check"
}
[miahjohnson@recipes]$: knife cookbook test
WARNING: No cookbooks to test in /Users/miahjohnson/Documents/cx/chef-repo/cookbooks - is your cookbook path misconfigured?
[miahjohnson@recipes]$: knife cookbook test collectd
checking collectd
Running syntax check on collectd
Validating ruby files
Validating templates
execute "haproxy_check_config" do
command "#{haproxy_bin} -c -f /etc/haproxy/haproxy.cfg"
notifies :restart, "service[haproxy]"
action :nothing
end
template "/etc/haproxy/haproxy.cfg" do
.. trimmed
notifies :run, "execute[haproxy_check_config]"
end
@miah
miah / gist:2705827
Created May 15, 2012 23:02
BDD Cookbook Writing
# After approximately 3 hours of discussion we have come up with the following:
- Integration testing with Minitest
- Functional testing with ChefSpec
- Because Minitest runs after convergence, it becomes time consuming to test during cookbook development.
- Testing with ChefSpec during development helps ensure your cookbook meets functional requirements.
magical-unicorn:db miah$ vagrant up
/Users/miah/projects/vagrant/db/Vagrantfile:10:in `block (2 levels) in <top (required)>': undefined method `share_folder=' for #<Vagrant::Config::VMConfig:0x007f80118230f0> (NoMethodError)
from /Users/miah/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/vagrant-1.0.3/lib/vagrant/config/vm/provisioner.rb:32:in `call'
from /Users/miah/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/vagrant-1.0.3/lib/vagrant/config/vm/provisioner.rb:32:in `configure'
from /Users/miah/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/vagrant-1.0.3/lib/vagrant/config/vm/provisioner.rb:21:in `initialize'
from /Users/miah/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/vagrant-1.0.3/lib/vagrant/config/vm.rb:71:in `new'
from /Users/miah/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/vagrant-1.0.3/lib/vagrant/config/vm.rb:71:in `provision'
from /Users/miah/projects/vagrant/db/Vagrantfile:2:in `block in <top (required)>'
from /Users/miah/.rbenv/versions/1.9.3-p125/lib/ruby/g
{
"name": "nagios",
"description": "Nagios server, source of alert nightmares..",
"json_class": "Chef::Role",
"default_attributes": {
"nagios": {
"notifications_enabled": "0",
"server_auth_method": "htauth",
"server_role": "nagios"
"server": {
@miah
miah / gist:3209829
Created July 30, 2012 20:18
veewee <3
magical-unicorn:nagios miah$ veewee
/Users/miah/.rbenv/versions/1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:1625:in `raise_if_conflicts': can't activate json-1.7.3, already activated json-1.5.4 (Gem::LoadError)
from /Users/miah/.rbenv/versions/1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:746:in `activate'
from /Users/miah/.rbenv/versions/1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:51:in `block in require'
from /Users/miah/.rbenv/versions/1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:50:in `each'
from /Users/miah/.rbenv/versions/1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:50:in `require'
from /Users/miah/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/vagrant-1.0.3/lib/vagrant.rb:47:in `<top (required)>'
from /Users/miah/.rbenv/versions/1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
from /Users/miah/.rbenv/versions/1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55