Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

v2.3.0: added CUBRID 9.1 support to all recipes.

  • Loading branch information...
commit 70aba60047100cc0dd48f52d98b2934046647ff2 1 parent 44ee376
@kadishmal authored
View
10 CHANGELOG.md
@@ -2,11 +2,17 @@
This file is used to list changes made in each version of this cubrid cookbook.
+## 2.3.0
+
+- New: added CUBRID 9.1 support to all recipes.
+- Enh: override `['mysql']['tunable']['wait_timeout']` to MySQL's default value 28800 for CUBRID SHARD to work as expected.
+- Enh: allow to set `MAX_NUM_APPL_SERVER` and `MIN_NUM_APPL_SERVER` SHARD broker configuration parameters.
+
## 2.2.0
- New: allow to configure MySQL as a backend for CUBRID SHARD through **shard_mysql** recipe.
-- Enh: allow to set `MAX_NUM_APPL_SERVER` broker configuration paramter.
-- Enh: allow to set `MIN_NUM_APPL_SERVER` broker configuration paramter.
+- Enh: allow to set `MAX_NUM_APPL_SERVER` broker configuration parameter.
+- Enh: allow to set `MIN_NUM_APPL_SERVER` broker configuration parameter.
- Enh: upgrade CUBRID Web Manager only if a minor upgrade is available.
- Enh: allow to set `max_clients` CUBRID Server parameter based on the number of Brokers.
- Ref: corrected code indendation.
View
3  README.md
@@ -407,6 +407,9 @@ The default username and password to connect to CUBRID Manager Server are **admi
- Allow users to specify custom port for CUBRID HA.
- Test on a vanilla CentOS.
- Validate the database name.
+- Add Chef and Ohai dependency `depends 'chef', '>= 1.1.2'` in metadata.rb.
+- In shard_mysql open MySQL ports only to main SHARD node.
+- In shard_mysql check if Ubuntu version is 10.x.
## License and Authors
View
9 attributes/default.rb
@@ -10,10 +10,10 @@
include_attribute "cubrid::broker"
# latest build numbers for each CUBRID version in the form of 'version'=>'build_number'
-build_numbers = {'9.0.0' => '0478', '8.4.3' => '1005', '8.4.1' => '7007'}
+build_numbers = {'9.1.0' => '0212', '9.0.0' => '0478', '8.4.3' => '1005', '8.4.1' => '7007'}
# the default version of CUBRID to install
-default['cubrid']['version'] = "9.0.0"
+default['cubrid']['version'] = "9.1.0"
# the full version of CUBRID including the build number
set['cubrid']['full_version'] = "#{node['cubrid']['version']}.#{build_numbers[node['cubrid']['version']]}"
# the architecture of CUBRID binaries to install based on the current system architecture
@@ -30,6 +30,9 @@
# the target directory to install CUBRID
default['cubrid']['home'] = "/opt/cubrid"
+default['cubrid']['charset'] = 'en_US'
+default['cubrid']['lang'] = 'en_US'
+
# Set the maximum number of clients this Server should respond to.
# +1 is for Query Editory Broker.
# Calculated based on the recommendation from the manual page
@@ -40,6 +43,8 @@
set['cubrid']['conf_dir'] = "#{node['cubrid']['home']}/conf"
# Full path to cubrid.conf.
set['cubrid']['conf'] = "#{node['cubrid']['conf_dir']}/cubrid.conf"
+# full path to cm_httpd.conf
+set['cubrid']['cm_httpd_conf'] = "#{node['cubrid']['conf_dir']}/cm_httpd.conf"
# the file name of the shell scipt which sets environmental variables for CUBRID
set['cubrid']['env_script_name'] = "cubrid.sh"
View
4 attributes/pdo_cubrid.rb
@@ -8,10 +8,10 @@
#
# latest build numbers for each CUBRID PDO version in the form of 'version'=>'build_number'
-build_numbers = {'9.0.0' => '0001', '8.4.3' => '0001', '8.4.0' => '0002'}
+build_numbers = {'9.1.0' => '0001', '9.0.0' => '0001', '8.4.3' => '0001', '8.4.0' => '0002'}
# the default version of CUBRID to install
-default['cubrid']['version'] = "9.0.0"
+default['cubrid']['version'] = "9.1.0"
# for CUBRID 8.4.1 use PDO driver 8.4.0 as they are compatible.
# No separeate PDO driver version was released for CUBRID 8.4.1.
View
4 attributes/perl_driver.rb
@@ -8,10 +8,10 @@
#
# Latest build numbers for each CUBRID Perl version in the form of 'version'=>'build_number'.
-build_numbers = {'9.0.0' => '0001', '8.4.3' => '0001', '8.4.1' => '0001', '8.4.0' => '0002'}
+build_numbers = {'9.1.0' => '0001', '9.0.0' => '0001', '8.4.3' => '0001', '8.4.1' => '0001', '8.4.0' => '0002'}
# The default version of CUBRID to install.
-default['cubrid']['version'] = "9.0.0"
+default['cubrid']['version'] = "9.1.0"
# The version of a CUBRID Perl driver to install from CPAN.
set['cubrid']['perl_version'] = "#{node['cubrid']['version']}.#{build_numbers[node['cubrid']['version']]}"
View
4 attributes/php_driver.rb
@@ -8,10 +8,10 @@
#
# latest build numbers for each CUBRID PHP version in the form of 'version'=>'build_number'
-build_numbers = {'9.0.0' => '0001', '8.4.3' => '0001', '8.4.1' => '0006'}
+build_numbers = {'9.1.0' => '0001', '9.0.0' => '0001', '8.4.3' => '0001', '8.4.1' => '0006'}
# the default version of CUBRID to install
-default['cubrid']['version'] = "9.0.0"
+default['cubrid']['version'] = "9.1.0"
# the version of a CUBRID PHP driver to install from PECL
set['cubrid']['php_version'] = "#{node['cubrid']['version']}.#{build_numbers[node['cubrid']['version']]}"
View
4 attributes/python_driver.rb
@@ -8,10 +8,10 @@
#
# Latest build numbers for each CUBRID Python version in the form of 'version'=>'build_number'.
-build_numbers = {'9.0.0' => '0001', '8.4.3' => '0003', '8.4.1' => '0001', '8.4.0' => '0001'}
+build_numbers = {'9.1.0' => '0001', '9.0.0' => '0001', '8.4.3' => '0003', '8.4.1' => '0001', '8.4.0' => '0001'}
# The default version of CUBRID to install.
-default['cubrid']['version'] = "9.0.0"
+default['cubrid']['version'] = "9.1.0"
# The defalut Python Development Package required to build Python modules.
if platform_family?('rhel')
View
11 attributes/web_manager.rb
@@ -12,9 +12,12 @@
# the default version of CUBRID to install
default['cubrid']['version'] = "9.0.0"
-# the full version of CUBRID including the build number
-set['cubrid']['cwm_full_version'] = "#{node['cubrid']['version']}.#{build_numbers[node['cubrid']['version']]}"
-# the architecture of CUBRID binaries to install based on the current system architecture
+
+# For CUBRID 9.1.0 use CWM 8.4.3 as CWM 8.4.3 comes prebuilt in CUBRID 9.1.0.
+set['cubrid']['cwm_major_version'] = node['cubrid']['version'] == "9.1.0" ? "8.4.3" : node['cubrid']['version']
+# The full version of CUBRID Web Manager including the build number.
+set['cubrid']['cwm_full_version'] = "#{node['cubrid']['cwm_major_version']}.#{build_numbers[node['cubrid']['cwm_major_version']]}"
+# The architecture of CUBRID binaries to install based on the current system architecture.
set['cubrid']['arch'] = node['kernel']['machine'] =~ /x86_64/ ? "x86_64" : "i386"
# the name of the directory where the archive is extracted
@@ -23,7 +26,7 @@
set['cubrid']['cwm_filename'] = "#{node['cubrid']['cwm_dirname']}.tar.gz"
# the full URL of the TAR archive to download
-set['cubrid']['cwm_tar_url'] = "https://sourceforge.net/projects/cubrid/files/CUBRID-AppsTools/CUBRID_Web_Manager/#{node['cubrid']['version']}/#{node['cubrid']['cwm_filename']}/download"
+set['cubrid']['cwm_tar_url'] = "https://sourceforge.net/projects/cubrid/files/CUBRID-AppsTools/CUBRID_Web_Manager/#{node['cubrid']['cwm_major_version']}/#{node['cubrid']['cwm_filename']}/download"
# the home directory of a Vagrant user
default['cubrid']['user_home_dir'] = "/home/vagrant"
View
2  metadata.rb
@@ -11,7 +11,7 @@
license "MIT"
description "Installs/Configures CUBRID Database"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
-version "2.2.0"
+version "2.3.0"
depends "build-essential"
depends "database"
View
18 recipes/default.rb
@@ -23,11 +23,13 @@
CUBRID_HOME_DIR = "#{node['cubrid']['home']}"
CUBRID_DATABASES_DIR = "#{CUBRID_HOME_DIR}/databases"
CUBRID_CONF = "#{node['cubrid']['conf']}"
+CM_HTTPD_CONF = "#{node['cubrid']['cm_httpd_conf']}"
ENV_SCRIPT = "#{node['cubrid']['env_script']}"
-ENV['CUBRID'] = "#{CUBRID_HOME_DIR}"
-ENV['CUBRID_DATABASES'] = "#{CUBRID_DATABASES_DIR}"
-ENV['CUBRID_LANG'] = "en_US"
+ENV['CUBRID'] = CUBRID_HOME_DIR
+ENV['CUBRID_DATABASES'] = CUBRID_DATABASES_DIR
+ENV['CUBRID_LANG'] = node['cubrid']['lang']
+ENV['CUBRID_CHARSET'] = node['cubrid']['charset']
ENV['LD_LIBRARY_PATH'] = "#{CUBRID_HOME_DIR}/lib:#{ENV['LD_LIBRARY_PATH']}"
ENV['PATH'] = "#{CUBRID_HOME_DIR}/bin:#{ENV['PATH']}"
@@ -78,6 +80,16 @@
not_if "cat #{CUBRID_CONF} | grep 'Cookbook Name:: cubrid'"
end
+# Update cm_httpd.conf. It is necessary to update CWM configuration here
+# because by default it comes with `user` HTTPD parameter commented out
+# which will cause a "getgrnam("nobody") failed" error if CUBRID is
+# installed via root user which is the case in cubrid-cookbook.
+# So, override the default CWM configurations with the one from templates.
+template CM_HTTPD_CONF do
+ source "cm_httpd.conf.erb"
+ not_if "cat #{CM_HTTPD_CONF} | grep 'Cookbook Name:: cubrid'"
+end
+
# Start CUBRID Service.
execute "cubrid service start"
View
138 recipes/web_manager.rb
@@ -9,78 +9,104 @@
include_recipe "cubrid"
-require 'chef/shell_out'
-
TEMP_DIR = "/tmp"
CWM_EXTRACT_DIR_NAME = "#{TEMP_DIR}/#{node['cubrid']['cwm_dirname']}"
CWM_BINARY = "#{TEMP_DIR}/#{node['cubrid']['cwm_filename']}"
-CUBRID_HOME_DIR = "#{node['cubrid']['home']}"
+CUBRID_HOME_DIR = node['cubrid']['home']
CWM_HOME_DIR = "#{CUBRID_HOME_DIR}/share/webmanager"
CM_HTTPD_CONF = "#{node['cubrid']['cm_httpd_conf']}"
-def getCurrentInstalledVersion
- @getCurrentInstalledVersion ||= begin
- delimeter = /=/
-
- version_check_cmd = "cat #{CWM_HOME_DIR}/appLoader.js | grep 'Ext.cwm.prodVersion ='"
- cmd = Mixlib::ShellOut.new(version_check_cmd)
- version = cmd.run_command
+# Stop CUBRID Manager Service.
+execute "cubrid manager stop"
- output = version.stdout
+# I had to wrap version checking into a `ruby_block` because of
+# http://tickets.opscode.com/browse/MIXLIB-11 feature: file read
+# operations are run at compile time, not at execution time. This
+# means that CWM files don't exist at compile time which would
+# always report as if CWM is not installed.
+# Wrapping in `ruby_block` tells Chef to do file read operations
+# at run time.
+ruby_block "Check if CURBID Web Manager needs installation" do
+ block do
+ version = ""
+
+ if File.exists?("#{CWM_HOME_DIR}/appLoader.js")
+ # Read the CWM version from file.
+ f = File.open("#{CWM_HOME_DIR}/appLoader.js")
+
+ pattern = /Ext\.cwm\.prodVersion = '(\d+\.\d+\.\d+\.\d+)'/
+
+ f.each {|line|
+ if match = pattern.match(line)
+ version = match[1]
+ break
+ end
+ }
+
+ f.close
+ end
- if output.length > 0
- output.split(delimeter)[1].strip.gsub(/[';]/, "")
- else
- output
+ # Check if the installed version of CUBRID Web Manager is smaller
+ # than the one defined in the recipe attributes.
+ # Also make sure the compatible version is installed, so that
+ # 9.0.0 version doesn't override 8.4.1 version.
+ if version.length == 0 || version < node['cubrid']['cwm_full_version'] && version.index(node['cubrid']['cwm_major_version']) == 0
+ # Since it is not possible to call Chef providers from within `ruby_block`,
+ # I need to take them out of `ruby_block` and call them when necessary
+ # via `recources` function.
+ resources(:remote_file => CWM_BINARY).run_action(:create_if_missing)
+ resources(:execute => "extract #{CWM_BINARY}").run_action(:run)
+ resources(:execute => "Override CUBRID binaries").run_action(:run)
+ resources(:execute => "Change ownership of #{CUBRID_HOME_DIR}").run_action(:run)
+ resources(:directory => CWM_EXTRACT_DIR_NAME).run_action(:delete)
+ resources(:file => CWM_BINARY).run_action(:delete)
end
- rescue Mixlib::ShellOut::ShellCommandFailed
end
end
-# Stop CUBRID Manager Service.
-execute "cubrid manager stop"
-
-current_installed_version = getCurrentInstalledVersion
-
-# Check if the installed version of CUBRID Web Manager is smaller
-# than the one defined in the recipe attributes.
-# Also make sure the compatible version is installed, so that
-# 9.0.0 version doesn't override 8.4.1 version.
-if current_installed_version.length == 0 || current_installed_version < node['cubrid']['cwm_full_version'] && current_installed_version.index(node['cubrid']['version']) == 0
- remote_file CWM_BINARY do
- action :create_if_missing
- source "#{node['cubrid']['cwm_tar_url']}"
- mode 0644
- end
+# Do nothing unless told otherwise in the above `ruby_block`.
+remote_file CWM_BINARY do
+ source "#{node['cubrid']['cwm_tar_url']}"
+ mode 0644
+ action :nothing
+end
- execute "tar -zxf #{CWM_BINARY}" do
- cwd "#{TEMP_DIR}"
- only_if "test -f #{CWM_BINARY}"
- end
+# Do nothing unless told otherwise in the above `ruby_block`.
+execute "extract #{CWM_BINARY}" do
+ command "tar -zxf #{CWM_BINARY}"
+ cwd "#{TEMP_DIR}"
+ only_if "test -f #{CWM_BINARY}"
+ action :nothing
+end
- execute "Override CUBRID binaries" do
- command "cp -r #{CWM_EXTRACT_DIR_NAME}/* #{CUBRID_HOME_DIR}"
- only_if "test -d #{CWM_EXTRACT_DIR_NAME}"
- end
+# Do nothing unless told otherwise in the above `ruby_block`.
+execute "Override CUBRID binaries" do
+ command "cp -r #{CWM_EXTRACT_DIR_NAME}/* #{CUBRID_HOME_DIR}"
+ only_if "test -d #{CWM_EXTRACT_DIR_NAME}"
+ action :nothing
+end
- # Own CUBRID files.
- execute "Change ownership of #{CUBRID_HOME_DIR}" do
- command "chown -R root #{CUBRID_HOME_DIR} && chgrp -R root #{CUBRID_HOME_DIR}"
- only_if "test -d #{CUBRID_HOME_DIR}"
- not_if "ls -ld #{CWM_HOME_DIR} | grep root"
- end
+# Own CUBRID files.
+# Do nothing unless told otherwise in the above `ruby_block`.
+execute "Change ownership of #{CUBRID_HOME_DIR}" do
+ command "chown -R root #{CUBRID_HOME_DIR} && chgrp -R root #{CUBRID_HOME_DIR}"
+ only_if "test -d #{CUBRID_HOME_DIR}"
+ not_if "ls -ld #{CWM_HOME_DIR} | grep root"
+ action :nothing
+end
- directory "#{CWM_EXTRACT_DIR_NAME}" do
- action :delete
- recursive true
- only_if "test -d #{CWM_EXTRACT_DIR_NAME}"
- end
+# Do nothing unless told otherwise in the above `ruby_block`.
+directory CWM_EXTRACT_DIR_NAME do
+ recursive true
+ only_if "test -d #{CWM_EXTRACT_DIR_NAME}"
+ action :nothing
+end
- file "#{CWM_BINARY}" do
- action :delete
- only_if "test -f #{CWM_BINARY}"
- backup false
- end
+# Do nothing unless told otherwise in the above `ruby_block`.
+file CWM_BINARY do
+ only_if "test -f #{CWM_BINARY}"
+ backup false
+ action :nothing
end
# Update cm_httpd.conf.
@@ -98,6 +124,6 @@ def getCurrentInstalledVersion
# Detailed explanation of all ports used below can be found at http://www.cubrid.org/port_iptables_configuration.
# Port 8282 is the default HTTPS port used by CUBRID Web Manager.
execute "iptables -I INPUT 1 -p tcp -m tcp --dport 8282 -j ACCEPT" do
- only_if {File.exists?("/sbin/iptables") && File.directory?("#{CWM_HOME_DIR}")}
+ only_if {File.exists?("/sbin/iptables") && File.directory?(CWM_HOME_DIR)}
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.