Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Build a Movie ticket booking application using Crunchy Data PostgreSQL on Red Hat Marketplace

License

Notifications You must be signed in to change notification settings

IBM/movie_ticket_booking_application_using_crunchydb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build a movie ticket reservation system

In this code pattern, you will build a movie ticket reservation application using Crunchy Data PostgreSQL on Red Hat Marketplace.

After completing this code pattern, you will understand how to:

  • Deploy Crunchy PostgreSQL for Kubernetes Operator on an OpenShift cluster.
  • Create a CrunchyDB cluster and database.
  • Access the cluster on your localhost.
  • Connect and access CrunchyDB data from a python flask application.

Flow

  1. User enters his details and reserves his seat.
  2. Application updates the Crunchy Data PostgreSQL tables accordingly.
  3. Application fetches the updated data from the tables.
  4. Application displays the updated seats availability data and booking details data that was fetched from the respective tables.

Pre-requisites

  1. Red Hat Marketplace Account.
  2. IBM Managed Red Hat OpenShift Cluster.
  3. For all operators being installed from Red Hat Marketplace, a Red Hat OpenShift cluster version 4.3 or higher is mandatory. Please set up a classic cluster using the instructions from this URL. Setting up OpenShift Cluster
  4. OC & kubectl CLI.

Steps

  1. Clone the repo
  2. Deploy a Crunchy PostgreSQL for Kubernetes Operator to an OpenShift cluster
  3. Run the application
  4. Analyse the results

1. Clone the repo

Clone the movie_ticket_booking_application_using_crunchydb repo locally. In a terminal, run:

$ git clone https://github.com/IBM/movie_ticket_booking_application_using_crunchydb

2. Deploy a Crunchy PostgreSQL for Kubernetes Operator to an OpenShift cluster

Steps to Deploy Crunchy PostgreSQL for Kubernetes Operator from Red Hat Marketplace on OpenShift Cluster can be found at Steps to Deploy Crunchy PostgreSQL for Kubernetes Operator

3. Run the application

To run the application, follow these steps:

3.1 Install the dependecies

Go to the cloned repo from step 1. In your terminal, run the following commands to install the required python libraries and run the app

  1. Install the required Python libraries by running the following command:
$ pip install -r requirements.txt
  1. Run the application as follows:
$ python app.py

3.2 Create a table and load it with required data

Open the following URL in the browser: http://localhost:5000/create

Click on the link. This will create screen and userdetails tables in the Crunchy Data PostgreSQL database and load it with required data.

Note: Please be patient, this step will take a while

3.3 Open the booking application

Open the application by following the promptss or opening the http://localhost:5000/.

The booking application showing the seats in a theater should lead on your screen.

4. Analyze the results

Now, let's play around with the app to see how it works.

  1. Select the seats you want, type your name and phone number in the fields and click Reserve Seats.

  2. Your booking will be showcased in the booking details tab . Click on Reserve More Tickets to reserve more seats.

    The seats you chose will be marked with an X, as shown below:

  3. You can view the tables in the CruncyDB console by running the following commands on the terminal,

    kubectl port-forward -n pgo svc/cpdemo-pgadmin 5050:5050

  4. Open the browser with the URL, http://localhost:5050/. This will open the console for Crunchy Data PostgreSQL database.

    For more details on Crunchy Data PostgreSQL console, refer to this tutorial

License

This code pattern is licensed under the Apache License, Version 2. Separate third-party code objects invoked within this code pattern are licensed by their respective providers pursuant to their own separate licenses. Contributions are subject to the Developer Certificate of Origin, Version 1.1 and the Apache License, Version 2.

Apache License FAQ

About

Build a Movie ticket booking application using Crunchy Data PostgreSQL on Red Hat Marketplace

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published