The Container Life-Cycle managent for ECC will required splitting the running of envSetup.sh into two parts. First part will just run Step 1 creation of ECC user and ECC schema in EBS database. So technically you don’t even need two docker images to do this. You can just quickly set up your ECC environment following oracle documentation, then run Step 1. Save EccConfig.properties from this, we will be using this to build our Docker image later.
Build Context Location, this is where Dockerfile and other required scripts and files reside. Docker build command will be run from here.
Let says my Build Context Location is “/var/lib/docker/docker-images/ECCDockerTEST”. scripts and files are actual directories. I don’t like to clutter my Dockerfile so most of the configuration will be done when Dockerfile execute the several scripts.
-rwxr-xr-x 1 root root 44 Dec 30 15:02 build.sh
-rw-r--r-- 1 root root 664 Dec 30 15:53 Dockerfile
drwxr-xr-x 2 root root 75 Dec 30 16:16 scripts
drwxr-xr-x 2 root root 4096 Dec 31 07:42 files
Let’s take a look at my Dockerfile
# LICENSE UPL 1.0
#
# Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved.
#
#Oracle version of this script is using oraclelinux:7-slim, we want oraclelinux:7
#This step will pull oraclelinux:7 from the repo that you setup-see docker info
FROM oraclelinux:7
MAINTAINER Bo Aye <baye@zeusinc.com>
# environment variables
ENV JAVA_HOME=/opt/java
# copy all scripts
ADD scripts /scripts/
ADD files /files/
RUN groupadd -g 54322 dba && \
useradd -r -m -u 54322 -g dba oracle
RUN /scripts/setupEnvironment.sh
# Install ECC
#------------
USER oracle
WORKDIR /home/oracle
RUN /scripts/install_ecc.sh
CMD ["/u02/ecc/SourceAndStartECC.sh"]
Let’s look at /var/lib/docker/docker-images/ECCDockerTEST/scripts
-rwxrwxrwx 1 root root 105 Dec 11 14:59 install_ecc.sh
-rwxrwxrwx 1 root root 1052 Dec 30 14:51 install_java.sh
-rwxrwxrwx 1 root root 1246 Dec 30 16:16 setupEnvironment.sh
Now, take a quick peek at /var/lib/docker/docker-images/ECCDockerTEST/files
-rw-r--r-- 1 root root 55263209 Aug 21 13:10 server-jre-8u221-linux-x64.tar.gz
-rw-r--r-- 1 root root 2015410170 Sep 11 13:23 p29905497_R12_GENERIC.zip
-rw-r--r-- 1 root root 9419 Sep 11 13:23 p30276526_R12_GENERIC.zip
-rw-r--r-- 1 root root 399 Dec 12 09:40 ReadmeResponsefile.txt
-rw-r--r-- 1 root root 89 Dec 30 14:59 SetupResponse.rsp
-rw-r--r-- 1 root root 374 Dec 30 15:16 connection.dbc
-rwx------ 1 root root 1493 Dec 30 15:16 EccConfig.properties
-rw-r--r-- 1 root root 11 Dec 30 15:46 eccWeblogic.rsp
-rwxrwxrwx 1 root root 161 Dec 31 07:42 SourceAndStartECC.sh
I will explain the purpose of what each contents under files and scripts directories as we move forward.
Dockerfile will first ADD all the contents files and scripts into intermediate container. Then It will run setupEnvironment.sh
setupEnvironment.sh
#!/bin/bash
#
echo "--------------------------------------------------"
echo "Installing JAVA..................................."
./scripts/install_java.sh
#
echo "--------------------------------------------------"
# Setup filesystem and oracle user
#------------------------------------------------------------
mkdir -p /u02/ecc
chown -R oracle:dba /u02
#Installed yum packages
#-------------------------------------------------------------
yum install --assumeyes zip unzip tar gzip vi source libaio lsof cron bind-utils && \
yum clean all
# Copy scripts
#-------------
unzip /files/p29905497_R12_GENERIC.zip -d /u02/ecc/
rm -rvf /files/p29905497_R12_GENERIC.zip
unzip /files/p30276526_R12_GENERIC.zip -d /u02/ecc/
rm -rvf /files/p30276526_R12_GENERIC.zip
cd /u02/ecc
chmod 777 *.bsx
rm -rvf /u02/ecc/p*zip
./EBS_ECC*.bsx
./p*.bsx
echo "-----------------------------------------------------------"
echo "Moving ECC related files to ECC_BASE"
mv /files/EccConfig.properties /u02/ecc/Oracle/quickInstall/.
mv /files/connection.dbc /u02/ecc/Oracle/quickInstall/.
mv /files/SetupResponse.rsp /u02/ecc/Oracle/quickInstall/.
mv /files/eccWeblogic.rsp /u02/ecc/.
mv /files/SourceAndStartECC.sh /u02/ecc/.
chown -R oracle:dba /u02
It will install java using install_java.sh (Assuming you landed all the necessary files such as server jre8.tar.gz under /var/lib/docker/docker-images/ECCDockerTEST/files
#!/bin/bash
# install required OS components
yum install -y perl \
tar \
unzip \
wget \
lsof \
locate
cd /files
tar -xzf server-jre*.tar.gz
mkdir -p ${JAVA_HOME}
mv jdk*/* ${JAVA_HOME}/.
echo 'JAVA_HOME='${JAVA_HOME} >> /etc/profile
echo 'PATH=$PATH:$HOME/bin:$JAVA_HOME/bin' >> /etc/profile
echo 'export JAVA_HOME' >> /etc/profile
echo 'export PATH' >> /etc/profile
source /etc/profile
echo "export JAVA_HOME=${JAVA_HOME}" >> /home/oracle/.bash_profile
echo "export JAVA_HOME=${JAVA_HOME}" >> /home/oracle/.bashrc # .bash_profile not executed by docker
echo "export JAVA_HOME=${JAVA_HOME}" >> /root/.bash_profile
echo "export JAVA_HOME=${JAVA_HOME}" >> /root/.bashrc # .bash_profile not executed by docker
echo "export PATH=\$JAVA_HOME/bin:\$PATH" >> /home/oracle/.bash_profile
echo "export PATH=\$JAVA_HOME/bin:\$PATH" >> /home/oracle/.bashrc # .bash_profile not executed by docker
echo "export PATH=\$JAVA_HOME/bin:\$PATH" >> /root/.bash_profile
echo "export PATH=\$JAVA_HOME/bin:\$PATH" >> /root/.bashrc # .bash_profile not executed by docker
Now, we are getting back to setupEnvironment.sh.
- Setup filesystem and oracle user
- Installed yum packages
- Copy ECC installation zips
- Moving ECC related files to ECC_BASE
Now, we are going back to Dockerfile, this is where ECC installation process begin.
- Set USER as oracle
- Set WORKDIR for oracle user as /home/oracle
- Run install_ecc.sh
install_ecc.sh
cd /u02/ecc/Oracle/quickInstall/
./createEnvFile.sh
source env/ecc.env
./envSetup.sh < SetupResponse.rsp
rm /u02/ecc/Oracle/quickInstall/SetupResponse.rsp
If you followed all the steps, you should have EccConfig.properties from the very first run (initially). Make sure you follow Oracle documentation to create “connection.dbc” on EBS front end. This should also already in /var/lib/docker/docker-images/ECCDockerTEST/files. There are two custom rsp files and one custom shell sript under that directory also.
SetupResponse.rsp ( I know I’m hard-coding a lot of passwords, but you can always delete the response files after image creation (from both docker host and within docker container). In the future I will attempt to leverage –build-arg to pass the password at build time.
2
3
<ECC user password>
<ECC Weblogic password>
<ECC Weblogic password>
4
<EBS apps password>
<ECC_DISCOVERY password>
<ECC Weblogic password>
5
y
<ECC user password>
<ECC Weblogic password>
6
install_ecc.sh will run createEnvFile.sh (assuming you correct EccConfig.properties ). It will then source ecc.env. Then Run envSetup.sh (oracle scirpt) using my “custom” SetupResponse.rsp file.
If you met all the pre-requisitive such as connection.dbc and EccConfig.properties, Step 2-Step 6 should run smoothly.
Important note!!!!! Toward the end of ECC docker image building process (envSetup.sh). Make note of the container ID before Step 11 (CMD ["/u02/ecc/SourceAndStartECC.sh"])
...cut for brevity
PL/SQL procedure successfully completed.
Removing intermediate container 6a5489cec69a
---> ab5b672a4058
Step 11/11 : CMD ["/u02/ecc/SourceAndStartECC.sh"]
---> Running in 94963791a888
Removing intermediate container 94963791a888
---> 007617566032
Successfully built 007617566032
Successfully tagged myoraclejourney/testecc:3
What i meant above is to keep note of container 6a5489cec69a, because all the weblogic configuration was done using 6a5489cec69a as “hostname”.
Once install_ecc.sh is finished, now we are back in Dockerfile
CMD [“/u02/ecc/SourceAndStartECC.sh”]
This is a custom script that will source ecc.env, run startAllEcc.sh with another response file called eccWeblogic.rsp.
SourceAndStartECC.sh
#!/bin/bash
source /u02/ecc/Oracle/quickInstall/env/ecc.env
/u02/ecc/Oracle/quickInstall/bin/startAllEcc.sh < /u02/ecc/eccWeblogic.rsp && tail -f /dev/null
eccWeblogic.rsp
1
<ECC Weblogic password>
Now you may noticed “&& tail -f /dev/null” at the end of my SourceAndStartECC.sh. In Docker environment, the main process is run as “PID 1”. Once that PID 1 is finished, container will exit. So without “&& tail -f /dev/null”, ECC admin server and ECC managed server will start successfully then container will exit with status “0”.
The last shell script under /var/lib/docker/docker-images/ECCDockerTEST is build.sh
#!/bin/sh
docker build -t myoraclejourney/testecc:3 .
Once your “build” process finished successfully and save the “intermediate” container ID as i mentioned earlier. You can start a container based from the image we created.
docker run -dit --restart always -v /etc/localtime:/etc/localtime:ro -h 6a5489cec69a -p 7776:7776 -p 7775:7775 --name testECCv3 --user oracle myoraclejourney/testecc:3
If testECCv3 docker PID on docker host was killed or docker host get rebooted or docker daemon get reloaded, this container will restart and run the /u02/ecc/SourceAndStartECC.sh
The very last step is to docker cp patchEccFiles.pl from /u02/ecc/Oracle/quickInstall/scripts. Run this perl script on EBS middle tier (Per Oracle Documentation)
Then followed the rest of the Oracle Documentation for EBS configuration such as CONTEXT_FILE parameters and giving RBAC to EBS responsibility.
Happy dockerizing your ECC environment.