Programmatic Deploy on Cloud Run

556 views
Skip to first unread message

Jaden Banson

unread,
Sep 5, 2020, 8:16:26 PM9/5/20
to Google App Engine
Is it possible to deploy a container (docker) on cloud run programmatically in code via an API, or is running bash commands w/ the gcloud SDK my only option?

alfio

unread,
Sep 21, 2020, 3:21:32 PM9/21/20
to Google App Engine

Hey Jaden,

This is entirely possible and all depends on your use case. You can deploy many different types of softwares on Google Compute Engine for example by using start-up scipts or the cloud-init library. I suggest consulting this documentation [1] if you are curious of the mutiple ways you can deploy containers on VM instances or Managed Instance Groups.

C Mos

unread,
Oct 12, 2020, 9:53:26 AM10/12/20
to Google App Engine
I can suggest these next two links:
  • Consider using Terraform or Google Deployment Manager[1] 
  • Using Google Deployment Manager- discussion[2]  
I would like to share that is totally fine to use gcloud CLI to deploy to GCR and it is recommended you create a service account to manage your deployments. For instance, this would work using GitlabCI which allows you to define and laydown your own CI/CD strategy. Another alternative is to use Github (or  BitBucket) + Google Source Repository[3] + Google Cloud Build + Google Deployment Manager to manage your deployment programmatically and relying in Google Container Registry(GCR) to store your images. I suggest you investigate this alternative by creating a simple proof of concept to understand the deployment flow and to ensure DM is able to manage all the resources associated with your requirement.

Jofre Riba Sanchez

unread,
Oct 23, 2020, 10:11:10 AM10/23/20
to Google App Engine
There is an API for Cloud Run: https://cloud.google.com/run/docs/reference/rest

The gcloud SDK is only an interface to connect to the GCP APIs. If you run any command with the flags `--verbosity=debug` and `--log-http`, you'll see each call the SDK is making.

You can make the calls manually, but it is non-trivial. Nevertheless, all the actions that can be taken in Cloud Run (including deployment), can be taken through the API.

You can try to deploy using the API directly from your browser: https://apis-explorer.appspot.com/apis-explorer/#p/run/v1/run.namespaces.services.create
Reply all
Reply to author
Forward
0 new messages