Red Hat Training

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

Chapter 2. Installing and starting the employee rostering starter application on OpenShift

You can deploy the Red Hat Business Optimizer Employee Rostering starter application to Red Hat OpenShift Container Platform using an OpenShift template or using the provision.sh shell script that is provided in the add-ons distribution.

If you use an OpenShift template, Red Hat OpenShift Container Platform loads an image with the application from the Red Hat repository and deploys it. This method of deployment is a technological preview.

If you use the script, it builds and packages the application source code locally and uploads it to the OpenShift environment for deployment. You can use this method when Java developer tools (Java Development Kit and Maven) and a bash shell command line are available.

Important

In the deployed application, the data is held in memory and lost when the pod is restarted.

2.1. Deploying the application using the template

To deploy the application using the template, you must first ensure that the image streams for Red Hat Decision Manager are available and configure OpenShift registry authentication. Then you can deploy the template.

2.1.1. Ensuring the availability of image streams and the image registry

To deploy Red Hat Decision Manager components of Red Hat OpenShift Container Platform, you must ensure that OpenShift can download the correct images from the Red Hat registry. To download the images, OpenShift requires the information about their location (known as image streams). OpenShift also must be configured to authenticate with the Red Hat registry using your service account user name and password.

Some versions of the OpenShift environment include the required image streams. You must check if they are available. If image streams are available in OpenShift by default, you can use them if the OpenShift infrastructure is configured for registry authentication server. The administrator must complete the registry authentication configuration when installing the OpenShift environment.

Otherwise, you can configure registry authentication in your own project and install the image streams in the same project.

Procedure

  1. Determine whether Red Hat OpenShift Container Platform was configured with the user name and password for Red Hat registry access. For details about the required configuration, see Configuring a Registry Location. If you are using an OpenShift Online subscription, it is configured for Red Hat registry access.
  2. If Red Hat OpenShift Container Platform was configured with the user name and password for Red Hat registry access, run the following commands:

    $ oc get imagestreamtag -n openshift | grep rhdm72-decisioncentral-openshift
    $ oc get imagestreamtag -n openshift | grep rhdm72-kieserver-openshift

    If the outputs of both commands are not empty, the required image streams are available in the openshift namespace and no further action is required.

  3. If the output of one or both of the commands is empty or if OpenShift was not configured with the user name and password for Red Hat registry access, complete the following steps:

    1. Ensure you are logged in to OpenShift with the oc command and that your project is active.
    2. Complete the steps documented in Registry Service Accounts for Shared Environments. You must log on to Red Hat Customer Portal to access the document and to complete the steps to create a registry service account.
    3. Select the OpenShift Secret tab and click the link under Download secret to download the YAML secret file.
    4. View the downloaded file and note the name that is listed in the name: entry.
    5. Run the following commands:

      oc create -f <file_name>.yaml
      oc secrets link default <secret_name> --for=pull
      oc secrets link builder <secret_name> --for=pull

      Where <file_name> is the name of the downloaded file and <secret_name> is the name that is listed in the name: entry of the file.

    6. Download the rhdm-7.2.0-openshift-templates.zip product deliverable file from the Software Downloads page and extract the rhdm72-image-streams.yaml file.
    7. Complete one of the following actions:

      • Run the following command:

        $ oc create -f rhdm72-image-streams.yaml
      • Using the OpenShift Web UI, select Add to Project → Import YAML / JSON and then choose the file or paste its contents.

        Note

        If you complete these steps, you install the image streams into the namespace of your project. If you install the image streams using these steps, you must set the IMAGE_STREAM_NAMESPACE parameter to the name of this project when deploying templates.

2.1.2. Deploying the OpenShift template

Prerequisites

  • You must be logged in to the target OpenShift environment using the Web UI or using the oc command line tool. For more information about this tool, see CLI Reference.

Procedure

  1. Download the rhdm-openshift-templates.zip file from the Software Downloads page for Red Hat Decision Manager 7.2.
  2. Unzip the downloaded archive and locate the rhdm72-optaweb-employee-rostering-trial-ephemeral.yaml file.
  3. 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-optaweb-employee-rostering-trial-ephemeral.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-optaweb-employee-rostering-trial-ephemeral.yaml

      In this command line:

      • Replace <template-path> with the path to the downloaded template file.
      • Add 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.
  4. Set the following parameters as necessary:

    • Application Name (APPLICATION_NAME): The name of the OpenShift application. It is used in the default URL for the application.
    • OptaWeb Admin User (OPTAWEB_ADMIN_USER): The user name for the administrative user in the application. The default user name is adminUser.
    • OptaWeb Admin Password (OPTAWEB_ADMIN_PWD): The password for the administrative user in the application. The default password is RedHat.
    • 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.1, “Ensuring the availability of image streams and the image registry”), the namespace is openshift. If you installed the image streams file, the namespace is the name of the OpenShift project.
    • Optaweb Employee Rostering Container Memory Limit (OPTAWEB_MEMORY_LIMIT): The memory limit for the application container. The higher the limit, the more employees and shifts are supported. The default is 1 Gi.
    • Optaweb Employee Rostering Generator Zone ID (OPTAWEB_GENERATOR_ZONE_ID): The time zone that is set in the generated example data sets in the application. The default is the local time zone of the OpenShift server.
  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 pop-up message is displayed, click Create Anyway.
    • Complete and run the command line.

2.2. Deploying the application using the provided script

You can deploy the Red Hat Business Optimizer Employee Rostering starter application to Red Hat OpenShift Container Platform using the provided script. The script builds and packages the application source code locally and uploads it to the OpenShift environment for deployment.

Prerequisites

  • You must be logged in to the target OpenShift environment using the oc command line tool. For more information about this tool, see CLI Reference.

    1. Java Development Kit and Maven must be installed on your local machine.
    2. A bash shell environment must be available on your local machine.

Procedure

  1. Download the rhdm-7.2.0-add-ons.zip file from the Software Downloads page for Red Hat Decision Manager 7.2.
  2. Unzip the downloaded archive.
  3. Unzip the employee rostering zip file (rhdm-7.2.0-employee-rostering.zip) that is extracted from the add-ons archive.
  4. Using the command line, change to the optashift-employee-rostering-7.14.0.Final-redhat-00002/sources folder.
  5. Run the provision script to build and deploy the application:

    ./provision.sh setup employee-rostering --binary
    Note

    If the current OpenShift user name contains characters that are not letters or numbers, the deployment might fail. You can resolve this issue by providing an additional parameter: ./provision.sh setup employee-rostering --binary --project-suffix optaweb. This example uses "optaweb", but you can use any value for the suffix.

    Compilation and packaging might take several minutes to complete. They continually show progress on the command line output.

    When the operation is completed, the following message is displayed: Uploading file "target/ROOT.war" as binary input for the build …​.

  6. Use the OpenShift web UI to view the details for the deployed application. Click the link in the Routes section to open the starter application. The first startup can take up to a minute as additional building is completed on the OpenShift platform.

If the application does not open for more than a minute after clicking the link, perform a hard refresh of your browser page.

  1. Optionally, you can use other actions provided by the provision script:

    1. Deploy updates to the code to an existing deployment:
./provision.sh deploy employee-rostering --binary

+ .. Remove the application:

./provision.sh delete employee-rostering