Red Hat Training

A Red Hat training course is available for Red Hat Decision Manager

Chapter 3. Environment with immutable servers

You can deploy an environment that includes one or more pods running Decision Server with preloaded services. Each Decision Server pod can be separately scaled as necessary.

In this case, any services (KJAR files) must be loaded onto a Decision Server at the time the image is created. You cannot load or unload services on a running Decision Server. The advantage of this approach is that the Decision Server with the services in it runs like any other containerized service and does not require specialized management. The Decision Server runs like any other pod on the OpenShift environment; you can use any container-based integration workflows as necessary.

When you create a Decision Server image, you can build your services using S2I (Source to Image). Provide a Git repository with the source of your services and other business assets; if you develop the services or assets in Decision Central, copy the source into a separate repository for the S2I build. OpenShift automatically builds the source, installs the services into the Decision Server image, and starts the containers with the services.

If you are using Decision Central for authoring services, you can extract the source for your process and place it into a separate Git repository (such as GitHub or an on-premise installation of GitLab) for use in the S2I build.

Alternatively, you can create a similar Decision Server deployment using services that are already built as KJAR files. In this case, you must provide the services in a Maven repository; you can use the built-in repository of the Decision Central or your own repository (for example, a Nexus deployment). The KJAR files are retrieved from the Maven repository during the startup of the pod and not updated or changed after that. The files are retrieved at every restart or scaling of the pod, so you must ensure they do not change on the Maven repository to keep the deployment immutable.

With both methods of creating immutable images, no further management of the image is required. If you want to use a new version of a service, you can build a new image.

3.1. Deploying an immutable Decision Server from service source code

To deploy an immutable Decision Server from service source code, use the rhdm72-prod-immutable-kieserver.yaml template file. You can extract this file from the rhdm-7.2.0-openshift-templates.zip product deliverable file. You can download the file from the Software Downloads page.

When you deploy an immutable Decision Server, the deployment procedure retrieves the source code for any services that must run on this server, builds the services, and includes them in the server image.

Procedure

  1. Use one of the following methods to deploy the template:

    • In the OpenShift Web UI, select Add to Project → Import YAML / JSON and then select or paste the rhdm72-prod-immutable-kieserver.yaml file. In the Add Template window, ensure Process the template is selected and click Continue.
    • To use the OpenShift command line console, prepare the following command line:

      oc new-app -f <template-path>/rhdm72-prod-immutable-kieserver.yaml -p KIE_SERVER_HTTPS_SECRET=kieserver-app-secret

      In this command line:

      • Replace <template-path> with the path to the downloaded template file.
      • Use as many -p PARAMETER=value pairs as needed to set the required parameters. You can view the template file to see descriptions for all parameters.
  2. Set the following parameters as necessary:

    • KIE Server Keystore Secret Name (KIE_SERVER_HTTPS_SECRET): The name of the secret for Decision Server, as created in Section 2.2, “Creating the secrets for Decision Server”.
    • Application Name (APPLICATION_NAME): The name of the OpenShift application. It is used in the default URL for Decision Server. OpenShift uses the application name to create a separate set of deployment configurations, services, routes, labels, and artifacts. You can deploy several applications using the same template into the same project, as long as you use different application names. Also, the application name determines the name of the server configuration (server template) on the Decision Central that the Decision Server is to join. If you are deploying several Decision Servers, you must ensure each of the servers has a different application name.
    • KIE Server Certificate Name (KIE_SERVER_HTTPS_NAME): The name of the certificate in the keystore that you created in Section 2.2, “Creating the secrets for Decision Server”.
    • KIE Server Keystore Password (KIE_SERVER_HTTPS_PASSWORD): The password for the keystore that you created in Section 2.2, “Creating the secrets for Decision Server”.
    • KIE Server Container Deployment (KIE_SERVER_CONTAINER_DEPLOYMENT): The identifying information of the decision service (KJAR file) that is built from your source. The format is: <containerId>=<groupId>:<artifactId>:<version>. You can provide two or more KJAR files using the | separator, for example: containerId=groupId:artifactId:version|c2=g2:a2:v2. The Maven build process must produce all these files from the source in the Git repository.
    • Git Repository URL (SOURCE_REPOSITORY_URL): The URL for the Git repository that contains the source for your decision service.
    • Git Reference (SOURCE_REPOSITORY_REF): The branch in the Git repository
    • Context Directory (CONTEXT_DIR): The path to the source within the project downloaded from the Git repository
    • Artifact Directory (ARTIFACT_DIR): The path within the project that contains the required binary files (KJAR files and any other necessary files) after a successful Maven build. Normally this directory is the target directory of the build. However, you can provide prebuilt binaries in this directory in the Git repository
    • ImageStream Namespace (IMAGE_STREAM_NAMESPACE): The namespace where the image streams are available. If the image streams were already available in your OpenShift environment (see Section 2.1, “Ensuring the availability of image streams and the image registry”), the namespace is openshift. If you have installed the image streams file, the namespace is the name of the OpenShift project.
  3. If your build includes dependencies that are not available on the public Maven tree and require a separate repository, set the parameters to provide this repository:

    • Maven repository URL (MAVEN_REPO_URL): The URL for the Maven repository.
    • Maven repository username (MAVEN_REPO_USERNAME): The username for the Maven repository.
    • Maven repository password (MAVEN_REPO_PASSWORD): The password for the Maven repository.
  4. If you want to use RH-SSO or LDAP authentication, complete the following additional configuration. Do not configure LDAP authentication and RH-SSO authentication in the same deployment.

    1. In the RH-SSO or LDAP service, create all user names in the deployment parameters. If you do not set any of the parameters, create users with the default user names. The created users must also be assigned to roles:

      • KIE_ADMIN_USER: default user name adminUser, roles: kie-server,rest-all,admin
      • KIE_SERVER_USER: default user name executionUser, roles kie-server,rest-all,guest
    2. If you want to configure Red Hat Single Sign On (RH-SSO) authentication, an RH-SSO realm that applies to Red Hat Decision Manager must exist. A client within RH-SSO must also exist for

      For the user roles that you can configure in RH-SSO, see Roles and users.

      Use one of the following procedures:

      1. If the client for Red Hat Decision Manager within RH-SSO already exists, set the following parameters in the template:

        • RH-SSO URL (SSO_URL): The URL for RH-SSO.
        • RH-SSO Realm name (SSO_REALM): The RH-SSO realm for Red Hat Decision Manager.
        • KIE Server RH-SSO Client name (KIE_SERVER_SSO_CLIENT): The RH-SSO client name for Decision Server.
        • KIE Server RH-SSO Client Secret (KIE_SERVER_SSO_SECRET): The secret string that is set in RH-SSO for the client for Decision Server.
        • RH-SSO Disable SSL Certificate Validation (SSO_DISABLE_SSL_CERTIFICATE_VALIDATION): Set to true if your RH-SSO installation does not use a valid HTTPS certificate.
      2. To create the client for Red Hat Decision Manager within RH-SSO, set the following parameters in the template:

        • RH-SSO URL (SSO_URL): The URL for RH-SSO.
        • RH-SSO Realm name (SSO_REALM): The RH-SSO realm for Red Hat Decision Manager.
        • KIE Server RH-SSO Client name (KIE_SERVER_SSO_CLIENT): The name of the client to create in RH-SSO for Decision Server.
        • KIE Server RH-SSO Client Secret (KIE_SERVER_SSO_SECRET): The secret string to set in RH-SSO for the client for Decision Server.
        • KIE Server Custom http Route Hostname (KIE_SERVER_HOSTNAME_HTTP): The fully qualified host name to use for the HTTP endpoint for Decision Server. If you need to create a client in RH-SSO, you can not leave this parameter blank.
        • KIE Server Custom https Route Hostname (KIE_SERVER_HOSTNAME_HTTPS): The fully qualified host name to use for the HTTPS endpoint for Decision Server. If you need to create a client in RH-SSO, you can not leave this parameter blank.
        • RH-SSO Realm Admin Username (SSO_USERNAME) and RH-SSO Realm Admin Password (SSO_PASSWORD): The user name and password for the realm administrator user for the RH-SSO realm for Red Hat Decision Manager.
        • RH-SSO Disable SSL Certificate Validation (SSO_DISABLE_SSL_CERTIFICATE_VALIDATION): Set to true if your RH-SSO installation does not use a valid HTTPS certificate.
    3. To configure LDAP, set the AUTH_LDAP* parameters of the template. These parameters correspond to the settings of the LdatExtended Login module of Red Hat JBoss EAP. For instructions about using these settings, see LdapExtended Login Module.

      If the LDAP server does not define all the roles required for your deployment, you can map LDAP groups to Red Hat Decision Manager roles. To enable LDAP role mapping, set the following parameters:

      • RoleMapping rolesProperties file path (AUTH_ROLE_MAPPER_ROLES_PROPERTIES): The fully qualified pathname of a file that defines role mapping, for example, /opt/eap/standalone/configuration/rolemapping/rolemapping.properties. You must provide this file and mount it at this path in all applicable deployment configurations; for instructions, see Section 3.3, “Providing the LDAP role mapping file”.
      • RoleMapping replaceRole property (AUTH_ROLE_MAPPER_REPLACE_ROLE): If set to true, mapped roles replace the roles defined on the LDAP server; if set to false, both mapped roles and roles defined on the LDAP server are set as user application roles. The default setting is false.
  5. Complete the creation of the environment, depending on the method that you are using:

    • In the OpenShift Web UI, click Create.

      • If the This will create resources that may have security or project behavior implications message appears, click Create Anyway.
    • Complete and run the command line.

3.2. Deploying an immutable Decision Server from KJAR services

To deploy an immutable Decision Server from KJAR services, use the rhdm72-kieserver.yaml template file. You can extract this file

from the rhdm-7.2.0-openshift-templates.zip product deliverable file. You can download the file from the Software Downloads page.

In this method of deployment, the Decision Server retrieves all the required KJAR files during the startup of the pod.

Procedure

  1. Use one of the following methods to deploy the template:

    • In the OpenShift Web UI, select Add to Project → Import YAML / JSON and then select or paste the template file. In the Add Template window, ensure Process the template is selected and click Continue.
    • To use the OpenShift command line console, prepare the following command line:

      oc new-app -f <template-path>/<template-file-name>.yaml -p KIE_SERVER_HTTPS_SECRET=kieserver-app-secret

      In this command line:

      • Replace <template-path> with the path to the template file.
      • Replace <template-file-name> with the name of the template file.
      • Use as many -p PARAMETER=value pairs as needed to set the required parameters. You can view the template file to see descriptions for all parameters.
  2. Set the following parameters as necessary:

    • KIE Server Keystore Secret Name (KIE_SERVER_HTTPS_SECRET): The name of the secret for Decision Server, as created in Section 2.2, “Creating the secrets for Decision Server”.
    • Application Name (APPLICATION_NAME): The name of the OpenShift application. It is used in the default URL for Decision Server. OpenShift uses the application name to create a separate set of deployment configurations, services, routes, labels, and artifacts. You can deploy several applications using the same template into the same project, as long as you use different application names. Also, the application name determines the name of the server configuration (server template) on the Decision Central that the Decision Server is to join. If you are deploying several Decision Servers, you must ensure each of the servers has a different application name.
    • KIE Server Certificate Name (KIE_SERVER_HTTPS_NAME): The name of the certificate in the keystore that you created in Section 2.2, “Creating the secrets for Decision Server”.
    • KIE Server Keystore Password (KIE_SERVER_HTTPS_PASSWORD): The password for the keystore that you created in Section 2.2, “Creating the secrets for Decision Server”.
    • KIE Server Container Deployment (KIE_SERVER_CONTAINER_DEPLOYMENT): The identifying information of the decision services (KJAR files) that the deployment must pull from the Maven repository. The format is: <containerId>=<groupId>:<artifactId>:<version>. You can provide two or more KJAR files using the | separator, for example: containerId=groupId:artifactId:version|c2=g2:a2:v2.
    • Maven repository URL (MAVEN_REPO_URL): The URL for the Maven repository.
    • Maven repository username (MAVEN_REPO_USERNAME): The username for the Maven repository.
    • Maven repository password (MAVEN_REPO_PASSWORD): The password for the Maven repository.
    • Disable KIE server management (KIE_SERVER_MGMT_DISABLED): You must set this parameter to true for an immutable deployment.
    • KIE Server Startup Strategy (KIE_SERVER_STARTUP_STRATEGY): You must set this parameter to LocalContainersStartupStrategy for an immutable deployment.
    • ImageStream Namespace (IMAGE_STREAM_NAMESPACE): The namespace where the image streams are available. If the image streams were already available in your OpenShift environment (see Section 2.1, “Ensuring the availability of image streams and the image registry”), the namespace is openshift. If you have installed the image streams file, the namespace is the name of the OpenShift project.
  3. If you want to use RH-SSO or LDAP authentication, complete the following additional configuration. Do not configure LDAP authentication and RH-SSO authentication in the same deployment.

    1. In the RH-SSO or LDAP service, create all user names in the deployment parameters. If you do not set any of the parameters, create users with the default user names. The created users must also be assigned to roles:

      • KIE_ADMIN_USER: default user name adminUser, roles: kie-server,rest-all,admin
      • KIE_SERVER_USER: default user name executionUser, roles kie-server,rest-all,guest
    2. If you want to configure Red Hat Single Sign On (RH-SSO) authentication, an RH-SSO realm that applies to Red Hat Decision Manager must exist. A client within RH-SSO must also exist for

      For the user roles that you can configure in RH-SSO, see Roles and users.

      Use one of the following procedures:

      1. If the client for Red Hat Decision Manager within RH-SSO already exists, set the following parameters in the template:

        • RH-SSO URL (SSO_URL): The URL for RH-SSO.
        • RH-SSO Realm name (SSO_REALM): The RH-SSO realm for Red Hat Decision Manager.
        • KIE Server RH-SSO Client name (KIE_SERVER_SSO_CLIENT): The RH-SSO client name for Decision Server.
        • KIE Server RH-SSO Client Secret (KIE_SERVER_SSO_SECRET): The secret string that is set in RH-SSO for the client for Decision Server.
        • RH-SSO Disable SSL Certificate Validation (SSO_DISABLE_SSL_CERTIFICATE_VALIDATION): Set to true if your RH-SSO installation does not use a valid HTTPS certificate.
      2. To create the client for Red Hat Decision Manager within RH-SSO, set the following parameters in the template:

        • RH-SSO URL (SSO_URL): The URL for RH-SSO.
        • RH-SSO Realm name (SSO_REALM): The RH-SSO realm for Red Hat Decision Manager.
        • KIE Server RH-SSO Client name (KIE_SERVER_SSO_CLIENT): The name of the client to create in RH-SSO for Decision Server.
        • KIE Server RH-SSO Client Secret (KIE_SERVER_SSO_SECRET): The secret string to set in RH-SSO for the client for Decision Server.
        • KIE Server Custom http Route Hostname (KIE_SERVER_HOSTNAME_HTTP): The fully qualified host name to use for the HTTP endpoint for Decision Server. If you need to create a client in RH-SSO, you can not leave this parameter blank.
        • KIE Server Custom https Route Hostname (KIE_SERVER_HOSTNAME_HTTPS): The fully qualified host name to use for the HTTPS endpoint for Decision Server. If you need to create a client in RH-SSO, you can not leave this parameter blank.
        • RH-SSO Realm Admin Username (SSO_USERNAME) and RH-SSO Realm Admin Password (SSO_PASSWORD): The user name and password for the realm administrator user for the RH-SSO realm for Red Hat Decision Manager.
        • RH-SSO Disable SSL Certificate Validation (SSO_DISABLE_SSL_CERTIFICATE_VALIDATION): Set to true if your RH-SSO installation does not use a valid HTTPS certificate.
    3. To configure LDAP, set the AUTH_LDAP* parameters of the template. These parameters correspond to the settings of the LdatExtended Login module of Red Hat JBoss EAP. For instructions about using these settings, see LdapExtended Login Module.

      If the LDAP server does not define all the roles required for your deployment, you can map LDAP groups to Red Hat Decision Manager roles. To enable LDAP role mapping, set the following parameters:

      • RoleMapping rolesProperties file path (AUTH_ROLE_MAPPER_ROLES_PROPERTIES): The fully qualified pathname of a file that defines role mapping, for example, /opt/eap/standalone/configuration/rolemapping/rolemapping.properties. You must provide this file and mount it at this path in all applicable deployment configurations; for instructions, see Section 3.3, “Providing the LDAP role mapping file”.
      • RoleMapping replaceRole property (AUTH_ROLE_MAPPER_REPLACE_ROLE): If set to true, mapped roles replace the roles defined on the LDAP server; if set to false, both mapped roles and roles defined on the LDAP server are set as user application roles. The default setting is false.
  4. Complete the creation of the environment, depending on the method that you are using:

    • In the OpenShift Web UI, click Create.

      • If the This will create resources that may have security or project behavior implications message appears, click Create Anyway.
    • Complete and run the command line.

3.3. Providing the LDAP role mapping file

If you configure the AUTH_ROLE_MAPPER_ROLES_PROPERTIES parameter, you must provide a file that defines the role mapping. Mount this file on all affected deployment configurations.

Procedure

  1. Create the role mapping properties file, for example, my-role-map. The file must contain entries in the following format:

    ldap_role = product_role1, product_role2...

    For example:

    admins = kie-server,rest-all,admin
  2. Create an OpenShift configuration map from the file. Run the following command:

    oc create configmap ldap_role_mapping --from-file=<new_name>=<existing_name>

    Where new_name is the name that the file is to have on the pods (it must be the same as the name specified in the AUTH_ROLE_MAPPER_ROLES_PROPERTIES file) and existing_name is the name of the file that you created. For example:

    oc create configmap ldap_role_mapping --from-file=rolemapping.properties=my-role-map
  3. Mount the configuration map on every deployment config that is configured for role mapping. The following deployment configs can be affected in this environment:

    • myapp-rhpamcentrmon: Decision Central Monitoring
    • myapp-kieserver: Decision Server

    Where myapp is the application name. Sometimes, several Decision Server deployments can be present under different application names.

    For every deployment configuration, run the command:

     oc set volume dc/<deployment_config_name> --add --type configmap --configmap-name ldap_role_mapping --mount-path=<mapping_dir> --name=ldap_role_mapping

    Where mapping_dir is the directory name (without file name) set in the AUTH_ROLE_MAPPER_ROLES_PROPERTIES parameter, for example, /opt/eap/standalone/configuration/rolemapping .