Skip to main content

Cantara 5.1 and Docker - A Brief Guide

Requirements:

On This Page

Creating Cantara Images:

 - Use this section if creating Cantara container images from scratch -
Refer to the tomcat installation guide for detailed information on context.xml and other configuration information


  1. Once docker is installed, create 3 separate folders, one each for the worker, assur and console container images.
  2. Inside each folder create the etc and logs folders. Add the configuration.json files relevant to each to the etc folder.
  3. Add a worker.properties file to the worker/etc folder and define the hostname as needed.
  4. Create a folder called tomcatjars in each server folder, add the following jars to this folder, use appropriate versions:
    1. javax.mail.jar
    2. mysql-connector-java-x.x.xx.jar
  5. In the worker folder create a folder called cantaralib, add the following jars to it:
    1. AIS_Client
    2. Base_JAR
    3. JdeNet_JAR
    4. jmxremote_optional
    5. jmxri.jar
    6. ManagementAgent_JAR
    7. System_JAR
    8. xmlparserv2
  6. In each server folder create and configure the context files:
    1. cantara.xml for worker
    2. console.xml for console
    3. assur.xml for assur
  7. Add a server.xml with appropriate configuration as needed to each folder. As each container is isolated, the default tomcat server.xml file can be left in place.
  8. Copy the respective exploded war folders to each server folder:
    1. worker.war for worker
    2. assur.war for assur
    3. console.war for console
  9. Create a file called"Dockerfile" in each folder. Copy in the following content:

Worker Dockerfile

CODE
#Install JDK
FROM openjdk:8u212-b04-jdk
#Install tomcat
FROM tomcat:9.0.21-jdk8-openjdk

WORKDIR /usr/local/tomcat

#Copy files to appropriate locations
COPY worker.war /worker/worker.war/
COPY etc /worker/etc/
COPY logs /worker/logs/
COPY /cantaralib/*.jar /worker/worker.war/WEB-INF/lib/
COPY /tomcatjars/*.jar /usr/local/tomcat/lib/
COPY cantara.xml /usr/local/tomcat/conf/Catalina/localhost/
COPY server.xml /usr/local/tomcat/conf/

#Set container port
EXPOSE 8080

#Set java environment options
ENV JAVA_OPTS="-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom -Dcantara.worker.etc=/worker/etc"

ENTRYPOINT ["catalina.sh", "run"]

Assur Dockerfile

CODE
#Install jdk
FROM openjdk:8u212-b04-jdk
#Install tomcat
FROM tomcat:9.0.21-jdk8-openjdk

WORKDIR /usr/local/tomcat

#Copy files to appropriate locations
COPY assur.war /assur/assur.war/
COPY etc /assur/etc/
COPY logs /assur/logs/
COPY /tomcatjars/*.jar /usr/local/tomcat/lib/
COPY assur.xml /usr/local/tomcat/conf/Catalina/localhost/
COPY server.xml /usr/local/tomcat/conf/

#Set container port
EXPOSE 8080


#Set java environment options
ENV JAVA_OPTS="-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom -Dcantara.assur.etc=/assur/etc"


ENTRYPOINT ["catalina.sh", "run"]

Console Dockerfile

CODE
#Install JDK
FROM openjdk:8u212-b04-jdk
#Install tomcat
FROM tomcat:9.0.21-jdk8-openjdk

WORKDIR /usr/local/tomcat

#Copy files to appropriate locations
COPY console.war /console/console.war/
COPY etc /console/etc/
COPY logs /console/logs/
COPY /tomcatjars/*.jar /usr/local/tomcat/lib/
COPY console.xml /usr/local/tomcat/conf/Catalina/localhost/
COPY server.xml /usr/local/tomcat/conf/

#Set container port
EXPOSE 8080

#Set java environment options
ENV JAVA_OPTS="-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom -Dcantara.console.etc=/console/etc"

ENTRYPOINT ["catalina.sh", "run"]

Building an Image:

Once the server folders are configured navigate to the folder to build (i.e. console/worker/assur)  in a terminal and run:

CODE
docker build -t [console/worker/assur]-[version]-[config] .

Version should be in the for 5xx, i.e. 514. Use config to label the build according to the specific configuration setup, i.e. rnmtest for Rinami Test.
Take note of the final period after the tag.

Running an Image:

From a terminal enter the following command:

CODE
docker run -d -p [EXTERNALPORT]:[CONTAINERPORT] -t [console/worker/assur]-[version]-[config]

Accessing a Running Image:

Docker autogenerates container names when running, to find the name of your container run:

CODE
docker container ls

Find the container you want to access and run:

CODE
docker container exec -it [container-id] bash

This will start a bash shell for the container.

Publishing an image:

We're using Google Cloud Platform's native container registry to publish container images.
Refer to this guide to configure gcloud to work with docker:
https://cloud.google.com/container-registry/docs/advanced-authentication

Then refer to this guide to push and pull:
https://cloud.google.com/container-registry/docs/pushing-and-pulling?hl=en_US&_ga=2.115601158.-1803574576.1560815708#pushing_an_image_to_a_registry


For: 

[HOSTNAME]/[PROJECT-ID]/[IMAGE]


use gcr.io as HOSTNAME and cantara-cloud-dev as PROJECT-ID unless otherwise specified. Your tag should look like this:

"gcr.io/cantara-cloud-dev/console-514-rnmtest"

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.