\r
Vagrantfile for Payara.\r
\r
-Currently it uses ubuntu/trusty64 as a base and gets the Java EE Web profile of Payara 4.1.1.154, extracting to /opt/payara/payara-$PAYARA_VERSION. The provision.sh script contains PAYARA_VERSION and PAYARA_ED variables which can be changed to point to a different version/edition of Payara. OpenJDK 7 is installed, since that is the latest Java currently available in the Ubuntu repos.\r
+Currently it uses ubuntu/trusty64 as a base and gets the Java EE Web profile of Payara 4.1.1.154, extracting to /opt/payara/payara-$PAYARA_VERSION. The provision.sh script contains PAYARA_VERSION and PAYARA_ED variables which can be changed to point to a different version/edition of Payara.\r
+\r
+By default, OpenJDK 7 is installed, since that is the latest Java currently available in the Ubuntu repos. The `JDK` variable can be changed in the provision.sh script to choose to install Oracle JDK 8 instead of OpenJDK.\r
\r
During provisioning, both domains (`domain1` and `payaradomain`) are configured to enable secure admin mode with a username of `admin` and password of `payara0payara`.\r
\r
# Setting properties
#
+# Which JDK to use (OPENJDK or ORACLE)
+JDK="OPENJDK"
+
# Payara Version
PAYARA_VERSION=4.1.1.154
MULTI_LANGUAGE_FULL=https://s3-eu-west-1.amazonaws.com/payara.co/payara-ml-prerelease.zip
MULTI_LANGUAGE_WEB=https://s3-eu-west-1.amazonaws.com/payara.co/payara-web-ml-prerelease.zip
;;
-\*)
+ \*)
echo "unknown version number"
esac
##########################################
+# Configure the operating system environment
+configureOSE() {
+ echo "Configuring operating system"
+
+ echo "running update..."
+ apt-get -qqy update # Update the repos
+
+ echo "installing unzip"
+ apt-get -qqy install unzip # Install unzip
+}
+
+
+# Install OpenJDK7 from Ubuntu repos
+installOpenJDK7() {
+ echo "Installing OpenJDK 7"
+ apt-get -qqy install openjdk-7-jdk # Install OpenJDK 7
+}
+
+
+# Install Oracle JDK8 via PPA from webupd8.org
+installOracleJDK8() {
+ echo "Installing OracleJDK 8"
+
+ # Automate the Oracle JDK license acceptence
+ echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections
+
+ add-apt-repository -y ppa:webupd8team/java # Register the PPA
+ apt-get -qqy update # Update the repos
+ apt-get -qqy install oracle-java8-installer # Install Oracle JDK 8
+}
+
+
# Download and unzip to /opt/payara
installPayara() {
echo "Provisioning Payara-$PAYARA_VERSION $PAYARA_ED to $PAYARA_HOME"
-
- echo "running update..."
- sudo apt-get -qqy update # Update the repos
-
- echo "installing openjdk and unzip"
- sudo apt-get -qqy install openjdk-7-jdk # Install JDK 7
- sudo apt-get -qqy install unzip # Install unzip
-
+
echo "Downloading Payara $PAYARA_VERSION"
- wget -q $PAYARA_ED -O temp.zip > /dev/null # Download Payara
- sudo mkdir -p $PAYARA_HOME # Make dirs for Payara
- unzip -qq temp.zip -d $PAYARA_HOME # unzip Payara to dir
+ wget -q $PAYARA_ED -O temp.zip > /dev/null # Download Payara
+ mkdir -p $PAYARA_HOME # Make dirs for Payara
+ unzip -qq temp.zip -d $PAYARA_HOME # unzip Payara to dir
+ rm temp.zip # cleanup temp file
echo "Enabling secure admin mode for domains (u/p = admin/payara0payara)"
PWDFILE=/tmp/pwdfile
rm "${PWDFILE}"
echo "Setting ownership of ${PAYARA_HOME} content"
- sudo chown -R vagrant:vagrant $PAYARA_HOME # Make sure vagrant owns dir
+ chown -R vagrant:vagrant $PAYARA_HOME # Make sure vagrant owns dir
}
# Copy startup script, and create service
installService() {
echo "installing startup scripts"
- mkdir -p $PAYARA_HOME/startup # Make dirs for Payara
+ mkdir -p $PAYARA_HOME/startup # Make dirs for Payara
cp /vagrant/payara_service-$PAYARA_VERSION $PAYARA_HOME/startup/
chmod +x $PAYARA_HOME/startup/payara_service-$PAYARA_VERSION
ln -s $PAYARA_HOME/startup/payara_service-$PAYARA_VERSION /etc/init.d/payara
echo "Adding payara system startup..."
- sudo update-rc.d payara defaults > /dev/null
+ update-rc.d payara defaults > /dev/null
echo "starting Payara..."
esac
}
+configureOSE
+
+if [ "$JDK" = "ORACLE" ]; then
+ installOracleJDK8
+else
+ installOpenJDK7
+fi
+
installPayara
if [ $PAYARA_ED = $WEB ] ||