Skip to content
This repository was archived by the owner on Jan 19, 2019. It is now read-only.

Commit

Permalink
[COOK-2845] Fix misconfigured wrapper.conf and add Open SUSE support
Browse files Browse the repository at this point in the history
Signed-off-by: Seth Vargo <[email protected]>
  • Loading branch information
Lyndon Washington authored and sethvargo committed Sep 18, 2013
1 parent ac710f8 commit 6b38928
Show file tree
Hide file tree
Showing 9 changed files with 138 additions and 90 deletions.
21 changes: 20 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,21 @@
.kitchen/
*~
*#
.#*
\#*#
.*.sw[a-z]
*.un~
*.tmp
*.bk
*.bkup
.kitchen.local.yml
Berksfile.lock
Gemfile.lock

.bundle/
.cache/
.kitchen/
.vagrant/
.vagrant.d/
bin/
tmp/
vendor/
35 changes: 10 additions & 25 deletions .kitchen.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,17 @@
---
driver_plugin: vagrant
driver_config:
require_chef_omnibus: true

platforms:
- name: ubuntu-12.04
driver_config:
box: opscode-ubuntu-12.04
box_url: https://opscode-vm-bento.s3.amazonaws.com/vagrant/opscode_ubuntu-12.04_provisionerless.box
run_list: ["recipe[apt]"]

- name: ubuntu-10.04
driver_config:
box: opscode-ubuntu-10.04
box_url: http://opscode-vm-bento.s3.amazonaws.com/vagrant/opscode_ubuntu-10.04_provisionerless.box
run_list: ["recipe[apt]"]

- name: centos-6.4
driver_config:
box: opscode-centos-6.4
box_url: http://opscode-vm-bento.s3.amazonaws.com/vagrant/opscode_centos-6.4_provisionerless.box

- name: centos-5.9
driver_config:
box: opscode-centos-5.9
box_url: http://opscode-vm-bento.s3.amazonaws.com/vagrant/opscode_centos-5.9_provisionerless.box
- name: ubuntu-12.04
run_list:
- recipe[apt]
- name: ubuntu-10.04
run_list:
- recipe[apt]
- name: centos-6.4

suites:
- name: default
run_list: ["recipe[activemq]"]
attributes: {}
- name: default
run_list:
- recipe[activemq]
11 changes: 11 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
source 'http://rubygems.org'

gem 'berkshelf', '~> 2.0'
gem 'chefspec', '~> 2.0'
gem 'foodcritic', '~> 2.2'
gem 'rubocop', '~> 0.12'

group :integration do
gem 'test-kitchen', '~> 1.0.0.beta'
gem 'kitchen-vagrant', '~> 0.11'
end
2 changes: 1 addition & 1 deletion attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
default['activemq']['mirror'] = "http://apache.mirrors.tds.net"
default['activemq']['version'] = "5.8.0"
default['activemq']['home'] = "/opt"
default['activemq']['wrapper']['max_memory'] = "512"
default['activemq']['wrapper']['max_memory'] = "1024"
default['activemq']['wrapper']['useDedicatedTaskRunner'] = "true"

default['activemq']['enable_stomp'] = true
Expand Down
40 changes: 17 additions & 23 deletions libraries/chef_activemq.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,24 @@
#
class Chef
module ActiveMQ
# Returns the name of the jar file that contains the ActiveMQ main classes. Since ActiveMQ 5.8.0 the name
# of such jar file is "activemq.jar", prior to that it was "run.jar".
#
# @param node [Chef::Node] the Chef node
#
# @return [String] the name of the ActiveMQ jar file that should be included in the JVM Classpath.
def self.get_amq_jar_name(node)
version = node['activemq']['version']
vMj, vMn, vRev = version.split('.').map { |v| Integer(v) rescue nil }

class << self

# Returns the name of the jar file that contains the ActiveMQ main classes. Since ActiveMQ 5.8.0 the name
# of such jar file is "activemq.jar", prior to that it was "run.jar".
#
# @param node [Chef::Node] the Chef node
#
# @return [String] the name of the ActiveMQ jar file that should be included in the JVM Classpath.
def get_amq_jar_name(node)

version = node['activemq']['version']

vMj,vMn,vRev = version.split(".").map{ |v| Integer(v) rescue nil }
runner = case
when vMj == 5 && vMn >= 8
"activemq.jar"
when vMj >= 6
"activemq.jar"
else
"run.jar"
end
runner
end
case
when vMj == 5 && vMn >= 8
'activemq.jar'
when vMj >= 6
'activemq.jar'
else
'run.jar'
end
end
end
end
2 changes: 1 addition & 1 deletion metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version "1.2.1"

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

Expand Down
92 changes: 53 additions & 39 deletions templates/default/activemq.xml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<!-- Allows us to use system properties as variables in this configuration file -->
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<value>file:${activemq.base}/conf/credentials.properties</value>
<value>file:${activemq.conf}/credentials.properties</value>
</property>
</bean>

Expand All @@ -35,8 +35,8 @@
<broker xmlns="http://activemq.apache.org/schema/core" brokerName="localhost" dataDirectory="${activemq.base}/data" destroyApplicationContextOnStop="true">

<!--
For better performances use VM cursor and small memory limit.
For more information, see:
For better performances use VM cursor and small memory limit.
For more information, see:
http://activemq.apache.org/message-cursors.html
Expand All @@ -48,23 +48,31 @@
<destinationPolicy>
<policyMap>
<policyEntries>
<policyEntry topic=">" producerFlowControl="true" memoryLimit="1mb">
<pendingSubscriberPolicy>
<vmCursor />
</pendingSubscriberPolicy>
</policyEntry>
<policyEntry queue=">" producerFlowControl="true" memoryLimit="1mb">
<!-- Use VM cursor for better latency
For more information, see:
http://activemq.apache.org/message-cursors.html
<pendingQueuePolicy>
<vmQueueCursor/>
</pendingQueuePolicy>
-->
</policyEntry>
</policyEntries>
<policyEntry topic=">" producerFlowControl="true">
<!-- The constantPendingMessageLimitStrategy is used to prevent
slow topic consumers to block producers and affect other consumers
by limiting the number of messages that are retained
For more information, see:
http://activemq.apache.org/slow-consumer-handling.html
-->
<pendingMessageLimitStrategy>
<constantPendingMessageLimitStrategy limit="1000"/>
</pendingMessageLimitStrategy>
</policyEntry>
<policyEntry queue=">" producerFlowControl="true" memoryLimit="1mb">
<!-- Use VM cursor for better latency
For more information, see:
http://activemq.apache.org/message-cursors.html
<pendingQueuePolicy>
<vmQueueCursor/>
</pendingQueuePolicy>
-->
</policyEntry>
</policyEntries>
</policyMap>
</destinationPolicy>

Expand All @@ -88,30 +96,29 @@
http://activemq.apache.org/persistence.html
-->
<persistenceAdapter>
<kahaDB directory="${activemq.base}/data/kahadb"/>
<kahaDB directory="${activemq.data}/kahadb"/>
</persistenceAdapter>


<!--
<!--
The systemUsage controls the maximum amount of space the broker will
use before slowing down producers. For more information, see:
http://activemq.apache.org/producer-flow-control.html
If using ActiveMQ embedded - the following limits could safely be used:
-->
<systemUsage>
<systemUsage>
<memoryUsage>
<memoryUsage limit="20 mb"/>
</memoryUsage>
<storeUsage>
<storeUsage limit="1 gb"/>
</storeUsage>
<tempUsage>
<tempUsage limit="100 mb"/>
</tempUsage>
</systemUsage>
</systemUsage>
-->
<systemUsage>
<memoryUsage>
<memoryUsage limit="64 mb"/>
</memoryUsage>
<storeUsage>
<storeUsage limit="100 gb"/>
</storeUsage>
<tempUsage>
<tempUsage limit="50 gb"/>
</tempUsage>
</systemUsage>
</systemUsage>

<!--
The transport connectors expose ActiveMQ over a given protocol to
Expand All @@ -120,12 +127,19 @@
http://activemq.apache.org/configuring-transports.html
-->
<transportConnectors>
<transportConnector name="openwire" uri="tcp://0.0.0.0:61616"/>
<!-- DOS protection, limit concurrent connections to 1000 and frame size to 100MB -->
<transportConnector name="openwire" uri="tcp://0.0.0.0:61616?maximumConnections=1000&amp;wireformat.maxFrameSize=104857600"/>
<transportConnector name="amqp" uri="amqp://0.0.0.0:5672?maximumConnections=1000&amp;wireformat.maxFrameSize=104857600"/>
<% if node['activemq']['enable_stomp'] -%>
<transportConnector name="stomp" uri="stomp://0.0.0.0:61613"/>
<transportConnector name="stomp" uri="stomp://0.0.0.0:61613?maximumConnections=1000&amp;wireformat.maxFrameSize=104857600"/>
<% end -%>
</transportConnectors>

<!-- destroy the spring context on shutdown to stop jetty -->
<shutdownHooks>
<bean xmlns="http://www.springframework.org/schema/beans" class="org.apache.activemq.hooks.SpringContextHook" />
</shutdownHooks>

</broker>

<!--
Expand Down
14 changes: 14 additions & 0 deletions test/integration/default/serverspec/localhost/activemq_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
require 'spec_helper'

describe 'ActiveMQ server' do

it 'should have a vagrant user' do
expect(user('vagrant')).to exist
end

it 'should be running the activemq server' do
expect(service('activemq')).to be_running
expect(service('activemq')).to be_enabled
end

end
11 changes: 11 additions & 0 deletions test/integration/default/serverspec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
require 'serverspec'
require 'pathname'

include Serverspec::Helper::Exec
include Serverspec::Helper::DetectOS

RSpec.configure do |c|
c.before :all do
c.os = backend(Serverspec::Commands::Base).check_os
end
end

0 comments on commit 6b38928

Please sign in to comment.