forked from Rajspeaks/Google-Cloud-Qwiklabs-Lab-Assessment
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create Build a Website using Google Cloud
- Loading branch information
Showing
1 changed file
with
81 additions
and
0 deletions.
There are no files selected for viewing
81 changes: 81 additions & 0 deletions
81
Build a Website Using Google Cloud/Build a Website using Google Cloud
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
*****************Build-a-Website-on-Google-Cloud-Challenge-Lab*********************** | ||
|
||
|
||
|
||
######################################################################################## | ||
Task 1: Download the monolith code and build your container | ||
|
||
|
||
git clone https://github.com/googlecodelabs/monolith-to-microservices.git | ||
|
||
cd ~/monolith-to-microservices | ||
./setup.sh | ||
|
||
cd ~/monolith-to-microservices/monolith | ||
npm start | ||
|
||
gcloud services enable cloudbuild.googleapis.com | ||
gcloud builds submit --tag gcr.io/${GOOGLE_CLOUD_PROJECT}/fancytest:1.0.0 . | ||
|
||
|
||
########################################################################################## | ||
|
||
Task 2: Create a kubernetes cluster and deploy the application | ||
|
||
|
||
gcloud config set compute/zone us-central1-a | ||
gcloud services enable container.googleapis.com | ||
gcloud container clusters create fancy-cluster --num-nodes 3 | ||
|
||
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 your 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 | ||
|
||
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 | ||
|
||
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 | ||
|
||
|
||
################################################################################################### | ||
|
||
Task 5: Configure the Frontend microservice | ||
|
||
cd ~/monolith-to-microservices/react-app | ||
nano .env | ||
|
||
################################################################################################### | ||
Task 6: 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 7: 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 | ||
|
||
|
||
|
||
|
||
|
||
########################*************************##############################***************************##########################***************************##########################3 |