Skip to content
This repository has been archived by the owner on Dec 28, 2021. It is now read-only.

Latest commit

 

History

History
162 lines (119 loc) · 8.41 KB

openshift.md

File metadata and controls

162 lines (119 loc) · 8.41 KB

Run on Red Hat OpenShift

This document shows how to run the Watson Banking Chatbot application in a container running on Red Hat OpenShift.

Prerequisites

You will need a running OpenShift cluster, or OKD cluster. You can provision OpenShift on the IBM Cloud.

Steps

  1. Create an OpenShift project
  2. Create the config map
  3. Get a secure endpoint
  4. Run the web app

1. Create an OpenShift project

  • Using the OpenShift web console, select the Application Console view.

    console-options

  • Use the +Create Project button to create a new project, then click on your project to open it.

  • In the Overview tab, click on Browse Catalog.

    Browse Catalog

  • Choose the Node.js app container and click Next.

    Choose Node.js

  • Give your app a name and add https://github.com/IBM/watson-banking-chatbot for the github repo, then click Create.

    Add github repo

2. Create the config map

  • Click on the Resources tab and choose Config Maps and then click the Create Config Map button.
    • Provide a Name for the config map.
    • Add a key named PORT and paste in the 8080 under Enter a value....
    • For each of the following key/value pairs, click Add Item to add the key, and then paste the value in the Enter a value... field. The necessary keys to configure will depend on whether you are provisioning services using IBM Cloud Pak for Data or on IBM Cloud.

Click to expand one:

IBM Cloud Pak for Data

Collect the credentials for IBM Cloud Pak for Data provisioned services (Assistant, Discovery and Natural Language Understanding). For each of these services:

Gather service credentials

  1. For production use, create a user to use for authentication. From the main navigation menu (☰), select Administer > Manage users and then + New user.
  2. From the main navigation menu (☰), select My instances.
  3. On the Provisioned instances tab, find your service instance, and then hover over the last column to find and click the ellipses icon. Choose View details.
  4. Copy the URL to use as the {SERVICE_NAME}_URL when you configure credentials.
  5. Optionally, copy the Bearer token to use in development testing only. It is not recommended to use the bearer token except during testing and development because that token does not expire.
  6. Use the Menu and select Users and + Add user to grant your user access to this service instance. This is the user name (and password) you will use when you configure credentials to allow the Node.js server to authenticate.

The other settings for Assistant and Discovery were collected during the earlier setup steps detailed in the main README page. See the setup sections for each service to determine where to find DISCOVERY_COLLECTION_ID and Assistant SKILL_ID.

For each service (ASSISTANT, DISCOVERY, and NATURAL_LANGUAGE_UNDERSTANDING) the following settings are needed with the service name as a prefix:

  • Set _AUTH_TYPE to cp4d

  • Provide the _URL, _USERNAME and _PASSWORD for the user added to this service instance.

  • For the _AUTH_URL use the base fragment of your URL including the host and port. I.e. https://{cpd_cluster_host}{:port}.

  • If your CPD installation is using a self-signed certificate, you need to disable SSL verification with both _AUTH_DISABLE_SSL and _DISABLE_SSL. Disable SSL only if absolutely necessary, and take steps to enable SSL as soon as possible.

    Key Value
    ASSISTANT_AUTH_TYPE cp4d
    ASSISTANT_URL https://{cpd_cluster_host}{:port}/assistant/{release}/instances/{instance_id}/api
    ASSISTANT_AUTH_URL https://{cpd_cluster_host}{:port}
    ASSISTANT_USERNAME <add_assistant_username>
    ASSISTANT_PASSWORD <add_assistant_password>
    ASSISTANT_DISABLE_SSL true or false
    ASSISTANT_AUTH_DISABLE_SSL true or false
    SKILL_ID <add_assistant_skill_id>
    DISCOVERY_AUTH_TYPE cp4d
    DISCOVERY_URL https://{cpd_cluster_host}{:port}/natural-language-understanding/{release}/instances/{instance_id}/api
    DISCOVERY_AUTH_URL https://{cpd_cluster_host}{:port}
    DISCOVERY_USERNAME <add_discovery_username>
    DISCOVERY_PASSWORD <add_discovery_password>
    DISCOVERY_DISABLE_SSL true or false
    DISCOVERY_AUTH_DISABLE_SSL true or false
    DISCOVERY_COLLECTION_ID <add_discovery_collection_id>
    NATURAL_LANGUAGE_UNDERSTANDING_AUTH_TYPE cp4d
    NATURAL_LANGUAGE_UNDERSTANDING_URL https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api
    NATURAL_LANGUAGE_UNDERSTANDING_AUTH_URL https://{cpd_cluster_host}{:port}
    NATURAL_LANGUAGE_UNDERSTANDING_USERNAME <add_nlu_username>
    NATURAL_LANGUAGE_UNDERSTANDING_PASSWORD <add_nlu_password>
    NATURAL_LANGUAGE_UNDERSTANDING_DISABLE_SSL true or false
    NATURAL_LANGUAGE_UNDERSTANDING_AUTH_DISABLE_SSL true or false

IBM Cloud

Collect the credentials for the IBM Cloud services (Assistant, Discovery and Natural Language Understanding). For each of these services:

Gather service credentials
  1. From the main navigation menu (☰), select Resource list to find your services under Services.
  2. Click on each service to find the Manage view where you can collect the API Key and URL to use for each service when you configure credentials.

The other settings for Assistant and Discovery were collected during the earlier setup steps detailed in the main README page. See the setup sections for each service to determine where to find DISCOVERY_COLLECTION_ID, DISCOVERY_ENVIRONMENT_ID and Assistant SKILL_ID.

For each service (ASSISTANT, DISCOVERY, and NATURAL_LANGUAGE_UNDERSTANDING) the following settings are needed with the service name as a prefix:

  • Set _AUTH_TYPE to iam

  • Provide the _URL and _APIKEY collected when you created the services.

    Key Value
    ASSISTANT_AUTH_TYPE iam
    ASSISTANT_APIKEY <add_assistant_apikey>
    ASSISTANT_URL <add_assistant_url>
    SKILL_ID <add_assistant_skill_id>
    DISCOVERY_AUTH_TYPE iam
    DISCOVERY_APIKEY <add_discovery_apikey>
    DISCOVERY_URL <add_discovery_url>
    DISCOVERY_ENVIRONMENT_ID <add_discovery_environment_id>
    DISCOVERY_COLLECTION_ID <add_discovery_collection_id>
    NATURAL_LANGUAGE_UNDERSTANDING_AUTH_TYPE iam
    NATURAL_LANGUAGE_UNDERSTANDING_APIKEY <add_nlu_apikey>
    NATURAL_LANGUAGE_UNDERSTANDING_URL <add_nlu_url>

Create the config map and add it to your application.

  • Hit the Create button.

  • Click on your new Config Map's name.

  • Click the Add to Application button.

  • Select your application from the pulldown.

  • Click Save.

    config_map.png

  • Go to the Applications tab, choose Deployments to view the status of your application.

3. Get a secure endpoint

  • From the OpenShift or OKD UI, under ApplicationsRoutes you will see your app.
    • Click on the application Name.
    • Under TLS Settings, click on Edit.
    • Under Security, check the box for Secure route.
    • Hit Save.

4. Run the web app

  • Under ApplicationsRoutes you will see your app. Click on the Hostname to see your Watson banking chatbot in action.
  • Go back to the README.md for instructions on how to use the web app.

return