Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.
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.
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 Link kopierenLink in die Zwischenablage kopiert!
To deploy the application using the template, you must first ensure that the image streams for Red Hat Process Automation Manager are available and configure OpenShift registry authentication. Then you can deploy the template.
The template deploys a pod with the Employee Rostering starter application and a separate pod with a PostgreSQL database server. The application uses the database server for persistent storage of all the information that it uses.
Prerequisites
-
You must be logged in to the target OpenShift environment using the Web UI or using the
occommand line tool. For more information about this tool, see CLI Reference.
2.1.1. Ensuring the availability of image streams and the image registry Link kopierenLink in die Zwischenablage kopiert!
To deploy the Employee Rostering starter application on 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.
Procedure
- Determine whether Red Hat OpenShift Container Platform is 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.
If Red Hat OpenShift Container Platform is configured with the user name and password for Red Hat registry access, run the following command:
oc get imagestreamtag -n openshift | grep rhdm73-optaweb-employee-rostering
$ oc get imagestreamtag -n openshift | grep rhdm73-optaweb-employee-rosteringCopy to Clipboard Copied! Toggle word wrap Toggle overflow If the output of the command is not empty, the required image streams are available in the
openshiftnamespace and no further action is required.If the output of the command is empty or if OpenShift is not configured with the user name and password for Red Hat registry access, complete the following steps:
-
Ensure you are logged in to OpenShift with the
occommand and that your project is active. - 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.
- Select the OpenShift Secret tab and click the link under Download secret to download the YAML secret file.
-
View the downloaded file and note the name that is listed in the
name:entry. 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
oc create -f <file_name>.yaml oc secrets link default <secret_name> --for=pull oc secrets link builder <secret_name> --for=pullCopy to Clipboard Copied! Toggle word wrap Toggle overflow Where
<file_name>is the name of the downloaded file and <secret_name> is the name that is listed in thename:entry of the file.-
Download the
rhdm-7.3.0-openshift-templates.zipfile from the Software Downloads page for Red Hat Decision Manager 7.3. -
Extract the
rhdm73-image-streams.yamlfile. Complete one of the following actions:
Run the following command:
oc create -f rhdm73-image-streams.yaml
$ oc create -f rhdm73-image-streams.yamlCopy to Clipboard Copied! Toggle word wrap Toggle overflow -
Using the OpenShift Web UI, select Add to Project
Import YAML / JSON and then choose the file or paste its contents.
-
Ensure you are logged in to OpenShift with the
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. Creating the secrets for Employee Rostering Link kopierenLink in die Zwischenablage kopiert!
You must create an SSL certificate for HTTPS access to the Employee Rostering application and provide it to your OpenShift environment as a secret.
Procedure
Generate an SSL keystore with a private and public key for SSL encryption for the Employee Rostering application. In a production environment, generate a valid signed certificate that matches the expected URL of the application. Save the keystore in a file named
keystore.jks. Record the name of the certificate and the password of the keystore file.See Generate a SSL Encryption Key and Certificate for more information on how to create a keystore with self-signed or purchased SSL certificates.
Use the
occommand to generate a secret namedoptaweb-employee-rostering-app-secretfrom the new keystore file:oc create secret generic optaweb-employee-rostering-app-secret --from-file=keystore.jks
$ oc create secret generic optaweb-employee-rostering-app-secret --from-file=keystore.jksCopy to Clipboard Copied! Toggle word wrap Toggle overflow
2.1.3. Deploying the OpenShift template Link kopierenLink in die Zwischenablage kopiert!
You can deploy an OpenShift template to create an environment running the Employee Rostering starting application.
Procedure
-
Download the
rhdm-7.3.0-openshift-templates.zipfile from the Software Downloads page for Red Hat Decision Manager 7.3. -
Unzip the downloaded archive and locate the
rhdm73-optaweb-employee-rostering.yamlfile. 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 rhdm73-optaweb-employee-rostering.yamlfile. 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>/rhdm73-optaweb-employee-rostering.yaml -p OPTAWEB_HTTPS_SECRET=optaweb-employee-rostering-app-secret
oc new-app -f <template-path>/rhdm73-optaweb-employee-rostering.yaml -p OPTAWEB_HTTPS_SECRET=optaweb-employee-rostering-app-secretCopy to Clipboard Copied! Toggle word wrap Toggle overflow In this command line:
-
Replace
<template-path>with the path to the downloaded template file. -
Add as many
-p PARAMETER=valuepairs as needed to set the required parameters. You can view the template file to see descriptions for all parameters.
-
Replace
-
In the OpenShift Web UI, select Add to Project
Set the following parameters as necessary:
-
Optaweb Employee Rostering Keystore Secret Name (
OPTAWEB_HTTPS_SECRET): The name of the secret for HTTPS connections, as created in Section 2.1.2, “Creating the secrets for Employee Rostering”. -
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 isadminUser. -
OptaWeb Admin Password (
OPTAWEB_ADMIN_PWD): The password for the administrative user in the application. The default password isRedHat. -
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 isopenshift. 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.
-
Optaweb Employee Rostering Keystore Secret Name (
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 implicationspop-up message is displayed, click Create Anyway.
-
If the
- Complete and run the command line.
2.2. Deploying the application using the provided script Link kopierenLink in die Zwischenablage kopiert!
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
occommand line tool. For more information about this tool, see CLI Reference.- Java Development Kit and Maven must be installed on your local machine.
-
A
bashshell environment must be available on your local machine.
Procedure
-
Download the
rhdm-7.3.0-add-ons.zipfile from the Software Downloads page for Red Hat Decision Manager 7.3. - Unzip the downloaded archive.
-
Unzip the
rhdm-7.3.0-employee-rostering.zipfile that is extracted from the add-ons archive. -
Using the command line, change to the
optashift-employee-rostering-7.18.0.Final-redhat-00002/sourcesfolder. Run the provision script to build and deploy the application:
./provision.sh setup employee-rostering --binary
./provision.sh setup employee-rostering --binaryCopy to Clipboard Copied! Toggle word wrap Toggle overflow NoteIf 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 up to 10 minutes to complete. These processes 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 ….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.
NoteIf the application does not open for more than a minute after clicking the link, perform a hard refresh of your browser page.
Optionally, you can use other actions provided by the provision script:
- Deploy updates to the code to an existing deployment:
./provision.sh deploy employee-rostering --binary
./provision.sh deploy employee-rostering --binary
+ .. Remove the application:
./provision.sh delete employee-rostering
./provision.sh delete employee-rostering