Install JMap Server in a Docker container

 

Product

JMap Server

Versions

7 Jakarta +

 

Since JMap 7 Jakarta, it is possible to run JMap Server in a Docker container. This allows you to easily deploy instances of JMap Server in your Docker environment with all the advantages that this entails.

Running JMap Server in Docker is easy and similar to the traditional way with installer. The main difference concerns the storage of data read and written by JMap Server. Since it is not possible to write to a Docker container, this data must reside elsewhere on the server. There must be two storage spaces, also called volumes.

A first volume is used for storing system data written by JMap Server (configurations, logs, etc.). We call it JMap's system data volume.

A second volume is used to store spatial data files that will be read by JMap Server. We call it the JMap spatial data volume.

Prerequisites

Before starting, make sure you have the following prerequisites:

Linux: /home/jmapserver/systemconfig Windows: C:/jmapserver/systemconfig
  • A directory for the JMap spatial data volume. For example:

Linux: /home/jmapserver/data Windows: C:/jmapserver/data

Create and launch the JMap Server container the first time 

Run the following command at the terminal to create and launch the container:

Linux :

docker run -e TZ=America/New_York -it -e LOCAL_USER_ID=`id -u $USER` -e VM_OPTIONS_XMX=4g -p 8080:8080 -p 7003:7003 -d -v /home/jmapserver/systemconfig:/opt/jmap/systemconfig -v /home/jmapserver/data:/opt/jmapdata --name jmapserver k2geospatial/jmap:7_Jakarta_latest

Windows :

-e LOCAL_USER_ID = ʻid -u $ USER` tells Docker to write data as the account used in the current session.

-e VM_OPTIONS_XMX = 4g allocates 4 gigabytes to the JVM. The default is 2 gigabytes if this environment variable is not specified.

-p 7003 and 8080 define the ports through which JMap Server will be accessible.

-v /home/jmapserver/systemconfig:/opt/jmap/systemconfig indicates that the JMap system data volume is in the /home/jmapserver/systemconfig directory of the server and that it will be mounted in /opt/jmap/systemconfig.

-v /home/jmapserver/data:/opt/jmapdata indicates that the JMap spatial data volume is in the /home/jmapserver/ data directory of the server and that it will be mounted in /opt/jmapdata.

--name jmapserver determines that the name of the new container will be jmapserver. This name will be used later to control the container.

k2geospatial/jmap:latest is the name of the most recent JMap Docker image. It will be downloaded from Docker Hub. It is also possible to request a particular version by specifying for example k2geospatial/jmap: 7_jakarta.

-d will execute the jmap server console in background. It means you will not see the console running in the terminal. This option is optional.

-e TZ=America/New_York will set time zone.

Place the license file

After creating and running the container, JMap Server stops automatically because it cannot find a license file. As with the traditional installation, an activationkey.txt file is generated automatically and must be sent to the Customer Portal for the creation of the license file (jmap.license).

The activationkey.txt file is generated at the root of the JMap system data volume.

Once you receive the jmap.licence file from K2, place it at the root of the JMap system data volume, in the same directory as the activationkey.txt file.

You will need to restart the previous created container. 

Start the JMap Server container

Use this command to start the container:

jmapserver  is the name of the container.

Stop the JMap Server container

Once the container has been created and started for the first time, and once the license file is correctly placed, use this command to stop it:

jmapserver  is the name of the container.

Consult the JMap Server console

Whether the container is started or stopped, use this command to view the JMap Server console:

-f allows continuous monitoring of the console
jmapserver is the name of the container.

Update JMap Server

It is easy to update a JMap Server installation in a Docker container. The procedure is to download a newer image and relaunch the container.

1. Stop the container if it is running

2. Delete the container. No data will be lost.

3. Run the docker run command again, specifying the new image as a parameter.

Install an extension

Extensions can be installed in your JMap and Docker environment by following the following steps:

1. Create a scripts directory in the systems data volume. For example:

2. Place the extension installation in the script directory. This is the .sh file that is used to install the extension on Linux. For example:

3. Restart the container.