Build Context location
/var/lib/docker/docker-images/OIC
-rwxr--r-- 1 root root 39 Jan 8 09:14 build.sh
-rwxr--r-- 1 root root 68 Jan 8 09:16 run.sh
-rwxr--r-- 1 root root 43 Jan 8 09:29 connect.sh
-rwxr--r-- 1 root root 438 Jan 8 13:52 Dockerfile
drwxr-xr-x 2 root root 123 Jan 8 13:55 files
drwxr-xr-x 2 root root 106 Jan 8 14:03 scripts
-rw-r--r-- 1 root root 58 Jul 7 10:52 runDevOIC.sh
build.sh
#!/bin/sh
docker build -t baye/oic:1 .
runDevOIC.sh (Mount NFS on docker host first, then bind mount the docker host NFS to container using -v because some of the integration uses FTP connector)
#!/bin/sh
docker run -dit --restart always -v /usr/local/WindozeShared/:/usr/local/WindozeShared -v /scratch/transfer/Concur/DEV/:/scratch/transfer/Concur/DEV/ --name devOIC baye/oic:2
connect.sh (I’m lazy to type the whole thing every time I want to connect to a docker container)
#!/bin/sh
docker exec -it devOIC /bin/bash
Dockerfile
Not required to run connectivity.jar with nohup because docker container will be running the java process as the main process in detach mode)
Ensure current OIC_URL, OIC_USER and OIC_PASSWORD environment are set in Dockerfile, we will unset them later.
FROM oraclelinux:7.6
MAINTAINER Bo Aye <baye@zeusinc.com>
# environment variables
ENV JAVA_HOME=/usr/java/latest \
OIC_URL=https://blahblahblah \
AGENT_GROUP_IDENTIFIER=CONNECTIVI_AGENT_GROUP \
OIC_USER=blah \
OIC_PASSWORD=blahblah
# copy all scripts
ADD scripts /scripts/
# copy all files
ADD files /files/
RUN groupadd -g 54322 dba && \
useradd -r -m -u 54322 -g dba oracle
# image setup via shell script to reduce layers and optimize final disk usage
RUN /scripts/install_main.sh
# unset environment variables
ENV OIC_URL= \
AGENT_GROUP_IDENTIFIER= \
OIC_USER= \
OIC_PASSWORD=
USER oracle
WORKDIR /usr/local/oicAgent
ENTRYPOINT ["/usr/java/latest/bin/java","-jar","/usr/local/oicAgent/connectivityagent.jar"]
/var/lib/docker/docker-images/zeusOIC/files
oic_connectivity_agent.zip – Download from OIC
server-jre-*.tar.gz – Download from Oracle site
InstallerProfile.cfg – This is part of oic_connectivity_agent.zip, unzip and add optional parameters oic_USER=#OIC_USER, #oic_PASSWORD=#OIC_PASSWORD#
rootCA.crt – Download it from OIC
total 210788
-rw-r--r-- 1 root root 160546679 Jan 8 09:11 oic_connectivity_agent.zip
-rw-r--r-- 1 root root 55290205 Jan 8 10:42 server-jre-8u231-linux-x64.tar.gz
-rwxrwxrwx 1 root root 305 Jan 8 12:58 InstallerProfile.cfg
-rw-r--r-- 1 root root 1694 Jan 8 13:55 rootCA.crt
Make the following changes (all of the parameters will be set as part of building image using “sed” and environment variables which will get unset later )
# Required Parameters
# oic_URL format should be https://hostname:sslPort
oic_URL=#OIC_URL#
agent_GROUP_IDENTIFIER=#AGENT_GROUP_IDENTIFIER#
#Optional Parameters
oic_USER=#OIC_USER#
oic_PASSWORD=#OIC_PASSWORD#
# Proxy Parameters
proxy_HOST=
proxy_PORT=
proxy_USER=
proxy_PASSWORD=
proxy_NON_PROXY_HOSTS=
/var/lib/docker/docker-images/zeusOIC/scripts
-rwxr--r-- 1 root root 601 Jan 8 09:59 image_setup.sh
-rwxr--r-- 1 root root 1314 Jan 8 10:51 install_java.sh
-rwxr--r-- 1 root root 1079 Jan 8 12:57 install_main.sh
-rw-r--r-- 1 root root 10 Jan 8 13:19 test.sh
-rwxr--r-- 1 root root 596 Jan 8 14:03 install_oic.sh
install_main.sh
#!/bin/bash
echo "--------------------------------------------------"
echo "Environment Vars.................................."
echo "JAVA_HOME: ${JAVA_HOME}"
echo "oic_URL: ${OIC_URL}"
echo "agent_GROUP_IDENTIFIER: ${AGENT_GROUP_IDENTIFIER}"
echo "oic_USER: ${OIC_USER}"
echo "oic_PASSWORD: ${OIC_PASSWORD}"
export PATH=$PATH:/usr/bin
#
echo "--------------------------------------------------"
echo "Image Setup......................................."
./scripts/image_setup.sh
#
echo "--------------------------------------------------"
echo "Installing JAVA..................................."
./scripts/install_java.sh
#
echo "--------------------------------------------------"
echo "Installing OIC..................................."
./scripts/install_oic.sh
#
echo "--------------------------------------------------"
echo "Cleanup..........................................."
yum clean all
#rm -r -f /tmp/*
#rm -r -f /files/*
#rm -r -f /var/tmp/*
echo "--------------------------------------------------"
echo "DONE.............................................."
image_setup.sh
#!/bin/bash
# add hostname
echo "127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4" > /etc/hosts
echo "::1 localhost localhost.localdomain localhost6 localhost6.localdomain6" >> /etc/hosts
echo "127.0.0.1 $HOSTNAME" >> /etc/hosts
# folder permissions
chmod -R 777 /files
chmod -R 777 /scripts
# set timezone
ln -s -f /usr/share/zoneinfo/${TIME_ZONE} /etc/localtime
# disable SELinux
#setenforce disabled
if [ -f /etc/selinux/config ]; then
sed -i -E 's:SELINUX=enforcing:SELINUX=disabled:g' /etc/selinux/config
fi
# update YUM
yum clean all
yum update -y
install_java.sh
yum install -y perl \
tar \
unzip \
wget \
lsof \
locate \
which
cd /files
tar -xzf server-jre-8u*-linux-x64.tar.gz
mkdir -p ${JAVA_HOME}
mv jdk1*/* ${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
chown -R oracle:dba ${JAVA_HOME}
install_oic.sh
#!/bin/bash
source /etc/profile
mkdir -p /usr/local/oicAgent
unzip -o /files/oic*.zip -d /usr/local/oicAgent
sed -i -E 's|#OIC_URL#|'${OIC_URL}'|g' /files/InstallerProfile.cfg
sed -i -E 's:#AGENT_GROUP_IDENTIFIER#:'${AGENT_GROUP_IDENTIFIER}':g' /files/InstallerProfile.cfg
sed -i -E 's:#OIC_USER#:'${OIC_USER}':g' /files/InstallerProfile.cfg
sed -i -E 's:#OIC_PASSWORD#:'${OIC_PASSWORD}':g' /files/InstallerProfile.cfg
mv -f /files/InstallerProfile.cfg /usr/local/oicAgent
mv -f /files/ascii*.com /usr/local/oicAgent/agenthome/agent/cert
cd /usr/local/oicAgent
sleep 120
cd /usr/local/oicAgent/agenthome/agent/cert/
keytool -importcert -keystore keystore.jks -storepass changeit -keypass password -alias DEV_OIC -noprompt -file ascii*.com
chown -R oracle:dba /usr/local/oicAgent
Entrypoint script will keep Java process running in the background.
./build.sh (to build the OIC image)
./runDevOIC.sh. (to run/start OIC docker container using above OIC image)
[root@ bayeOIC]# docker logs devOIC
Proceeding to install a new agent ...
No Proxy Configuration Detected
Checking for trusted certificates ...
Making call to check OIC Version ...
Making call to check Agent group availability ...
Updating Agent with configuration details ...
Making call to register new agent instance ...
Making call for getting agent app id & keys...
Done with Agent installation & configuration... Starting Agent for message processing.
Agent started successfully...Now available for new messages...
