From 525b4f7d2d361ac8f73dbec55398a35187b8db0f Mon Sep 17 00:00:00 2001 From: jtimberman Date: Thu, 22 Oct 2009 15:13:03 -0600 Subject: [PATCH] cook-199 add activemq cookbook --- README.rdoc | 39 +++++++++++++++++++++ attributes/activemq.rb | 21 ++++++++++++ metadata.json | 40 ++++++++++++++++++++++ metadata.rb | 10 ++++++ recipes/default.rb | 41 +++++++++++++++++++++++ templates/default/sv-activemq-log-run.erb | 2 ++ templates/default/sv-activemq-run.erb | 3 ++ 7 files changed, 156 insertions(+) create mode 100644 README.rdoc create mode 100644 attributes/activemq.rb create mode 100644 metadata.json create mode 100644 metadata.rb create mode 100644 recipes/default.rb create mode 100644 templates/default/sv-activemq-log-run.erb create mode 100644 templates/default/sv-activemq-run.erb diff --git a/README.rdoc b/README.rdoc new file mode 100644 index 0000000..6156892 --- /dev/null +++ b/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 () + +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. diff --git a/attributes/activemq.rb b/attributes/activemq.rb new file mode 100644 index 0000000..c319462 --- /dev/null +++ b/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" diff --git a/metadata.json b/metadata.json new file mode 100644 index 0000000..097740f --- /dev/null +++ b/metadata.json @@ -0,0 +1,40 @@ +{ + "recipes": { + "activemq": "" + }, + "conflicting": { + + }, + "description": "Installs\/Configures activemq", + "providing": { + "activemq": [ + + ] + }, + "long_description": "= DESCRIPTION:\n\n= REQUIREMENTS:\n\n= ATTRIBUTES: \n\n= USAGE:\n\n", + "platforms": { + + }, + "version": "0.1.0", + "replacing": { + + }, + "name": "activemq", + "attributes": { + + }, + "maintainer": "Opscode, Inc.", + "recommendations": { + + }, + "license": "Apache 2.0", + "maintainer_email": "ops@example.com", + "suggestions": { + + }, + "dependencies": { + "java": [ + + ] + } +} \ No newline at end of file diff --git a/metadata.rb b/metadata.rb new file mode 100644 index 0000000..25d4155 --- /dev/null +++ b/metadata.rb @@ -0,0 +1,10 @@ +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" + +%x{java runit}.each do |cb| + depends cb +end diff --git a/recipes/default.rb b/recipes/default.rb new file mode 100644 index 0000000..da083d3 --- /dev/null +++ b/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" diff --git a/templates/default/sv-activemq-log-run.erb b/templates/default/sv-activemq-log-run.erb new file mode 100644 index 0000000..a79a518 --- /dev/null +++ b/templates/default/sv-activemq-log-run.erb @@ -0,0 +1,2 @@ +#!/bin/sh +exec svlogd -tt ./main diff --git a/templates/default/sv-activemq-run.erb b/templates/default/sv-activemq-run.erb new file mode 100644 index 0000000..3982bbc --- /dev/null +++ b/templates/default/sv-activemq-run.erb @@ -0,0 +1,3 @@ +#!/bin/sh +exec 2>&1 +exec /opt/apache-activemq-<%= @node[:activemq][:version] %>/bin/activemq