Importer Manual / Version 2310
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-templateinto 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.propertiesto 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.inboxmust keep its value to match the volume mapping defined in later steps.import.multiResultGeneratorFactory.property.sleepingSecondsmust keep its value because repeated import must be controlled through another variable (see below).Also replace all occurrences of
cm-xmlimportwithmy-xmlimportin 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=arm64to 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_healthyIf you chose a name other than
my-xmlimport, rename all occurrences (including the value ofIMPORT_COMMAND) accordingly.Adjust
IMPORT_SLEEPING_SECONDSto the desired waiting time between two imports.Change
/my/external/inbox/directoryto the directory where import files will be available. This directory must be readable and writable from the Docker host.Configuration in
capclient.propertiesandmy-xmlimport.propertiesmay 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-serverat 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.propertiesdirectly or by mounting an external file with updated values.Add the finished compose file to your Docker compose setup via variable
COMPOSE_FILEand start your Docker compose setup as described in Section 3.2.2, “Docker Compose Setup” in Blueprint Developer Manual .


