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

I was playing around with Docker (well, with Docker toolbox for Windows…) and decided to give this a go. The following post contains instructions on how to build a single image hosting a similar environment to the previously posted (Unofficial) D7.2 Developer Edition.

This is not the cleanest, nor more elegant solution, so I wouldn’t use this for anything else than testing/learning purposes. If you want something more “professional” you should check the existing guides/scripts to build a documentum environment using docker: xCP dockerized environment (GitHub – jppop/dctm-docker: Documentum running in containers) and docker-dctm (dctm/docker at master · andreybpanfilov/dctm · GitHub) by PanfilovAB

So here we go:

Step 1: Install docker-toolbox

Well, simply run the installer, next, next, next, Finish. Just be sure to check the option to install the NDIS5 driver. The docker toolbox for Windows installs Oracle VirtualBox and has a headless vbox running a base *nix image (boot2docker) designed to run containers (there’s is a beta docker for Windows 10 enterprise that works directaly against MS HyperV without an intermediate virtualization software).

Step 2: Get a “more suitable” default docker machine

Default docker vm has 1gb ram, so we’ll delete it:

docker-machine rm default

And create a new one with 4g RAM and using 2 cpus

docker-machine create -d virtualbox –virtualbox-memory 4096 –virtualbox-cpu-count 2 –engine-storage-driver overlay default

Step 3: Fix swap space for Oracle XE

thanks to GitHub – madhead/docker-oracle-xe: CentOS 7 Docker image with Oracle XE 11.2.0 onboard:

The steps are same as for usual build, but you need to configure swap space in boot2docker / Docker Machine prior the build:

Log into boot2docker / Docker Machine: boot2docker ssh or docker-machine ssh default (replace default if needed).

Create a file named bootlocal.sh in /var/lib/boot2docker/ with the following content:

dd if=/dev/zero of=$SWAPFILE bs=1024 count=2097152
mkswap $SWAPFILE && chmod 600 $SWAPFILE && swapon $SWAPFILE
Make this file executable: chmod u+x /var/lib/boot2docker/bootlocal.sh

After restarting boot2docker / Docker Machine, it will have increased swap size. Just follow the steps above to build this image.

Step 4: Get the installers ready

You should have a folder structure similar to this one:

cs\config\configProperties.properties -> repository install script
cs\config\installProperties.properties -> cs install script
cs\config\startup-dctm.sh -> dctm startup script
db\config\init.ora -> oracle xe config
db\config\initXETemp.ora -> oracle xe config
db\config\startdb.sh -> oracle xe startup script
db\config\xe.rsp -> oracle xe config
tomcat\config\catalina.properties -> tomcat updated config files
tomcat\config\catalina.sh -> tomcat modified startup script
tomcat\config\context.xml -> tomcat updated config files
tomcat\config\server.xml -> tomcat updated config files
tomcat\config\web.xml -> tomcat updated config files

Step 5: Get latest centos as base OS

Open docker terminal and run:

docker pull centos:latest

From now on, we’ll be editing the Dockerfile that we’ll use to create the image

Step 6: Installing Oracle XE

We’ll be building and image based on the centos we’ve just pulled, so we start our Dockerfile with:

FROM centos

Now we need to setup user accounts:

RUN echo root:root | chpasswd
RUN useradd dmadmin
RUN passwd -f -u dmadmin

RUN echo “dmadmin ALL=(ALL) ALL” >> /etc/sudoers.d/dmadmin
RUN sed -i -e ‘s/Defaults requiretty.*/ #Defaults requiretty/g’ /etc/sudoers

Install required libraries:

RUN yum install -y passwd sudo tail 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

And run the Oracle installation:

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 \
RUN chmod 755 /u01/app/oracle/product/11.2.0/xe/config/scripts/*.ora \

ENV ORACLE_HOME /u01/app/oracle/product/11.2.0/xe
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

those scripts have the Oracle configuration and you can get them from GitHub – madhead/docker-oracle-xe: CentOS 7 Docker image with Oracle XE 11.2.0 onboard

Configure instantclient:

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

And copy the db startup script to the image:

ADD db/config/startdb.sh /

Step 7: Installing Documentum 7.2

You need to get a copy of the silent install scripts, you can get them by running the dctm installers with “-r <path to file>” or by checking support.emc.com for a SN with an attached copy.

Just be sure to fill in the usual required fields and the AEK password option or the installer will fail (you can avoid using lockbox though)

Avoid problems with the Oracle client:

RUN usermod -a -G dba dmadmin

Create the folder structure and copy the installers and the configuration scripts:

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

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

Additional configurations before running the installer:

USER root
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

RUN ln /usr/lib64/libsasl2.so.3 /usr/lib64/libsasl2.so.2

RUN chown -R dmadmin:dmadmin /opt/documentum/install; \
chmod u+x /opt/documentum/install/serverSetup.bin

USER dmadmin

ENV DOCUMENTUM /opt/documentum
ENV ORACLE_HOME /u01/app/oracle/product/11.2.0/xe
ENV JAVA_HOME /opt/documentum/java64/1.7.0_72

And run CS install:

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

Let’s configure the repository. First, “fix” dmdbtest (bad, dirty fix)

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

While building an image, docker generates intermediate containers. These containers are like individual VMs with their own configuration, so starting the DB and the installer in different docker commands makes the DB run in a different container than the installation, so the installer won’t be able to connect to Oracle. In order to avoid this problem we need to run everything in the same run command (dirty workaround). Also, update hostnames with the current container hostname:

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; \
sudo -E /startdb.sh; \
/opt/documentum/product/7.2/install/dm_launch_server_config_program.sh -f /opt/documentum/install/configProperties.properties

Step 8: Installing Tomcat / DA 7.2

The configuration files are the same used in the (Unofficial) D7.2 Developer Edition, I simply copied those to avoid further manual modifications:

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

RUN mv /opt/apache-tomcat-8.0.14 /opt/tomcat; \
chown -R dmadmin:dmadmin /opt/tomcat

ADD tomcat/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 tomcat/config/catalina.properties /opt/tomcat/conf/
ADD tomcat/config/context.xml /opt/tomcat/conf/
ADD tomcat/config/server.xml /opt/tomcat/conf/
ADD tomcat/config/web.xml /opt/tomcat/conf/
ADD tomcat/config/catalina.sh /opt/tomcat/bin/

Step 9: Exposing ports and configuring default command to be run:

EXPOSE 8080 1521

CMD /opt/documentum/startup-dctm.sh ; bash

Save and get ready to build the image!

Step 10: building the image

docker build -t dctm72 .

And wait 40-60 minutes

Step 11: Running the image

Now that everything is setup, just run the image:

docker run -it -p 8080:8080 dctm72

the startup-dctm.sh command will start the database listening to the container’s IP, update server.ini, dfc.properties with the new hostname, remove dfc.keystore (just to be sure), load the aek passphrase and start docbroker, repository, jms and tomcat.

You can run idql from the container to check that you can connect to the repository. Now point your host browser to the docker-machine ip (you can see the ip on the docker terminal or by running “docker-machine ip”) through the 8080 port and try to open DA and login using the usual dmadmin/dmadmin.

Everything should be (kind of) working, Congrats!

In the next post I’ll explain how to “split” this image in three different images (db, cs and tomcat)

One thought on “(Unofficial) D7.2 Developer Docker edition (I)

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