Generate custom Rule Engine Docker images

This topic describes how to generate and configure custom Rule Engine images using Dockerfile scripts.

For details on how to download and run pre-built Docker images, see Run pre-built Rule Engine images.

You can generate and configure Rule Engine images from :

Generate a new Rule Engine Docker image

Set up your local environment

The following component is required on your system: Docker version 1.17.x

Step 1—Build your Docker images

Docker images are required to generate your Rule Engine configuration. To build your Docker images, perform the following steps:

1. Unzip the file containing the Docker scripts available from Axway Support. For example:

AccountingIntegrator_2.3.0_DockerImage-linux-x86-64_BN<n>.zip

2. Copy the DockerFile Sample from the directory in which you unzipped the Docker image, and copy it to a working directory.

3-Edit the file DockerFile Sample and adapt it to your case, if needed.

To copy the configuration (mvt, ctx) files from your Docker host environment to the custom image, use the following command:

docker build -f Dockerfile-sample --no-cache --rm \

--build-arg MVT=[mvt_file] \

--build-arg CTX=[ctx_file] \

-t [RuleEngineFile_CustomImage_Name] <context dir>

Note   <context dir> is the build context directory in which [mvt_file] and [ctx_file] are located. Set to ‘.’ for current directory.

Caution:

  • The Dockerfile-sample file must be in the <context dir> directory.
  • The mvt and ctx files, must exist. If they do not, you must use an empty file. The file path to these files must be relative and they must be inside the <context dir> directory (Docker restriction).
  • To manage the Rule Engine license in Docker, uncomment the following line and replace the [license key] field with your license, so you can import it into the sample image:
  • #RUN echo "[license key]" > $RDJ_HOME/res/rdjkey.txt
  • The sample image built with this command contains the default script file from the SIC. It is possible to embed a specific script.fic file, modify the Dockerfile-sample as follows:
  • …..

    COPY $MVT $RDJ_EXEC/dat

    COPY $CTX $RDJ_EXEC/dat

    ### Add customer specific script

    COPY <local_script_file_path> $RDJ_EXEC/dat

Step 2—Run and test your Rule Engine system

You can run and test your images locally by launching the following Docker run command:

docker run --rm -e LOCAL_USER_ID=`id -u $USER` \

-e IEVENT_FILE=[ievent_file_name] \

-e SESSION=[session_name] \

-e PROCESS_CONTEXT_IN=[Process_Context_in] \

-v [Local_Input_Dir]:/home/ai-user/RuleEngineFile/runtimes \ /EXEC/share/input \

- v [Local_Output_Dir]:/home/ai-ai-user/RuleEngineFile/runtimes \ /EXEC/share/output \ [RuleEngineFile_CustomImage_Name]

It launches the container as an executable and removes it (--rm) after the automatic rdjexp command is finished.

The outputs (bres,edi,log), are exported from a container volume in a shared directory on the docker host [Local_Output_Dir] through the -v option.

It is mandatory to set the LOCAL_USER_ID environment variable, in order to grant access rights to the data exported from the container in the shared directory.

Other arguments must be provided in order to run rdjexp with customer specific data :

  • IEVENT_FILE: the name of IEvent file. For instance: -e IEVENT_FILE=IEvent.seq
  • SESSION: use this environment variable to set the SESSION of script.fic file.
  • PROCESS_CONTEXT_IN : use this environment variable to set the context for the session.
  • -v [Local_Input_Dir]:/home/ai-user/RuleEngineFile/runtimes/ EXEC/share/input:
  • [Local_Input_Dir] absolute path to a directory that contains IEvent file.
  • -v [Local_Output_Dir]:/home/ai-user/RuleEngineFile/runtimes/ EXEC/share/output:
  • [Local_Output_Dir] absolute path to a directory that will contains output produced by Rule Engine.
  • Caution This directory must exists before the command is issued.
Note   If the image has been built with a specific script file, it is not necessary to set SESSION and PROCESS_CONTEXT_IN.

For information on how to launch with exits, see the Rule Engine Exits and External Calls Guide.

Generate a new Rule Engine Docker image from an old Rule Engine Docker image configuration

When an image is updated several times, new layers can degrade the image performance. In addition, the number of layers an image can have is limited.

For this reason, it is better to extract the configuration of the image and create a new image. This way there will only be a single update.

Also, when a new service pack is installed, the configuration must be extracted from an old custom image to deploy it on a new custom image.

To create a new image with a previous configuration, you can use Dockerfile script Sample-Ext with two stages:

  • Stage config-ext is extracting configuration from the old custom Rule Engine image
  • Stage config-dep is deploying this extracted configuration and new updates from the delivered Docker image

Step 1—Build your old Docker image

For information on how to build your old Docker image, see Step 1—Build your Docker images.

Step 2—Build your Docker images with configuration extraction from your old Docker image

1-Copy the DockerFile Sample Ext from the directory in which you unzipped the Docker image, and copy it to a working directory.

2-Edit the file DockerFile Sample Ext and adapt it to your case, if needed.

To copy the configuration (mvt, ctx) files from your Docker host environment to the custom image, use the following command:

docker build -f Dockerfile-sample-ext --no-cache --rm \

--build-arg MVT=[mvt_file] \

--build-arg CTX=[ctx_file] \

-t [RuleEngineFile_CustomNewImage_Name] <context dir>

Note   <context dir> is the build context directory in which [mvt_file] and [ctx_file] are located. Set to ‘.’ for current directory.

Caution:

  • The Dockerfile-sample file must be in the <context dir> directory.
  • The mvt and ctx files, must exist. If they do not, you must use an empty file. The file path to these files must be relative and they must be inside the <context dir> directory (Docker restriction).
  • To manage the Rule Engine license in Docker, uncomment the following line and replace the [license key] field with your license, so you can import it into the sample image:
  • #RUN echo "[license key]" > $RDJ_HOME/res/rdjkey.txt
  • The sample image built with this command contains the default script file from the SIC. It is possible to embed a specific script.fic file issued from an old image. To do so, modify the Dockerfile-sample-ext in stage config-dep as follows:
  • …..

    ###Copy old configuration

    COPY --from=config-ext $RDJ_EXEC/dat/sys.dat $RDJ_EXEC/dat

    COPY --from=config-ext $RDJ_EXEC/dat/usr.dat $RDJ_EXEC/dat

    COPY --from=config-ext $RDJ_EXEC/dat/mvttrf.mvt $RDJ_EXEC/dat/mvt.mvt

    ### Add customer specific script

    COPY --from=config-ext $RDJ_EXEC/dat/script.fic $RDJ_EXEC/dat

Step 3—Run and test your Rule Engine system

You can run and test your images locally by launching the following Docker run command:

docker run --rm -e LOCAL_USER_ID=`id -u $USER` \

-e IEVENT_FILE=[ievent_file_name] \

-e SESSION=[session_name] \

-e PROCESS_CONTEXT_IN=[Process_Context_in] \

-v [Local_Input_Dir]:/home/ai-user/RuleEngineFile/runtimes \ /EXEC/share/input \

- v [Local_Output_Dir]:/home/ai-ai-user/RuleEngineFile/runtimes \ /EXEC/share/output \ [RuleEngineFile_CustomNewImage_Name]

It launches the container as an executable and removes it (--rm) after the automatic rdjexp command is finished.

[Local_Input_Dir] and [Local_Output_Dir] docker host directories are mounted into the container through the -v option.

It is mandatory to set the LOCAL_USER_ID environment variable, in order to grant access rights to the data exported from the container in the shared directory.

Other arguments must be provided in order to run rdjexp with customer specific data :

  • IEVENT_FILE: the name of IEvent file. For instance: -e IEVENT_FILE=IEvent.seq
  • SESSION: use this environment variable to set the SESSION of script.fic file.
  • PROCESS_CONTEXT_IN : use this environment variable to set the context for the session.
  • -v [Local_Input_Dir]:/home/ai-user/RuleEngineFile/runtimes/ EXEC/share/input:
  • [Local_Input_Dir] absolute path to a directory that contains IEvent file.
  • -v [Local_Output_Dir]:/home/ai-user/RuleEngineFile/runtimes/ EXEC/share/output:
  • [Local_Output_Dir] absolute path to a directory that will contains output produced by Rule Engine.
  • Caution This directory must exists before the command is issued.
Note   If the image has been built with a specific script file, it is not necessary to set SESSION and PROCESS_CONTEXT_IN.

For information on how to launch with exits, see the Rule Engine Exits and External Calls Guide.

Related Links