Chapter 1. Installing and running the employee rostering demonstration on OpenShift

You can deploy the Red Hat Business Optimizer Employee Rostering starter application to an OpenShift instance.

Preparing deployment files

  1. Unzip the add-ons distribution (rhdm-7.0.0-add-ons.zip).
  2. Unzip the employee-rostering zip file that is extracted from the add-ons archive.

    Note

    When you unzip the employee-rostering zip file, the optashift-employee-rostering-7.5.0.Final-redhat-4 folder is created. This folder is the base folder in subsequent steps. File and folder names may have higher version numbers than specifically noted in this document.

There are two options for quickly deploying this application to OpenShift:

  1. Using the Source to Image (S2I) template. This template pulls the source for the application from a Git repository and builds it during the deployment.
  2. Using the pre-built binary application archive that is provided in the distribution. In this case, a template prepares the environment but does not rebuild the application.
Note

The S2I approach requires significantly more resources to complete than the binary deployment. If your OpenShift environment has less than 2GB of memory available, for example, when using the OpenShift Online Starter tier, you must follow the binary deployment approach.

1.1. Deploying using the Source to Image (S2I) template

Procedure

  1. Log in to the OpenShift web console and click Import YAML/JSON in the upper right corner.
  2. Select the project to add to from the Add to Project drop down menu, or select Create Project to create a new one. If creating a new project, enter a new project name, display name, and description.
  3. Click the Browse button and navigate to the optashift-employee-rostering-template.yaml file. Starting from the optashift-employee-rostering-7.5.0.Final-redhat-4 folder, access the file by clicking sources > openshift > templates.
  4. Click Create.

    Figure 1.1. Upload template window

    optashift ER s2i step one
  5. In the Add Template dialog box, click Continue to accept the default settings.

    Figure 1.2. Add template window

    optashift ER s2i step two
  6. In the Import YAML/JSON dialog box, click Create to accept the default settings.

    Figure 1.3. Configure template window

    optashift ER s2i step three
  7. In the Success dialog box, click Close.
  8. Wait for the build and deployment to complete. This might take several minutes. When the deployment completes, click the link in the upper right corner and above the shaded bar to open the application.

    Figure 1.4. Completed deployment and resulting link

    optashift ER s2i step four
    Note

    Perform a hard refresh of your browser page if the web app does not open after clicking the link.

1.2. Deploying with pre-built binary

Procedure

  1. Prepare the binary deployment.

    Note

    You must conduct binary deployments using the oc command line tools. See the OpenShift documentation for installation steps.

    1. Working from the optashift-employee-rostering-7.5.0.Final-redhat-4 distribution folder, open the binaries folder.
    2. Copy the optashift-employee-rostering-webapp-7.5.0.Final-redhat-4.war to the sources folder.
    3. Rename the file to ROOT.war. The updated name instructs the application server to deploy the file to the root context of the server.
  2. Using the command line, change to the sources folder.
  3. Create a project using the following command:

    oc new-project optashift-demo --display-name="Employee Rostering Demo"
    Note

    Alternatively, you can use an existing project. In this case, replace all instances of optashift-demo in this procedure with your project name.

  4. Create a build and deployment configuration. Use the optashift-employee-rostering-template-binary.yaml template file to set the OpenShift configuration, such as the route to expose the application to make it accessible to browsers.

    oc process -f openshift/templates/optashift-employee-rostering-template-binary.yaml -n optashift-demo | oc create -f - -n optashift-demo
  5. Upload the binary file to begin a deployment.

    oc start-build employee-rostering --from-file=ROOT.war
  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.

    Figure 1.5. OpenShift web console with deployed Employee Rostering starter application

    optashift ER binary success