Search code examples
dockerrule-engine

How to deply OpenL Tablets with Docker?


I want to deploy OpenL Tablets with Docker. I used the official Docker image for OpenL Tablets WS.

Deploy OpenL Tablets

I started the Docker container as documented:

To use file system repo

To run OpenL Tablets Rule Services with filesystem datasource you can mount your local folder to the container:

$ docker run -d --rm -p 9080:8080 -v <path_to_datasource>:/root/.openl/openl-ruleservice/datasource openltablets/ws
  • -e ruleservice.datasource.filesystem.supportDeployments=true - enables support for deployments
    

Deploy rule

For testing I copied the unzipped first tutorial into the mounted directory, see Chapter 4: Deploy OpenL Tablets Web Services

c. Put your rule project to the appropriate datasource folder. Every rule project should be represented as a separate folder. As an example you can use OpenL Tablets Tutorial that you can download from the OpenL Tablets web site.

Result

After entering URL http://localhost:9080 I see:

Screenshot

What did I do wrong? Why is the tutorial not shown?


Solution

  • I found an answer in the non-Docker installation guide, see OpenL Tablets BRMS Installation Guide:

    4.2 Configuring OpenL Tablets Rule Services for a Local File System Data Source

    Using a file system as a data source for user projects means that projects are stored in a local folder. This folder represents single deployment containing all projects. Each project must also be represented as a separate folder. This is the default data source configured in the system.

    To deploy OpenL Tablets Rule Services, configure a local file system as a data source as follows:

    1. Navigate to the <TOMCAT_HOME>\webapps folder and extract the OpenL Tablets Rule Services WAR file. For example, right click the OpenL Tablets Rule Services WAR file name and select 7-zip > Open archive. For more information on downloading OpenL Tablets Rule Services as a WAR file, see Downloading Preconfigured OpenL Tablets Rule Services.

    2. Navigate to the WEB-INF\classes folder, open the application.properties file, and for the ruleservice.datasource.dir setting, define the address to the folder with projects.

      For example:
      ruleservice.datasource.dir = d:/datasource/

      Note that for proper parsing of Java properties file, the path to the folder must be defined with a slash (‘/’) as the folders delimiter. Back slash “\” is not allowed.

    3. Check if the property is defined as production-repository.factory = org.openl.rules.repository.LocalRepositoryFactory.

    After adding environment variables

    • production-repository.factory
    • ruleservice.datasource.dir

    it works.

    docker run  \
      --detach  \
      --publish 9080:8080 \
      --mount type=bind,source=/home/ubuntu/openl/datasource,target=/root/datasource,readonly \
      --env production-repository.factory=org.openl.rules.repository.LocalRepositoryFactory \
      --env ruleservice.datasource.dir=/root/datasource \
      openltablets/ws