On this page
Some of the functionalities provided by Web Application Platform are long-running tasks that take longer time periods and machine resources to be executed. One notable example is exporting Cameo Collaborator documents to various formats (pdf, html) that is provided by the Document Exporter web application. It is possible to deploy such applications on a separate web container instance to withdraw load from the server where remaining web applications are deployed.
To make the solution scalable, you can use the Docker as the container platform to run web applications. For example, you can run a single instance of Web Application Platform applications on one Tomcat instance and run one or more instances of the Document Exporter as the Docker containers.
To run a Docker container
The following section provides an example how to create a container for the Document Exporter web application.
This section provides an example how to create a container for the Document Exporter web application.
To create a container for Document exporter
Prepare a Dockerfile for the Document Exporter with image build instructions. For simplicity, the webappplatform.properties file will be copied to the Tomcat classpath within the container.
FROM tomcat:10.1.8-jre17-temurin-jammy
ARG TOMCAT_DIR=/usr/local/tomcat
ARG SET_ENV_FILE=/usr/local/tomcat/bin/setenv.sh
ARG USER_UID=5000
ARG USER_GID=${USER_UID}
COPY logback.xml ${TOMCAT_DIR}/shared/conf/
COPY document-exporter.war ${TOMCAT_DIR}/webapps/
COPY webappplatform.properties ${TOMCAT_DIR}/shared/conf/
COPY data ${TOMCAT_DIR}/shared/conf/data
RUN sed -i "s|shared\.loader=*$|shared\.loader=\"\${catalina.base}/shared/conf\"|" ${TOMCAT_DIR}/conf/catalina.properties && \
echo 'export JAVA_OPTS="$JAVA_OPTS ${WEBAPP_PROPERTIES}"' >> ${SET_ENV_FILE} && \
chmod o+x ${SET_ENV_FILE} && \
groupadd --gid ${USER_GID} tomcat && \
useradd -r --uid ${USER_UID} --gid ${USER_GID} -s /sbin/nologin -d ${TOMCAT_DIR} -c "Tomcat user" tomcat && \
chown -R tomcat:tomcat ${TOMCAT_DIR} && \
chown -R root:root ${TOMCAT_DIR}/bin/*.sh && \
rm -rf webapps.dist && \
apt-get update -y && \
apt install dialog apt-utils -y && \
echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | debconf-set-selections && \
apt-get install ttf-mscorefonts-installer -y && \
apt-get clean
USER tomcat
EXPOSE 8080
CMD ["catalina.sh", "run"] |
Use the following command to build the Docker image:
docker build --tag document-exporter . |
Run the container on port 8080 by executing the following command:
docker run -p 8080:8080 document-exporter |
To test that if Document Exporter is accessible, send a request to this address://<host>:8080/document-exporter. If the container runs and the application is successfully started, a 404 page should be displayed with a custom error text and image.
This section does not cover a particular scaling method. You can choose it based on the infrastructure available and your own preferences. There are several ways to scale the containerized Document Exporter application:
You need to have sticky sessions for the scaling to work. |
When a document is exported to the pdf format, fonts are required to be installed on the OS where the document is being generated. If fonts installed on the OS and used for creating models and fonts of the deployment OS are different, you may need to install additional fonts. For example, if the deployment OS is Linux-based, and models are created using a Windows version of the modeling tool, then Microsoft true type fonts should be installed to have an expected output.
Microsoft True Type Fonts
General instructions describing how to add Microsft True Type fonts to the Linux-based OS are provided in the Exporting documents to PDF and HTML chapter. However, the installation of the fonts depends on the Docker container OS. Assuming that font files are pre-downloaded and put to the msttcore folder, this folder can be moved to the folder with the Dockerfile. Then you can copy fonts to the Linux font folder by using the following script:
FROM tomcat:10.1.8-jre17-temurin-jammy ARG TOMCAT_DIR=/usr/local/tomcat COPY logback.xml ${TOMCAT_DIR}/shared/conf/ RUN sed -i "s|shared\.loader=*$|shared\.loader=\"\${catalina.base}/shared/conf\"|" ${TOMCAT_DIR}/conf/catalina.properties && \ EXPOSE 8080 |