cr_run: Create a CloudRun service.

View source: R/cloudrun.R

cr_runR Documentation

Create a CloudRun service.

Description

Deploys an existing gcr.io image.

Usage

cr_run(
  image,
  name = basename(image),
  allowUnauthenticated = TRUE,
  concurrency = 1,
  port = NULL,
  max_instances = "default",
  memory = "256Mi",
  cpu = 1,
  timeout = 600L,
  region = cr_region_get(),
  projectId = cr_project_get(),
  launch_browser = interactive(),
  env_vars = NULL,
  gcloud_args = NULL,
  ...
)

Arguments

image

The name of the image to create or use in deployment - gcr.io

name

Name for deployment on Cloud Run

allowUnauthenticated

TRUE if can be reached from public HTTP address. If FALSE will configure a service-email called (name)-cloudrun-invoker@(project-id).iam.gserviceaccount.com

concurrency

How many connections each container instance can serve. Can be up to 80.

port

Container port to receive requests at. Also sets the $PORT environment variable. Must be a number between 1 and 65535, inclusive. To unset this field, pass the special value "default".

max_instances

the desired maximum nuimber of container instances. "default" is 1000, you can get more if you requested a quota instance. For Shiny instances on Cloud Run, this needs to be 1.

memory

The format for size is a fixed or floating point number followed by a unit: G, M, or K corresponding to gigabyte, megabyte, or kilobyte, respectively, or use the power-of-two equivalents: Gi, Mi, Ki corresponding to gibibyte, mebibyte or kibibyte respectively. The default is 256Mi

cpu

1 or 2 CPUs for your instance

timeout

Amount of time that this build should be allowed to run, to second

region

The endpoint region for deployment

projectId

The GCP project from which the services should be listed

launch_browser

Whether to launch the logs URL in a browser once deployed

env_vars

Environment arguments passed to the Cloud Run container at runtime. Distinct from env that run at build time.

gcloud_args

a character string of arguments that can be sent to the gcloud command not covered by other parameters of this function

...

Arguments passed on to cr_buildstep_run

Details

Uses Cloud Build to deploy an image to Cloud Run

See Also

Google Documentation for Cloud Run

Use cr_deploy_docker or similar to create image, cr_deploy_run to automate building and deploying, cr_deploy_plumber to deploy plumber APIs.

Deploying Cloud Run using Cloud Build

Other Cloud Run functions: cr_jwt_create(), cr_plumber_pubsub(), cr_run_email(), cr_run_get(), cr_run_list(), cr_run_schedule_http()

Examples

## Not run: 
cr_project_set("my-project")
cr_region_set("europe-west1")
cr_run("gcr.io/my-project/my-image")
cr_run("gcr.io/cloud-tagging-10302018/gtm-cloud-image:stable",
  env_vars = c("CONTAINER_CONFIG=xxxxxxx")
)

## End(Not run)

googleCloudRunner documentation built on March 18, 2022, 8 p.m.