Skip to content

Instantly share code, notes, and snippets.

View rberger's full-sized avatar

Robert J. Berger rberger

View GitHub Profile
@rberger
rberger / colorprompt.sh.erb
Created December 8, 2011 22:30 — forked from lusis/colorprompt.sh.erb
chef template and snippit for managing the prompt - useful for ec2
#------------------------------------------------------------------------
# ISO 6429 character sequences for colors etc
# lc = leading character sequence, common for all colors.
lc='\[\e[1;'
# foregrounds----backgrounds--------------------------------------------------
BLACK=${lc}30m; B_BLACK=${lc}40m
RED=${lc}31m; B_RED=${lc}41m
GREEN=${lc}32m; B_GREEN=${lc}42m
YELLOW=${lc}33m; B_YELLOW=${lc}43m
BLUE=${lc}34m; B_BLUE=${lc}44m
$hosts_table = {
:dbm => "192.168.86.101",
:app1 => "192.168.86.102",
:app2 => "192.168.86.103",
:lb => "192.168.86.104",
}
def bootstrap(config, host)
config.vm.box = "lucid64"
config.vm.network $hosts_table[host]
@rberger
rberger / recipe.rb
Created June 15, 2011 22:28 — forked from peplin/recipe.rb
S3 File Resource for Chef
# Source accepts the protocol s3:// with the host as the bucket
# access_key_id and secret_access_key are just that
s3_file "/var/bulk/the_file.tar.gz" do
source "s3://your.bucket/the_file.tar.gz"
access_key_id your_key
secret_access_key your_secret
owner "root"
group "root"
mode 0644
end
@rberger
rberger / nginx_unicorn.rb
Created June 15, 2011 22:06 — forked from threetee/nginx_unicorn.rb
chef nginx_unicorn recipe (part of modified application cookbook)
app = node.run_state[:current_app]
#unicorn
include_recipe "application::unicorn"
#nginx
include_recipe "nginx::source"
#nginx/unicorn proxy
socket = "/tmp/unicorn_#{app['id']}.sock"
@rberger
rberger / knife.rb
Created February 18, 2011 08:14 — forked from jbz/knife.rb
# This knife.rb orig. provided by jtimberman@opscode.com - but any mistakes are mine!
current_dir = File.dirname(__FILE__)
platform = "https://api.opscode.com/organizations"
require 'grit'
branch = Grit::Repo.new("#{current_dir}/..").head.name
case branch
#
# Cookbook Name:: myface
# Recipe:: default
#
# Copyright (C) 2012 Sean OMeara
#
# Apache 2 license
#
user 'myface'
#
# Cookbook Name:: myface
# Recipe:: default
#
# Copyright (C) 2012 Sean OMeara
#
# Apache 2 license
#
user 'myface'
/* A table for myface users */
CREATE TABLE users(
id CHAR (32) NOT NULL,
PRIMARY KEY(id),
user_name VARCHAR(64),
url VARCHAR(256),
email VARCHAR(128),
neck_beard INTEGER
);
# Managed by Chef for <%= node['hostname'] %>
<VirtualHost *:80>
ServerAdmin <%= node['apache']['contact'] %>
DocumentRoot /srv/apache/myface
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /srv/apache/myface>
#
# Cookbook Name:: myface
# Recipe:: database
#
# Copyright (C) 2013 Charles Johnson
#
# All rights reserved - Do Not Redistribute
#
include_recipe "mysql::server"