This gives you a private RStudio Server with your custom packages and users.
In summary it:
Here we are setting up a 13GB RAM instance, as found via
library(googleComputeEngineR) ## setting up a 13GB RAM instance ## see gce_list_machinetype() for options of predefined_type vm <- gce_vm(template = "rstudio-hadleyverse", name = "rstudio-team", username = "mark", password = "mark1234", predefined_type = "n1-highmem-2") ## wait a bit, login at the IP it gives you
You can add users via:
gce_rstudio_adduser(vm, username = "bill", password = "flowerpot")
You can then login at the IP address given via
gce_get_external_ip(vm), and install packages as you would on RStudio Desktop.
Every Google project has its own private Docker repo called the Container Registry.
This command takes the running container that has your changes and saves it to there.
By default, the RStudio container runs with name “rstudio” which you can see via
gce_push_registry(vm, save_name = "my_rstudio", container_name = "rstudio")
This can take a while the first time so go make a cup of tea. If successful you should be able to see your container saved at this URL
Now say you want a larger more powerful instance, or to launch another with your settings. You can now pull from the Container Registry and start up a VM with your settings enabled.
template=rstudio to make sure the right ports and so forth are configured for your Rstudio, and
dynamic_image="my_rstudio" to instruct the template to pull from your own image instead of using the default. You need to make sure the dynamic image is based on an RStudio one for this to work correctly.
gce_tag_container constructs the name of the custom image on your Container Registry for you.
## construct the correct tag name for your custom image tag <- gce_tag_container("my_rstudio") # gcr.io/mark-edmondson-gde/my_rstudio ## start a 50GB RAM instance vm2 <- gce_vm(name = "rstudio-big", predefined_type = "n1-highmem-8", template = "rstudio", dynamic_image = tag, username = "me", password = "mypassword") ## wait for it to launch