Chapter 2. Project deployment in Business Central

You can use Business Central to develop your business assets and services and to manage Process Servers configured for project deployment. When your project is developed, you can build the project in Business Central and deploy it automatically to the Process Server. To enable automatic deployment, Business Central includes a built-in Maven repository. From Business Central, you can start, stop, or remove the deployment units (KIE containers) that contain the services and their project versions that you have built and deployed.

You can also connect several Process Servers to the same Business Central instance and group them into different server configurations (in MenuDeployExecution Servers). Servers belonging to the same server configuration run the same services, but you can deploy different projects or different versions of projects on different configurations.

For example, you could have test servers in the Test configuration and production servers in a Production configuration. As you develop business assets and services in a project, you deploy the project on the Test server configuration and then, when a version of the project is sufficiently tested, you can deploy it on the Production server configuration. In this case, to keep developing the project, change the version in the project settings. Then the new version and the old version are seen as different artifacts in the built-in Maven repository. You can deploy the new version on the Test server configuration and keep running the old version on the Production server configuration. This deployment process is simple but has significant limitations. Notably, there is not enough access control: a developer can deploy a project directly into a production environment.

Important

You cannot move a Process Server into a different server configuration using Business Central. You must change the configuration file of the server to change the server configuration name for it.

2.1. Configuring a Process Server to connect to Business Central

If a Process Server is not already configured in your Red Hat Process Automation Manager environment, or if you require additional Process Servers in your Red Hat Process Automation Manager environment, you must configure a Process Server to connect to Business Central.

Note

If you are deploying Process Server on Red Hat OpenShift Container Platform, see Deploying a Red Hat Process Automation Manager freeform managed server environment on Red Hat OpenShift Container Platform for instructions about configuring it to connect to Business Central.

Prerequisites

Procedure

  1. In your Red Hat Process Automation Manager installation directory, navigate to the standalone-full.xml file. For example, if you use a Red Hat JBoss EAP installation for Red Hat Process Automation Manager, go to $EAP_HOME/standalone/configuration/standalone-full.xml.
  2. Open standalone-full.xml and under the <system-properties> tag, set the following properties:

    • org.kie.server.controller.user: The user name of a user who can log in to the Business Central.
    • org.kie.server.controller.pwd: The password of the user who can log in to the Business Central.
    • org.kie.server.controller: The URL for connecting to the API of Business Central. Normally, the URL is http://<centralhost>:<centralport>/business-central/rest/controller, where <centralhost> and <centralport> are the host name and port for Business Central. If Business Central is deployed on OpenShift, remove business-central/ from the URL.
    • org.kie.server.location: The URL for connecting to the API of Process Server. Normally, the URL is http://<serverhost>:<serverport>/kie-server/services/rest/server, where <serverhost> and <serverport> are the host name and port for Process Server.
    • org.kie.server.id: The name of a server configuration. If this server configuration does not exist in Business Central, it is created automatically when Process Server connects to Business Central.

    Example:

    <property name="org.kie.server.controller.user" value="central_user"/>
    <property name="org.kie.server.controller.pwd" value="central_password"/>
    <property name="org.kie.server.controller" value="http://central.example.com:8080/business-central/rest/controller"/>
    <property name="org.kie.server.location" value="http://kieserver.example.com:8080/kie-server/services/rest/server"/>
    <property name="org.kie.server.id" value="production-servers"/>
  3. Start or restart the Process Server.

2.2. Configuring the environment mode in Process Server and Business Central

You can set Process Server to run in production mode or in development mode. Development mode provides a flexible deployment policy that enables you to update existing deployment units (KIE containers) while maintaining active process instances for small changes. It also enables you to reset the deployment unit state before updating active process instances for larger changes. Production mode is optimal for production environments, where each deployment creates a new deployment unit.

In a development environment, you can click Deploy in Business Central to deploy the built KJAR file to a Process Server without stopping any running instances (if applicable), or click Redeploy to deploy the built KJAR file and replace all instances. The next time you deploy or redeploy the built KJAR, the previous deployment unit (KIE container) is automatically updated in the same target Process Server.

In a production environment, the Redeploy option in Business Central is disabled and you can click only Deploy to deploy the built KJAR file to a new deployment unit (KIE container) on a Process Server.

Procedure

  1. To configure the Process Server environment mode, set the org.kie.server.mode system property to org.kie.server.mode=development or org.kie.server.mode=production.
  2. To configure the deployment behavior for a project in Business Central, go to project SettingsGeneral SettingsVersion and toggle the Development Mode option.

    Note

    By default, Process Server and all new projects in Business Central are in development mode.

    You cannot deploy a project with Development Mode turned on or with a manually added SNAPSHOT version suffix to a Process Server that is in production mode.

2.3. Configuring an external Maven repository for Business Central and Process Server

You can configure Business Central and Process Server to use an external Maven repository, such as Nexus or Artifactory, instead of the built-in repository. This enables Business Central and Process Server to access and download artifacts that are maintained in the external Maven repository.

Note

For information about configuring an external Maven repository for an authoring environment on Red Hat OpenShift Container Platform, see the following documents:

Prerequisites

Procedure

  1. Create a Maven settings.xml file with connection and access details for your external repository. For details about the settings.xml file, see the Maven Settings Reference.
  2. Save the file in a known location, for example, /opt/custom-config/settings.xml.
  3. In your Red Hat Process Automation Manager installation directory, navigate to the standalone-full.xml file. For example, if you use a Red Hat JBoss EAP installation for Red Hat Process Automation Manager, go to $EAP_HOME/standalone/configuration/standalone-full.xml.
  4. Open standalone-full.xml and under the <system-properties> tag, set the kie.maven.settings.custom property to the full path name of the settings.xml file.

    For example:

    <property name="kie.maven.settings.custom" value="/opt/custom-config/settings.xml"/>
  5. Start or restart Business Central and Process Server.

Next steps

For each Business Central project that you want to export or push as a KJAR artifact to the external Maven repository, you must add the repository information in the project pom.xml file. For instructions, see Section 2.4, “Exporting a Business Central project to an external Maven repository”.

2.4. Exporting a Business Central project to an external Maven repository

If you configured an external Maven repository for Business Central and Process Server, you must add the repository information in the pom.xml file for each Business Central project that you want to export or push as a KJAR artifact to that external repository. You can then progress the project KJAR files through the repository as necessary to implement your integration process, and deploy the KJAR files using Business Central or the Process Server REST API.

Prerequisites

Procedure

  1. In Business Central, go to MenuDesignProjects, click the project name, and select any asset in the project.
  2. In the Project Explorer menu on the left side of the screen, click the Customize View gear icon and select Repository Viewpom.xml.
  3. Add the following settings at the end of the project pom.xml file (before the </project> closing tag). The values must correspond to the settings that you defined in your settings.xml file.

    <distributionManagement>
    <repository>
    <id>${maven-repo-id}</id>
    <url>${maven-repo-url}</url>
    <layout>default</layout>
    </repository>
    </distributionManagement>
  4. Click Save to save the pom.xml file changes.

Repeat this procedure for each Business Central project that you want to export or push as a KJAR artifact to the external Maven repository.

2.5. Building and deploying a project in Business Central

After your project is developed, you can build the project in Business Central and deploy it to the configured Process Server. Projects in Business Central are packaged automatically as KJARs with all necessary components when you build and deploy the projects.

Procedure

  1. In Business Central, go to MenuDesignProjects and click the project name.
  2. In the upper-right corner, click Deploy to build the project and deploy it to a Process Server. To compile the project without deploying it to Process Server, click Build.

    Note

    You can also select the Build & Install option to build the project and publish the KJAR file to the configured Maven repository without deploying to a Process Server. In a development environment, you can click Deploy to deploy the built KJAR file to a Process Server without stopping any running instances (if applicable), or click Redeploy to deploy the built KJAR file and replace all instances. The next time you deploy or redeploy the built KJAR, the previous deployment unit (KIE container) is automatically updated in the same target Process Server. In a production environment, the Redeploy option is disabled and you can click Deploy only to deploy the built KJAR file to a new deployment unit (KIE container) on a Process Server.

    To configure the Process Server environment mode, set the org.kie.server.mode system property to org.kie.server.mode=development or org.kie.server.mode=production. To configure the deployment behavior for a corresponding project in Business Central, go to project SettingsGeneral SettingsVersion and toggle the Development Mode option. By default, Process Server and all new projects in Business Central are in development mode. You cannot deploy a project with Development Mode turned on or with a manually added SNAPSHOT version suffix to a Process Server that is in production mode.

    If only one Process Server is connected to Business Central, or if all connected Process Servers are in the same server configuration, the services in the project are started automatically in a deployment unit (KIE container).

    If multiple server configurations are available, a deployment dialog is displayed in Business Central, prompting you to specify server and deployment details.

  3. If the deployment dialog appears, verify or set the following values:

    • Deployment Unit Id / Deployment Unit Alias: Verify the name and alias of the deployment unit (KIE container) running the service within the Process Server. You normally do not need to change these settings. For more information about KIE container aliases, see Section 2.6.3, “KIE container aliases”.
    • Server Configuration: Select the server configuration for deploying this project. You can later deploy it to other configured servers without rebuilding the project.
    • Start Deployment Unit?: Verify that this box is selected to start the deployment unit (KIE container). If you clear this box, the service is deployed onto the server but not started.

2.6. Deployment units in Business Central

The services in a project are consumed at run time through an instantiated KIE container, or deployment unit, on a configured Process Server. When you build and deploy a project in Business Central, the deployment unit is created automatically in the configured server. You can start, stop, or remove deployment units in Business Central as needed. You can also create additional deployment units from previously built projects and start them on existing or new Process Servers configured in Business Central.

2.6.1. Creating a deployment unit in Business Central

One or more deployment units should already exist as part of your Red Hat Process Automation Manager configuration, but if not, you can create a deployment unit from a project that was previously built in Business Central.

Prerequisites

  • The project for which you are creating the new deployment unit has been built in Business Central.

Procedure

  1. In Business Central, go to MenuDeployExecution servers.
  2. Under Server Configurations, select an existing configuration or click New Server Configuration to create a configuration.
  3. Under Deployment Units, click Add Deployment Unit.
  4. Add an alias in the Alias field if required.
  5. In the table within the window, select a GAV and click Select next to the GAV to populate the deployment unit data fields.
  6. Select the Start Deployment Unit? box to start the service immediately, or clear the box to start it later.
  7. Click Finish.

    The new deployment unit for the service is created and placed on the Process Servers that are configured for this server configuration. If you have selected Start Deployment Unit?, the service is started.

2.6.2. Starting, stopping, and removing deployment units in Business Central

When a deployment unit is started, the services in the deployment unit are available for use. If only one Process Server is connected to Business Central, or if all connected Process Servers are in the same server configuration, services are started in a deployment unit automatically when a project is deployed. If multiple server configurations are available, you are prompted upon deployment to specify server and deployment details and to start the deployment unit. However, at any time you can manually start, stop, or remove deployment units in Business Central to manage your deployed services as needed.

Procedure

  1. In Business Central, go to MenuDeployExecution servers.
  2. Under Server Configurations, select a configuration.
  3. Under Deployment Units, select a deployment unit.
  4. Click Start, Stop, or Remove in the upper-right corner. To remove a running deployment unit, stop it and then remove it.

2.6.3. KIE container aliases

An alias for a KIE container (deployment unit) is a proxy in the Process Server instance that helps in handling different versions of the same container deployment. You can link a single alias to different versions of a container. When a container is upgraded, the linked alias automatically points to the new version of the container. For information about creating a KIE container alias, see Section 2.6.1, “Creating a deployment unit in Business Central”.

For example, if a client application is changing every time a new version of a container is deployed, then the client application can point to the container alias. When a new container version is deployed, the associated alias is updated and all the requests are routed automatically to the new container without changing the client application.

Consider an example project that contains a single process and uses the following properties:

  • GroupId: org.jbpm
  • ArtifactId: my-project
  • Version: 1.0
  • containerID: my-project

When you update, build, and deploy the above project, the associated project is updated in the Process Server with the latest version and contains the following properties:

  • GroupId: org.jbpm
  • ArtifactId: my-project
  • Version: 2.0

If you want to deploy the latest version of the project, you need to update the containerID as my-project2 because the my-project container points to the old version.

Note

Every project version contains a different containerID name. The associated client applications need to be aware of all versions of the projects they interact with.

Container aliases also help you manage KIE containers. You can set the container aliases explicitly when creating a container, or implicitly based on the associated ArtifactId name. You can add a single alias to multiple containers if required. If you do not specify a container alias, then the ArtifactId of a project is set as the container alias by default.

When you set an alias for multiple containers that contain different GroupId and ArtifactId names, then you can use the same alias every time to interact with the Process Server.

You typically use container aliases in the following use cases:

  • Starting a new process instance on the client application with the latest version of the process
  • Interacting with an existing process of a specific version
  • Interacting with an existing task in a process
  • Interacting with a process definition image and form

For example, after you deploy the 1.0 version of a project, you send a POST request to the following Process Server REST API endpoint to start the process in the project:

/http://localhost:8230/kie-server/services/rest/server/containers/my-project/processes/evaluation/instances

The sent request starts a new process instance from org.jbpm:my-project:1.0 in which my-project is defined as the container alias. Later, when you deploy the 2.0 version of the project and send the same request, a new instance starts from org.jbpm:my-project:2.0. You can deploy the latest version of the process without adding the containerID name.

2.7. Editing the GAV values for a project in Business Central

The GroupId, ArtifactId, and Version (GAV) values identify a project in a Maven repository. When Business Central and Process Server are on the same file system and use the same Maven repository, the project is automatically updated in the repository each time you build a new version of your project. However, if Business Central and Process Server are on separate file systems and use separate local Maven repositories, you must update a project GAV value, usually the version, for any new versions of the project to ensure that the project is seen as a different artifact alongside the old version.

Note

For development purposes only, you can toggle the Development Mode option in project SettingsGeneral SettingsVersion to add the SNAPSHOT suffix in the project version. This suffix instructs Maven to get a new snapshot update according to the Maven policy. Do not use Development Mode or manually add the SNAPSHOT version suffix for a production environment.

You can set the GAV values in the project Settings screen.

Procedure

  1. In Business Central, go to MenuDesignProjects and click the project name.
  2. Click the project Settings tab.
  3. In General Settings, modify the Group ID, Artifact ID, or Version fields as necessary. If you have deployed the project and are developing a new version, usually you need to increase the version number.

    Note

    For development purposes only, you can toggle the Development Mode option in project SettingsGeneral SettingsVersion to add the SNAPSHOT suffix in the project version. This suffix instructs Maven to get a new snapshot update according to the Maven policy. Do not use Development Mode or manually add the SNAPSHOT version suffix for a production environment.

  4. Click Save to finish.

2.8. Duplicate GAV detection in Business Central

In Business Central, all Maven repositories are checked for any duplicated GroupId, ArtifactId, and Version (GAV) values in a project. If a GAV duplicate exists, the performed operation is canceled.

Note

Duplicate GAV detection is disabled for projects in Development Mode. To enable duplicate GAV detection in Business Central, go to project SettingsGeneral SettingsVersion and toggle the Development Mode option to OFF (if applicable).

Duplicate GAV detection is executed every time you perform the following operations:

  • Save a project definition for the project.
  • Save the pom.xml file.
  • Install, build, or deploy a project.

The following Maven repositories are checked for duplicate GAVs:

  • Repositories specified in the <repositories> and <distributionManagement> elements of the pom.xml file.
  • Repositories specified in the Maven settings.xml configuration file.

2.8.1. Managing duplicate GAV detection settings in Business Central

Business Central users with the admin role can modify the list of repositories that are checked for duplicate GroupId, ArtifactId, and Version (GAV) values for a project.

Note

Duplicate GAV detection is disabled for projects in Development Mode. To enable duplicate GAV detection in Business Central, go to project SettingsGeneral SettingsVersion and toggle the Development Mode option to OFF (if applicable).

Procedure

  1. In Business Central, go to MenuDesignProjects and click the project name.
  2. Click the project Settings tab and then click Validation to open the list of repositories.
  3. Select or clear any of the listed repository options to enable or disable duplicate GAV detection.

    In the future, duplicate GAVs will be reported for only the repositories you have enabled for validation.

    Note

    To disable this feature, set the org.guvnor.project.gav.check.disabled system property to true for Business Central at system startup:

    $ ~/EAP_HOME/bin/standalone.sh -c standalone-full.xml
    -Dorg.guvnor.project.gav.check.disabled=true