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

Latest commit

 

History

History
83 lines (51 loc) · 3.63 KB

openshift.md

File metadata and controls

83 lines (51 loc) · 3.63 KB

Run on Red Hat OpenShift

This document shows how to run the watson-discovery-news 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 your Watson Discovery service
  2. Create an OpenShift project
  3. Create the config map
  4. Run the application

1. Create your Watson Discovery service

  • Click here to go the Watson Discovery create resource page.

  • Review the settings. The defaults and a Free plan should work.

  • Click Create.

  • Copy/paste the API Key and URL or keep the browser tab open. You'll need these later.

    get-creds

2. 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-news for the github repo, then click Create.

    Add github repo

3. Create the config map

add config map

Create a new Config Map under Workloads then under Config Maps.

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

3. Reference the config map in the Deployment

Click on the Edit Deployment button. Go to Edit Deployment

Then Add the following to the deployment yaml:

      envFrom: 
        - configMapRef:
          name: news-cm

Edit Deployment yaml

5. Run the application

Under Applications -> Routes you will see your app. Click on the Hostname to see your Watson Discovery News app in action.

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

return