Skip to content

Commit

Permalink
start #142
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkEdmondson1234 committed Nov 6, 2021
1 parent 2bc8b54 commit 65a7b0e
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
37 changes: 37 additions & 0 deletions R/buildsteps_gce.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#' Buildstep to deploy to Google Compute Engine
#'
#' This build step adds some helpers to \link{cr_buildstep_gcloud} for deploying to VMs to GCE
#'
#' @export
cr_buildstep_compute_rstudio <- function(
rstudio_user,
rstudio_pw,
vm_name = "rstudio",
template = "gcr.io/gcer-public/persistent-rstudio",
disk_name = "rstudio-disk", # do check to see if it exists, if it does attach
disk_size = "10GB",
machine_type = "n1-standard-1"
){

# https://cloud.google.com/compute/docs/containers/deploying-containers
# https://cloud.google.com/sdk/gcloud/reference/compute/instances/create-with-container
cr_buildstep_gcloud(
"gcloud",
args = c(
"compute",
"instances",
"create-with-container",
vm_name,
sprintf("--container-env=[ROOT=TRUE,USER=%s,PASSWORD=%s]",
rstudio_user, rstudio_pw),
sprintf("--container-image %s", template),
sprintf("--container-mount-disk=name=%s,mount-path=/home/%s",
disk_name, rstudio_user),
sprintf("--create-disk=name=%s,size=%s", disk_name, disk_size),
sprintf("--machine-type=%s", machine_type),
sprintf("--scopes=cloud-platform")
)

)

}
14 changes: 14 additions & 0 deletions man/cr_setup_test.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 65a7b0e

Please sign in to comment.