Skip to content

Toolkit on Docker

Sunil Bhaskarla edited this page Nov 7, 2018 · 1 revision

Assumptions

  1. Docker is already installed on your system.

  2. Tomcat 7 with JRE8 for Docker is already installed on your system.

  3. You have a Toolkit WAR file.

    1. You can view a copy of the toolkit.property file that is embedded in your Toolkit WAR file.

  4. You have, or can create, a separate External Cache directory dedicated for Toolkit on Docker.

Goal

Given a Toolkit WAR file, the goal is to deploy the WAR file in a Tomcat container running in Docker.

External Cache

You must have a dedicated External Cache directory to be used in Part 5 of "Docker Command Explained"

Toolkit WAR file

Recommendation

Use a WAR file that was built using a Docker specific Toolkit property file. Normally, this is accomplished by specifying a Maven Build Profile that uses with special Toolkit properties.

Create a Docker-specific webapps directory

Create a directory to be used in Part 6 of "Docker Command Explained"

Copy the WAR file

Copy the WAR file to the webapps directory

Docker Command

Recommendation

Port numbers in the Toolkit Property file and the Toolkit Docker command should be the same.

If the host port is different than what is specified in the Toolkit Properties file, the value in the Toolkit Properties will be shown throughout the Toolkit Web application. Port numbers in Toolkit URLs in Toolkit will be confusing.

Procedure

Port numbers and file directories in Toolkit properties must be exposed in the Docker command.

Port numbers

Port numbers in the article are for demonstration only. You should use the values in the Toolkit Property file that is embedded in your WAR file.

Shell Command

sudo docker run -it --rm \
-p 8080:8080 \
-p 6000-6015:6000-6015 \
-p 8297:8297 \
-p 8443:8443 \
-v /home/skb1/projects/ec_dir_docker:/home/skb1/projects/ec_dir_docker:rw \
-v /home/skb1/myWebappDir:/usr/local/tomcat/webapps:rw \
tomcat:7-jre8

Docker Command Explained

See this page for general Docker options (-it and --rm).

sudo docker run -it --rm \

1) Toolkit_Port Toolkit property

NOTE: The Toolkit_Port needs to match Tomcat port. If you are running multiple copies of Toolkit at the same time, this port number (and others below) must be unique.

IMPORTANT: The following assumes you have Toolkit_Port set to 8080 in your Toolkit_Port property in toolkit.properties file.

-p 8080:8080 \

2) Listener_Port_Range property (Simualtor PIF port thread pool)

If you are running Toolkit in a development environment with a debugger, avoid conflict with debugger or other instances of Toolkit running on the same system.

-p 6000-6015:6000-6015 \

3) Proxy_Port property

-p 8297:8297 \

4) Toolkit_TLS_Port property

-p 8443:8443 \

5) External_Cache property: Remap External Cache directory

The 'ec_dir_docker' directory must exist with Read/Write privileges on your system.

-v /home/skb1/projects/ec_dir_docker:/home/skb1/projects/ec_dir_docker:rw \

6) Remap Tomcat webapps directory

The 'myWebappDir' directory must exist with Read/Write privileges on your system.

NOTE: the :rw is required, otherwise the EC dir cannot be read/written.

-v /home/skb1/myWebappDir:/usr/local/tomcat/webapps:rw \

7) Use Tomcat 7 container

tomcat:7-jre8

Troubleshooting

Toolkit shows wrong ports

If the host port is different than what is specified in the Toolkit Properties file, the value in the Toolkit Properties will be shown throughout the Toolkit Web application. Port numbers in Toolkit URLs in Toolkit will be confusing.

Toolkit does not start

If Toolkit does not start due to a FHIR support server error, it is a good idea to remove the "simdb" folder so that it will recreated on startup.

Clone this wiki locally