Database setup

Use the IBM Cloud console to launch the OpenShift web console

web console

First create an 'Example Bank' namespace

create project

From the navigation menu on the left select OperatorsOperatorHub

operatorhub

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

postgres operator

Click Continue to show the community operator and then Install

install operator

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

subscribe

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

succeeded

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

developer view

Click +Add and select the Database tile

add database

Choose the Database Database tile and then Create

database

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

create database

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

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

developer view

Click +Add and select the Database tile

add database

Choose the Database Database tile and then Create

database

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

create database

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

topology

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

cognitiveclass

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

copy login command

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

clusterlogin

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

schema

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.