Skip to content

Latest commit

 

History

History
115 lines (68 loc) · 5.39 KB

openshift.md

File metadata and controls

115 lines (68 loc) · 5.39 KB

Run on Red Hat OpenShift

This document shows how to run the watson-discovery-ui 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. Clone the repo
  2. Create your Watson Discovery service
  3. Load Discovery files and configure collection
  4. Create an OpenShift project
  5. Create the config map
  6. Run the application

1. Clone the repo

git clone https://github.com/IBM/watson-discovery-ui

2. Create your Watson Discovery service

To create your Watson Discovery service:

  1. Click Create resource on your IBM Cloud dashboard.

  2. Search the catalog for discovery.

  3. Click the Discovery tile to launch the create panel.

create-service

From the panel, enter a unique name, a region and resource group, and a plan type (select the default lite plan). Click Create to create and enable your service.

3. Load Discovery files and configure collection

Launch the Watson Discovery tool. Create a new data collection by selecting the Update your own data option. Give the data collection a unique name.

create-collection

When prompted to get started by uploading your data, select and upload the first 2 json documents located in your local data/airbnb directory. Once uploaded, you can then use the Configure data option to add the Keyword Extraction enrichment, as show here:

upload_data_into_collection

Note: failure to do this will result in no keywords being shown in the app.

Once the enrichments are selected, use the Apply changes to collection button to upload the remaining json files found in data/airbnb. Warning - this make take several minutes to complete.

There may be a limit to the number of files you can upload, based on your IBM Cloud account permissions.

4. 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-discovery-ui for the github repo, then click Create.

    Add github repo

5. Create the config map

To complete the config map instructions below, you will need to gather some key values from your Discovery service.

  • You can find your service credentials on the home page of your Discovery service. This includes your API Key and service URL values:

    get-creds

  • From your Discovery service collection page, you can find the credentials for your collection by clicking the dropdown button located at the top right. Included will be the Collection ID and Environment ID values.

Now that we know where to find these value, let's move on to creating the config map.

Click on the Resources tab and choose Config Maps and then click the Create Config Map button:

add config map

Use the Create Config Map panel to add our application parameters.

  • Provide a Name for the config map.
  • Add a key named DISCOVERY_APIKEY and paste in the API Key under Enter a value....
  • Click Add Item and add a key named DISCOVERY_URL and paste in the URL under Enter a value.....
  • Click Add Item and add a key named PORT, enter 8080 under Enter a value....
  • Click Add Item and add a key named DISCOVERY_ENVIRONMENT_ID and paste in the value under Enter a value.....
  • Click Add Item and add a key named DISCOVERY_COLLECTION_ID and paste in the value under Enter a value.....
  • 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.

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

6. Run the application

  • From the OpenShift or OKD UI, under Applications -> Routes you will see your app. Click on the Hostnameto see your Watson Discovery UI app in action.
  • Save this URL.

return