Digital Developer Conference: Hybrid Cloud
  • Introduction
  • Getting Started
    • Pre-work
  • Threat Modeling & Identity Management
    • Lecture
      • Threat Modeling
      • Identity Management
      • Prerequisites
    • Lab 1
      • Clone the repo
      • Creating App ID in IBM Cloud
      • Building the front end service
      • Deploying to OpenShift
      • Test the Simulator
  • Operator Workshop
    • Lecture
      • Introduction
    • Lab 2
      • Install the PostgreSQL Operator
      • Create an instance of a database
      • Load the schema
      • Expose and verify
  • Microservice Workshop
    • Lecture
      • Introduction
      • Prerequisites
    • Lab 3
      • Part 1
      • Part 2
  • Microservice Workshop (OSS)
    • Lecture
      • Introduction
      • Prerequisites
    • Lab
      • Database setup
      • Part 1
      • Part 2
  • Serverless Workshop
    • Introduction
      • Example Bank App Architecture
      • Serverless
      • Prerequisites
      • Quick Install - Identity Management, Operator, Microservices Workshops
    • Lab 4
      • Installing OpenShift Serverless
      • Installing Knative Serving
      • Clone the repo
      • Create an admin scoped user
      • Building the example serverless application
      • Configure Deployment file
      • Deploying to OpenShift Serverless
      • Test the Serverless App
      • Modify Serverless App
      • Conclusion
  • Service Mesh Workshop
    • ServiceMesh Lab
  • Pipelines (Tekton) Workshop
    • Lecture
      • What is tekton?
      • CI/CD
      • Explain tasks and pipelines
    • Lab 6
      • Cluster Setup
      • Install Pipeline
  • Resources
    • IBM Developer
Powered by GitBook
On this page

Was this helpful?

  1. Microservice Workshop (OSS)
  2. Lab

Database setup

PreviousLabNextPart 1

Last updated 4 years ago

Was this helpful?

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!

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.

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

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

schema
https://labs.cognitiveclass.ai
web console
create project
operatorhub
postgres operator
install operator
subscribe
succeeded
developer view
add database
database
create database
developer view
add database
database
create database
topology
cognitiveclass
copy login command
clusterlogin
topology