Skip to content

Instantly share code, notes, and snippets.

@zzondlo
zzondlo / application_default.rb
Created February 23, 2012 06:32 — forked from rcreasey/application_default.rb
application::default
include_recipe "git"
node.run_state[:applications] = []
search(:apps) do |app|
(app["server_roles"] & node.run_list.roles).each do |app_role|
node.run_state[:applications] << {:app => app, :recipes => app["type"][app_role]}
end
end
@zzondlo
zzondlo / default.rb
Created February 23, 2012 06:21 — forked from jonah-williams/default.rb
chef recipe to add delayed_job workers to monit to run them on Engine Yard cloud instances
#
# Cookbook Name:: delayed_job
# Recipe:: default
#
node[:applications].each do |app_name, data|
user = node[:users].first
case node[:instance_role]
when "solo", "app", "app_master"
service_link 'apache' do
version [node[:apache][:version], node[:apache][:worker]].join('-')
end
directory "/etc/httpd" do
owner "root"
group "root"
mode 0755
action :create
not_if { File.exists?('/etc/httpd') }
@zzondlo
zzondlo / development.rb
Created February 23, 2012 06:12 — forked from avit/development.rb
Using chef roles...
name "development"
description "The development environment"
# Using a role because chef-solo doesn't support environments.
override_attributes "app_environment" => "development",
override_attributes "mysql" => {
:allow_remote_root => true,
:server_root_password => "",

Make sure the EC2 instance for the Rundeck server has ports 4440 and 4443

Get the JAR files from github

wget https://github.com/downloads/dtolabs/rundeck/rundeck-launcher-1.1.0.jar --no-check-certificate

Install Java

sudo apt-get install openjdk-6-jre 
@zzondlo
zzondlo / updated_resources.rb
Created February 23, 2012 06:02 — forked from jtimberman/updated_resources.rb
Lists the resources updated
module SimpleReport
class UpdatedResources < Chef::Handler
def report
Chef::Log.info "Resources updated this run:"
run_status.updated_resources.each {|r| Chef::Log.info " #{r.to_s}"}
end
end
end
define :php_app, :docroot, :canonical_hostname => nil, :template => "php/php.conf.erb" do
application_name = params[:name]
include_recipe "apache2"
include_recipe "apache2::mod_rewrite"
include_recipe "apache2::mod_deflate"
include_recipe "apache2::mod_headers"
template "/etc/apache2/sites-available/#{params[:name]}.conf" do
@zzondlo
zzondlo / chef-websites.rb
Created February 23, 2012 03:15 — forked from abondis/chef-websites.rb
cookbook/recipes/websites
include_recipe "mysql::client"
node[:websites].each do |website|
db_website = search(:websites, "id:#{website} AND status:enabled").first
puts "apptype: #{db_website}"
case db_website["apptype"]
when "php", "dp", "wp"
document_root="/var/www/#{db_website["client"]}/#{db_website["id"]}"
package "php"
include_recipe "apache2::mod_php5"
@zzondlo
zzondlo / base.rb
Created February 23, 2012 03:14 — forked from abondis/base.rb
base role
{
"name": "base",
"description": "Basic role for any client",
"json_class": "Chef::Role",
"default_attributes": {
"authorization": {
"sudo": {
"groups": [
"sysadmin"
],
@zzondlo
zzondlo / knife.rb
Created February 23, 2012 03:07 — forked from fnichol/knife.rb
My Generic knife.rb
### Chef Solo
#
#
### Opscode Hosted Chef Server
#
# export KNIFE_USER="jdoe"
# export KNIFE_ORGNAME="acmeco"
#
# * Your Opscode client key should be at `~/.chef.d/opscode-jdoe.pem`.
# * Your Opscode validation key should be at `~/.chef.d/opscode-acmeco-validator.pem`.