This document shows how to deploy the server using Red Hat OpenShift.
You will need a running OpenShift cluster, or OKD cluster. You can provision OpenShift on the IBM Cloud.
-
Using the OpenShift web console, select the
Application Console
view. -
Use the
+Create Project
button to create a new project, then click on your project to open it. -
In the
Overview
tab, click onBrowse Catalog
. -
Choose the
Node.js
app container and clickNext
. -
Give your application a name and add
https://github.com/IBM/text-to-speech-code-pattern
for theGit Repository
, then clickCreate
.
Create a config map to configure credentials for the Node.js server.
- Click on the
Resources
tab and chooseConfig Maps
and then click theCreate 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, chooseDeployments
to view the status of your application.
- From the OpenShift or OKD UI, under
Applications
▷Routes
you will see your app.- Click on the application
Name
. - Under
TLS Settings
, click onEdit
. - Under
Security
, check the box forSecure route
. - Hit
Save
.
- Click on the application
- Go back to
Applications
▷Routes
. 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.