This build step adds some helpers to cr_buildstep_gcloud for deploying to VMs to GCE that will auto create a container within them and atytach it to the disk

cr_buildstep_compute_container(
  vm_name,
  container_image = "gcr.io/gcer-public/persistent-rstudio:latest",
  disk_name = paste0(vm_name, "-disk"),
  disk_mount_path = "/home",
  zone = "europe-west1-b",
  disk_size = "10GB",
  machine_type = "n1-standard-1",
  container_env = "",
  scopes = "cloud-platform",
  network = "default",
  gcloud_args = NULL
)

cr_buildstep_compute_rstudio(
  rstudio_user,
  rstudio_pw,
  vm_name = "rstudio",
  disk_name = "rstudio-disk",
  zone = "europe-west1-b",
  disk_size = "10GB",
  machine_type = "n1-standard-1",
  container_image = "gcr.io/gcer-public/persistent-rstudio:latest",
  network = "default"
)

Arguments

vm_name

Name of the VM you will create

container_image

The Docker image that will be launched in the VM

disk_name

Name of the disk that will be attached to the VM's container image

disk_mount_path

Where the disk will be attached to the container in the VM

zone

Which zone the VM will launch within

disk_size

The size of the disk

machine_type

The type of VM that will be launched

container_env

Environment variables set within the VM's container image

scopes

The GCE scopes that the VM will be launched with permission to use

network

The network the VM will use. The container will bridge into the same network

gcloud_args

Other gcloud arguments you send in e.g. c("--boot-disk-device-name=boot-disk1","--boot-disk-size=10GB")

rstudio_user

The usename for the RStudio image the VM will launch

rstudio_pw

The password for the RStudio image the VM will launch

Examples


bs <- cr_buildstep_compute_rstudio("mark", "securepassword1234")
build <- cr_build_yaml(bs)
build
#> ==cloudRunnerYaml==
#> steps:
#> - name: gcr.io/google.com/cloudsdktool/cloud-sdk:alpine
#>   args:
#>   - gcloud
#>   - compute
#>   - instances
#>   - create-with-container
#>   - rstudio
#>   - --container-env=--container-env=[ROOT=TRUE,USER=mark,PASSWORD=securepassword1234]
#>   - --container-image=gcr.io/gcer-public/persistent-rstudio:latest
#>   - --container-mount-disk=name=rstudio-disk,mount-path=/home/mark
#>   - --create-disk=name=rstudio-disk,size=10GB
#>   - --machine-type=n1-standard-1
#>   - --scopes=cloud-platform
#>   - --zone=europe-west1-b
#>   - --network=default
if (FALSE) {

cr_build(build)
}