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

Try to install mysql2 and dependencies only in omnibus installation. #4

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 48 additions & 3 deletions resources/mysql2_gem.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,58 @@
default_action :install

action :install do
include_recipe 'mariadb::devel'
build_essential 'install_packages'
gem_package 'mysql2'
package 'cmake' do
action :install
end
if Dir.glob('/opt/chef/embedded/lib/ruby/gems/?.?.?/gems/mysql2-?.?.?/lib/mysql2/mysql2.so').empty?

#First install curl
if Dir.glob('/opt/chef/embedded/lib/libcurl.*.so').empty?
remote_file '/tmp/curl-7.59.0.tar.gz' do
source 'https://github.com/curl/curl/releases/download/curl-7_59_0/curl-7.59.0.tar.gz'
action :create
end
bash 'extract_curl' do
cwd ::File.dirname('/tmp/')
code <<-EOH
cd /tmp
tar xzf /tmp/curl-7.59.0.tar.gz
EOH
end
execute 'configure_and_install_curl' do
command 'cd /tmp/curl-7.59.0 && ./configure --prefix=/opt/chef/embedded --disable-manual --disable-debug --enable-optimize --disable-ldap --disable-ldaps --disable-rtsp --enable-proxy --disable-dependency-tracking --enable-ipv6 --without-libidn --without-gnutls --without-librtmp --with-ssl=/opt/chef/embedded --with-zlib=/opt/chef/embedded --with-ca-bundle=/opt/chef/embedded/ssl/certs/cacert.pem && make && make install-exec'
end
end

# Then install libmariadb
if Dir.glob('/opt/chef/embedded/lib/libmariadb*.so').empty?
remote_file '/tmp/mariadb-connector-c-3.0.3.tar.gz' do
source 'https://github.com/MariaDB/mariadb-connector-c/archive/v3.0.3.tar.gz'
action :create
end
bash 'extract_libmariadb' do
cwd ::File.dirname('/tmp/')
code <<-EOH
cd /tmp
tar xzf /tmp/mariadb-connector-c-3.0.3.tar.gz
EOH
end
execute 'configure_and_install_libmariadb' do
command 'cd /tmp/mariadb-connector-c-3.0.3 && cmake -DCMAKE_INSTALL_PREFIX:PATH=/opt/chef/embedded -DCMAKE_INCLUDE_PATH=/opt/chef/embedded/include/ -DCMAKE_LIBRARY_PATH=/opt/chef/embedded/lib/ . && make all install'
end
end

# Then finish with mysql2 gem
chef_gem 'mysql2' do
action :install
options '-- --with-mysql-config=/opt/chef/embedded/bin/mariadb_config'
end
end
end

action :remove do
gem_package 'mysql2' do
chef_gem 'mysql2' do
action :remove
end
end
Expand Down