forked from TechieZilla/Qwiklabs
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Serverless Cloud Run Development: Challenge Lab [GSP328]
107 lines (66 loc) · 3.76 KB
/
Serverless Cloud Run Development: Challenge Lab [GSP328]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
GSP328 : Serverless Cloud Run Development: Challenge Lab :-
----------------------------------------------------------------------------------------------------------------------------------------------
gcloud auth list
gcloud config list project
gcloud config set project \
$(gcloud projects list --format='value(PROJECT_ID)' \
--filter='qwiklabs-gcp')
gcloud config set run/region us-central1
gcloud config set run/platform managed
git clone https://github.com/rosera/pet-theory.git && cd pet-theory/lab07
export PROJECT_ID=$(gcloud info --format='value(config.project)')
----------------------------------------------------------------------------------------------------------------------------------------------
Task - 1 : Deploy a Public Billing Service :-
cd
cd ~/pet-theory/lab07/unit-api-billing
gcloud builds submit --tag gcr.io/${PROJECT_ID}/billing-staging-api:0.1
gcloud run deploy public-billing-service --image gcr.io/${PROJECT_ID}/billing-staging-api:0.1
gcloud run services list
----------------------------------------------------------------------------------------------------------------------------------------------
Task - 2 : Deploy the Frontend Service :-
cd
cd ~/pet-theory/lab07/staging-frontend-billing
gcloud builds submit --tag gcr.io/${PROJECT_ID}/frontend-staging:0.1
gcloud run deploy public-billing-service --image gcr.io/${PROJECT_ID}/frontend-staging:0.1
gcloud run services list
----------------------------------------------------------------------------------------------------------------------------------------------
Task - 3 : Deploy a Private Billing Service :-
cd
cd ~/pet-theory/lab07/staging-api-billing
gcloud builds submit --tag gcr.io/${PROJECT_ID}/billing-staging-api:0.2
gcloud run deploy public-billing-service --image gcr.io/${PROJECT_ID}/billing-staging-api:0.2
gcloud run services list
BILLING_URL=$(gcloud run services describe $BILLING_SERVICE \
--platform managed \
--region us-central1 \
--format "value(status.url)")
curl -X get -H "Authorization: Bearer $(gcloud auth print-identity-token)" $BILLING_URL
----------------------------------------------------------------------------------------------------------------------------------------------
Task - 4 : Create a Billing Service Account :-
gcloud iam service-accounts create billing-service-sa --display-name "Billing Service Cloud Run"
----------------------------------------------------------------------------------------------------------------------------------------------
Task - 5 : Deploy a Billing Service in Production :-
cd
cd ~/pet-theory/lab07/prod-api-billing
gcloud builds submit --tag gcr.io/${PROJECT_ID}/billing-prod-api:0.1
gcloud run deploy public-billing-service --image gcr.io/${PROJECT_ID}/billing-prod-api:0.1
gcloud run services list
PROD_BILLING_SERVICE=private-billing-service
PROD_BILLING_URL=$(gcloud run services \
describe $PROD_BILLING_SERVICE \
--platform managed \
--region us-central1 \
--format "value(status.url)")
curl -X get -H "Authorization: Bearer \
$(gcloud auth print-identity-token)" \
$PROD_BILLING_URL
----------------------------------------------------------------------------------------------------------------------------------------------
Task - 6 : Create a Frontend Service Account :-
gcloud iam service-accounts create frontend-service-sa --display-name "Billing Service Cloud Run Invoker"
----------------------------------------------------------------------------------------------------------------------------------------------
Task - 7 : Deploy the Frontend Service in Production :-
cd
cd ~/pet-theory/lab07/prod-frontend-billing
gcloud builds submit --tag gcr.io/${PROJECT_ID}/frontend-prod:0.1
gcloud run deploy public-billing-service --image gcr.io/${PROJECT_ID}/frontend-prod:0.1
gcloud run services list