Skip to content

Latest commit

 

History

History

google-cloud-run-introduction

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Google Cloud Run Introduction

Consider giving this repo a ✨! Thanks!!!

Here's a link to the YouTube video explaining this setup in greater detail:

Cloud Run Introduction

Prerequisites

  • You'll need to have gcloud installed.
  • Make sure gcloud is configured. You can configure gcloud by running gcloud init.

1] Deploy Your App On Google Cloud Run

gcloud run deploy greeter

Answer yes for all the prompts.

You can test the app by running:

curl https://[APP_URL]/greeting/YourTechBud

2] Deploy Your App On Google Cloud Run [The Declarative Way]

First retreive the config of the deployed app by using:

gcloud run services describe greeter --format export > service.yaml

Make any changes in main.go (like changing the default greeting) then build the application using Google Cloud Build.

gcloud builds submit --tag us-east1-docker.pkg.dev/space-cloud/cloud-run-source-deploy/greeter:0.2.0

In service.yaml, update the spec.template.spec.containers[0].image to match the newly deployed image. Also, update the revision name mentioned in spec.template.metadata.name.

You can test the new version of the app by running:

curl https://[APP_URL]/greeting/YourTechBud

3] Split Traffic Between Revisions

In service.yaml update the spec.traffic section to split traffic between the previous and the latest revisions.

  traffic:
  - revisionName: [PREVIOUS_REVISION_NAME]
    percent: 50
  - latestRevision: true
    percent: 50