GROUP7

Step-by-Step Setup for Application

  1. Clone the application to local (i.e. git clone https://github.com/nguyensjsu/fa21-172-group-7.git).
  2. Make sure Node.js is installed.
  3. Install node dependencies for React front office by cd frontoffice and npm install.
  4. Install node dependencies for React back office by cd backoffice and npm install.
  5. You're done!

Individual Team Member Journals

These journals will include the following contents as per the project requirements:

  • A snapshot (point-in-time) image of the Team's Task Board highlighting which "Card" you worked on
  • A discussion of your accomplishments that week with a list of links to your Code Commits and PRs.
  • A discussion of the challenges you faced that week and how your resolved those issues.

These journals are located in the journals folder. They can also be accessed with the links below:

Project Description - GameGo

GameGo is a platform for purchasing video games, similar to GameStop.

Cloud Architecture Diagram

Overall Architecture Diagram of Cloud Deployment

Functional Requirements

  • User tasks:
    • Can register for an account, log in, and log out
    • Video games can be seen and selected for purchase
    • User can purchase a video game with a credit card
  • Admin tasks:
    • Game inventory can be accessed and the number of remaining games can be viewed
    • Previous transactions' information can be seen
    • List of user accounts can be seen
      • If a user is locked out of their account by too many log in attempts, admin can unlock them
    • Help inquiries sent in by the user can be seen

Technical Requirements

  • Frontend

    • React JS
  • Backend

    • Spring
    • MySQL 8.0
    • RabbitMQ
    • Kong API Gateway
    • CyberSource Payment Gateway
  • JDK 11

  • Gradle 5.6

Extra Credit

  • Okta Authentication
  • MySQL Cloud Database

Useful Scripts

// Found in package.json of base directory
npm run backend // Runs Spring Backend, SQL, Kong, Rabbit on Docker
npm run fo // Runs frontoffice web app
npm run bo // Runs backoffice web app
npm run clean-all // Stop and remove Spring Backend, SQL, Kong, Rabbit Docker Images

Commands to Run React Frontend

cd frontoffice / backoffice
npm install
npm start

Commands to Run Java Spring Backend

cd backend
gradle bootRun

Commands to Get Kong API Working

cd backend
gradle bootJar
// Start Docker Desktop
docker build -t spring-gamego .
docker images
docker network create --driver bridge gamego-network
docker network ls
docker network inspect gamego-network
docker run -d --name spring-gamego --network gamego-network -td spring-gamego

docker run -d --name kong \
--network=gamego-network \
-e "KONG_DATABASE=off" \
-e "KONG_PROXY_ACCESS_LOG=/dev/stdout" \
-e "KONG_ADMIN_ACCESS_LOG=/dev/stdout" \
-e "KONG_PROXY_ERROR_LOG=/dev/stderr" \
-e "KONG_ADMIN_ERROR_LOG=/dev/stderr" \
-e "KONG_ADMIN_LISTEN=0.0.0.0:8001, 0.0.0.0:8444 ssl" \
-p 80:8000 \
-p 443:8443 \
-p 8001:8001 \
-p 8444:8444 \
kong:2.4.0

http :8001/config config=@kong.yaml
docker exec -it kong kong reload

http localhost/api/ping
http localhost/api/ping apikey:2H3fONTa8ugl1IcVS7CjLPnPIS2Hp9dJ
curl localhost/api/ping -H 'apikey:2H3fONTa8ugl1IcVS7CjLPnPIS2Hp9dJ'

// Test it on the React app (Took Kong 20 seconds to respond on Windows)
// Make sure the Kong functions in App.js useEffect() are being used, not the non-Docker ones
npm start

GKE Deployment

GCP MySQL

  1. Create a new MySQL instances. Also remember to activate google-MySQL API. Sample tutorial.

  2. Go to connection and add your public ipv4 address.

image

  1. Enable VPC private IP

image

  1. Go to user and add admin- password.

image

  1. Go to database and add cmpe172.

image

  1. Change your MYSQL_HOST in deployment.yml of Kubernetes backend-deployment

image

GKE RabbitMQ

Upload GKE yml files from https://github.com/nguyensjsu/fa21-172-group-7/tree/main/backend/GKE_rabbit

Get credentials on GKE console: gcloud container clusters get-credentials YOURCLUSTERHERE --zone YOURCLUSTERZONEHERE ex: gcloud container clusters get-credentials cluster-backend --zone us-central1-a

Execute scripts on GKE console:

kubectl create -f rabbitmq-pod.yaml
kubectl create -f rabbitmq-console.yaml
kubectl create -f rabbitmq-service.yaml

GKE API-Cluster

Upload GKE yml files from https://github.com/nguyensjsu/fa21-172-group-7/tree/main/backend/docker https://github.com/nguyensjsu/fa21-172-group-7/tree/main/backend/kong

Get credentials on GKE console: gcloud container clusters get-credentials YOURCLUSTERHERE --zone YOURCLUSTERZONEHERE ex: gcloud container clusters get-credentials cluster-backend --zone us-central1-a

Execute scripts on GKE console:

kubectl create -f deployment.yaml 
kubectl create -f service.yaml
kubectl apply -f https://bit.ly/k4k8s

kubectl apply -f kong-ingress-rule.yaml
kubectl apply -f kong-strip-path.yaml
kubectl patch ingress gamego-api -p '{"metadata":{"annotations":{"konghq.com/override":"kong-strip-path"}}}'

kubectl apply -f kong-cors.yaml
kubectl apply -f kong-key-auth.yaml
kubectl patch service spring-gamego-api-service -p '{"metadata":{"annotations":{"konghq.com/plugins":"kong-key-auth"}}}'
kubectl apply -f kong-consumer.yaml

 kubectl create secret generic apikey  \
  --from-literal=kongCredType=key-auth  \
  --from-literal=key=2H3fONTa8ugl1IcVS7CjLPnPIS2Hp9dJ

kubectl apply -f kong-credentials.yaml

GKE ReactJS

Has the same steps as deploying Backend-Spring:

  1. In package.json, change proxy to the Backend-IP:Port

image

  1. build img - docker build -t frontend-gamego .
  2. tag - docker tag frontend-gamego YourDockerRepo
  3. docker push YourDockerRepo
  4. Uploads deployment.yml to GKE and create a pod and expose it with service.