cloudyr / googleComputeEngineR

An R interface to the Google Cloud Compute API, for launching virtual machines
https://cloudyr.github.io/googleComputeEngineR/
Other
152 stars 41 forks source link

default image_project `cos-cloud` missing cron (or apt-get) #48

Closed valentinumbach closed 7 years ago

valentinumbach commented 7 years ago

The example given at https://cloudyr.github.io/googleComputeEngineR/articles/single-scheduler.html fails because gce_vm_container (in container.R) defaults to image_family cos-cloud (Container-Optimized OS), and this parameter can not be overridden. The Google Container-Optimized OS does not support package managers like apt-get (https://cloud.google.com/container-optimized-os/docs/resources/faq#what_is_the_software_package_manager_for_container-optimized_os). Therefore cron is not installed during docker_build in the example, which means scheduling via cronR is impossible.

I have replaced the default image_project with debian-cloud and the default image_family with debian-8 (https://github.com/valentinumbach/googleComputeEngineR/commit/7584784ca070b8bc7afb85bd9d2244a86d37c806). Now cron is installed during docker_build, but I cannot get RStudio Server to run on the Debian image. Possibly Ubuntu would be a better choice? (This setup worked for me: https://github.com/grantmcdermott/rstudio-compute-engine).

MarkEdmondson1234 commented 7 years ago

Thanks @valentinumbach , I updated the image_family only recently on dev so good to see what it has affected downstream.

You may be better off using gce_vm as that is what gce_vm_container wraps with some defaults, so you can choose whatever image you like, and then call the rocker/rstudio image which I think uses Ubuntu. cron should be installed within the Docker image so install ok for the templates in the package so I'll investigate if that isn't launching. (via the Dockerfiles)

valentinumbach commented 7 years ago

I did use gce_vm but it only allows defining the image_family, not image_project (it will throw an error). since gce_vm_container always defaults to cos-cloud (previously google-containers with gci prefix I believe), it's impossible to use anything other but Container-Optimized OS images.

MarkEdmondson1234 commented 7 years ago

Hmm it should allow that, try calling even more directly via gce_vm_create() - that allows image_family and image_project. Will investigate but gce_vm() should also accept them.

MarkEdmondson1234 commented 7 years ago

Revisting this,

The container optimised images that gce_vm_container calls must all come from the image family cos-cloud as specified here. cron or anything shouldn't be installed in the root of these containers, the intention is that cronis installed within the containers running on them - these can be Ubuntu, Debian or whatever. The rocker/rstudiodocker image is based on Ubuntu.

The example was most likely failing as there was a missing cron service start line in the Dockerfiles - sorry you got caught up with that.

If you want to specify your own image_project or image_family then gce_vm_create can be called directly, which is what gce_vm_container wraps setting some defaults. If you want to install RStudio server then I suggest running rocker/rstudio .

The article is being updated now as I now have public images that do this all for you, so will be much simpler to set up in the future https://cloudyr.github.io/googleComputeEngineR/articles/single-scheduler.html

valentinumbach commented 7 years ago

Sounds good. We can close this issue then.