Skip to content
This repository has been archived by the owner on Feb 15, 2023. It is now read-only.

Latest commit

 

History

History
111 lines (75 loc) · 4.63 KB

openshift.md

File metadata and controls

111 lines (75 loc) · 4.63 KB

Run on Red Hat OpenShift

This document shows how to deploy the server using 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

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 application a name and add https://github.com/IBM/text-to-speech-code-pattern for the Git Repository, then click Create.

    Add github repo

Create the config map

Create a config map to configure credentials for the Node.js server.

  • 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 items with keys and values. 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

For the Text to Speech service, the following settings are needed:

  • Set TEXT_TO_SPEECH_AUTH_TYPE to cp4d

  • Provide the TEXT_TO_SPEECH_URL, TEXT_TO_SPEECH_USERNAME and TEXT_TO_SPEECH_PASSWORD for the user added to this service instance.

  • For the TEXT_TO_SPEECH_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 TEXT_TO_SPEECH_DISABLE_SSL and TEXT_TO_SPEECH_AUTH_DISABLE_SSL set to true. You might also need to use browser-specific steps to ignore certificate errors (try browsing to the AUTH_URL). Disable SSL only if absolutely necessary, and take steps to enable SSL as soon as possible.

    Key Value
    TEXT_TO_SPEECH_AUTH_TYPE cp4d
    TEXT_TO_SPEECH_URL https://{cpd_cluster_host}{:port}/text-to-speech/{release}/instances/{instance_id}/api
    TEXT_TO_SPEECH_AUTH_URL https://{cpd_cluster_host}{:port}
    TEXT_TO_SPEECH_USERNAME <add_text-to-speech_username>
    TEXT_TO_SPEECH_PASSWORD <add_text-to-speech_password>
    TEXT_TO_SPEECH_AUTH_SSL true or false
    TEXT_TO_SPEECH_AUTH_DISABLE_SSL true or false
    PORT 8080

IBM Cloud

For the Text to Speech service, the following settings are needed:

  • Set TEXT_TO_SPEECH_AUTH_TYPE to iam

  • Provide the TEXT_TO_SPEECH_URL and TEXT_TO_SPEECH_APIKEY collected when you created the services.

    Key Value
    TEXT_TO_SPEECH_AUTH_TYPE iam
    TEXT_TO_SPEECH_APIKEY <add_text-to-speech_apikey>
    TEXT_TO_SPEECH_URL <add_text-to-speech_url>
    PORT 8080

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.
  • Go to the Applications tab, choose Deployments to view the status of your application.

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.

Run the web app

  • Go back to ApplicationsRoutes. You will see your app.
  • Click your app's Hostname. This will open the Text to Speech web app in your browser.
  • Go back to the README.md for instructions on how to use the app.

return