Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open file limit not set correctly #127

Merged
merged 16 commits into from Apr 23, 2015
Merged
Changes from 7 commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -167,6 +167,14 @@ class Chef::Resource # rubocop:disable all
notifies :restart, "service[#{node['rabbitmq']['service_name']}]", :immediately
end

template '/etc/default/rabbitmq-server' do

This comment has been minimized.

Copy link
@stevecstian

stevecstian Dec 15, 2014

Should we use template "/etc/default/#{node['rabbitmq']['service_name']}" instead?

This comment has been minimized.

Copy link
@jjasghar

jjasghar Dec 15, 2014

Collaborator

👍

source 'default.rabbitmq-server.erb'

This comment has been minimized.

Copy link
@stevecstian

stevecstian Dec 15, 2014

How about rabbitmq.service.default.erb?

This comment has been minimized.

Copy link
@stevecstian

stevecstian Dec 16, 2014

default.rabbitmq-server.erb is looking good to me. 👍

owner 'root'
group 'root'
mode 00644

This comment has been minimized.

Copy link
@tas50

tas50 Jan 19, 2015

Contributor

This should be a 4 digit string: '0644'

This comment has been minimized.

Copy link
@cmluciano

cmluciano Mar 16, 2015

Collaborator

The 5 digit should be fine. I believe this just forces the octet rule

notifies :restart, "service[#{node['rabbitmq']['service_name']}]"

This comment has been minimized.

Copy link
@stevecstian

stevecstian Dec 15, 2014

Open question: Do we need to notify restart immediately?

This comment has been minimized.

Copy link
@michaelklishin

michaelklishin Dec 15, 2014

Member

I'd say we do because a user may have overridden RABBITMQ_MNESIA_DIR or similar and the added a user (for example).

end

if File.exist?(node['rabbitmq']['erlang_cookie_path']) && File.readable?((node['rabbitmq']['erlang_cookie_path']))
existing_erlang_key = File.read(node['rabbitmq']['erlang_cookie_path']).strip
else
@@ -1,7 +1,6 @@
require 'spec_helper'

describe 'rabbitmq::default' do

version = '3.4.2-1'

let(:chef_run) do
@@ -53,5 +52,4 @@
:source => 'rabbitmq.config.erb',
:mode => 00644)
end

end
@@ -10,5 +10,4 @@
it 'includes the `default` recipe' do
expect(chef_run).to include_recipe('rabbitmq::default')
end

end
@@ -10,5 +10,4 @@
it 'includes the `default` recipe' do
expect(chef_run).to include_recipe('rabbitmq::default')
end

end
@@ -10,5 +10,4 @@
it 'includes the `default` recipe' do
expect(chef_run).to include_recipe('rabbitmq::default')
end

end
@@ -14,5 +14,4 @@
it 'includes the `virtualhost_management` recipe' do
expect(chef_run).to include_recipe('rabbitmq::virtualhost_management')
end

end
@@ -10,5 +10,4 @@
it 'includes the `default` recipe' do
expect(chef_run).to include_recipe('rabbitmq::default')
end

end
@@ -0,0 +1,10 @@
# This file is sourced by /etc/init.d/rabbitmq-server. Its primary

This comment has been minimized.

Copy link
@stevecstian

stevecstian Dec 15, 2014

Add comment below in the beginning of the file?

%%%
%% Generated by Chef
%%%

This comment has been minimized.

Copy link
@jjasghar

jjasghar Dec 15, 2014

Collaborator

👍

# reason for existing is to allow adjustment of system limits for the
# rabbitmq-server process.
#
# Maximum number of open file handles. This will need to be increased
# to handle many simultaneous connections. Refer to the system
# documentation for ulimit (in man bash) for more information.
#
#ulimit -n 1024
<% if node['rabbitmq']['open_file_limit'] -%>ulimit -n <%= node['rabbitmq']['open_file_limit'] %><% end %>

This comment has been minimized.

Copy link
@stevecstian

stevecstian Dec 15, 2014

Open question: Which attribute we should use here? node['rabbitmq']['open_file_limit'] or node['rabbitmq']['max_file_descriptors']?

This comment has been minimized.

Copy link
@stevecstian

stevecstian Dec 16, 2014

Looks like we should use node['rabbitmq']['open_file_limit'] here as it has default value nil. node['rabbitmq']['max_file_descriptors'] has default value 1024 and is only used when node['rabbitmq']['job_control'] is upstart. 💔

This comment has been minimized.

Copy link
@jjasghar

jjasghar Dec 16, 2014

Collaborator

We should be able to depreciate the upstart feature flip. Chef-client 12 now supports the cough_ubuntu_cough crazyness.

@@ -18,5 +18,3 @@ export ERL_EPMD_ADDRESS=<%= node['rabbitmq']['erl_networking_bind_address'] %>
<% if node['rabbitmq']['config'] -%>CONFIG_FILE=<%= node['rabbitmq']['config'] %><% end %>
<% if node['rabbitmq']['logdir'] -%>LOG_BASE=<%= node['rabbitmq']['logdir'] %><% end %>
<% if node['rabbitmq']['mnesiadir'] -%>MNESIA_BASE=<%= node['rabbitmq']['mnesiadir'] %><% end %>

<% if node['rabbitmq']['open_file_limit'] -%>ulimit -n <%= node['rabbitmq']['open_file_limit'] %><% end %>
@@ -15,7 +15,6 @@
#

describe 'rabbitmq_test::cluster' do

it 'writes the erlang cookie file' do
file('/var/lib/rabbitmq/.erlang.cookie').must_exist
end
@@ -25,5 +24,4 @@
/^ {cluster_nodes, [.*]},$/
)
end

end
@@ -33,5 +33,4 @@

file(rpm_path).wont_exist && package('rabbitmq-server').must_be_installed
end

end
@@ -25,5 +25,4 @@
file('/etc/apt/sources.list.d/rabbitmq-source.list').wont_exist &&
package('rabbitmq-server').must_be_installed
end

end
@@ -33,5 +33,4 @@
file("#{node['rabbitmq']['config_root']}/rabbitmq-env.conf")
.must_match(/(ulimit -n #{node['rabbitmq']['open_file_limit']})/)
end

end
@@ -0,0 +1,24 @@
# 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.
#

require File.expand_path('../support/helpers', __FILE__)

describe 'rabbitmq_test::cook-openfiles' do
include Helpers::RabbitMQ

it 'properly sets open_file_limit' do
if node['rabbitmq']['open_file_limit']
command("grep 'Max open files' /proc/$(sudo pgrep -u rabbitmq beam)/limits | awk '{print $5}'").stdout.chomp == "#{node['rabbitmq']['open_file_limit']}"
end
end
end
@@ -26,5 +26,4 @@
it 'enables the rabbitmq_management_visualiser plugin' do
assert(plugin_enabled?('rabbitmq_management_visualiser'))
end

end
@@ -0,0 +1,26 @@
#
# Cookbook Name:: rabbitmq_test
# Recipe:: cook-openfiles
#
# 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.
#

node.set['rabbitmq']['open_file_limit'] = 2048
include_recipe 'rabbitmq::default'

# HACK: Give rabbit time to spin up before the tests, it seems
# # to be responding that it has started before it really has
execute 'sleep 10' do
action :nothing
subscribes :run, "service[#{node['rabbitmq']['service_name']}]", :delayed
end
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.