Chapter 4. Using an external Maven repository to deploy a decision service

You can use an external Maven repository (for example, Nexus) to set up an integration process. You can configure Decision Central to push decision service files into the external repository instead of the built-in repository.

You can still use Decision Central to deploy decision services on a test Decision Server. However, in this process, other Decision Server (for example, staging and production) are not connected to Decision Central. Instead, they retrieve the decision service KJAR files and any necessary dependencies from your Maven repository. You can progress the KJAR versions through your repository as necessary, in line with the integration process that you want to implement.

If you deploy a Decision Server on OpenShift, you can configure it to load and start a decision service from a Maven repository automatically.

If you deploy a Decision Server on premises, you can configure access to a Maven repository when setting up the server. Then you can use the REST API of the server to load and start a decision service from the repository. A Maven project and a Java client library for automating the API calls are available.

4.1. Configuring Decision Central to use an external Maven repository

You can configure Decision Central to use an external Maven repository instead of its built-in repository. In this case, Decision Central pushes all the built KJAR files into this repository. You can progress these files through the repository as necessary to implement your integration process.

Important

Using an external Maven repository in Decision Central deployed on OpenShift is not supported.

Procedure

  1. Install the Decision Central. See Installing Red Hat Decision Manager on premise for instructions.
  2. Create a Maven settings.xml file with connetion and access details for your external repository. For details about the settings.xml file, see Maven documentation: https://maven.apache.org/settings.html .
  3. In the <eap_home>/standalone/configuration/standalone.xml file, under the <system-properties> tag, set the kie.maven.settings.custom property to the full pathname of the settings.xml file, for example:

    <property name="kie.maven.settings.custom" value="/opt/custom-config/settings.xml"/>
  4. Start or restart the Decision Central.

4.2. Configuring a Decision Server to run a decision service

You can configure a Decision Server to load and run a decision service automatically without using a Decision Central. The service must be present in a Maven repository. You need access information for the repository and the GAV values for the service. You can also stop and delete the service from this server at a later time. You can start several services on one Decision Server at the same time.

Important

Do not use this procedure for a Decision Server deployed on OpenShift. See Deploying Red Hat Decision Manager on Red Hat OpenShift Container Platform for instructions about configuring a a Decision Server to load and run a decision service from a Maven repository.

4.2.1. Configuring a Decision Server to use a Maven repository

Before you can load and start a decision service on a Decision Server, you need to configure the server to use your Maven repository.

Procedure

  1. Install the Decision Server. See Installing Red Hat Decision Manager on premise for instructions.
  2. Create a Maven settings.xml file with connetion and access details for your external repository. For details about the settings.xml file, see Maven documentation: https://maven.apache.org/settings.html .
  3. In the <eap_home>/standalone/configuration/standalone.xml file, under the <system-properties> tag, set the kie.maven.settings.custom property to the full pathname of the settings.xml file, for example:

    <property name="kie.maven.settings.custom" value="/opt/custom-config/settings.xml"/>
  4. Start or restart the Decision Server.

4.2.2. Loading and starting a service on the Decision Server

If you have configured a Decision Server to use a Maven repository, you can use an API call to load a service. The service is started automatically.

Procedure

  1. To load a service into a container in the Decision Server and start it, run the following command to send an API request:

    $ curl --user "<username>:<password>" -H "Content-Type: application/json" -X PUT -d '{"container-id" : "<containerID>","release-id" : {"group-id" : "<groupID>","artifact-id" : "<artifactID>","version" : "<version>"}}' http://<serverhost>:<serverport>/kie-server/services/rest/server/containers/<containerID>

    where:

    • <username> is the user name for an account that can log onto the Decision Server and administer it.
    • <password> is the password for the account.
    • <containerID> is the identifier for the container. You can use any random identifier but it must be the same in both places in the command (the URL and the data).
    • <groupID>, <artifactID>, version are GAV values.
    • <serverhost> is the host name for the KIE server, or localhost if you are running the command on the same host as the KIE server.
    • <serverport> is the port number for the KIE server

      For example:

      curl --user "rhdmAdmin:password@1" -H "Content-Type: application/json" -X PUT -d '{"container-id" : "kie1","release-id" : {"group-id" : "org.kie.server.testing","artifact-id" : "container-crud-tests1","version" : "2.1.0.GA"}}' http://localhost:39043/kie-server/services/rest/server/containers/kie1

4.2.3. Stopping and removing a service from the Decision Server

You can use an API call to stop and remove a service from the Decision Server. You need the container identifier that was configured when loading the service.

Procedure

  1. To stop and remove a container with a service on the Decision Server, run the following command to send an API request:

    $ curl --user "<username>:<password>" -X DELETE http://<serverhost>:<serverport>/kie-server/services/rest/server/containers/<containerID>

    where:

    • <username> is the user name for an account that can log onto the Decision Server and administer it.
    • <password> is the password for the account.
    • <containerID> is the identifier for the container.
    • <serverhost> is the host name for the KIE server, or localhost if you are running the command on the same host as the KIE server.
    • <serverport> is the port number for the KIE server

      For example:

      curl --user "rhdmAdmin:password@1" -X DELETE http://localhost:39043/kie-server/services/rest/server/containers/kie1