Skip to content

Commit

Permalink
[Temporary] Download MySQL
Browse files Browse the repository at this point in the history
Signed-off-by: Hanwen <[email protected]>
  • Loading branch information
hanwen-cluster committed Jan 25, 2024
1 parent 41c26fa commit ffcbc31
Showing 1 changed file with 19 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,37 @@

action :setup do
mysql_archive_url = package_archive(node['cluster']['artifacts_s3_url'])
mysql_tar_file = "/tmp/#{package_filename}"
mysql_tar_file = "/tmp/" # TODO: upload mysql to S3 and revert the code

log "Downloading MySQL packages archive from #{mysql_archive_url}"

# Add MySQL source file
action_create_source_link

remote_file mysql_tar_file do
source mysql_archive_url
mode '0644'
retries 3
retry_delay 5
action :create_if_missing
platform_version = node['platform_version'].to_i
if platform_version == 2
platform_version = 7
end
packages = %w(common client-plugins libs devel)
if platform_version == 7
packages = %w(common client-plugins libs-compat libs devel)
end
packages.each do |package|
file_name = "mysql-community-#{package}-#{package_version}.el#{platform_version}.#{arm_instance? ? 'aarch64' : 'x86_64'}.rpm"
remote_file "/tmp/#{file_name}" do
source "https://dev.mysql.com/get/Downloads/MySQL-8.0/#{file_name}"
mode '0644'
retries 3
retry_delay 5
action :create_if_missing
end
end

bash 'Install MySQL packages' do
user 'root'
group 'root'
cwd '/tmp'
code <<-MYSQL
set -e
EXTRACT_DIR=$(mktemp -d --tmpdir mysql.XXXXXXX)
tar xf "#{mysql_tar_file}" --directory "${EXTRACT_DIR}"
yum install -y ${EXTRACT_DIR}/*
yum install -y mysql-community-*
MYSQL
end
end
Expand Down

0 comments on commit ffcbc31

Please sign in to comment.