(Unofficial) D7.2 Developer Docker edition (II)

In this post I’ll explain how to move from the full environment in a single image/container described in the previous post ((Unofficial) D7.2 Developer Docker edition (I)) to a multi-image/container environment. As I said in the previous post, if you want to set up a complete environment you better check the existing guides (GitHub – jppop/dctm-docker: Documentum running in containers, dctm/docker at master · andreybpanfilov/dctm · GitHub) instead of this one

Database:

This is the easiest part, as the Dockerfile is exactly the same we used previously to set up the database:

FROM centos
RUN echo root:root | chpasswd

RUN yum install -y passwd sudo tail vi libaio bc initscripts net-tools libXp.x86_64 libXp.i686 libXi.i686 libXtst.i686 libXt.i686 glibc.i686 libgcc.i686 libstdc++.i686 libaio.i686; \
yum clean all

RUN mkdir -p /run/lock/subsys

ADD db/oracle-xe-11.2.0-1.0.x86_64.rpm /tmp/
RUN yum localinstall -y /tmp/oracle-xe-11.2.0-1.0.x86_64.rpm; \
rm -rf /tmp/oracle-xe-11.2.0-1.0.x86_64.rpm

ADD db/config/xe.rsp db/config/init.ora db/config/initXETemp.ora /u01/app/oracle/product/11.2.0/xe/config/scripts/
RUN chown oracle:dba /u01/app/oracle/product/11.2.0/xe/config/scripts/*.ora \
/u01/app/oracle/product/11.2.0/xe/config/scripts/xe.rsp
RUN chmod 755 /u01/app/oracle/product/11.2.0/xe/config/scripts/*.ora \
/u01/app/oracle/product/11.2.0/xe/config/scripts/xe.rsp
ENV ORACLE_HOME /u01/app/oracle/product/11.2.0/xe
ENV ORACLE_SID XE
ENV PATH $ORACLE_HOME/bin:$PATH

RUN /etc/init.d/oracle-xe configure responseFile=/u01/app/oracle/product/11.2.0/xe/config/scripts/xe.rsp

RUN echo oracle:oracle | chpasswd

RUN mkdir /u01/app/oracle/product/11.2.0/xe/lib32; \
chown oracle:dba /u01/app/oracle/product/11.2.0/xe/lib32

ADD db/instantclient_11_2/lib* /u01/app/oracle/product/11.2.0/xe/lib32/

RUN ln -s /u01/app/oracle/product/11.2.0/xe/lib32/libclntsh.so.11.1 /u01/app/oracle/product/11.2.0/xe/lib32/libclntsh.so; \
ln -s /u01/app/oracle/product/11.2.0/xe/lib32/libocci.so.11.1 /u01/app/oracle/product/11.2.0/xe/lib32/libocci.so; \
chown -h oracle:dba /u01/app/oracle/product/11.2.0/xe/lib32/*; \
chown -h oracle:dba /u01/app/oracle/product/11.2.0/xe/lib32/libclntsh.so; \
chown -h oracle:dba /u01/app/oracle/product/11.2.0/xe/lib32/libocci.so

ADD db/config/startdb.sh /

EXPOSE 1521

CMD /startdb.sh ; bash

Then build the image:

docker build -t database .

Now we can run the image by running:

docker run -dit -p 1521:1521 db

which will run the container as a daemon publishing the port 1521 so we can connect from another container.

Content Server / Repository:

This needs extra work from the previous setup. First, we need to install the oracle client:

FROM centos

RUN echo root:root | chpasswd

RUN yum install -y libaio sudo tail vi openssh-server; \
yum clean all; \
sed -i ‘s/PermitRootLogin without-password/PermitRootLogin yes/’ /etc/ssh/sshd_config; \
sed ‘s@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g’ -i /etc/pam.d/sshd

ADD db/install/oracle-instantclient11.2-sqlplus-11.2.0.3.0-1.x86_64.rpm /tmp/oracle-instantclient11.2-sqlplus-11.2.0.3.0-1.x86_64.rpm
ADD db/install/oracle-instantclient11.2-basic-11.2.0.3.0-1.x86_64.rpm /tmp/oracle-instantclient11.2-basic-11.2.0.3.0-1.x86_64.rpm

RUN rpm -ivh /tmp/oracle-instantclient11.2-sqlplus-11.2.0.3.0-1.x86_64.rpm /tmp/oracle-instantclient11.2-basic-11.2.0.3.0-1.x86_64.rpm; \
rm /tmp/oracle-instantclient11.2-sqlplus-11.2.0.3.0-1.x86_64.rpm; \
rm /tmp/oracle-instantclient11.2-basic-11.2.0.3.0-1.x86_64.rpm

Now, let’s install CS:

Create the dmadmin user:

RUN useradd dmadmin; \
passwd -f -u dmadmin; \
mkdir -p /home/dmadmin/.ssh; chown dmadmin /home/dmadmin/.ssh; chmod 700 /home/dmadmin/.ssh; \
echo “dmadmin ALL=(ALL) ALL” >> /etc/sudoers.d/dmadmin; \
sed -i -e ‘s/Defaults requiretty.*/ #Defaults requiretty/g’ /etc/sudoers

Create folder structure:

RUN mkdir /opt/documentum; \
mkdir /opt/documentum/product; \
mkdir /opt/documentum/product/7.2; \
mkdir /opt/documentum/install; \
mkdir /opt/documentum/db; \
chown -R dmadmin:dmadmin /opt/documentum

Copy files, including a new config.properties containing the setup of an additional docbroker (we need this to do the IP translation so external machines can connect to the repository):

ADD cs/install/* /opt/documentum/install/
ADD cs/config/installProperties.properties /opt/documentum/install/
ADD cs/config/configProperties.properties /opt/documentum/install/
ADD cs/config/configPropertiesDoc.properties /opt/documentum/install/

Preinstallation checks:

RUN echo “#dctm services” >> /etc/services ; \
echo “dctm72 49001/tcp # 7.2 Repository native connection” >> /etc/services ; \
echo “dctm72_s 49002/tcp # 7.2 Repository secure connection” >> /etc/services ; \
ln /usr/lib64/libsasl2.so.3 /usr/lib64/libsasl2.so.2; \
ln -s /usr/lib/oracle/11.2/client64/lib/libclntsh.so.11.1 /usr/lib/oracle/11.2/client64/lib/libclntsh.so; \
ln -s /usr/lib/oracle/11.2/client64/lib/libocci.so.11.1 /usr/lib/oracle/11.2/client64/lib/libocci.so; \
chown -R dmadmin:dmadmin /opt/documentum/install; \
chmod u+x /opt/documentum/install/serverSetup.bin

ENV DOCUMENTUM /opt/documentum
ENV DM_HOME $DOCUMENTUM/product/7.2
ENV LC_ALL C
ENV JAVA_HOME /opt/documentum/java64/1.7.0_72
ENV ORACLE_HOME /usr/lib/oracle/11.2/client64
ENV ORACLE_SID XE
ENV PATH $ORACLE_HOME/bin:$DM_HOME/bin:$PATH
ENV NLS_LANG AMERICAN_AMERICA.AL32UTF8
ENV LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client64/lib:$DM_HOME/bin/FIPS/:$JAVA_HOME/jre/lib/amd64/server:$DM_HOME/bin:$LD_LIBRARY_PATH
ENV PATH=/usr/lib/oracle/11.2/client64/bin:$PATH
ENV TNS_ADMIN=/opt/documentum/db

And run the silent install:

RUN $DOCUMENTUM/install/serverSetup.bin -f installProperties.properties

Now that the content server is installed, we need to create a repository. We’ll need to use a tnsnames.ora pointing to our running database container. In this case I’m hadrdcoding the docker virtual machine IP for the installation, however, fix_tnsnames.sh takes an environment variable (defined in the docker run command) and updates the file so the container can connect to the database if the IP changes:

ENV DBHOST 192.168.99.100
ADD db/config/tnsnames.ora /opt/documentum/db/
ADD db/config/fix_tnsnames.sh /opt/documentum/

The dmdbtest “patch”:

RUN /opt/documentum/fix_tnsnames.sh; \
mv $DM_HOME/bin/dmdbtest $DM_HOME/bin/dmdbtest.bak; \
echo “exit 0” >> $DM_HOME/bin/dmdbtest; \
chmod u+x $DM_HOME/bin/dmdbtest

And run the docbrokers/repository configuration:

RUN sed -i “/SERVER.PROJECTED_DOCBROKER_HOST/cSERVER.PROJECTED_DOCBROKER_HOST=$HOSTNAME” /opt/documentum/install/configProperties.properties; \
sed -i “/SERVER.SMTP_SERVER_NAME/cSERVER.SMTP_SERVER_NAME=$HOSTNAME” /opt/documentum/install/configProperties.properties; \
sed -i “/SERVER.FQDN/cSERVER.FQDN=$HOSTNAME” /opt/documentum/install/configProperties.properties; \
/opt/documentum/product/7.2/install/dm_launch_server_config_program.sh -f /opt/documentum/install/configPropertiesDoc.properties; \
/opt/documentum/product/7.2/install/dm_launch_server_config_program.sh -f /opt/documentum/install/configProperties.properties

Final touches:

EXPOSE 22 1489 1492 49001 49002
ADD cs/config/startup-dctm.sh /opt/documentum/startup-dctm.sh
CMD /opt/documentum/fix_tnsnames.sh; /opt/documentum/startup-dctm.sh ; bash

startup-dctm.sh should:

  • Update server.ini host and projection target 1 for the additional docbroker.
  • Update dfc.properties with the right hostname
  • Delete dfc.keystore
  • Run dm_crypto_boot
  • Add the IP translation section to DocbrokerExt.ini
  • Update dfc.properties with both dockbrokers
  • Launch docbroker services (using -init_file for our additional docbroker)
  • Run JMS
  • Start repository.

Now we just have to build the image:

docker build -t dctm72 .

and run it:

docker run -dit -p 1489:1489 -p 1492:1492 -p 49001:49001 -p 49002:49002 –env DBHOST=192.168.99.100 dctm

Application Server

Finally, let’s build the application server image (quite self-explanatory):

FROM centos
ADD install/apache-tomcat-8.0.14.tar.gz /opt/

RUN mv /opt/apache-tomcat-8.0.14 /opt/tomcat

RUN yum install -y unzip; \
yum clean all

ADD install/da.war /opt/tomcat/webapps/
RUN unzip /opt/tomcat/webapps/da.war -d /opt/tomcat/webapps/da; \
sed -i “/<compression_filter_enabled>true</compression_filter_enabled>/c<compression_filter_enabled>false</compression_filter_enabled>” /opt/tomcat/webapps/da/wdk/app.xml; \
rm /opt/tomcat/webapps/da.war
ADD config/catalina.properties /opt/tomcat/conf/
ADD config/context.xml /opt/tomcat/conf/
ADD config/server.xml /opt/tomcat/conf/
ADD config/web.xml /opt/tomcat/conf/
ADD config/catalina.sh /opt/tomcat/bin/
ADD config/starttomcat.sh /opt/tomcat/bin/

ADD install/jdk-8u91-linux-x64.tar.gz /opt/
EXPOSE 8080
CMD /opt/tomcat/bin/starttomcat.sh ; bash

starttomcat.sh will simply update da/WEB-INF/classes/dfc.properties with the right CS host/port

So let’s build the image:

docker build -t appserver .

And run it with:

docker run -dit -p 8080:8080 –env CSHOST=192.168.99.100 –env CSPORT=1492 tomcat

And if everything worked fine, you’ll have 3 containers running the same Documentum environment we had previously running in a single container.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s