Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

support rabbit for multi version

Change-Id: I47142f92c6b4d51c433fdd7ba9bbf761d2e7b9fe
  • Loading branch information...
commit 731e1df616624d9fa85bebc515dd11293dbe647a 1 parent 0391d3f
@andyzh andyzh authored
View
15 dev_setup/cookbooks/rabbitmq/attributes/default.rb
@@ -2,15 +2,24 @@
default[:rabbitmq][:supported_versions] = {
"2.4" => "2.4.1",
+ "2.8" => "2.8.7",
}
default[:rabbitmq][:version_aliases] = {
- "current" => "2.4",
+ "deprecated" => "2.8",
+ "current" => "2.4",
}
default[:rabbitmq][:default_version] = "2.4"
default[:rabbitmq][:path] = File.join(node[:deployment][:home], "deploy", "rabbitmq")
-default[:rabbitmq][:id] = "eyJzaWciOiJOTWRVQm01RHU3c1RXcHF4dUovUm93S1c0UUU9Iiwib2lkIjoi%0ANGU0ZTc4YmNhNDFlMTIxMjA0ZTRlODZlZTUzOTIxMDUwMTlmYTU0YWRkZTEi%0AfQ==%0A"
-default[:rabbitmq][:checksum] = "0a87dfe4489b0ddabfee7306536530934a4d4518ef0821e08634c7a07d4cf732"
+default[:rabbitmq][:id] = {
+ "2.4.1" => "eyJzaWciOiJOTWRVQm01RHU3c1RXcHF4dUovUm93S1c0UUU9Iiwib2lkIjoi%0ANGU0ZTc4YmNhNDFlMTIxMjA0ZTRlODZlZTUzOTIxMDUwMTlmYTU0YWRkZTEi%0AfQ==%0A",
+ "2.8.7" => "eyJvaWQiOiI0ZTRlNzhiY2E0MWUxMjEwMDRlNGU3ZDUxNzYxOGYwNTBiMzI2%0ANzM2ODZlZCIsInNpZyI6IjkwaDNnYnRuUzJKTXhSZmpVSlZxanUwT1RRYz0i%0AfQ==%0A",
+}
+
+default[:rabbitmq][:checksum] = {
+ "2.4.1" => "0a87dfe4489b0ddabfee7306536530934a4d4518ef0821e08634c7a07d4cf732",
+ "2.8.7" => "7a177c541ad6a33d639330d09503d0948e77208323bd8e603c48e40cd041a432",
+}
default[:rabbitmq_gateway][:service][:timeout] = "15"
default[:rabbitmq_gateway][:node_timeout] = "10"
View
19 dev_setup/cookbooks/rabbitmq/libraries/rabbitmq.rb
@@ -0,0 +1,19 @@
+module CloudFoundryRabbitmq
+
+ def id_and_checksum_for_rabbitmq_version(version)
+ id = ''
+ checksum = ''
+ id_for_version = node[:rabbitmq][:id]["#{version}"]
+ checksum_for_version = node[:rabbitmq][:checksum]["#{version}"]
+
+ if id_for_version.nil? || checksum_for_version.nil?
+ raise "Unsupported version: #{version}"
+ end
+
+ [id_for_version, checksum_for_version]
+ end
+end
+
+class Chef::Recipe
+ include CloudFoundryRabbitmq
+end
View
15 dev_setup/cookbooks/rabbitmq/recipes/default.rb
@@ -13,27 +13,30 @@
case node['platform']
when "ubuntu"
package "erlang-nox"
-
+ install_path = File.join(node[:deployment][:home], "deploy", "rabbitmq", install_version)
+ source_file_id, source_file_checksum = id_and_checksum_for_rabbitmq_version(install_version)
rabbitmq_tarball_path = File.join(node[:deployment][:setup_cache], "rabbitmq-server-with-plugins-generic-unix-#{install_version}.tar.gz")
cf_remote_file rabbitmq_tarball_path do
owner node[:deployment][:user]
- id node[:rabbitmq][:id]
- checksum node[:rabbitmq][:checksum]
+ id source_file_id
+ checksum source_file_checksum
end
- directory "#{node[:rabbitmq][:path]}" do
+ directory install_path do
owner node[:deployment][:user]
group node[:deployment][:group]
mode "0755"
+ recursive true
+ action :create
end
- bash "Install RabbitMQ" do
+ bash "Install RabbitMQ #{install_version} As #{version}" do
cwd File.join("", "tmp")
user node[:deployment][:user]
code <<-EOH
tar xzf #{rabbitmq_tarball_path}
cd rabbitmq_server-#{install_version}
- cp -rf * #{node[:rabbitmq][:path]}
+ cp -rf * #{install_path}
EOH
end
View
10 dev_setup/cookbooks/rabbitmq/templates/default/rabbitmq_node.yml.erb
@@ -21,5 +21,13 @@ admin_port_range:
last: 30000
max_clients: 1000
rabbitmq_log_dir: /var/vcap/services/rabbit/logs
-rabbitmq_server: <%= File.join(node[:rabbitmq][:path], "sbin", "rabbitmq-server") %>
+rabbitmq_server: <%= File.join(node[:rabbitmq][:path], "2.4.1", "sbin", "rabbitmq-server") %>
rabbitmq_start_timeout: <%= node[:rabbitmq_node][:rabbitmq_start_timeout] %>
+rabbit:
+ '2.4':
+ config_template: ../../../resources/rabbitmq24.config.erb
+ rabbitmq_server: <%= File.join(node[:rabbitmq][:path], "2.4.1", "sbin", "rabbitmq-server") %>
+ '2.8':
+ config_template: ../../../resources/rabbitmq28.config.erb
+ rabbitmq_server: <%= File.join(node[:rabbitmq][:path], "2.8.7", "sbin", "rabbitmq-server") %>
+ disk_free_limit: 13421772
2  services
@@ -1 +1 @@
-Subproject commit 53d73d2d5125263ca85fbf75ec95c146c9bca465
+Subproject commit ddf52a5e3e62c0178ed27feca36c003238d636ae
Please sign in to comment.
Something went wrong with that request. Please try again.