oracle / vagrant-projects

Vagrant projects for Oracle products and other examples
Universal Permissive License v1.0
946 stars 477 forks source link

OracleDatabase/18.4.0-XE project - Option to save installer rpm #279

Closed PaulNeumann closed 3 years ago

PaulNeumann commented 4 years ago

The ability to install Oracle Database 18c XE without having to click through the license agreement is terrific. However, installing directly from OTN means that the installer rpm is downloaded each time the VM is built. The rpm is 2.3 GB, so this can be problematic for people with slow or metered connections.

It might be helpful to add an option to save the installer rpm. This could be added as a Boolean in .env and the Vagrantfile, with the value passed to install.sh as an environment variable. The download/install part of install.sh might look something like:

# Install Oracle
if [[ ! -f /vagrant/oracle-database-xe-18c-1.0-1.x86_64.rpm ]]; then
  echo 'INSTALLER: Downloading Oracle Database software'
  wget -q -P /vagrant \
    https://download.oracle.com/otn-pub/otn_software/db-express/oracle-database-xe-18c-1.0-1.x86_64.rpm
fi

yum -y localinstall /vagrant/oracle-database-xe-18c-1.0-1.x86_64.rpm

if [[ "${KEEP_DB_INSTALLER}" == 'false' ]]; then
  rm -f /vagrant/oracle-database-xe-18c-1.0-1.x86_64.rpm
fi

To avoid changing the current behavior of the project, it probably makes sense for KEEP_DB_INSTALLER to default to false.

If you think that this is a good idea, I'd be happy to work on it.

AmedeeBulle commented 4 years ago

Seems to be a good idea to me -- I'll let the DB folks decide on that, but from a pure scripting standpoint I would:

PaulNeumann commented 4 years ago

@AmedeeBulle Thank you. If this moves forward, I'll incorporate your suggestions.

gvenzl commented 4 years ago

Hey @PaulNeumann, you know when they say "great minds think alike" :)

I should have checked before but I too just realized the same issue with the click-through XE and got eager to do "that quick fix". However, I adopted a slightly different approach of just looking for the file locally before reaching out to the web in the install.sh script.

Basically, if you (the user) provide the RPM, we will install the RPM otherwise, we will install it from the web. That way a user may never have to go through an additional download again. Also keeps the config simpler IMO, what do you think?

Also curious about your opinion, @AmedeeBulle

PaulNeumann commented 4 years ago

@gvenzl :-) Sure, that works, and it does keep the configuration simpler. I think I'd still lean toward saving the installer to /vagrant and installing from there, though. That way the script does all the work. The user never has to download the installer manually and the download happens only once.

gvenzl commented 4 years ago

How about we combine the two? 1) Look for the local file 1.1) if it's there install it 1.2) if not download it and if the variable is set keep the file. That way we get everything one could want.

PaulNeumann commented 4 years ago

@gvenzl I apologize if I'm misunderstanding, but that sounds similar to my initial suggestion. Having a "keep the file" Boolean does complicate the configuration (although users wouldn't have to do anything with it unless they wanted to). If the goal is to keep the configuration as simple as possible, then something like the following might work:

# Install Oracle
# If local file doesn't exist, download it
install_file='oracle-database-xe-18c-1.0-1.x86_64.rpm'
if [[ ! -f /vagrant/"${install_file}" ]]; then
  echo 'INSTALLER: Downloading Oracle Database software'
  wget -q -P /vagrant \
    https://download.oracle.com/otn-pub/otn_software/db-express/"${install_file}"
fi

yum -y localinstall /vagrant/"${install_file}"

There would be no manual download, and the download would happen only once.

gvenzl commented 4 years ago

Hey @PaulNeumann, no I think you understand correctly and I'm the one who was confused yesterday, sorry about that! I didn't see that you were also already checking whether the file exists or not. The top one is fine with me, there is a legitimate use case to give the user the choice whether the install file should be preserved or not.

PaulNeumann commented 4 years ago

@gvenzl Got it. Thanks! I'll work on this as soon as I can.