Skip to content

Instantly share code, notes, and snippets.

View ctgswallow's full-sized avatar

Greg Swallow ctgswallow

  • ExactTarget
  • Indianapolis
View GitHub Profile
namespace :pre_deploy do
task "default" do
create_zipfile
end
desc "Create package zip file"
task "create_zipfile" do
run_locally "mkdir -p #{build_dir}"
run_locally "git archive --format=zip --prefix=#{app_name}/ -6 --output=#{build_dir}/#{app_name}-`git rev-parse --short=8 HEAD`.zip HEAD"
envs = Hash.new
q = Chef::Search::Query.new
r, f, l = q.search(:node, "fqdn:*.*")
r.each { |n| envs.has_key?(n.chef_environment) ? envs[n.chef_environment] += 1 : envs[n.chef_environment] = 1 }
@ctgswallow
ctgswallow / fix-graphite.sh
Created September 20, 2012 20:41
fix-graphite.sh
#!/bin/bash
/usr/bin/chef-client
rm -f /opt/graphite/webapp/graphite/settings.pyc /opt/graphite/webapp/graphite/settings.py
if [ -d "/var/chef/cache/graphite-web-0.9.10" ]; then
cd /var/chef/cache/graphite-web-0.9.10
python setup.py install
elif [ -d "/var/cache/chef/graphite-web-0.9.10" ]; then
cd /var/cache/chef/graphite-web-0.9.10
rb = ruby_block "wait_for_myself" do
action :nothing
block do
Chef::Log.info "Waiting for service registration to complete"
providers = all_providers_for_service("rabbitmq-disk-member")
found = false
until found
providers.each do |n|
n.hostname == node.hostname && found = true
Chef::Log.info "still waiting... #{providers.join(", ")}"
@ctgswallow
ctgswallow / gist:1903110
Created February 24, 2012 19:21
pentaho::i_am_the_nfs_server_for_pentaho
# register with cluster_service_discovery
provide_service("nfs-server-for-pentaho")
include_recipe "nfs::server"
# I think there's the potential for a chicken-and-egg issue here, where the NFS server doesn't
# know who to set up exports for, and the clients fail mounting an NFS share that has no permissions.
searchenv = node[:pentaho][:nfs_environment] ? node[:pentaho][:nfs_environment] : nil
nfs_clients = all_provider_private_ips_services("nfs-client-for-pentaho", :ignore_cluster => true, searchenv.to_a)
@ctgswallow
ctgswallow / gist:1903085
Created February 24, 2012 19:17
pentaho::nfs_mount
#
# Cookbook Name:: pentaho
# Recipe:: default
#
provide_service("nfs-client-for-pentaho")
searchenv = node[:pentaho][:nfs_environment] ? node[:pentaho][:nfs_environment] : nil
wait_for_service("nfs-server-for-pentaho", 1, 5, true, searchenv)
nfs_server = provider_for_service("nfs-server-for-pentaho", true, searchenv)
@ctgswallow
ctgswallow / gist:1634933
Created January 18, 2012 19:01
a.patch
--- src/http/ngx_http_upstream_round_robin.c.orig 2011-09-30 14:30:01.000000000 +0000
+++ src/http/ngx_http_upstream_round_robin.c 2012-01-18 18:38:25.438381169 +0000
@@ -7,13 +7,44 @@
#include <ngx_config.h>
#include <ngx_core.h>
#include <ngx_http.h>
+#include <ngx_supervisord.h>
+
+#if (NGX_SUPERVISORD_API_VERSION != 2)
+ #error "ngx_supervisord-aware upstream requires NGX_SUPERVISORD_API v2"