close

Filter

Importer Manual / Version 2406.1

Table Of Contents

3.4 Deployment and Operation of an Importer in Docker

Setting 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:

  1. With the integration of importer-template into your workspace as described in the previous section, you have already created a copy of importer-image (we will assume new name my-importer-image).

  2. 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).

  3. Also replace all occurrences of cm-xmlimport with my-xmlimport in module my-importer-image.

  4. 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.

  5. 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 of IMPORT_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 and my-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 file capclient.properties directly or by mounting an external file with updated values.

  6. 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 .

Search Results

Table Of Contents
warning

Your Internet Explorer is no longer supported.

Please use Mozilla Firefox, Google Chrome, or Microsoft Edge.