Permalink
Browse files

Merge "[dev_setup] add versions support to all services"

  • Loading branch information...
2 parents 83d4fc1 + 237eb7a commit b7f7ce57463976af2983c90df6b71256dfedcc2c @andl andl committed with Gerrit Code Review Aug 17, 2012
Showing with 352 additions and 167 deletions.
  1. +8 −1 dev_setup/cookbooks/couchdb/attributes/default.rb
  2. +39 −27 dev_setup/cookbooks/couchdb/recipes/default.rb
  3. +5 −0 dev_setup/cookbooks/couchdb/templates/default/couchdb_gateway.yml.erb
  4. +2 −0 dev_setup/cookbooks/couchdb/templates/default/couchdb_node.yml.erb
  5. +8 −0 dev_setup/cookbooks/echo/attributes/default.rb
  6. +1 −1 dev_setup/cookbooks/echo/recipes/default.rb
  7. +5 −0 dev_setup/cookbooks/echo/templates/default/echo_gateway.yml.erb
  8. +2 −0 dev_setup/cookbooks/echo/templates/default/echo_node.yml.erb
  9. +8 −2 dev_setup/cookbooks/elasticsearch/attributes/default.rb
  10. +26 −21 dev_setup/cookbooks/elasticsearch/recipes/default.rb
  11. +5 −0 dev_setup/cookbooks/elasticsearch/templates/default/elasticsearch_gateway.yml.erb
  12. +2 −0 dev_setup/cookbooks/elasticsearch/templates/default/elasticsearch_node.yml.erb
  13. +8 −0 dev_setup/cookbooks/filesystem/attributes/default.rb
  14. +5 −0 dev_setup/cookbooks/filesystem/templates/default/filesystem_gateway.yml.erb
  15. +9 −1 dev_setup/cookbooks/memcached/attributes/default.rb
  16. +44 −32 dev_setup/cookbooks/memcached/recipes/default.rb
  17. +5 −0 dev_setup/cookbooks/memcached/templates/default/memcached_gateway.yml.erb
  18. +2 −0 dev_setup/cookbooks/memcached/templates/default/memcached_node.yml.erb
  19. +1 −2 dev_setup/cookbooks/mongodb/recipes/default.rb
  20. +2 −6 dev_setup/cookbooks/mongodb/templates/default/mongodb_gateway.yml.erb
  21. +1 −5 dev_setup/cookbooks/mongodb/templates/default/mongodb_node.yml.erb
  22. +8 −0 dev_setup/cookbooks/mysql/attributes/default.rb
  23. +5 −0 dev_setup/cookbooks/mysql/templates/default/mysql_gateway.yml.erb
  24. +2 −0 dev_setup/cookbooks/mysql/templates/default/mysql_node.yml.erb
  25. +9 −1 dev_setup/cookbooks/neo4j/attributes/default.rb
  26. +20 −15 dev_setup/cookbooks/neo4j/recipes/default.rb
  27. +5 −0 dev_setup/cookbooks/neo4j/templates/default/neo4j_gateway.yml.erb
  28. +2 −0 dev_setup/cookbooks/neo4j/templates/default/neo4j_node.yml.erb
  29. +8 −0 dev_setup/cookbooks/postgresql/attributes/default.rb
  30. +6 −1 dev_setup/cookbooks/postgresql/templates/default/postgresql_gateway.yml.erb
  31. +2 −0 dev_setup/cookbooks/postgresql/templates/default/postgresql_node.yml.erb
  32. +9 −2 dev_setup/cookbooks/rabbitmq/attributes/default.rb
  33. +27 −22 dev_setup/cookbooks/rabbitmq/recipes/default.rb
  34. +5 −0 dev_setup/cookbooks/rabbitmq/templates/default/rabbitmq_gateway.yml.erb
  35. +2 −0 dev_setup/cookbooks/rabbitmq/templates/default/rabbitmq_node.yml.erb
  36. +8 −1 dev_setup/cookbooks/redis/attributes/default.rb
  37. +39 −27 dev_setup/cookbooks/redis/recipes/default.rb
  38. +5 −0 dev_setup/cookbooks/redis/templates/default/redis_gateway.yml.erb
  39. +2 −0 dev_setup/cookbooks/redis/templates/default/redis_node.yml.erb
@@ -1,5 +1,12 @@
include_attribute "deployment"
-default[:couchdb][:version] = "1.2.0"
+default[:couchdb][:supported_versions] = {
+ "1.2" => "1.2.0",
+}
+default[:couchdb][:version_aliases] = {
+ "current" => "1.2",
+}
+default[:couchdb][:default_version] = "1.2"
+
default[:couchdb][:id] = "eyJzaWciOiJTRWNYL1pjTEZGNEZRSHc0bHg0RGFFUkVhMU09Iiwib2lkIjoi%0ANGU0ZTc4YmNhMTFlMTIyMDA0ZTRlOGVjNjQ4NDMxMDUwMTlmMmU3MTkyMzUi%0AfQ==%0A"
default[:couchdb][:path] = File.join(node[:deployment][:home], "deploy", "couchdb")
default[:couchdb][:checksum] = "0f254ddea2471dbc4d3c6cd1fa61e4782c75475fb325024e10f68bf1aa8d5c37"
@@ -1,38 +1,49 @@
-couchdb_tarball_path = File.join(node[:deployment][:setup_cache], "apache-couchdb-#{node[:couchdb][:version]}.tar.gz")
-admin_user = "#{node[:couchdb][:username]} = #{node[:couchdb][:password]}"
-port = "port = #{node[:couchdb][:port]}"
-bind_address = "bind_address = #{node[:couchdb][:host]}"
-output_prefix = "#{node[:deployment][:home]}/log/couchdb."
-output_prefix = output_prefix.gsub(/\//, "\\/")
-
-cf_remote_file couchdb_tarball_path do
- owner node[:deployment][:user]
- id node[:couchdb][:id]
- checksum node[:couchdb][:checksum]
-end
+#
+# Cookbook Name:: couchdb
+# Recipe:: default
+#
+# Copyright 2012, VMware
+#
-directory "#{node[:couchdb][:path]}" do
- owner node[:deployment][:user]
- group node[:deployment][:user]
- mode "0755"
-end
+node[:couchdb][:supported_versions].each do |version, install_version|
+ #TODO, need more refine to actually support mutiple versions
+ Chef::Log.info("Building couchdb version: #{version} - #{install_version}")
+
+ couchdb_tarball_path = File.join(node[:deployment][:setup_cache], "apache-couchdb-#{install_version}.tar.gz")
+ admin_user = "#{node[:couchdb][:username]} = #{node[:couchdb][:password]}"
+ port = "port = #{node[:couchdb][:port]}"
+ bind_address = "bind_address = #{node[:couchdb][:host]}"
+ output_prefix = "#{node[:deployment][:home]}/log/couchdb."
+ output_prefix = output_prefix.gsub(/\//, "\\/")
+
+ cf_remote_file couchdb_tarball_path do
+ owner node[:deployment][:user]
+ id node[:couchdb][:id]
+ checksum node[:couchdb][:checksum]
+ end
-%w[bin etc var].each do |dir|
- directory File.join(node[:couchdb][:path], dir) do
+ directory "#{node[:couchdb][:path]}" do
owner node[:deployment][:user]
group node[:deployment][:user]
mode "0755"
- recursive true
- action :create
end
-end
-bash "Install couchdb" do
- cwd File.join("", "tmp")
- user node[:deployment][:user]
- code <<-EOH
+ %w[bin etc var].each do |dir|
+ directory File.join(node[:couchdb][:path], dir) do
+ owner node[:deployment][:user]
+ group node[:deployment][:user]
+ mode "0755"
+ recursive true
+ action :create
+ end
+ end
+
+ bash "Install couchdb" do
+ cwd File.join("", "tmp")
+ user node[:deployment][:user]
+ code <<-EOH
tar xzf #{couchdb_tarball_path}
- cd apache-couchdb-#{node[:couchdb][:version]}
+ cd apache-couchdb-#{install_version}
./configure \
--prefix=#{node[:couchdb][:path]} \
--with-js-lib=/usr/lib/xulrunner-devel-#{node[:xulrunner][:version]}/lib \
@@ -55,4 +66,5 @@
not_if do
::File.exists?(File.join(node[:couchdb][:path], "bin", "couchdb"))
end
+ end
end
@@ -8,6 +8,11 @@ service:
default_plan: 'free'
tags: ['couchdb', 'couchdb-1.2', 'key-value', 'cache']
timeout: <%= node[:couchdb_gateway][:service][:timeout] %>
+ supported_versions: <%= "['#{node[:couchdb][:supported_versions].keys.join("', '")}']"%>
+ version_aliases:
+<% node[:couchdb][:version_aliases].each do |a, v| %>
+ "<%= a %>": "<%= v %>"
+<% end %>
index: 0
token: <%= node[:couchdb_node][:token] %>
mbus: nats://<%= node[:nats_server][:user] %>:<%= node[:nats_server][:password] %>@<%= node[:nats_server][:host] %>:<%= node[:nats_server][:port] %>/
@@ -9,6 +9,8 @@ couchdb_log_dir: /var/vcap/services/couchdb/logs
plan: free
pid: /var/vcap/sys/run/couchdb_node.pid
node_id: <%= "couchdb_node_#{node[:couchdb_node][:index]}" %>
+supported_versions: <%= "['#{node[:couchdb][:supported_versions].keys.join("', '")}']"%>
+default_version: "<%= node[:couchdb][:default_version] %>"
op_time_limit: <%= node[:couchdb_node][:op_time_limit] %>
couchdb_install_path: <%= node[:couchdb][:path] %>
logging:
@@ -1,5 +1,13 @@
include_attribute "deployment"
+default[:echo][:supported_versions] = {
+ "1.0" => "1.0",
+}
+default[:echo][:version_aliases] = {
+ "current" => "1.0",
+}
+default[:echo][:default_version] = "1.0"
+
default[:echo][:host] = "localhost"
default[:echo_node][:capacity] = "100"
@@ -18,7 +18,7 @@
code <<-EOH
unzip #{echoserver_tarball_path} -d /tmp
cp -r /tmp/echoserver #{File.join(node[:deployment][:home], 'deploy')}
- ln -s -t /etc/init.d/ #{File.join(node[:echo_server][:path], 'echoserver')}
+ ln -s -f -t /etc/init.d/ #{File.join(node[:echo_server][:path], 'echoserver')}
EOH
not_if do
::File.exists?(File.join(node[:echo_server][:path], 'echoserver'))
@@ -7,6 +7,11 @@ service:
plans: ['free']
default_plan: 'free'
tags: ['echo', 'echo-1.0', 'echobased', 'demo']
+ supported_versions: <%= "['#{node[:echo][:supported_versions].keys.join("', '")}']"%>
+ version_aliases:
+<% node[:echo][:version_aliases].each do |a, v| %>
+ "<%= a %>": "<%= v %>"
+<% end %>
index: 0
token: <%= node[:echo_node][:token] %>
logging:
@@ -9,4 +9,6 @@ logging:
level: debug
pid: /var/vcap/sys/run/echo_node.pid
node_id: <%= "echo_node_#{node[:echo_node][:index]}" %>
+supported_versions: <%= "['#{node[:echo][:supported_versions].keys.join("', '")}']"%>
+default_version: "<%= node[:echo][:default_version] %>"
port: <%= node[:echo_server][:port] %>
@@ -1,7 +1,13 @@
include_attribute "deployment"
-default[:elasticsearch][:version] = "0.19.4"
-default[:elasticsearch][:distribution_file] = "elasticsearch-#{elasticsearch[:version]}.tar.gz"
+default[:elasticsearch][:supported_versions] = {
+ "0.19" => "0.19.4",
+}
+default[:elasticsearch][:version_aliases] = {
+ "current" => "0.19",
+}
+default[:elasticsearch][:default_version] = "0.19"
+
default[:elasticsearch][:id] = "eyJzaWciOiJRR3o1cnVZUGFzQ1gxVTNCZFZiQ3pZcUdTbU09Iiwib2lkIjoi%0ANGU0ZTc4YmNhNTFlMTIyMDA0ZTRlOGVjNjg0MDc3MDUwMTlmMGJhYWMxODki%0AfQ==%0A"
default[:elasticsearch][:path] = File.join(node[:deployment][:home], "deploy", "elasticsearch")
@@ -5,34 +5,39 @@
# Copyright 2011, VMware
#
-elasticsearch_tarball = File.join(node[:deployment][:setup_cache], node[:elasticsearch][:distribution_file])
-cf_remote_file elasticsearch_tarball do
- owner node[:deployment][:user]
- id node[:elasticsearch][:id]
- checksum node[:elasticsearch][:checksum]
-end
+node[:elasticsearch][:supported_versions].each do |version, install_version|
+ #TODO, need more refine to actually support mutiple versions
+ Chef::Log.info("Building elasticserarch version: #{version} - #{install_version}")
-plugin = File.join(node[:deployment][:setup_cache], node[:elasticsearch][:http_basic_plugin][:distribution_file])
-cf_remote_file plugin do
- owner node[:deployment][:user]
- id node[:elasticsearch][:http_basic_plugin][:id]
- checksum node[:elasticsearch][:http_basic_plugin][:checksum]
-end
+ elasticsearch_tarball = File.join(node[:deployment][:setup_cache], "elasticsearch-#{install_version}.tar.gz")
+ cf_remote_file elasticsearch_tarball do
+ owner node[:deployment][:user]
+ id node[:elasticsearch][:id]
+ checksum node[:elasticsearch][:checksum]
+ end
-bash "Install elasticsearch" do
- cwd File.join("", "tmp")
- user node[:deployment][:user]
- code <<-EOH
+ plugin = File.join(node[:deployment][:setup_cache], node[:elasticsearch][:http_basic_plugin][:distribution_file])
+ cf_remote_file plugin do
+ owner node[:deployment][:user]
+ id node[:elasticsearch][:http_basic_plugin][:id]
+ checksum node[:elasticsearch][:http_basic_plugin][:checksum]
+ end
+
+ bash "Install elasticsearch" do
+ cwd File.join("", "tmp")
+ user node[:deployment][:user]
+ code <<-EOH
mkdir -p #{node[:elasticsearch][:path]}
tar xzf #{elasticsearch_tarball}
- cp -r #{node[:elasticsearch][:distribution_file].gsub(/.tar.gz/,'')}/* #{node[:elasticsearch][:path]}/
+ cp -r elasticsearch-#{install_version}/* #{node[:elasticsearch][:path]}/
EOH
-end
+ end
-bash "Install elasticsearch-http-basic plugin" do
- user node[:deployment][:user]
- code <<-EOH
+ bash "Install elasticsearch-http-basic plugin" do
+ user node[:deployment][:user]
+ code <<-EOH
mkdir -p #{node[:elasticsearch][:http_basic_plugin][:path]}
cp #{plugin} #{node[:elasticsearch][:http_basic_plugin][:path]}
EOH
+ end
end
@@ -8,6 +8,11 @@ service:
default_plan: 'free'
tags: ['elasticsearch', 'elasticsearch-0.19', 'search']
timeout: <%= node[:elasticsearch_gateway][:service][:timeout] %>
+ supported_versions: <%= "['#{node[:elasticsearch][:supported_versions].keys.join("', '")}']"%>
+ version_aliases:
+<% node[:elasticsearch][:version_aliases].each do |a, v| %>
+ "<%= a %>": "<%= v %>"
+<% end %>
host: localhost
index: 0
token: <%= node[:elasticsearch_node][:token] %>
@@ -10,6 +10,8 @@ logging:
pid: /var/vcap/sys/run/elasticsearch_node.pid
max_memory: <%= node[:elasticsearch_node][:max_memory] %>
node_id: <%= "elasticsearch_node_#{node[:elasticsearch_node][:index]}" %>
+supported_versions: <%= "['#{node[:elasticsearch][:supported_versions].keys.join("', '")}']"%>
+default_version: "<%= node[:elasticsearch][:default_version] %>"
op_time_limit: <%= node[:elasticsearch_node][:op_time_limit] %>
elasticsearch_log_dir: /var/vcap/sys/log/elasticsearch
elasticsearch_path: <%= File.join(node[:elasticsearch][:path], "bin", "elasticsearch") %>
@@ -1,5 +1,13 @@
include_attribute "deployment"
+default[:filesystem][:supported_versions] = {
+ "1.0" => "1.0",
+}
+default[:filesystem][:version_aliases] = {
+ "current" => "1.0",
+}
+default[:filesystem][:default_version] = "1.0"
+
default[:filesystem_node][:token] = "changefilesystemtoken"
default[:filesystem_gateway][:service][:timeout] = "15"
@@ -8,6 +8,11 @@ service:
default_plan: 'free'
tags: ['filesystem', 'filesystem-1.0', 'Persistent filesystem service']
timeout: <%= node[:filesystem_gateway][:service][:timeout] %>
+ supported_versions: <%= "['#{node[:filesystem][:supported_versions].keys.join("', '")}']"%>
+ version_aliases:
+<% node[:filesystem][:version_aliases].each do |a, v| %>
+ "<%= a %>": "<%= v %>"
+<% end %>
token: <%= node[:filesystem_node][:token] %>
logging:
level: debug
@@ -1,7 +1,15 @@
include_attribute "deployment"
+
+default[:memcached][:supported_versions] = {
+ "1.4" => "1.4.13",
+}
+default[:memcached][:version_aliases] = {
+ "current" => "1.4",
+}
+default[:memcached][:default_version] = "1.4"
+
default[:libevent][:version] = "2.0.19"
default[:libevent][:id] = "eyJzaWciOiJoemRHWEtZTWdKYm9OSUJIeU5kcHc5Ti9TNEk9Iiwib2lkIjoi%0ANGU0ZTc4YmNhNTFlMTIyMjA0ZTRlOTg2M2YyOGYzMDUwMTlmOWMxYzE4N2Ei%0AfQ==%0A"
-default[:memcached][:version] = "1.4.13"
default[:memcached][:path] = File.join(node[:deployment][:home], "deploy", "memcached")
default[:memcached][:id] = "eyJzaWciOiJmZzdRNDJvZ3pZTnYvNHBjeEpjM1UvMWVVK2c9Iiwib2lkIjoi%0ANGU0ZTc4YmNhNTFlMTIxMjA0ZTRlODZlZThlMmM5MDUwMTlmOWJhY2UxYWIi%0AfQ==%0A"
default[:memcached][:runner] = node[:deployment][:user]
@@ -1,53 +1,65 @@
-libevent_tarball_path = File.join(node[:deployment][:setup_cache], "libevent-#{node[:libevent][:version]}-stable.tar.gz")
-cf_remote_file libevent_tarball_path do
- owner node[:deployment][:user]
- id node[:libevent][:id]
- checksum node[:memcached][:checksums][:libevent]
-end
+#
+# Cookbook Name:: memcached
+# Recipe:: default
+#
+# Copyright 2012, VMware
+#
-memcached_tarball_path = File.join(node[:deployment][:setup_cache], "memcached-#{node[:memcached][:version]}.tar.gz")
-cf_remote_file memcached_tarball_path do
- owner node[:deployment][:user]
- id node[:memcached][:id]
- checksum node[:memcached][:checksums][:memcached]
-end
+node[:memcached][:supported_versions].each do |version, install_version|
+ #TODO, need more refine to actually support mutiple versions
+ Chef::Log.info("Building memcached version: #{version} - #{install_version}")
-directory "#{node[:memcached][:path]}" do
- owner node[:deployment][:user]
- group node[:deployment][:group]
- mode "0755"
-end
+ libevent_tarball_path = File.join(node[:deployment][:setup_cache], "libevent-#{node[:libevent][:version]}-stable.tar.gz")
+ cf_remote_file libevent_tarball_path do
+ owner node[:deployment][:user]
+ id node[:libevent][:id]
+ checksum node[:memcached][:checksums][:libevent]
+ end
+
+ memcached_tarball_path = File.join(node[:deployment][:setup_cache], "memcached-#{install_version}.tar.gz")
+ cf_remote_file memcached_tarball_path do
+ owner node[:deployment][:user]
+ id node[:memcached][:id]
+ checksum node[:memcached][:checksums][:memcached]
+ end
-%w[bin etc var].each do |dir|
- directory File.join(node[:memcached][:path], dir) do
+ directory "#{node[:memcached][:path]}" do
owner node[:deployment][:user]
group node[:deployment][:group]
mode "0755"
- recursive true
- action :create
end
-end
-bash "Compile libevent" do
- cwd File.join("", "tmp")
- user node[:deployment][:user]
- code <<-EOH
+ %w[bin etc var].each do |dir|
+ directory File.join(node[:memcached][:path], dir) do
+ owner node[:deployment][:user]
+ group node[:deployment][:group]
+ mode "0755"
+ recursive true
+ action :create
+ end
+ end
+
+ bash "Compile libevent" do
+ cwd File.join("", "tmp")
+ user node[:deployment][:user]
+ code <<-EOH
tar xzf #{libevent_tarball_path}
cd libevent-#{node[:libevent][:version]}-stable
./configure --prefix=`pwd`/tmp
make
make install
EOH
-end
+ end
-bash "Install memcached" do
- cwd File.join("", "tmp")
- user node[:deployment][:user]
- code <<-EOH
+ bash "Install memcached" do
+ cwd File.join("", "tmp")
+ user node[:deployment][:user]
+ code <<-EOH
tar xzf #{memcached_tarball_path}
- cd memcached-#{node[:memcached][:version]}
+ cd memcached-#{install_version}
./configure --with-libevent=../libevent-#{node[:libevent][:version]}-stable/tmp LDFLAGS="-static"
make
cp memcached #{File.join(node[:memcached][:path], "bin")}
EOH
+ end
end
Oops, something went wrong.

0 comments on commit b7f7ce5

Please sign in to comment.