Database setup

Use the IBM Cloud console to launch the OpenShift web console

First create an 'Example Bank' namespace

From the navigation menu on the left select Operators --> OperatorHub

Type 'Postgres' into the search bar, and select the PostgreSQL Operator by Dev4Ddevs.com tile.

Click Continue to show the community operator and then Install

Be sure you are installing the Operator in the Example Bank namespace, and click Subscribe

Status will show "Succeeded: Up to date" when complete

Use the very top drop down in the navigation menu on the left to switch to Developer* view

Click +Add and select the Database tile

Choose the Database Database tile and then Create

You can edit some of the specifics of the database here. For example, change the name to creditdb and click Create

Switch to the Topology tab, and watch your database creation complete!

Click +Add and select the Database tile

Choose the Database Database tile and then Create

You can edit some of the specifics of the database here. For example, change the name to creditdb and click Create

Switch to the Topology tab, and watch your database creation complete!

Now we will need some CLI access. First, go to https://labs.cognitiveclass.ai and start a Theia - Cloud IDE (With OpenShift) session

back on your OpenShift web console, click you email address in the upper right corner and choose Copy Login Command

From the resulting screen, grab your login credentials, and copy them into your ClognitiveClass terminal

switch to the example bank project:

oc project example-bank

Create a secret so the script that loads the schema can access the database

kubectl create secret generic bank-db-secret --from-literal=DB_SERVERNAME=creditdb --from-literal=DB_PORTNUMBER=5432 --from-literal=DB_DATABASENAME=example --from-literal=DB_USER=postgres --from-literal=DB_PASSWORD=postgres

Run the job to create the schema

oc apply -f data_model/job.yaml

Verify that the schema load succeeded:

oc logs cc-schema-load-<pod>

Now that the database is ready, we can build and deploy the remaining microservices.

Last updated