Skip to content

Commit

Permalink
Merge branch 'master' into COOK-107
Browse files Browse the repository at this point in the history
  • Loading branch information
jtimberman committed Jan 6, 2010
2 parents d0e2924 + 18388bb commit dba899e
Show file tree
Hide file tree
Showing 490 changed files with 17,629 additions and 1,726 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1 +1,2 @@
tmp/*
.rake_test_cache
97 changes: 13 additions & 84 deletions Rakefile
@@ -1,91 +1,15 @@
require 'rubygems'
require 'chef'
require 'json'


TOPDIR = File.expand_path(File.join(File.dirname(__FILE__), ".."))
TEST_CACHE = File.expand_path(File.join(TOPDIR, ".rake_test_cache"))
COMPANY_NAME = "Opscode, Inc."
SSL_EMAIL_ADDRESS = "cookbooks@opscode.com"
NEW_COOKBOOK_LICENSE = :apachev2

desc "Test the cookbooks for syntax errors"
task :test do
puts "** Testing your cookbooks for syntax errors"
Dir[ File.join(File.dirname(__FILE__), "**", "*.rb") ].each do |recipe|
print "Testing recipe #{recipe}: "
sh %{ruby -c #{recipe}} do |ok, res|
if ! ok
raise "Syntax error in #{recipe}"
end
end
end
end

desc "Create a new cookbook (with COOKBOOK=name)"
task :new_cookbook do
create_cookbook(File.join(TOPDIR, "cookbooks"))
create_readme(File.join(TOPDIR, "cookbooks"))
end

def create_cookbook(dir)
raise "Must provide a COOKBOOK=" unless ENV["COOKBOOK"]
puts "** Creating cookbook #{ENV["COOKBOOK"]}"
sh "mkdir -p #{File.join(dir, ENV["COOKBOOK"], "recipes")}"
unless File.exists?(File.join(dir, ENV["COOKBOOK"], "recipes", "default.rb"))
open(File.join(dir, ENV["COOKBOOK"], "recipes", "default.rb"), "w") do |file|
file.puts <<-EOH
#
# Cookbook Name:: #{ENV["COOKBOOK"]}
# Recipe:: default
#
# Copyright #{Time.now.year}, #{COMPANY_NAME}
#
EOH
case NEW_COOKBOOK_LICENSE
when :apachev2
file.puts <<-EOH
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
EOH
when :none
file.puts <<-EOH
# All rights reserved - Do Not Redistribute
#
EOH
end
end
end
end

def create_readme(dir)
raise "Must provide a COOKBOOK=" unless ENV["COOKBOOK"]
puts "** Creating README for cookbook: #{ENV["COOKBOOK"]}"
unless File.exists?(File.join(dir, ENV["COOKBOOK"], "README.rdoc"))
open(File.join(dir, ENV["COOKBOOK"], "README.rdoc"), "w") do |file|
file.puts <<-EOH
= DESCRIPTION:
= REQUIREMENTS:
== Platform:
== Cookbooks:
= ATTRIBUTES:
= USAGE:
= LICENSE and AUTHOR:
EOH
end
end
end

load 'chef/tasks/chef_repo.rake'
task :default => [ :test ]

desc "Build a bootstrap.tar.gz"
Expand Down Expand Up @@ -115,3 +39,8 @@ task :build_bootstrap do
sh %{tar zcvf bootstrap.tar.gz cookbooks}
end
end

# remove unnecessary tasks
%w{update install roles ssl_cert}.each do |t|
Rake.application.instance_variable_get('@tasks').delete(t.to_s)
end
39 changes: 39 additions & 0 deletions activemq/README.rdoc
@@ -0,0 +1,39 @@
= DESCRIPTION:

Installs activemq and sets up a runit service.

= REQUIREMENTS:

Tested on Ubuntu 9.04.

Opscode cookbooks:

* java
* runit

= ATTRIBUTES:

* activemq[:mirror] - download URL up to the apache/activemq/apache-activemq directory.
* activemq[:version] - version to install.

= USAGE:

Include the default recipe on systems where you want to run activemq. At this time the cookbook doesn't use any custom configuration for activemq.

= LICENSE AND AUTHOR:

Author:: Joshua Timberman (<joshua@opscode.com>)

Copyright:: 2009, Opscode, 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

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
21 changes: 21 additions & 0 deletions activemq/attributes/activemq.rb
@@ -0,0 +1,21 @@
#
# Cookbook Name:: activemq
# Attributes:: activemq
#
# Copyright 2009, Opscode, 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

set_unless[:activemq][:mirror] = "http://mirrors.ibiblio.org/pub/mirrors"
set_unless[:activemq][:version] = "5.3.0"
48 changes: 48 additions & 0 deletions activemq/metadata.json
@@ -0,0 +1,48 @@
{
"maintainer": "Opscode, Inc.",
"description": "Installs activemq and sets it up as a runit service",
"recommendations": {

},
"maintainer_email": "cookbooks@opscode.com",
"recipes": {
"activemq": ""
},
"suggestions": {

},
"platforms": {
"ubuntu": [

],
"debian": [

]
},
"version": "0.1.0",
"name": "activemq",
"conflicting": {

},
"attributes": {

},
"providing": {
"activemq": [

]
},
"license": "Apache 2.0",
"long_description": "= DESCRIPTION:\n\nInstalls activemq and sets up a runit service.\n\n= REQUIREMENTS:\n\nTested on Ubuntu 9.04.\n\nOpscode cookbooks:\n\n* java\n* runit\n\n= ATTRIBUTES:\n\n* activemq[:mirror] - download URL up to the apache\/activemq\/apache-activemq directory.\n* activemq[:version] - version to install.\n\n= USAGE:\n\nInclude the default recipe on systems where you want to run activemq. At this time the cookbook doesn't use any custom configuration for activemq.\n\n= LICENSE AND AUTHOR:\n\nAuthor:: Joshua Timberman (<joshua@opscode.com>)\n\nCopyright:: 2009, Opscode, Inc\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http:\/\/www.apache.org\/licenses\/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
"replacing": {

},
"dependencies": {
"java": [

],
"runit": [

]
}
}
14 changes: 14 additions & 0 deletions activemq/metadata.rb
@@ -0,0 +1,14 @@
maintainer "Opscode, Inc."
maintainer_email "cookbooks@opscode.com"
license "Apache 2.0"
description "Installs activemq and sets it up as a runit service"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc'))
version "0.1"

%w{ubuntu debian}.each do |os|
supports os
end

%w{java runit}.each do |cb|
depends cb
end
41 changes: 41 additions & 0 deletions activemq/recipes/default.rb
@@ -0,0 +1,41 @@
#
# Cookbook Name:: activemq
# Recipe:: default
#
# Copyright 2009, Opscode, 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

include_recipe "java"

version = node[:activemq][:version]
mirror = node[:activemq][:mirror]

remote_file "/tmp/apache-activemq-#{version}-bin.tar.gz" do
source "#{mirror}/apache/activemq/apache-activemq/#{version}/apache-activemq-#{version}-bin.tar.gz"
mode "0644"
end

execute "tar zxf /tmp/apache-activemq-#{version}-bin.tar.gz" do
cwd "/opt"
not_if { File.exists?("/opt/apache-activemq-#{version}/bin/activemq") }
end

file "/opt/apache-activemq-#{version}/bin/activemq" do
owner "root"
group "root"
mode "0755"
end

runit_service "activemq"
3 changes: 3 additions & 0 deletions activemq/templates/default/sv-activemq-run.erb
@@ -0,0 +1,3 @@
#!/bin/sh
exec 2>&1
exec /opt/apache-activemq-<%= @node[:activemq][:version] %>/bin/activemq
16 changes: 16 additions & 0 deletions apache2/README.rdoc
Expand Up @@ -44,6 +44,22 @@ We only prototype one parameter for the web_app define, "template". This is used

These are available as @params[:docroot], @params[:server_name], @params[:server_aliases] within the template.

If 'cookbook' and 'template' are not specified, the current cookbook's templates/default/web_app.conf.erb will be used. If this template is not suitable for your application, copy it to your cookbook and customize as needed.

== God Monitor:

There's a new recipe, apache2::god_monitor. You will need to make sure to include the 'god' recipe before using the apache2::god_monitor recipe in your cookbook.

== OpenID Auth

Installs the mod_auth_openid module from source. Specify an array of OpenIDs that are allowed to authenticate with the attribute apache[:allowed_openids]. Use the following in a vhost to protect with OpenID authentication:

AuthOpenIDEnabled On
AuthOpenIDDBLocation /var/cache/apache2/mod_auth_openid.db
AuthOpenIDUserProgram /usr/local/bin/mod_auth_openid.rb

Change the DBLocation as appropriate for your platform. You'll need to change the file in the recipe to match. The UserProgram is optional if you don't want to limit access by certain OpenIDs.

= LICENSE & AUTHOR:

Author:: Joshua Timberman (<joshua@opscode.com>)
Expand Down

0 comments on commit dba899e

Please sign in to comment.