Deploying EFTLink within a Docker Container
Build Your Docker Image
-
Create a working directory.
For example:
mkdir $HOME/docker-build-files
- Extract the contents from container.zip to your working directory.
- Copy the EFTLink binaries zip file (v<xx>.0.0.<nnn>.binaries.zip) to your working directory.
- Copy the XST-jre-21.0.<XX>-linux_64.zip (from jrepackager) to your working directory.
-
Run the following command from the command shell within your working directory:
docker build \
--build-arg eftlink_zip=v<xx>.0.0.<nnn>.zip \
--build-arg jre_zip=XST-jre-21.0.<nnn>-linux_64.zip \
--build-arg eftlink_user_uid=<user uid> \
--build-arg eftlink_user_gid=<user gid> \
-f Dockerfile \
-t eftlink:latest .
For example:
docker build \
--build-arg eftlink_zip=v25.0.0.298.binaries.zip \
--build-arg jre_zip=XST-jre-21.0.12-linux_64.zip \
--build-arg eftlink_user_uid=9090 \
--build-arg eftlink_user_gid=9090 \
-f Dockerfile \
-t eftlink:latest .
This will build your Docker image. Once the process has finished, you can see the completed image by running:
docker image ls eftlink
Output:
REPOSITORY TAG IMAGE ID CREATED SIZE
eftlink latest 3a0e731911b4 6 hours ago 596MB
Running in Docker (Standalone)
You will need to decide which configuration file need to be made persistent (live outside of the docker container).
To do this, create a working directory. For example:
mkdir $HOME/eftlink-config
Copy the desire files into this directory and configure them for your intended environment.
The recommended files and folders to persist are as follows:
- tmp
- keys
- log
- EftlinkConfig.properties
- eftlink-rest-api.properties
- jetty.xml
- <core>.properties
- Lang<XX>_<core>.properties
Command example which will run a container with simple bind mounts:
docker run --name eftlink --user eftlink --publish 10100:10100 --publish 8443:8443 /
--volume <path>/tmp:/opt/eftlink/tmp /
--volume <path>/keys:/opt/eftlink/keys
--volume <path>/log:/opt/eftlink/log /
--volume <path>/EftlinkConfig.properties:/opt/eftlink/EftlinkConfig.properties /
--volume <path>/eftlink-rest-api.properties:/opt/eftlink/eftlink-rest-api.properties /
--volume <path>/jetty.xml:/opt/eftlink/jetty.xml /
--volume <path>/<core>.properties:/opt/eftlink/<core>.properties /
--volume <path>/Lang<XX>_<core>.properties:/opt/eftlink/Lang<XX>_<core>.properties /
--tty --rm --interactive --workdir /opt/eftlink eftlink
For example:
docker run --name eftlink --user eftlink --publish 10100:10100 --publish 8443:8443 /
--volume <path>/tmp:/opt/eftlink/tmp /
--volume <path>/keys:/opt/eftlink/keys
--volume <path>/log:/opt/eftlink/log /
--volume <path>/EftlinkConfig.properties:/opt/eftlink/EftlinkConfig.properties /
--volume <path>/eftlink-rest-api.properties:/opt/eftlink/eftlink-rest-api.properties /
--volume <path>/jetty.xml:/opt/eftlink/jetty.xml /
--volume <path>/opiretail.properties:/opt/eftlink/opiretail.properties /
--volume <path>/LangEN_OPIRetail.properties:/opt/eftlink/LangEN_OPIRetail.properties /
--tty --rm --interactive --workdir /opt/eftlink eftlink
To confirm that the container has started, you check the logs file in your working directory or enter:
docker ps | grep <container_name_or_id>
For example:
docker ps | grep eftlink
64c8f733f45e eftlink "/opt/eftlink/startu…" 7 minutes ago Up 7 minutes (healthy) 0.0.0.0:8443->8443/tcp, :::8443->8443/tcp, 0.0.0.0:10100->10100/tcp, :::10100->10100/tcp, 10101-10200/tcp eftlink
Running EFTLink in Docker Swarm
If you want to run EFTLink within a Docker Swarm, follow these steps:
-
Create a Docker swarm:
docker swarm init --advertise-addr <IP ADDRESS>
-
Confirm the machine is now part of the swarm by typing:
docker node ls
-
Create a virtual network within the swarm:
docker network create --scope swarm --driver overlay xst
-
Create a data volume:
For example:
docker volume create eftlink-reg1
-
Create a config.
Docker Configs are where we store config files and other static data.
The recommended files are:
- comms.keystore.properties
- eftlink.private.jks
- eftlink.public.jks
- pos.private.jks
- pos.public.jks
- eftlink.truststore.jks
- eftlink.truststore.properties
- eftlink-rest-api.keystore
- eftlink-rest-api.properties
- jetty.xml
- eftlink-rest-api-log4j2.xml
- log4j2.xml
- EftlinkConfig.properties
- <core>.properties
- Lang<XX>_<core>.properties
-
Add these to the config by running through the files you wish to add:
docker config create <descriptive_name> <file_location>
For example:
docker config create eftlink-reg1-comms.keystore.properties ./keys/comms.keystore.properties
docker config create eftlink-reg1-eftlink.private.jks ./keys/eftlink.private.jks
docker config create eftlink-reg1-eftlink.public.jks ./keys/eftlink.public.jks
docker config create eftlink-reg1-pos.private.jks ./keys/pos.private.jks
docker config create eftlink-reg1-pos.public.jks ./keys/pos.public.jks
docker config create eftlink-reg1-eftlink.truststore.jks ./keys/eftlink.truststore.jks
docker config create eftlink-reg1-eftlink.truststore.properties ./keys/eftlink.truststore.properties
docker config create eftlink-reg1-eftlink-rest-api.keystore ./keys/eftlink-rest-api.keystore
docker config create eftlink-reg1-eftlink-rest-api.properties eftlink-rest-api.properties
docker config create eftlink-reg1-jetty.xml jetty.xml
docker config create eftlink-reg1-eftlink-rest-api-log4j2.xml eftlink-rest-api-log4j2.xml
docker config create eftlink-reg1-log4j2.xml log4j2.xml
docker config create eftlink-reg1-EftlinkConfig.properties EftlinkConfig.properties
docker config create eftlink-reg1-opiretail.properties opiretail.properties
docker config create eftlink-reg1-LangEN_OPIRetail.properties LangEN_OPIRetail.properties
- Run to "docker config ls" to display the config, then docker config inspect <Name> to view each file data (Base 64 encoded).
-
Run the stack.
Below is an example content for a docker-compose-stack.yml. Create the file and copy in everything between the ----
Remember, YAML files are indentation specific. Once you have created the file run:
docker stack deploy -c docker-compose-stack.yml Eftlink-Example
-
To list the service in the stack, run:
docker stack services Eftlink-Example
output:
ID NAME MODE REPLICAS IMAGE PORTS
i43oqdgpwmch Eftlink-Example_eftlink-reg1 replicated 1/1 eftlink:latest
----
version: "3.9"
services:
eftlink-reg1:
hostname: reg1-eftlink
image: eftlink:latest
ports:
- target: 10100
published: 10100
protocol: tcp
mode: host
- target: 10101
published: 10101
protocol: tcp
mode: host
- target: 8443
published: 8443
protocol: tcp
mode: host
- target: 8444
published: 8444
protocol: tcp
mode: host
networks:
- xst
deploy:
replicas: 1
volumes:
- eftlink-log:/opt/eftlink/log
configs:
- source: eftlink-reg1-comms.keystore.properties
target: /opt/eftlink/keys/comms.keystore.properties
uid: '9090'
gid: '9090'
mode: 0440
- source: eftlink-reg1-eftlink.private.jks
target: /opt/eftlink/keys/eftlink.private.jks
uid: '9090'
gid: '9090'
mode: 0440
- source: eftlink-reg1-eftlink.public.jks
target: /opt/eftlink/keys/eftlink.public.jks
uid: '9090'
gid: '9090'
mode: 0440
- source: eftlink-reg1-pos.private.jks
target: /opt/eftlink/keys/pos.private.jks
uid: '9090'
gid: '9090'
mode: 0440
- source: eftlink-reg1-pos.public.jks
target: /opt/eftlink/keys/pos.public.jks
uid: '9090'
gid: '9090'
mode: 0440
- source: eftlink-reg1-eftlink.truststore.jks
target: /opt/eftlink/keys/eftlink.truststore.jks
uid: '9090'
gid: '9090'
mode: 0440
- source: eftlink-reg1-eftlink.truststore.properties
target: /opt/eftlink/keys/eftlink.truststore.properties
uid: '9090'
gid: '9090'
mode: 0440
- source: eftlink-reg1-eftlink-rest-api.keystore
target: /opt/eftlink/keys/eftlink-rest-api.keystore
uid: '9090'
gid: '9090'
mode: 0440
- source: eftlink-reg1-eftlink-rest-api.properties
target: /opt/eftlink/eftlink-rest-api.properties
uid: '9090'
gid: '9090'
mode: 0440
- source: eftlink-reg1-jetty.xml
target: /opt/eftlink/jetty.xml
uid: '9090'
gid: '9090'
mode: 0440
- source: eftlink-reg1-eftlink-rest-api-log4j2.xml
target: /opt/eftlink/eftlink-rest-api-log4j2.xml
uid: '9090'
gid: '9090'
mode: 0440
- source: eftlink-reg1-log4j2.xml
target: /opt/eftlink/log4j2.xml
uid: '9090'
gid: '9090'
mode: 0440
- source: eftlink-reg1-EftlinkConfig.properties
target: /opt/eftlink/EftlinkConfig.properties
uid: '9090'
gid: '9090'
mode: 0440
- source: eftlink-reg1-opiretail.properties
target: /opt/eftlink/opiretail.properties
uid: '9090'
gid: '9090'
mode: 0440
- source: eftlink-reg1-LangEN_OPIRetail.properties
target: /opt/eftlink/LangEN_OPIRetail.properties
uid: '9090'
gid: '9090'
mode: 0440
volumes:
eftlink-tmp:
eftlink-keys:
eftlink-log:
external: true
configs:
eftlink-reg1-comms.keystore.properties:
external: true
eftlink-reg1-eftlink.private.jks:
external: true
eftlink-reg1-eftlink.public.jks:
external: true
eftlink-reg1-pos.private.jks:
external: true
eftlink-reg1-pos.public.jks:
external: true
eftlink-reg1-eftlink.truststore.jks:
external: true
eftlink-reg1-eftlink.truststore.properties:
external: true
eftlink-reg1-eftlink-rest-api.keystore:
external: true
eftlink-reg1-eftlink-rest-api.properties:
external: true
eftlink-reg1-jetty.xml:
external: true
eftlink-reg1-eftlink-rest-api-log4j2.xml:
external: true
eftlink-reg1-log4j2.xml:
external: true
eftlink-reg1-EftlinkConfig.properties:
external: true
eftlink-reg1-opiretail.properties:
external: true
eftlink-reg1-LangEN_OPIRetail.properties:
external: true
networks:
xst:
external: true
----
- Clean up commands:
-
Stop the stack, run:
docker stack rm Eftlink-Example
-
Prune all stopped containers, networks, dangling images and build cache, run:
docker system prune -f
-
Prune all volumes
docker volume prune -f
-
Prune all images (forcing any intermediate images to need to be re-downloaded)
docker image prune -a