☁️
Cloud Computing
  • Introduction
  • Terminologies
    • Container
    • Kubernetes (K8s)
    • Serverless Computing
  • Services
    • Docker
    • Terraform
  • ☁️Cloud Computing Platforms
    • Google Cloud
      • Google Cloud Essentials
      • Management
        • Cloud IAM
      • Compute
        • Compute Engine
        • Kubernetes Engine
      • Resources
    • IBM Cloud
      • IBM Cloud Shell
      • Compute
      • Containers
      • Developer tools
      • Integration
      • Storage
      • Cloud Paks
    • Microsoft Azure
      • Compute
        • Functions
        • App Services
      • Networking
      • Storage
      • Web
      • Mobile
      • Databases
        • Cosmos DB
      • Analytics
      • AI + Machine Learning
      • Internet of things
      • Security
      • DevOps
      • Monitoring
      • Management and governance
      • Azure Stack
    • Amazon Web Services
    • Resources
  • Qwiklabs Challenge Labs
    • Create and Manage Cloud Resources
    • Deploy and Manage Cloud Environments with Google Cloud
    • Create ML Models with BigQuery ML
    • Insights from Data with BigQuery
    • Build a Website on Google Cloud
    • Build and Deploy a Docker Image to a Kubernetes Cluster
    • Build and Secure Networks in Google Cloud
    • Set Up and Configure a Cloud Environment in Google Cloud
    • Build and Optimize Data Warehouses with BigQuery: Challenge Lab
    • Scale Out and Update a Containerized Application on a Kubernetes Cluster
  • Whizlabs Challenge League
Powered by GitBook
On this page
  • Task 1
  • Download the monolith code
  • Build your container
  • Task 2
  • Create a Kubernetes cluster
  • Deploy the application
  • Task 3
  • Create a containerized version of orders and product Microservices
  • Task 4
  • Deploy the new microservices
  • Task 5
  • Create a containerized version of the Frontend microservice
  • Task 6
  • Deploy the Frontend microservice

Was this helpful?

  1. Qwiklabs Challenge Labs

Build a Website on Google Cloud

gcloud config set compute/zone us-central1-a

Task 1

Download the monolith code

git clone https://github.com/googlecodelabs/monolith-to-microservices.git
cd monolith-to-microservices
./setup.sh

Build your container

gcloud services enable cloudbuild.googleapis.com
cd ~/monolith-to-microservices/monolith
gcloud builds submit --tag gcr.io/${GOOGLE_CLOUD_PROJECT}/fancytest:1.0.0 .

Task 2

Create a Kubernetes cluster

gcloud services enable container.googleapis.com
gcloud container clusters create fancy-cluster --num-nodes 3

Deploy the application

kubectl create deployment fancytest \--image=gcr.io/${GOOGLE_CLOUD_PROJECT}/fancytest:1.0.0
kubectl expose deployment fancytest --type=LoadBalancer --port 80 --target-port 8080

Task 3

Create a containerized version of orders and product Microservices

cd ~/monolith-to-microservices/microservices/src/orders
gcloud builds submit --tag gcr.io/${GOOGLE_CLOUD_PROJECT}/orders:1.0.0 .
cd ~/monolith-to-microservices/microservices/src/products
gcloud builds submit --tag gcr.io/${GOOGLE_CLOUD_PROJECT}/products:1.0.0 .

Task 4

Deploy the new microservices

Orders

cd ~/monolith-to-microservices/microservices/src/orders
kubectl create deployment orders --image=gcr.io/${GOOGLE_CLOUD_PROJECT}/orders:1.0.0
kubectl expose deployment orders --type=LoadBalancer --port 80 --target-port 8081

Products

cd ~/monolith-to-microservices/microservices/src/products
kubectl create deployment products --image=gcr.io/${GOOGLE_CLOUD_PROJECT}/products:1.0.0
kubectl expose deployment products --type=LoadBalancer --port 80 --target-port 8082
kubectl get services

Task 5

cd ~/monolith-to-microservices/react-app
nano .env
When the editor opens, your file should look like this:

REACT_APP_ORDERS_URL=/service/orders
REACT_APP_PRODUCTS_URL=/service/products

Replace the REACT_APP_ORDERS_URL and REACT_APP_PRODUCTS_URL 
to the new format while replacing with your Orders and Products 
microservice IP address so it matches below:

REACT_APP_ORDERS_URL=http://<ORDERS_IP_ADDRESS>/api/orders
REACT_APP_PRODUCTS_URL=http://<PRODUCTS_IP_ADDRESS>/api/products

npm run build

Create a containerized version of the Frontend microservice

cd ~/monolith-to-microservices/microservices/src/frontend
gcloud builds submit --tag gcr.io/${GOOGLE_CLOUD_PROJECT}/frontend:1.0.0 .

Task 6

Deploy the Frontend microservice

kubectl create deployment frontend --image=gcr.io/${GOOGLE_CLOUD_PROJECT}/frontend:1.0.0
kubectl expose deployment frontend --type=LoadBalancer --port 80 --target-port 8080
PreviousInsights from Data with BigQueryNextBuild and Deploy a Docker Image to a Kubernetes Cluster

Last updated 3 years ago

Was this helpful?