Importer Manual / Version 2406.0
Table Of ContentsSetting up the Importer to Run in Docker
The importer can be run in a Docker container. For this purpose, a CoreMedia Blueprint example module
importer-image
is provided in importer-template
.
To run an importer in a Docker container, follow these steps:
With the integration of
importer-template
into your workspace as described in the previous section, you have already created a copy ofimporter-image
(we will assume new namemy-importer-image
).In this copy, rename file
my-importer-image/.../cm-xmlimport.properties
to match the name chosen during the steps of the previous section (e.g.,my-xmlimport.properties
). Adjust the contents of this file as you did during these steps but make sure the following properties remain unchanged:import.multiResultGeneratorFactory.property.inbox = /coremedia/import import.multiResultGeneratorFactory.property.sleepingSeconds = -1
import.multiResultGeneratorFactory.property.inbox
must keep its value to match the volume mapping defined in later steps.import.multiResultGeneratorFactory.property.sleepingSeconds
must keep its value because repeated import must be controlled through another variable (see below).Also replace all occurrences of
cm-xmlimport
withmy-xmlimport
in modulemy-importer-image
.Build the Docker image with the following command:
mvn clean install -Pdefault-image -pl :my-importer-image -am
If you want to build an image for ARM processors, you need to pass the property
-Dapplication.image-arch=arm64
to the Maven build.The default image configuration is prepared to integrate in a Docker compose setup as described in Section 3.2.2, “Docker Compose Setup” in Blueprint Developer Manual . To add the importer container to this setup, create a compose file as follows:
services: my-xmlimport: image: ${REPOSITORY_PREFIX:-coremedia}/my-xmlimport:${IMPORTER_TAG:-latest} container_name: my-xmlimport ports: - 41380:8080 - 41381:8081 - 41305:5005 environment: # seconds to wait before next import. "-1" runs importer only once and then exits container. IMPORT_SLEEPING_SECONDS: 60 # name of importer JPIF IMPORT_COMMAND: "my-xmlimport" volumes: # required: set "real" inbox directory (available on Docker host; left-hand side) and # match container-internal inbox directory (right-hand side) with setting "import.multiResultGeneratorFactory.property.inbox" - /my/external/inbox/directory:/coremedia/import # optional: provide mounted capclient.properties for connection to Content Management Server # overrides default capclient.properties in Docker container #- /my/external/capclient.properties:/coremedia/tools/properties/corem/capclient.properties # optional: provide mounted my-xmlimport.properties for importer configuration # overrides default my-xmlimport.properties in Docker container #- /my/external/import.properties:/coremedia/tools/properties/corem/my-xmlimport.properties networks: - backend depends_on: content-management-server: condition: service_healthy
If you chose a name other than
my-xmlimport
, rename all occurrences (including the value ofIMPORT_COMMAND
) accordingly.Adjust
IMPORT_SLEEPING_SECONDS
to the desired waiting time between two imports.Change
/my/external/inbox/directory
to the directory where import files will be available. This directory must be readable and writable from the Docker host.Configuration in
capclient.properties
andmy-xmlimport.properties
may be overridden upon Docker container start by uncommenting and adjusting the corresponding optional configurations in the compose file. The values defined in the property files cannot be overridden via Docker environment variables, therefore the "mounting" approach can be used.Per default, e.g., the importer will connect to host
content-management-server
at port 8080 which matches the default Docker compose setup as described in Section 3.2.2, “Docker Compose Setup” in Blueprint Developer Manual . This can be overriden by changing source filecapclient.properties
directly or by mounting an external file with updated values.Add the finished compose file to your Docker compose setup via variable
COMPOSE_FILE
and start your Docker compose setup as described in Section 3.2.2, “Docker Compose Setup” in Blueprint Developer Manual .