Serverless Cloud Run Development: Challenge Lab

    1  gcloud config set project $(gcloud projects list --format='value(PROJECT_ID)' \
--filter='qwiklabs-gcp')
    2  gcloud config set run/region us-central1
    3  gcloud projects list --format='value(PROJECT_ID)' --filter='qwiklabs-gcp'
    4  gcloud config set run/platform managed
    5  git clone https://github.com/rosera/pet-theory.git && cd pet-theory/lab07
    9  cd unit-api-billing/
   11  gcloud builds submit   --tag gcr.io/qwiklabs-gcp-04-d69ce0e2b134/billing-staging-api:0.1
   12  gcloud run deploy public-billing-service-836 --image gcr.io/qwiklabs-gcp-04-d69ce0e2b134/billing-staging-api:0.1
   14  gcloud run services list
   17  cd staging-frontend-billing/
   18  gcloud builds submit   --tag gcr.io/qwiklabs-gcp-04-d69ce0e2b134/frontend-staging:0.1
   19  gcloud run deploy frontend-staging-service-935 --image gcr.io/qwiklabs-gcp-04-d69ce0e2b134/frontend-staging:0.1
   20  gcloud run services list
   23  cd staging-api-billing/
   25  gcloud builds submit   --tag gcr.io/qwiklabs-gcp-04-d69ce0e2b134/billing-staging-api:0.2
   26  gcloud run deploy private-billing-service-687 --image gcr.io/qwiklabs-gcp-04-d69ce0e2b134/billing-staging-api:0.2 --no-allow-unauthenticated
   27  gcloud run services list
   28  history
   29  gcloud run services list
   30  BILLING_URL=$(gcloud run services describe private-billing-service-687 \
--platform managed \
--region us-central1 \
--format "value(status.url)")
   31  echo $BILLING_URL
   32  curl -X get -H "Authorization: Bearer $(gcloud auth print-identity-token)" $BILLING_URL
   33  cd ..
   34  cd prod-api-billing/
   35  gcloud builds submit   --tag gcr.io/qwiklabs-gcp-04-d69ce0e2b134/billing-prod-api:0.1
   36  gcloud run deploy billing-prod-service-763 --image gcr.io/qwiklabs-gcp-04-d69ce0e2b134/billing-prod-api:0.1 --no-allow-unauthenticated
   37  gcloud run services list
   38  PROD_BILLING_URL=$(gcloud run services \
describe private-billing-service-687 \
--platform managed \
--region us-central1 \
--format "value(status.url)")
   39  echo $PROD_BILLING_URL
   40  curl -X get -H "Authorization: Bearer \
$(gcloud auth print-identity-token)" $PROD_BILLING_URL

   43  cd prod-frontend-billing/

   45  gcloud builds submit   --tag gcr.io/qwiklabs-gcp-04-d69ce0e2b134/frontend-prod:0.1
   46  gcloud run deploy frontend-prod-service-626 --image gcr.io/qwiklabs-gcp-04-d69ce0e2b134/frontend-prod:0.1 --no-allow-unauthenticated
   47  gcloud run services list






Welcome to Cloud Shell! Type "help" to get started.
Your Cloud Platform project in this session is set to qwiklabs-gcp-04-d69ce0e2b134.
Use “gcloud config set project [PROJECT_ID]” to change to a different project.
student_02_d960927116fb@cloudshell:~ (qwiklabs-gcp-04-d69ce0e2b134)$ gcloud config set project \
$(gcloud projects list --format='value(PROJECT_ID)' \
--filter='qwiklabs-gcp')
Updated property [core/project].
student_02_d960927116fb@cloudshell:~ (qwiklabs-gcp-04-d69ce0e2b134)$ gcloud config set run/region us-central1
Updated property [run/region].
student_02_d960927116fb@cloudshell:~ (qwiklabs-gcp-04-d69ce0e2b134)$ gcloud projects list --format='value(PROJECT_ID)' \                                                                             
--filter='qwiklabs-gcp'
qwiklabs-gcp-04-d69ce0e2b134
student_02_d960927116fb@cloudshell:~ (qwiklabs-gcp-04-d69ce0e2b134)$ gcloud config set run/platform managed
Updated property [run/platform].
student_02_d960927116fb@cloudshell:~ (qwiklabs-gcp-04-d69ce0e2b134)$ git clone https://github.com/rosera/pet-theory.git && cd pet-theory/lab07
Cloning into 'pet-theory'...
remote: Enumerating objects: 5896, done.
remote: Counting objects: 100% (458/458), done.
remote: Compressing objects: 100% (260/260), done.
remote: Total 5896 (delta 265), reused 198 (delta 198), pack-reused 5438
Receiving objects: 100% (5896/5896), 14.66 MiB | 10.86 MiB/s, done.
Resolving deltas: 100% (2451/2451), done.
student_02_d960927116fb@cloudshell:~/pet-theory/lab07 (qwiklabs-gcp-04-d69ce0e2b134)$ gcloud builds submit \
  --tag gcr.io/$GOOGLE_CLOUD_PROJECT/billing-staging-api:0.1

ERROR: (gcloud.builds.submit) Invalid value for [source]: Dockerfile required when specifying --tag
student_02_d960927116fb@cloudshell:~/pet-theory/lab07 (qwiklabs-gcp-04-d69ce0e2b134)$ gcloud builds submit   --tag gcr.io/qwiklabs-gcp-04-d69ce0e2b134/billing-staging-api:0.1
ERROR: (gcloud.builds.submit) Invalid value for [source]: Dockerfile required when specifying --tag
student_02_d960927116fb@cloudshell:~/pet-theory/lab07 (qwiklabs-gcp-04-d69ce0e2b134)$ ls -l
total 24
drwxr-xr-x 3 student_02_d960927116fb student_02_d960927116fb 4096 Sep 29 17:49 prod-api-billing
drwxr-xr-x 4 student_02_d960927116fb student_02_d960927116fb 4096 Sep 29 17:49 prod-frontend-billing
-rw-r--r-- 1 student_02_d960927116fb student_02_d960927116fb  385 Sep 29 17:49 README.md
drwxr-xr-x 3 student_02_d960927116fb student_02_d960927116fb 4096 Sep 29 17:49 staging-api-billing
drwxr-xr-x 4 student_02_d960927116fb student_02_d960927116fb 4096 Sep 29 17:49 staging-frontend-billing
drwxr-xr-x 3 student_02_d960927116fb student_02_d960927116fb 4096 Sep 29 17:49 unit-api-billing
student_02_d960927116fb@cloudshell:~/pet-theory/lab07 (qwiklabs-gcp-04-d69ce0e2b134)$ cd unit-api-billing/
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/unit-api-billing (qwiklabs-gcp-04-d69ce0e2b134)$ ls -l
total 16
-rw-r--r-- 1 student_02_d960927116fb student_02_d960927116fb  140 Sep 29 17:49 Dockerfile
-rw-r--r-- 1 student_02_d960927116fb student_02_d960927116fb  306 Sep 29 17:49 index.js
-rw-r--r-- 1 student_02_d960927116fb student_02_d960927116fb  260 Sep 29 17:49 package.json
drwxr-xr-x 2 student_02_d960927116fb student_02_d960927116fb 4096 Sep 29 17:49 solution-01
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/unit-api-billing (qwiklabs-gcp-04-d69ce0e2b134)$ 
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/unit-api-billing (qwiklabs-gcp-04-d69ce0e2b134)$ gcloud builds submit   --tag gcr.io/qwiklabs-gcp-04-d69ce0e2b134/billing-staging-api:0.1
Creating temporary tarball archive of 6 file(s) totalling 1.4 KiB before compression.
Uploading tarball of [.] to [gs://qwiklabs-gcp-04-d69ce0e2b134_cloudbuild/source/1696009978.082322-90bec226f9484016b5fd8757757e5d25.tgz]
Created [https://cloudbuild.googleapis.com/v1/projects/qwiklabs-gcp-04-d69ce0e2b134/locations/global/builds/45be73ce-6503-4b2d-b58d-0f8c1bea12f1].
Logs are available at [ https://console.cloud.google.com/cloud-build/builds/45be73ce-6503-4b2d-b58d-0f8c1bea12f1?project=516149564574 ].
---------------------------------------------------------------------------------------------------------- REMOTE BUILD OUTPUT -----------------------------------------------------------------------------------------------------------
starting build "45be73ce-6503-4b2d-b58d-0f8c1bea12f1"

FETCHSOURCE
Fetching storage object: gs://qwiklabs-gcp-04-d69ce0e2b134_cloudbuild/source/1696009978.082322-90bec226f9484016b5fd8757757e5d25.tgz#1696009979157411
Copying gs://qwiklabs-gcp-04-d69ce0e2b134_cloudbuild/source/1696009978.082322-90bec226f9484016b5fd8757757e5d25.tgz#1696009979157411...
/ [1 files][  813.0 B/  813.0 B]                                                
Operation completed over 1 objects/813.0 B.
BUILD
Already have image (with digest): gcr.io/cloud-builders/docker
Sending build context to Docker daemon   7.68kB
Step 1/6 : FROM node:12-slim
12-slim: Pulling from library/node
8bd3f5a20b90: Pulling fs layer
3a665e454db5: Pulling fs layer
b5b0e172ab63: Pulling fs layer
45013ee4878f: Pulling fs layer
42a448233138: Pulling fs layer
45013ee4878f: Waiting
42a448233138: Waiting
3a665e454db5: Verifying Checksum
3a665e454db5: Download complete
45013ee4878f: Verifying Checksum
45013ee4878f: Download complete
b5b0e172ab63: Verifying Checksum
b5b0e172ab63: Download complete
42a448233138: Verifying Checksum
42a448233138: Download complete
8bd3f5a20b90: Verifying Checksum
8bd3f5a20b90: Download complete
8bd3f5a20b90: Pull complete
3a665e454db5: Pull complete
b5b0e172ab63: Pull complete
45013ee4878f: Pull complete
42a448233138: Pull complete
Digest: sha256:c28ca4124ac84ff1e72ee68abfe70aa4cc86f499c1ef20408dc2d35af1058ac1
Status: Downloaded newer image for node:12-slim
 9b792ac6810e
Step 2/6 : WORKDIR /usr/src/app
 Running in a14c6bf12f85
Removing intermediate container a14c6bf12f85
 a6a46e6e3859
Step 3/6 : COPY package.json package*.json ./
 f7e1f920ae21
Step 4/6 : RUN npm install --only=production
 Running in 33098812b999
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN billing-rest-api@1.0.0 No description
npm WARN billing-rest-api@1.0.0 No repository field.

added 58 packages from 42 contributors and audited 58 packages in 3.163s

8 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

Removing intermediate container 33098812b999
 5fbcb134a359
Step 5/6 : COPY . .
 47b095686a72
Step 6/6 : CMD [ "npm", "start" ]
 Running in 4d4362a5eff8
Removing intermediate container 4d4362a5eff8
 39f0e22f6cd5
Successfully built 39f0e22f6cd5
Successfully tagged gcr.io/qwiklabs-gcp-04-d69ce0e2b134/billing-staging-api:0.1
PUSH
Pushing gcr.io/qwiklabs-gcp-04-d69ce0e2b134/billing-staging-api:0.1
The push refers to repository [gcr.io/qwiklabs-gcp-04-d69ce0e2b134/billing-staging-api]
e22d44404795: Preparing
d130dbd4eefe: Preparing
fc900dc614ad: Preparing
0abde71afa93: Preparing
a2300a3fbe99: Preparing
7722feb318fa: Preparing
56ff4c5413ca: Preparing
3d1236fa695c: Preparing
dc8ea258c7d2: Preparing
7722feb318fa: Waiting
56ff4c5413ca: Waiting
3d1236fa695c: Waiting
dc8ea258c7d2: Waiting
a2300a3fbe99: Layer already exists
7722feb318fa: Layer already exists
56ff4c5413ca: Layer already exists
3d1236fa695c: Layer already exists
dc8ea258c7d2: Layer already exists
0abde71afa93: Pushed
e22d44404795: Pushed
fc900dc614ad: Pushed
d130dbd4eefe: Pushed
0.1: digest: sha256:864161e5086adf42fc9d4d79b7b3d3c553b29d08fcb57bd70f4e41c5fdf1668b size: 2199
DONE
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
ID: 45be73ce-6503-4b2d-b58d-0f8c1bea12f1
CREATE_TIME: 2023-09-29T17:52:59+00:00
DURATION: 35S
SOURCE: gs://qwiklabs-gcp-04-d69ce0e2b134_cloudbuild/source/1696009978.082322-90bec226f9484016b5fd8757757e5d25.tgz
IMAGES: gcr.io/qwiklabs-gcp-04-d69ce0e2b134/billing-staging-api:0.1
STATUS: SUCCESS
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/unit-api-billing (qwiklabs-gcp-04-d69ce0e2b134)$ gcloud run deploy public-billing-service-836 --image gcr.io/qwiklabs-gcp-04-d69ce0e2b134/billing-staging-api:0.1
Allow unauthenticated invocations to [public-billing-service-836] (y/N)?  y

Deploying container to Cloud Run service [public-billing-service-836] in project [qwiklabs-gcp-04-d69ce0e2b134] region [us-central1]
OK Deploying new service... Done.                                                                                                                                                                                                        
  OK Creating Revision...                                                                                                                                                                                                                
  OK Routing traffic...                                                                                                                                                                                                                  
  OK Setting IAM Policy...                                                                                                                                                                                                               
Done.                                                                                                                                                                                                                                    
Service [public-billing-service-836] revision [public-billing-service-836-00001-7d2] has been deployed and is serving 100 percent of traffic.
Service URL: https://public-billing-service-836-6ii5fljnfq-uc.a.run.app
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/unit-api-billing (qwiklabs-gcp-04-d69ce0e2b134)$ gcloud run service list
ERROR: (gcloud.run) Invalid choice: 'service'.
Maybe you meant:
  gcloud run services list
  gcloud service-directory services list
  gcloud network-services service-bindings list
  gcloud services list
  gcloud run services add-iam-policy-binding
  gcloud run services delete
  gcloud run services describe
  gcloud run services get-iam-policy
  gcloud run services proxy
  gcloud run services remove-iam-policy-binding

To search the help text of gcloud commands, run:
  gcloud help -- SEARCH_TERMS
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/unit-api-billing (qwiklabs-gcp-04-d69ce0e2b134)$ gcloud run services list
SERVICE: public-billing-service-836
REGION: us-central1
URL: https://public-billing-service-836-6ii5fljnfq-uc.a.run.app
LAST DEPLOYED BY: student-02-d960927116fb@qwiklabs.net
LAST DEPLOYED AT: 2023-09-29T17:57:45.488801Z
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/unit-api-billing (qwiklabs-gcp-04-d69ce0e2b134)$ cd ..
student_02_d960927116fb@cloudshell:~/pet-theory/lab07 (qwiklabs-gcp-04-d69ce0e2b134)$ ls -l
total 24
drwxr-xr-x 3 student_02_d960927116fb student_02_d960927116fb 4096 Sep 29 17:49 prod-api-billing
drwxr-xr-x 4 student_02_d960927116fb student_02_d960927116fb 4096 Sep 29 17:49 prod-frontend-billing
-rw-r--r-- 1 student_02_d960927116fb student_02_d960927116fb  385 Sep 29 17:49 README.md
drwxr-xr-x 3 student_02_d960927116fb student_02_d960927116fb 4096 Sep 29 17:49 staging-api-billing
drwxr-xr-x 4 student_02_d960927116fb student_02_d960927116fb 4096 Sep 29 17:49 staging-frontend-billing
drwxr-xr-x 3 student_02_d960927116fb student_02_d960927116fb 4096 Sep 29 17:49 unit-api-billing
student_02_d960927116fb@cloudshell:~/pet-theory/lab07 (qwiklabs-gcp-04-d69ce0e2b134)$ cd staging-frontend-billing/
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/staging-frontend-billing (qwiklabs-gcp-04-d69ce0e2b134)$ 
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/staging-frontend-billing (qwiklabs-gcp-04-d69ce0e2b134)$ 
























                                                                                                                               
Service [private-billing-service-687] revision [private-billing-service-687-00001-7wt] has been deployed and is serving 100 percent of



ERROR: (gcloud.builds.submit) build a0361b8f-640f-4925-8243-6b796ecc6d35 completed with status "CANCELLED"
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/staging-frontend-billing (qwiklabs-gcp-04-d69ce0e2b134)$ 
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/staging-frontend-billing (qwiklabs-gcp-04-d69ce0e2b134)$ 
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/staging-frontend-billing (qwiklabs-gcp-04-d69ce0e2b134)$ gcloud builds submit   --tag gcr.io/qwiklabs-gcp-04-d69ce0e2b134/frontend-staging:0.1
Creating temporary tarball archive of 62 file(s) totalling 3.0 MiB before compression.
Uploading tarball of [.] to [gs://qwiklabs-gcp-04-d69ce0e2b134_cloudbuild/source/1696010427.107123-6306b498e2cb4f3eb0a7521f29d0a2d8.tgz]
Created [https://cloudbuild.googleapis.com/v1/projects/qwiklabs-gcp-04-d69ce0e2b134/locations/global/builds/bfb67090-576e-434b-b2ae-cd3a03b0822c].
Logs are available at [ https://console.cloud.google.com/cloud-build/builds/bfb67090-576e-434b-b2ae-cd3a03b0822c?project=516149564574 ].
---------------------------------------------------------------------------------------------------------- REMOTE BUILD OUTPUT -----------------------------------------------------------------------------------------------------------
starting build "bfb67090-576e-434b-b2ae-cd3a03b0822c"

FETCHSOURCE
Fetching storage object: gs://qwiklabs-gcp-04-d69ce0e2b134_cloudbuild/source/1696010427.107123-6306b498e2cb4f3eb0a7521f29d0a2d8.tgz#1696010427831729
Copying gs://qwiklabs-gcp-04-d69ce0e2b134_cloudbuild/source/1696010427.107123-6306b498e2cb4f3eb0a7521f29d0a2d8.tgz#1696010427831729...
/ [1 files][  1.3 MiB/  1.3 MiB]                                                
Operation completed over 1 objects/1.3 MiB.
BUILD
Already have image (with digest): gcr.io/cloud-builders/docker
Sending build context to Docker daemon  3.154MB
Step 1/6 : FROM node:12-slim
12-slim: Pulling from library/node
8bd3f5a20b90: Pulling fs layer
3a665e454db5: Pulling fs layer
b5b0e172ab63: Pulling fs layer
45013ee4878f: Pulling fs layer
42a448233138: Pulling fs layer
45013ee4878f: Waiting
42a448233138: Waiting
3a665e454db5: Verifying Checksum
3a665e454db5: Download complete
45013ee4878f: Verifying Checksum
45013ee4878f: Download complete
8bd3f5a20b90: Verifying Checksum
8bd3f5a20b90: Download complete
b5b0e172ab63: Verifying Checksum
b5b0e172ab63: Download complete
42a448233138: Download complete
8bd3f5a20b90: Pull complete
3a665e454db5: Pull complete
b5b0e172ab63: Pull complete
45013ee4878f: Pull complete
42a448233138: Pull complete
Digest: sha256:c28ca4124ac84ff1e72ee68abfe70aa4cc86f499c1ef20408dc2d35af1058ac1
Status: Downloaded newer image for node:12-slim
 9b792ac6810e
Step 2/6 : WORKDIR /usr/src/app
 Running in 7b95423fdd54
Removing intermediate container 7b95423fdd54
 91f3af1798cd
Step 3/6 : COPY package.json package*.json ./
 b926025d8163
Step 4/6 : RUN npm install --only=production
 Running in 3c30bc2f1fa2
npm WARN gsp328-cloudrun-challenge-lab@1.0.0 No description
npm WARN gsp328-cloudrun-challenge-lab@1.0.0 No repository field.

added 59 packages from 79 contributors and audited 59 packages in 2.246s
found 3 vulnerabilities (1 moderate, 2 high)
  run `npm audit fix` to fix them, or `npm audit` for details
Removing intermediate container 3c30bc2f1fa2
 06e75c740a63
Step 5/6 : COPY . .
 89fcca762a54
Step 6/6 : CMD [ "npm", "start" ]
 Running in 5a9a67bd262a
Removing intermediate container 5a9a67bd262a
 2e81201bb803
Successfully built 2e81201bb803
Successfully tagged gcr.io/qwiklabs-gcp-04-d69ce0e2b134/frontend-staging:0.1
PUSH
Pushing gcr.io/qwiklabs-gcp-04-d69ce0e2b134/frontend-staging:0.1
The push refers to repository [gcr.io/qwiklabs-gcp-04-d69ce0e2b134/frontend-staging]
ee3d1120334f: Preparing
911927a4e920: Preparing
1e5b56c50bcc: Preparing
c397f264839f: Preparing
a2300a3fbe99: Preparing
7722feb318fa: Preparing
56ff4c5413ca: Preparing
3d1236fa695c: Preparing
dc8ea258c7d2: Preparing
7722feb318fa: Waiting
56ff4c5413ca: Waiting
3d1236fa695c: Waiting
dc8ea258c7d2: Waiting
a2300a3fbe99: Layer already exists
7722feb318fa: Layer already exists
56ff4c5413ca: Layer already exists
3d1236fa695c: Layer already exists
dc8ea258c7d2: Layer already exists
c397f264839f: Pushed
1e5b56c50bcc: Pushed
ee3d1120334f: Pushed
911927a4e920: Pushed
0.1: digest: sha256:01145b0519ef608e5fbf58b9cfdf0e085c17407a82f4ade0f4df9e3cb212e000 size: 2204
DONE
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
ID: bfb67090-576e-434b-b2ae-cd3a03b0822c
CREATE_TIME: 2023-09-29T18:00:28+00:00
DURATION: 26S
SOURCE: gs://qwiklabs-gcp-04-d69ce0e2b134_cloudbuild/source/1696010427.107123-6306b498e2cb4f3eb0a7521f29d0a2d8.tgz
IMAGES: gcr.io/qwiklabs-gcp-04-d69ce0e2b134/frontend-staging:0.1
STATUS: SUCCESS
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/staging-frontend-billing (qwiklabs-gcp-04-d69ce0e2b134)$ 
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/staging-frontend-billing (qwiklabs-gcp-04-d69ce0e2b134)$ 
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/staging-frontend-billing (qwiklabs-gcp-04-d69ce0e2b134)$ 
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/staging-frontend-billing (qwiklabs-gcp-04-d69ce0e2b134)$ gcloud run deploy frontend-staging-service-935 --image gcr.io/qwiklabs-gcp-04-d69ce0e2b134/frontend-staging:0.1
Allow unauthenticated invocations to [frontend-staging-service-935] (y/N)?  y

Deploying container to Cloud Run service [frontend-staging-service-935] in project [qwiklabs-gcp-04-d69ce0e2b134] region [us-central1]
OK Deploying new service... Done.                                                                                                                                                                                                        
  OK Creating Revision...                                                                                                                                                                                                                
  OK Routing traffic...                                                                                                                                                                                                                  
  OK Setting IAM Policy...                                                                                                                                                                                                               
Done.                                                                                                                                                                                                                                    
Service [frontend-staging-service-935] revision [frontend-staging-service-935-00001-h5v] has been deployed and is serving 100 percent of traffic.
Service URL: https://frontend-staging-service-935-6ii5fljnfq-uc.a.run.app
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/staging-frontend-billing (qwiklabs-gcp-04-d69ce0e2b134)$ gcloud run services list
SERVICE: frontend-staging-service-935
REGION: us-central1
URL: https://frontend-staging-service-935-6ii5fljnfq-uc.a.run.app
LAST DEPLOYED BY: student-02-d960927116fb@qwiklabs.net
LAST DEPLOYED AT: 2023-09-29T18:03:34.354185Z

SERVICE: public-billing-service-836
REGION: us-central1
URL: https://public-billing-service-836-6ii5fljnfq-uc.a.run.app
LAST DEPLOYED BY: student-02-d960927116fb@qwiklabs.net
LAST DEPLOYED AT: 2023-09-29T17:57:45.488801Z
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/staging-frontend-billing (qwiklabs-gcp-04-d69ce0e2b134)$ cd ../
student_02_d960927116fb@cloudshell:~/pet-theory/lab07 (qwiklabs-gcp-04-d69ce0e2b134)$ ls -l
total 24
drwxr-xr-x 3 student_02_d960927116fb student_02_d960927116fb 4096 Sep 29 17:49 prod-api-billing
drwxr-xr-x 4 student_02_d960927116fb student_02_d960927116fb 4096 Sep 29 17:49 prod-frontend-billing
-rw-r--r-- 1 student_02_d960927116fb student_02_d960927116fb  385 Sep 29 17:49 README.md
drwxr-xr-x 3 student_02_d960927116fb student_02_d960927116fb 4096 Sep 29 17:49 staging-api-billing
drwxr-xr-x 4 student_02_d960927116fb student_02_d960927116fb 4096 Sep 29 17:49 staging-frontend-billing
drwxr-xr-x 3 student_02_d960927116fb student_02_d960927116fb 4096 Sep 29 17:49 unit-api-billing
student_02_d960927116fb@cloudshell:~/pet-theory/lab07 (qwiklabs-gcp-04-d69ce0e2b134)$ cd staging-api-billing/
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/staging-api-billing (qwiklabs-gcp-04-d69ce0e2b134)$ ls -l
total 16
-rw-r--r-- 1 student_02_d960927116fb student_02_d960927116fb  140 Sep 29 17:49 Dockerfile
-rw-r--r-- 1 student_02_d960927116fb student_02_d960927116fb  314 Sep 29 17:49 index.js
-rw-r--r-- 1 student_02_d960927116fb student_02_d960927116fb  260 Sep 29 17:49 package.json
drwxr-xr-x 2 student_02_d960927116fb student_02_d960927116fb 4096 Sep 29 17:49 solution-01
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/staging-api-billing (qwiklabs-gcp-04-d69ce0e2b134)$ 
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/staging-api-billing (qwiklabs-gcp-04-d69ce0e2b134)$ 
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/staging-api-billing (qwiklabs-gcp-04-d69ce0e2b134)$ gcloud builds submit   --tag gcr.io/qwiklabs-gcp-04-d69ce0e2b134/billing-staging-api:0.2
Creating temporary tarball archive of 6 file(s) totalling 1.4 KiB before compression.
Uploading tarball of [.] to [gs://qwiklabs-gcp-04-d69ce0e2b134_cloudbuild/source/1696010684.822979-e68dc9245ebd4d31b1c869926b23c22f.tgz]
Created [https://cloudbuild.googleapis.com/v1/projects/qwiklabs-gcp-04-d69ce0e2b134/locations/global/builds/8763f3ce-766c-439a-8e01-33e9a0f53541].
Logs are available at [ https://console.cloud.google.com/cloud-build/builds/8763f3ce-766c-439a-8e01-33e9a0f53541?project=516149564574 ].
---------------------------------------------------------------------------------------------------------- REMOTE BUILD OUTPUT -----------------------------------------------------------------------------------------------------------
starting build "8763f3ce-766c-439a-8e01-33e9a0f53541"

FETCHSOURCE
Fetching storage object: gs://qwiklabs-gcp-04-d69ce0e2b134_cloudbuild/source/1696010684.822979-e68dc9245ebd4d31b1c869926b23c22f.tgz#1696010685138771
Copying gs://qwiklabs-gcp-04-d69ce0e2b134_cloudbuild/source/1696010684.822979-e68dc9245ebd4d31b1c869926b23c22f.tgz#1696010685138771...
/ [1 files][  820.0 B/  820.0 B]                                                
Operation completed over 1 objects/820.0 B.
BUILD
Already have image (with digest): gcr.io/cloud-builders/docker
Sending build context to Docker daemon   7.68kB
Step 1/6 : FROM node:12-slim
12-slim: Pulling from library/node
8bd3f5a20b90: Pulling fs layer
3a665e454db5: Pulling fs layer
b5b0e172ab63: Pulling fs layer
45013ee4878f: Pulling fs layer
42a448233138: Pulling fs layer
45013ee4878f: Waiting
42a448233138: Waiting
3a665e454db5: Verifying Checksum
3a665e454db5: Download complete
45013ee4878f: Verifying Checksum
45013ee4878f: Download complete
42a448233138: Verifying Checksum
42a448233138: Download complete
b5b0e172ab63: Verifying Checksum
b5b0e172ab63: Download complete
8bd3f5a20b90: Verifying Checksum
8bd3f5a20b90: Download complete
8bd3f5a20b90: Pull complete
3a665e454db5: Pull complete
b5b0e172ab63: Pull complete
45013ee4878f: Pull complete
42a448233138: Pull complete
Digest: sha256:c28ca4124ac84ff1e72ee68abfe70aa4cc86f499c1ef20408dc2d35af1058ac1
Status: Downloaded newer image for node:12-slim
 9b792ac6810e
Step 2/6 : WORKDIR /usr/src/app
 Running in a621a47c5038
Removing intermediate container a621a47c5038
 25c579cf5dc6
Step 3/6 : COPY package.json package*.json ./
 b16b3f05e4a8
Step 4/6 : RUN npm install --only=production
 Running in 39778bcb2eec
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN billing-rest-api@1.0.0 No description
npm WARN billing-rest-api@1.0.0 No repository field.

added 58 packages from 42 contributors and audited 58 packages in 3.034s

8 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
Removing intermediate container 39778bcb2eec
 fcce84e3faca
Step 5/6 : COPY . .
 2d83fef235f7
Step 6/6 : CMD [ "npm", "start" ]
 Running in 7b0a6c9664e3
Removing intermediate container 7b0a6c9664e3
 dfe2a34d8ead
Successfully built dfe2a34d8ead
Successfully tagged gcr.io/qwiklabs-gcp-04-d69ce0e2b134/billing-staging-api:0.2
PUSH
Pushing gcr.io/qwiklabs-gcp-04-d69ce0e2b134/billing-staging-api:0.2
The push refers to repository [gcr.io/qwiklabs-gcp-04-d69ce0e2b134/billing-staging-api]
9c67d001cc9d: Preparing
fea4508c05fb: Preparing
3c7a3ec300ff: Preparing
0c1896201c06: Preparing
a2300a3fbe99: Preparing
7722feb318fa: Preparing
56ff4c5413ca: Preparing
3d1236fa695c: Preparing
dc8ea258c7d2: Preparing
7722feb318fa: Waiting
56ff4c5413ca: Waiting
3d1236fa695c: Waiting
dc8ea258c7d2: Waiting
a2300a3fbe99: Layer already exists
7722feb318fa: Layer already exists
56ff4c5413ca: Layer already exists
3d1236fa695c: Layer already exists
dc8ea258c7d2: Layer already exists
3c7a3ec300ff: Pushed
0c1896201c06: Pushed
9c67d001cc9d: Pushed
fea4508c05fb: Pushed
0.2: digest: sha256:6f4fb625edc0b0831a87d36ee9b5b93b042d220ac84d297a902b4a43a8c8daed size: 2199
DONE
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
ID: 8763f3ce-766c-439a-8e01-33e9a0f53541
CREATE_TIME: 2023-09-29T18:04:45+00:00
DURATION: 29S
SOURCE: gs://qwiklabs-gcp-04-d69ce0e2b134_cloudbuild/source/1696010684.822979-e68dc9245ebd4d31b1c869926b23c22f.tgz
IMAGES: gcr.io/qwiklabs-gcp-04-d69ce0e2b134/billing-staging-api:0.2
STATUS: SUCCESS
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/staging-api-billing (qwiklabs-gcp-04-d69ce0e2b134)$ 
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/staging-api-billing (qwiklabs-gcp-04-d69ce0e2b134)$ gcloud run deploy private-billing-service-687 --image gcr.io/qwiklabs-gcp-04-d69ce0e2b134/billing-staging-api:0.2 --no-allow-unauthenticated
Deploying container to Cloud Run service [private-billing-service-687] in project [qwiklabs-gcp-04-d69ce0e2b134] region [us-central1]
OK Deploying new service... Done.                                                                                                                                                                                                        
  OK Creating Revision...                                                                                                                                                                                                                
  OK Routing traffic...                                                                                                                                                                                                                  
Done.                                                                                                                                                                                                                                    
Service [private-billing-service-687] revision [private-billing-service-687-00001-7wt] has been deployed and is serving 100 percent of traffic.
Service URL: https://private-billing-service-687-6ii5fljnfq-uc.a.run.app
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/staging-api-billing (qwiklabs-gcp-04-d69ce0e2b134)$ 
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/staging-api-billing (qwiklabs-gcp-04-d69ce0e2b134)$ 
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/staging-api-billing (qwiklabs-gcp-04-d69ce0e2b134)$ gcloud run services list
SERVICE: frontend-staging-service-935
REGION: us-central1
URL: https://frontend-staging-service-935-6ii5fljnfq-uc.a.run.app
LAST DEPLOYED BY: student-02-d960927116fb@qwiklabs.net
LAST DEPLOYED AT: 2023-09-29T18:03:34.354185Z

SERVICE: private-billing-service-687
REGION: us-central1
URL: https://private-billing-service-687-6ii5fljnfq-uc.a.run.app
LAST DEPLOYED BY: student-02-d960927116fb@qwiklabs.net
LAST DEPLOYED AT: 2023-09-29T18:07:43.579318Z

SERVICE: public-billing-service-836
REGION: us-central1
URL: https://public-billing-service-836-6ii5fljnfq-uc.a.run.app
LAST DEPLOYED BY: student-02-d960927116fb@qwiklabs.net
LAST DEPLOYED AT: 2023-09-29T17:57:45.488801Z
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/staging-api-billing (qwiklabs-gcp-04-d69ce0e2b13




student_02_d960927116fb@cloudshell:~/pet-theory/lab07/staging-api-billing (qwiklabs-gcp-04-d69ce0e2b134)$ history
    1  gcloud config set project $(gcloud projects list --format='value(PROJECT_ID)' \
--filter='qwiklabs-gcp')
    2  gcloud config set run/region us-central1
    3  gcloud projects list --format='value(PROJECT_ID)' --filter='qwiklabs-gcp'
    4  gcloud config set run/platform managed
    5  git clone https://github.com/rosera/pet-theory.git && cd pet-theory/lab07
    6  gcloud builds submit   --tag gcr.io/$GOOGLE_CLOUD_PROJECT/billing-staging-api:0.1
    7  gcloud builds submit   --tag gcr.io/qwiklabs-gcp-04-d69ce0e2b134/billing-staging-api:0.1
    8  ls -l
    9  cd unit-api-billing/
   10  ls -l
   11  gcloud builds submit   --tag gcr.io/qwiklabs-gcp-04-d69ce0e2b134/billing-staging-api:0.1
   12  gcloud run deploy public-billing-service-836 --image gcr.io/qwiklabs-gcp-04-d69ce0e2b134/billing-staging-api:0.1
   13  gcloud run service list
   14  gcloud run services list
   15  cd ..
   16  ls -l
   17  cd staging-frontend-billing/
   18  gcloud builds submit   --tag gcr.io/qwiklabs-gcp-04-d69ce0e2b134/frontend-staging:0.1
   19  gcloud run deploy frontend-staging-service-935 --image gcr.io/qwiklabs-gcp-04-d69ce0e2b134/frontend-staging:0.1
   20  gcloud run services list
   21  cd ../
   22  ls -l
   23  cd staging-api-billing/
   24  ls -l
   25  gcloud builds submit   --tag gcr.io/qwiklabs-gcp-04-d69ce0e2b134/billing-staging-api:0.2
   26  gcloud run deploy private-billing-service-687 --image gcr.io/qwiklabs-gcp-04-d69ce0e2b134/billing-staging-api:0.2 --no-allow-unauthenticated
   27  gcloud run services list
   28  history
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/staging-api-billing (qwiklabs-gcp-04-d69ce0e2b134)$ 







0e2b134)$ 
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/staging-api-billing (qwiklabs-gcp-04-d69ce0e2b134)$ history
    1  gcloud config set project $(gcloud projects list --format='value(PROJECT_ID)' \
--filter='qwiklabs-gcp')
    2  gcloud config set run/region us-central1
    3  gcloud projects list --format='value(PROJECT_ID)' --filter='qwiklabs-gcp'
    4  gcloud config set run/platform managed
    5  git clone https://github.com/rosera/pet-theory.git && cd pet-theory/lab07
    6  gcloud builds submit   --tag gcr.io/$GOOGLE_CLOUD_PROJECT/billing-staging-api:0.1
    7  gcloud builds submit   --tag gcr.io/qwiklabs-gcp-04-d69ce0e2b134/billing-staging-api:0.1
    8  ls -l
    9  cd unit-api-billing/
   10  ls -l
   11  gcloud builds submit   --tag gcr.io/qwiklabs-gcp-04-d69ce0e2b134/billing-staging-api:0.1
   12  gcloud run deploy public-billing-service-836 --image gcr.io/qwiklabs-gcp-04-d69ce0e2b134/billing-staging-api:0.1
   13  gcloud run service list
   14  gcloud run services list
   15  cd ..
   16  ls -l
   17  cd staging-frontend-billing/
   18  gcloud builds submit   --tag gcr.io/qwiklabs-gcp-04-d69ce0e2b134/frontend-staging:0.1
   19  gcloud run deploy frontend-staging-service-935 --image gcr.io/qwiklabs-gcp-04-d69ce0e2b134/frontend-staging:0.1
   20  gcloud run services list
   21  cd ../
   22  ls -l
   23  cd staging-api-billing/
   24  ls -l
   25  gcloud builds submit   --tag gcr.io/qwiklabs-gcp-04-d69ce0e2b134/billing-staging-api:0.2
   26  gcloud run deploy private-billing-service-687 --image gcr.io/qwiklabs-gcp-04-d69ce0e2b134/billing-staging-api:0.2 --no-allow-unauthenticated
   27  gcloud run services list
   28  history
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/staging-api-billing (qwiklabs-gcp-04-d69ce0e2b134)$ 
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/staging-api-billing (qwiklabs-gcp-04-d69ce0e2b134)$ 
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/staging-api-billing (qwiklabs-gcp-04-d69ce0e2b134)$ 
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/staging-api-billing (qwiklabs-gcp-04-d69ce0e2b134)$ 
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/staging-api-billing (qwiklabs-gcp-04-d69ce0e2b134)$ 
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/staging-api-billing (qwiklabs-gcp-04-d69ce0e2b134)$ 
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/staging-api-billing (qwiklabs-gcp-04-d69ce0e2b134)$ gcloud run services list
SERVICE: frontend-staging-service-935
REGION: us-central1
URL: https://frontend-staging-service-935-6ii5fljnfq-uc.a.run.app
LAST DEPLOYED BY: student-02-d960927116fb@qwiklabs.net
LAST DEPLOYED AT: 2023-09-29T18:03:34.354185Z

SERVICE: private-billing-service-687
REGION: us-central1
URL: https://private-billing-service-687-6ii5fljnfq-uc.a.run.app
LAST DEPLOYED BY: student-02-d960927116fb@qwiklabs.net
LAST DEPLOYED AT: 2023-09-29T18:07:43.579318Z

SERVICE: public-billing-service-836
REGION: us-central1
URL: https://public-billing-service-836-6ii5fljnfq-uc.a.run.app
LAST DEPLOYED BY: student-02-d960927116fb@qwiklabs.net
LAST DEPLOYED AT: 2023-09-29T17:57:45.488801Z
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/staging-api-billing (qwiklabs-gcp-04-d69ce0e2b134)$ 
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/staging-api-billing (qwiklabs-gcp-04-d69ce0e2b134)$ 
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/staging-api-billing (qwiklabs-gcp-04-d69ce0e2b134)$ 
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/staging-api-billing (qwiklabs-gcp-04-d69ce0e2b134)$ 
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/staging-api-billing (qwiklabs-gcp-04-d69ce0e2b134)$ BILLING_URL=$(gcloud run services describe private-billing-service-687 \                                                        
--platform managed \
--region us-central1 \
--format "value(status.url)")
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/staging-api-billing (qwiklabs-gcp-04-d69ce0e2b134)$ 
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/staging-api-billing (qwiklabs-gcp-04-d69ce0e2b134)$ echo $BILLING_URL
https://private-billing-service-687-6ii5fljnfq-uc.a.run.app
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/staging-api-billing (qwiklabs-gcp-04-d69ce0e2b134)$ curl -X get -H "Authorization: Bearer $(gcloud auth print-identity-token)" $BILLING_URL
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/staging-api-billing (qwiklabs-gcp-04-d69ce0e2b134)$ 
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/staging-api-billing (qwiklabs-gcp-04-d69ce0e2b134)$ 
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/staging-api-billing (qwiklabs-gcp-04-d69ce0e2b134)$ 
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/staging-api-billing (qwiklabs-gcp-04-d69ce0e2b134)$ 
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/staging-api-billing (qwiklabs-gcp-04-d69ce0e2b134)$ 
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/staging-api-billing (qwiklabs-gcp-04-d69ce0e2b134)$ cd ..
student_02_d960927116fb@cloudshell:~/pet-theory/lab07 (qwiklabs-gcp-04-d69ce0e2b134)$ cd prod-api-billing/
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/prod-api-billing (qwiklabs-gcp-04-d69ce0e2b134)$ 
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/prod-api-billing (qwiklabs-gcp-04-d69ce0e2b134)$ 
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/prod-api-billing (qwiklabs-gcp-04-d69ce0e2b134)$ gcloud builds submit   --tag gcr.io/qwiklabs-gcp-04-d69ce0e2b134/billing-prod-api:0.1
Creating temporary tarball archive of 6 file(s) totalling 8.4 KiB before compression.
Uploading tarball of [.] to [gs://qwiklabs-gcp-04-d69ce0e2b134_cloudbuild/source/1696011417.035768-c9f54bf5dcc94acd99ab857977725403.tgz]
Created [https://cloudbuild.googleapis.com/v1/projects/qwiklabs-gcp-04-d69ce0e2b134/locations/global/builds/d5067557-cb7e-4214-8c9d-bc7fa718e280].
Logs are available at [ https://console.cloud.google.com/cloud-build/builds/d5067557-cb7e-4214-8c9d-bc7fa718e280?project=516149564574 ].
--------------------------------------------------------------------------------------- REMOTE BUILD OUTPUT ---------------------------------------------------------------------------------------
starting build "d5067557-cb7e-4214-8c9d-bc7fa718e280"

FETCHSOURCE
Fetching storage object: gs://qwiklabs-gcp-04-d69ce0e2b134_cloudbuild/source/1696011417.035768-c9f54bf5dcc94acd99ab857977725403.tgz#1696011417314343
Copying gs://qwiklabs-gcp-04-d69ce0e2b134_cloudbuild/source/1696011417.035768-c9f54bf5dcc94acd99ab857977725403.tgz#1696011417314343...
/ [1 files][  3.0 KiB/  3.0 KiB]                                                
Operation completed over 1 objects/3.0 KiB.
BUILD
Already have image (with digest): gcr.io/cloud-builders/docker
Sending build context to Docker daemon  14.34kB
Step 1/6 : FROM node:12-slim
12-slim: Pulling from library/node
8bd3f5a20b90: Pulling fs layer
3a665e454db5: Pulling fs layer
b5b0e172ab63: Pulling fs layer
45013ee4878f: Pulling fs layer
42a448233138: Pulling fs layer
45013ee4878f: Waiting
42a448233138: Waiting
3a665e454db5: Verifying Checksum
3a665e454db5: Download complete
45013ee4878f: Verifying Checksum
45013ee4878f: Download complete
8bd3f5a20b90: Verifying Checksum
8bd3f5a20b90: Download complete
b5b0e172ab63: Verifying Checksum
b5b0e172ab63: Download complete
42a448233138: Verifying Checksum
42a448233138: Download complete
8bd3f5a20b90: Pull complete
3a665e454db5: Pull complete
b5b0e172ab63: Pull complete
45013ee4878f: Pull complete
42a448233138: Pull complete
Digest: sha256:c28ca4124ac84ff1e72ee68abfe70aa4cc86f499c1ef20408dc2d35af1058ac1
Status: Downloaded newer image for node:12-slim
 9b792ac6810e
Step 2/6 : WORKDIR /usr/src/app
 Running in a4b0d8c21a5b
Removing intermediate container a4b0d8c21a5b
 172fb8948bcb
Step 3/6 : COPY package.json package*.json ./
 33a4302aca6e
Step 4/6 : RUN npm install --only=production
 Running in d44505e52e7b
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN billing-rest-api@1.0.0 No description
npm WARN billing-rest-api@1.0.0 No repository field.

added 58 packages from 42 contributors and audited 58 packages in 3.091s

8 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

Removing intermediate container d44505e52e7b
 8928e35f9f97
Step 5/6 : COPY . .
 a181dd08cf3e
Step 6/6 : CMD [ "npm", "start" ]
 Running in 56cd0e016dde
Removing intermediate container 56cd0e016dde
 cf0377bf0e55
Successfully built cf0377bf0e55
Successfully tagged gcr.io/qwiklabs-gcp-04-d69ce0e2b134/billing-prod-api:0.1
PUSH
Pushing gcr.io/qwiklabs-gcp-04-d69ce0e2b134/billing-prod-api:0.1
The push refers to repository [gcr.io/qwiklabs-gcp-04-d69ce0e2b134/billing-prod-api]
0d728800d5d3: Preparing
c95403fc0d6b: Preparing
703f8eb3e884: Preparing
3b5c33b31da7: Preparing
a2300a3fbe99: Preparing
7722feb318fa: Preparing
56ff4c5413ca: Preparing
3d1236fa695c: Preparing
dc8ea258c7d2: Preparing
7722feb318fa: Waiting
56ff4c5413ca: Waiting
3d1236fa695c: Waiting
dc8ea258c7d2: Waiting
a2300a3fbe99: Layer already exists
7722feb318fa: Layer already exists
56ff4c5413ca: Layer already exists
3d1236fa695c: Layer already exists
dc8ea258c7d2: Layer already exists
703f8eb3e884: Pushed
3b5c33b31da7: Pushed
c95403fc0d6b: Pushed
0d728800d5d3: Pushed
0.1: digest: sha256:a485e3fb8a65fbde1acb0b7174f3c80598c863f30450762e90b2c3b9756a84a8 size: 2200
DONE
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
ID: d5067557-cb7e-4214-8c9d-bc7fa718e280
CREATE_TIME: 2023-09-29T18:16:57+00:00
DURATION: 29S
SOURCE: gs://qwiklabs-gcp-04-d69ce0e2b134_cloudbuild/source/1696011417.035768-c9f54bf5dcc94acd99ab857977725403.tgz
IMAGES: gcr.io/qwiklabs-gcp-04-d69ce0e2b134/billing-prod-api:0.1
STATUS: SUCCESS
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/prod-api-billing (qwiklabs-gcp-04-d69ce0e2b134)$ 
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/prod-api-billing (qwiklabs-gcp-04-d69ce0e2b134)$ 
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/prod-api-billing (qwiklabs-gcp-04-d69ce0e2b134)$ 
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/prod-api-billing (qwiklabs-gcp-04-d69ce0e2b134)$ gcloud run deploy billing-prod-service-763 --image gcr.io/qwiklabs-gcp-04-d69ce0e2b134/billing-prod-api:0.1 --no-allow-unauthenticated
Deploying container to Cloud Run service [billing-prod-service-763] in project [qwiklabs-gcp-04-d69ce0e2b134] region [us-central1]
OK Deploying new service... Done.                                                                                                                                                                 
  OK Creating Revision...                                                                                                                                                                         
  OK Routing traffic...                                                                                                                                                                           
Done.                                                                                                                                                                                             
Service [billing-prod-service-763] revision [billing-prod-service-763-00001-m9x] has been deployed and is serving 100 percent of traffic.
Service URL: https://billing-prod-service-763-6ii5fljnfq-uc.a.run.app
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/prod-api-billing (qwiklabs-gcp-04-d69ce0e2b134)$ 
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/prod-api-billing (qwiklabs-gcp-04-d69ce0e2b134)$ 
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/prod-api-billing (qwiklabs-gcp-04-d69ce0e2b134)$ 
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/prod-api-billing (qwiklabs-gcp-04-d69ce0e2b134)$ 
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/prod-api-billing (qwiklabs-gcp-04-d69ce0e2b134)$ gcloud run services list
SERVICE: billing-prod-service-763
REGION: us-central1
URL: https://billing-prod-service-763-6ii5fljnfq-uc.a.run.app
LAST DEPLOYED BY: student-02-d960927116fb@qwiklabs.net
LAST DEPLOYED AT: 2023-09-29T18:19:42.641010Z

SERVICE: frontend-staging-service-935
REGION: us-central1
URL: https://frontend-staging-service-935-6ii5fljnfq-uc.a.run.app
LAST DEPLOYED BY: student-02-d960927116fb@qwiklabs.net
LAST DEPLOYED AT: 2023-09-29T18:03:34.354185Z

SERVICE: private-billing-service-687
REGION: us-central1
URL: https://private-billing-service-687-6ii5fljnfq-uc.a.run.app
LAST DEPLOYED BY: student-02-d960927116fb@qwiklabs.net
LAST DEPLOYED AT: 2023-09-29T18:07:43.579318Z

SERVICE: public-billing-service-836
REGION: us-central1
URL: https://public-billing-service-836-6ii5fljnfq-uc.a.run.app
LAST DEPLOYED BY: student-02-d960927116fb@qwiklabs.net
LAST DEPLOYED AT: 2023-09-29T17:57:45.488801Z
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/prod-api-billing (qwiklabs-gcp-04-d69ce0e2b134)$ 
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/prod-api-billing (qwiklabs-gcp-04-d69ce0e2b134)$ 
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/prod-api-billing (qwiklabs-gcp-04-d69ce0e2b134)$ PROD_BILLING_URL=$(gcloud run services \
describe private-billing-service-687 \                                                                                                                                                             
--platform managed \
--region us-central1 \
--format "value(status.url)")
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/prod-api-billing (qwiklabs-gcp-04-d69ce0e2b134)$ 
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/prod-api-billing (qwiklabs-gcp-04-d69ce0e2b134)$ 
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/prod-api-billing (qwiklabs-gcp-04-d69ce0e2b134)$ echo $PROD_BILLING_URL
https://private-billing-service-687-6ii5fljnfq-uc.a.run.app
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/prod-api-billing (qwiklabs-gcp-04-d69ce0e2b134)$ curl -X get -H "Authorization: Bearer \
$(gcloud auth print-identity-token)" \
$PROD_BILLING_URL
{"status":"Billing Service Rest API: Online"}student_02_d960927116fb@cloudshell:~/pet-theory/lab07/prod-api-billing (qwiklabs-gcp-04-d69ce0e2b134)$ 
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/prod-api-billing (qwiklabs-gcp-04-d69ce0e2b134)$ 
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/prod-api-billing (qwiklabs-gcp-04-d69ce0e2b134)$ cd ..
student_02_d960927116fb@cloudshell:~/pet-theory/lab07 (qwiklabs-gcp-04-d69ce0e2b134)$ ls -l
total 24
drwxr-xr-x 3 student_02_d960927116fb student_02_d960927116fb 4096 Sep 29 17:49 prod-api-billing
drwxr-xr-x 4 student_02_d960927116fb student_02_d960927116fb 4096 Sep 29 17:49 prod-frontend-billing
-rw-r--r-- 1 student_02_d960927116fb student_02_d960927116fb  385 Sep 29 17:49 README.md
drwxr-xr-x 3 student_02_d960927116fb student_02_d960927116fb 4096 Sep 29 17:49 staging-api-billing
drwxr-xr-x 4 student_02_d960927116fb student_02_d960927116fb 4096 Sep 29 17:49 staging-frontend-billing
drwxr-xr-x 3 student_02_d960927116fb student_02_d960927116fb 4096 Sep 29 17:49 unit-api-billing
student_02_d960927116fb@cloudshell:~/pet-theory/lab07 (qwiklabs-gcp-04-d69ce0e2b134)$ cd prod-frontend-billing/
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/prod-frontend-billing (qwiklabs-gcp-04-d69ce0e2b134)$ ls -l
total 24
-rw-r--r-- 1 student_02_d960927116fb student_02_d960927116fb  140 Sep 29 17:49 Dockerfile
-rw-r--r-- 1 student_02_d960927116fb student_02_d960927116fb 1147 Sep 29 17:49 index.js
-rw-r--r-- 1 student_02_d960927116fb student_02_d960927116fb  426 Sep 29 17:49 package.json
drwxr-xr-x 5 student_02_d960927116fb student_02_d960927116fb 4096 Sep 29 17:49 public
-rw-r--r-- 1 student_02_d960927116fb student_02_d960927116fb 2278 Sep 29 17:49 render.js
drwxr-xr-x 2 student_02_d960927116fb student_02_d960927116fb 4096 Sep 29 17:49 views
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/prod-frontend-billing (qwiklabs-gcp-04-d69ce0e2b134)$ gcloud builds submit   --tag gcr.io/qwiklabs-gcp-04-d69ce0e2b134/frontend-prod:0.1
Creating temporary tarball archive of 61 file(s) totalling 2.9 MiB before compression.
Uploading tarball of [.] to [gs://qwiklabs-gcp-04-d69ce0e2b134_cloudbuild/source/1696011869.495663-ef7f923dd92f4774bf00c331be41ed7c.tgz]
Created [https://cloudbuild.googleapis.com/v1/projects/qwiklabs-gcp-04-d69ce0e2b134/locations/global/builds/fde2cac8-e935-4927-8d8c-6739aea070ce].
Logs are available at [ https://console.cloud.google.com/cloud-build/builds/fde2cac8-e935-4927-8d8c-6739aea070ce?project=516149564574 ].
--------------------------------------------------------------------------------------- REMOTE BUILD OUTPUT ---------------------------------------------------------------------------------------
starting build "fde2cac8-e935-4927-8d8c-6739aea070ce"

FETCHSOURCE
Fetching storage object: gs://qwiklabs-gcp-04-d69ce0e2b134_cloudbuild/source/1696011869.495663-ef7f923dd92f4774bf00c331be41ed7c.tgz#1696011870205269
Copying gs://qwiklabs-gcp-04-d69ce0e2b134_cloudbuild/source/1696011869.495663-ef7f923dd92f4774bf00c331be41ed7c.tgz#1696011870205269...
/ [1 files][  1.3 MiB/  1.3 MiB]                                                
Operation completed over 1 objects/1.3 MiB.
BUILD
Already have image (with digest): gcr.io/cloud-builders/docker
Sending build context to Docker daemon  3.137MB
Step 1/6 : FROM node:12-slim
12-slim: Pulling from library/node
8bd3f5a20b90: Pulling fs layer
3a665e454db5: Pulling fs layer
b5b0e172ab63: Pulling fs layer
45013ee4878f: Pulling fs layer
42a448233138: Pulling fs layer
45013ee4878f: Waiting
42a448233138: Waiting
3a665e454db5: Download complete
45013ee4878f: Verifying Checksum
45013ee4878f: Download complete
42a448233138: Verifying Checksum
42a448233138: Download complete
b5b0e172ab63: Verifying Checksum
b5b0e172ab63: Download complete
8bd3f5a20b90: Verifying Checksum
8bd3f5a20b90: Download complete
8bd3f5a20b90: Pull complete
3a665e454db5: Pull complete
b5b0e172ab63: Pull complete
45013ee4878f: Pull complete
42a448233138: Pull complete
Digest: sha256:c28ca4124ac84ff1e72ee68abfe70aa4cc86f499c1ef20408dc2d35af1058ac1
Status: Downloaded newer image for node:12-slim
 9b792ac6810e
Step 2/6 : WORKDIR /usr/src/app
 Running in d467c0ea5bcd
Removing intermediate container d467c0ea5bcd
 0b17ea8272ff
Step 3/6 : COPY package.json package*.json ./
 02ba93027183
Step 4/6 : RUN npm install --only=production
 Running in cba75fe7e79c
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated request-promise@4.2.6: request-promise has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN gspxxx-firebase-challenge-lab@1.0.0 No description
npm WARN gspxxx-firebase-challenge-lab@1.0.0 No repository field.

added 179 packages from 211 contributors and audited 179 packages in 7.612s

21 packages are looking for funding
  run `npm fund` for details

found 2 moderate severity vulnerabilities
  run `npm audit fix` to fix them, or `npm audit` for details
Removing intermediate container cba75fe7e79c
 1b6c2c7dc091
Step 5/6 : COPY . .
 daa935141cf5
Step 6/6 : CMD [ "npm", "start" ]
 Running in 69ec156a6667
Removing intermediate container 69ec156a6667
 26c1e10c718f
Successfully built 26c1e10c718f
Successfully tagged gcr.io/qwiklabs-gcp-04-d69ce0e2b134/frontend-prod:0.1
PUSH
Pushing gcr.io/qwiklabs-gcp-04-d69ce0e2b134/frontend-prod:0.1
The push refers to repository [gcr.io/qwiklabs-gcp-04-d69ce0e2b134/frontend-prod]
d679724a3376: Preparing
d8b2a7c05788: Preparing
9eeff3096884: Preparing
e2c922e95119: Preparing
a2300a3fbe99: Preparing
7722feb318fa: Preparing
56ff4c5413ca: Preparing
3d1236fa695c: Preparing
dc8ea258c7d2: Preparing
7722feb318fa: Waiting
56ff4c5413ca: Waiting
3d1236fa695c: Waiting
dc8ea258c7d2: Waiting
a2300a3fbe99: Layer already exists
7722feb318fa: Layer already exists
56ff4c5413ca: Layer already exists
3d1236fa695c: Layer already exists
dc8ea258c7d2: Layer already exists
e2c922e95119: Pushed
9eeff3096884: Pushed
d679724a3376: Pushed
d8b2a7c05788: Pushed
0.1: digest: sha256:39f731495dbe9fb9571da404959b7256d8d7fa8dbb5f1e7cded2e187ea7c3722 size: 2204
DONE
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
ID: fde2cac8-e935-4927-8d8c-6739aea070ce
CREATE_TIME: 2023-09-29T18:24:30+00:00
DURATION: 35S
SOURCE: gs://qwiklabs-gcp-04-d69ce0e2b134_cloudbuild/source/1696011869.495663-ef7f923dd92f4774bf00c331be41ed7c.tgz
IMAGES: gcr.io/qwiklabs-gcp-04-d69ce0e2b134/frontend-prod:0.1
STATUS: SUCCESS
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/prod-frontend-billing (qwiklabs-gcp-04-d69ce0e2b134)$ 
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/prod-frontend-billing (qwiklabs-gcp-04-d69ce0e2b134)$ 
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/prod-frontend-billing (qwiklabs-gcp-04-d69ce0e2b134)$ gcloud run deploy frontend-prod-service-626 --image gcr.io/qwiklabs-gcp-04-d69ce0e2b134/frontend-prod:0.1 --no-allow-unauthenticated
Deploying container to Cloud Run service [frontend-prod-service-626] in project [qwiklabs-gcp-04-d69ce0e2b134] region [us-central1]
OK Deploying new service... Done.                                                                                                                                                                 
  OK Creating Revision...                                                                                                                                                                         
  OK Routing traffic...                                                                                                                                                                           
Done.                                                                                                                                                                                             
Service [frontend-prod-service-626] revision [frontend-prod-service-626-00001-l7l] has been deployed and is serving 100 percent of traffic.
Service URL: https://frontend-prod-service-626-6ii5fljnfq-uc.a.run.app
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/prod-frontend-billing (qwiklabs-gcp-04-d69ce0e2b134)$ 
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/prod-frontend-billing (qwiklabs-gcp-04-d69ce0e2b134)$ 
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/prod-frontend-billing (qwiklabs-gcp-04-d69ce0e2b134)$ 
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/prod-frontend-billing (qwiklabs-gcp-04-d69ce0e2b134)$ gcloud run services list
SERVICE: billing-prod-service-763
REGION: us-central1
URL: https://billing-prod-service-763-6ii5fljnfq-uc.a.run.app
LAST DEPLOYED BY: student-02-d960927116fb@qwiklabs.net
LAST DEPLOYED AT: 2023-09-29T18:19:42.641010Z

SERVICE: frontend-prod-service-626
REGION: us-central1
URL: https://frontend-prod-service-626-6ii5fljnfq-uc.a.run.app
LAST DEPLOYED BY: student-02-d960927116fb@qwiklabs.net
LAST DEPLOYED AT: 2023-09-29T18:27:10.302162Z

SERVICE: frontend-staging-service-935
REGION: us-central1
URL: https://frontend-staging-service-935-6ii5fljnfq-uc.a.run.app
LAST DEPLOYED BY: student-02-d960927116fb@qwiklabs.net
LAST DEPLOYED AT: 2023-09-29T18:03:34.354185Z

SERVICE: private-billing-service-687
REGION: us-central1
URL: https://private-billing-service-687-6ii5fljnfq-uc.a.run.app
LAST DEPLOYED BY: student-02-d960927116fb@qwiklabs.net
LAST DEPLOYED AT: 2023-09-29T18:07:43.579318Z

SERVICE: public-billing-service-836
REGION: us-central1
URL: https://public-billing-service-836-6ii5fljnfq-uc.a.run.app
LAST DEPLOYED BY: student-02-d960927116fb@qwiklabs.net
LAST DEPLOYED AT: 2023-09-29T17:57:45.488801Z
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/prod-frontend-billing (qwiklabs-gcp-04-d69ce0e2b134)$ 
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/prod-frontend-billing (qwiklabs-gcp-04-d69ce0e2b134)$ 
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/prod-frontend-billing (qwiklabs-gcp-04-d69ce0e2b134)$ 
student_02_d960927116fb@cloudshell:~/pet-theory/lab07/prod-frontend-billing (qwiklabs-gcp-04-d69ce0e2b134)$ history
    1  gcloud config set project $(gcloud projects list --format='value(PROJECT_ID)' \
--filter='qwiklabs-gcp')
    2  gcloud config set run/region us-central1
    3  gcloud projects list --format='value(PROJECT_ID)' --filter='qwiklabs-gcp'
    4  gcloud config set run/platform managed
    5  git clone https://github.com/rosera/pet-theory.git && cd pet-theory/lab07
    6  gcloud builds submit   --tag gcr.io/$GOOGLE_CLOUD_PROJECT/billing-staging-api:0.1
    7  gcloud builds submit   --tag gcr.io/qwiklabs-gcp-04-d69ce0e2b134/billing-staging-api:0.1
    8  ls -l
    9  cd unit-api-billing/
   10  ls -l
   11  gcloud builds submit   --tag gcr.io/qwiklabs-gcp-04-d69ce0e2b134/billing-staging-api:0.1
   12  gcloud run deploy public-billing-service-836 --image gcr.io/qwiklabs-gcp-04-d69ce0e2b134/billing-staging-api:0.1
   13  gcloud run service list
   14  gcloud run services list
   15  cd ..
   16  ls -l
   17  cd staging-frontend-billing/
   18  gcloud builds submit   --tag gcr.io/qwiklabs-gcp-04-d69ce0e2b134/frontend-staging:0.1
   19  gcloud run deploy frontend-staging-service-935 --image gcr.io/qwiklabs-gcp-04-d69ce0e2b134/frontend-staging:0.1
   20  gcloud run services list
   21  cd ../
   22  ls -l
   23  cd staging-api-billing/
   24  ls -l
   25  gcloud builds submit   --tag gcr.io/qwiklabs-gcp-04-d69ce0e2b134/billing-staging-api:0.2
   26  gcloud run deploy private-billing-service-687 --image gcr.io/qwiklabs-gcp-04-d69ce0e2b134/billing-staging-api:0.2 --no-allow-unauthenticated
   27  gcloud run services list
   28  history
   29  gcloud run services list
   30  BILLING_URL=$(gcloud run services describe private-billing-service-687 \
--platform managed \
--region us-central1 \
--format "value(status.url)")
   31  echo $BILLING_URL
   32  curl -X get -H "Authorization: Bearer $(gcloud auth print-identity-token)" $BILLING_URL
   33  cd ..
   34  cd prod-api-billing/
   35  gcloud builds submit   --tag gcr.io/qwiklabs-gcp-04-d69ce0e2b134/billing-prod-api:0.1
   36  gcloud run deploy billing-prod-service-763 --image gcr.io/qwiklabs-gcp-04-d69ce0e2b134/billing-prod-api:0.1 --no-allow-unauthenticated
   37  gcloud run services list
   38  PROD_BILLING_URL=$(gcloud run services \
describe private-billing-service-687 \
--platform managed \
--region us-central1 \
--format "value(status.url)")
   39  echo $PROD_BILLING_URL
   40  curl -X get -H "Authorization: Bearer \
$(gcloud auth print-identity-token)" $PROD_BILLING_URL
   41  cd ..
   42  ls -l
   43  cd prod-frontend-billing/
   44  ls -l
   45  gcloud builds submit   --tag gcr.io/qwiklabs-gcp-04-d69ce0e2b134/frontend-prod:0.1
   46  gcloud run deploy frontend-prod-service-626 --image gcr.io/qwiklabs-gcp-04-d69ce0e2b134/frontend-prod:0.1 --no-allow-unauthenticated
   47  gcloud run services list
   48  history






Serverless Cloud Run Development: Challenge Lab

1 hour7 Credits

GSP328

Google Cloud self-paced labs logo

Introduction

In a challenge lab you’re given a scenario and a set of tasks. Instead of following step-by-step instructions, you will use the skills learned from the labs in the quest to figure out how to complete the tasks on your own! An automated scoring system (shown on this page) will provide feedback on whether you have completed your tasks correctly.

When you take a challenge lab, you will not be taught new Google Cloud concepts. You are expected to extend your learned skills, like changing default values and reading and researching error messages to fix your own mistakes.

To score 100% you must successfully complete all tasks within the time period!

This lab is recommended for students who have enrolled in the Serverless Cloud Run Development quest. Are you ready for the challenge?

Setup

Before you click the Start Lab button

Read these instructions. Labs are timed and you cannot pause them. The timer, which starts when you click Start Lab, shows how long Google Cloud resources will be made available to you.

This hands-on lab lets you do the lab activities yourself in a real cloud environment, not in a simulation or demo environment. It does so by giving you new, temporary credentials that you use to sign in and access Google Cloud for the duration of the lab.

To complete this lab, you need:

  • Access to a standard internet browser (Chrome browser recommended).
  • Time to complete the lab---remember, once you start, you cannot pause a lab.

Situational overview

Pet Theory is a veterinary practice who are keen to utilize serverless architecture to update their existing systems.

In this challenge lab, you are part of the development team and have been assigned the task of migrating a service to serverless. Pay close attention to the provided instructions to successfully complete the exercise.

Architecture

Pet Theory has nominated the existing monolithic Billing application to be reimagined using serverless.

Over the course of this lab, you will be expected to implement this design update.

Architecture diagram

The development team will provide either the code or an image to be deployed as part of the solution.

Developing a minimal viable product (MVP)

You will build a prototype solution for Pet Theory that meets the following high level requirement specification:

Ref

Definition of Done

1

Deploy Staging Architecture

2

Deploy Prod Architecture

3

Secure Access between components in the Prod Architecture

Provision the lab environment

During the lab, ensure the environment is provisioned to support the deployment of the resources.

  1. Open a Cloud Shell in an Incognito Browser Window.
  2. Set the default project for the environment:
gcloud config set project \
$(gcloud projects list --format='value(PROJECT_ID)' \
--filter='qwiklabs-gcp')
Copied!
  1. Set the region for the run deployments:
gcloud config set run/region us-central1
Copied!
  1. Set the Cloud Run platform type:
gcloud config set run/platform managed
Copied!
  1. Clone the repo with the Pet Theory code:
git clone https://github.com/rosera/pet-theory.git && cd pet-theory/lab07
Copied!

Task 1. Enable a Public Service

Overview

  1. Set up a Rest API for the billing service. Use the information in the table below:

FIELD

VALUE

Billing Image

billing-staging-api:0.1

Billing Service

public-billing-service-836

Authentication

unauthenticated

Code

pet-theory/lab07/unit-api-billing

Architecture

Pet Theory Challege Lab architecture diagram

  1. Using the available code, deploy the Billing Service.

Assessment

To complete this task successfully, you are required to implement the following:

  • Build an image using Cloud Build.
  • Deploy a Cloud Run service as an unauthenticated service.
  • Test service responds when the endpoint is accessed.

Click Check my progress to verify that you've performed the above task.

Assessment Completed!

Deploy a Public Billing Service

Assessment Completed!

Task 2. Deploy a Frontend Service

Overview

  • Set up a Frontend Service. Use the information in the table below:

FIELD

VALUE

Image Name

frontend-staging:0.1

Service Name

frontend-staging-service-935

Authentication

unauthenticated

Code

pet-theory/lab07/staging-frontend-billing

Architecture

Pet Theory Challenge Lab architecture diagram

Assessment

To complete this section successfully, you are required to implement the following tasks:

  • Build an image using Cloud Build.
  • Deploy the image to Cloud Run as an unauthenticated service.
  • Service should respond when the endpoint is accessed.

Click Check my progress to verify that you've performed the above task.

Assessment Completed!

Deploy the Frontend Service

Assessment Completed!

Task 3. Deploy a Private Service

Overview

  • The development team updated their application and would like this deployed to the staging environment:

FIELD

VALUE

Image Name

billing-staging-api:0.2

Service Name

private-billing-service-687

Repository

gcr.io

Authentication

authenticated

Code

pet-theory/lab07/staging-api-billing

Architecture

Pet Theory Challenge Lab architecture diagram

Assessment: Cloud Run Development

To complete this section successfully, you are required to implement the following tasks:

  • Delete the existing Billing Service.
  • Build an image using Cloud Build.
  • Deploy the image to Cloud Run requiring authentication.
  • Assign the SERVICE_URL to an environment variable.
BILLING_URL=$(gcloud run services describe PRIVATE_BILLING_SERVICE \
--platform managed \
--region us-central1 \
--format "value(status.url)")
Copied!
  • Service should respond when the endpoint is accessed
curl -X get -H "Authorization: Bearer $(gcloud auth print-identity-token)" $BILLING_URL
Copied!

Click Check my progress to verify that you've performed the above task.

Assessment Completed!

Deploy a Private Billing Service

Assessment Completed!

Task 4. Create a Billing Service Account

Overview

  • In preparation for the deployment to production, you will need to create a Service Account for the Billing Service:

FIELD

VALUE

Service Account

billing-service-sa-634

Display Name

Billing Service Cloud Run

Service Name

billing-service

Role

N/A

Architecture

Pet Theory Challenge Lab architecture diagram

Assessment: Service Account

To complete this section successfully, you are required to create a Service Account.

Click Check my progress to verify that you've performed the above task.

Assessment Completed!

Create a Billing Service Account

Assessment Completed!

Task 5. Deploy the Billing Service

Overview

  • Associate the new Billing Service Account with Billing Service:

FIELD

VALUE

Image Name

billing-prod-api:0.1

Service Name

billing-prod-service-763

Repository

gcr.io

Authentication

authenticated

Code

pet-theory/lab07/prod-api-billing

Service Account

billing-service-sa-634

Architecture

Pet Theory Challenge Lab architecture diagram

Assessment: Cloud Run Development

To complete this section successfully, you are required to implement the following tasks:

  • Deploy the image to Cloud Run.
  • Enable Authentication.
  • Enable the Service Account.
  • Service should respond when the endpoint is accessed.

Get the URL of the Billing Service:

PROD_BILLING_URL=$(gcloud run services \
describe PRIVATE_BILLING_SERVICE \
--platform managed \
--region us-central1 \
--format "value(status.url)")
Copied!

Access the deployed endpoint:

curl -X get -H "Authorization: Bearer \
$(gcloud auth print-identity-token)" \
$PROD_BILLING_URL
Copied!

Click Check my progress to verify that you've performed the above task.

Assessment Completed!

Deploy the Billing Service

Assessment Completed!

Task 6. Frontend Service Account

Overview

  • Create a new Service Account for the Frontend capable of invoking the Billing Service:

FIELD

VALUE

Service Account

frontend-service-sa-231

Display Name

Billing Service Cloud Run Invoker

Service Name

frontend-prod-service

Role

run.invoker

Architecture

Pet Theory Challenge Lab architecture diagram

Assessment

To complete this section successfully, you are required to implement the following tasks:

  • Create a Service Account.
  • Apply Service Account for Frontend Service.
  • Give Service Account run.invoker permission.
  • Bind Account to Service.

Click Check my progress to verify that you've performed the above task.

Assessment Completed!

Create the Frontend Service Account

Assessment Completed!

Task 7. Redeploy the Frontend Service

Overview

  • Use the new Service Account and redeploy the Frontend Service:

FIELD

VALUE

Image Name

frontend-prod:0.1

Service Name

frontend-prod-service-626

Repository

gcr.io

Authentication

unauthenticated

Code

pet-theory/lab07/prod-frontend-billing

Service Account

frontend-service-sa-231

Architecture

Pet Theory Challenge Lab architecture diagram

Assessment: Cloud Run Development

To complete this section successfully, you are required to implement the following tasks:

  • Deploy the image to Cloud Run.
  • Enable Authentication.
  • Enable Service Account.
  • Service should respond when the endpoint is accessed.

Click Check my progress to verify that you've performed the above task.

Assessment Completed!

Deploy the Frontend Service

Assessment Completed!

  • Now access the production frontend service to display the user interface.

Information on screen is consumed from the private billing service using the service account.

Pet Theory: Billing Service page

Congratulations!

Over this course of this challenge lab you have demonstrated your knowledge of Cloud Run and Google Cloud infrastructure.

AppEngine - Python

tudent_04_347b5286260a@cloudshell:~/python-docs-samples/appengine/standard_python3/hello_world (qwiklabs-gcp-00-88834e0beca1)$ sudo apt upda...