├── .Rbuildignore ├── .github ├── FUNDING.yml └── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── documentation-updates.md │ └── feature_request.md ├── .gitignore ├── .travis.yml ├── DESCRIPTION ├── LICENSE ├── NAMESPACE ├── NEWS.md ├── R ├── auth.R ├── build.R ├── cloud-init.R ├── container.R ├── deletion-prevention.R ├── disks.R ├── firewalls.R ├── future.R ├── googleComputeEngineR.R ├── gpus.R ├── harbor_container.R ├── harbor_containers.R ├── harbor_docker.R ├── harbor_gce.R ├── harbor_utils.R ├── images.R ├── instances_admin.R ├── machineType.R ├── metadata.R ├── min-cpu-platform.R ├── networks.R ├── opencpu.R ├── operations.R ├── options.R ├── print-methods.R ├── projects.R ├── rstudio.R ├── scheduler.R ├── service-accounts.R ├── shiny.R ├── ssh.R ├── ssh_admin.R ├── startup-scripts.R ├── template.R ├── utilities.R ├── vms.R └── zones.R ├── README.md ├── codecov.yml ├── cran-comments.md ├── docs ├── 404.html ├── LICENSE ├── LICENSE-text.html ├── LICENSE.html ├── articles │ ├── build-trigger-menu.png │ ├── build-trigger-running.png │ ├── build-trigger-settings.png │ ├── creating-vms.html │ ├── deeplearning-with-r-book.jpg │ ├── docker-ssh-futures.html │ ├── docker.R │ ├── docker.html │ ├── example-workflows.html │ ├── gpu.html │ ├── img │ │ └── logo.png │ ├── index.html │ ├── installation-and-authentication.R │ ├── installation-and-authentication.html │ ├── massive-parallel.html │ ├── opencpu-api-server.html │ ├── persistent-rstudio.html │ ├── remote-cluster.html │ ├── rstudio-gpu.png │ ├── rstudio-team.html │ ├── scheduled-rscripts.R │ ├── scheduled-rscripts.html │ ├── shiny-app.R │ ├── shiny-app.html │ ├── single-scheduler.html │ ├── ssh-login.gif │ └── troubleshooting.html ├── authors.html ├── docsearch.css ├── docsearch.js ├── index.html ├── jquery.sticky-kit.min.js ├── link.svg ├── news │ └── index.html ├── pkgdown.css ├── pkgdown.js ├── pkgdown.yml ├── reference │ ├── AttachedDisk.html │ ├── Disk.html │ ├── Instance.html │ ├── Metadata.html │ ├── as.cluster.gce_instance.html │ ├── as.container.html │ ├── as.gce_instance.html │ ├── as.gce_instance_name.html │ ├── as.gce_instance_name_one.html │ ├── auth_email.html │ ├── cat0.html │ ├── cli_tools.html │ ├── container_logs.html │ ├── container_rm.html │ ├── container_running.html │ ├── container_update_info.html │ ├── containers.html │ ├── docker_build.html │ ├── docker_cmd.gce_instance.html │ ├── docker_cmd.html │ ├── docker_exec.html │ ├── docker_inspect.html │ ├── docker_pull.html │ ├── docker_run.html │ ├── error.message.html │ ├── gce_attach_disk.html │ ├── gce_auth.html │ ├── gce_check_container.html │ ├── gce_check_gpu.html │ ├── gce_check_ssh.html │ ├── gce_check_zone_op.html │ ├── gce_container_addpackage.html │ ├── gce_container_aptget.html │ ├── gce_container_logs.html │ ├── gce_delete_disk.html │ ├── gce_delete_firewall_rule.html │ ├── gce_delete_op.gce_global_operation.html │ ├── gce_delete_op.gce_zone_operation.html │ ├── gce_delete_op.html │ ├── gce_delete_zone_op.html │ ├── gce_docker_build.html │ ├── gce_extract_projectzone.html │ ├── gce_future_install_packages.html │ ├── gce_get_disk.html │ ├── gce_get_external_ip.html │ ├── gce_get_firewall_rule.html │ ├── gce_get_global_project.html │ ├── gce_get_global_zone.html │ ├── gce_get_image.html │ ├── gce_get_image_family.html │ ├── gce_get_instance.html │ ├── gce_get_machinetype.html │ ├── gce_get_metadata.html │ ├── gce_get_metadata_project.html │ ├── gce_get_network.html │ ├── gce_get_op.gce_global_operation.html │ ├── gce_get_op.gce_zone_operation.html │ ├── gce_get_op.html │ ├── gce_get_project.html │ ├── gce_get_zone.html │ ├── gce_get_zone_op.html │ ├── gce_global_project.html │ ├── gce_global_zone.html │ ├── gce_list_disks.html │ ├── gce_list_disks_all.html │ ├── gce_list_firewall_rules.html │ ├── gce_list_gpus.html │ ├── gce_list_images.html │ ├── gce_list_instances.html │ ├── gce_list_machinetype.html │ ├── gce_list_machinetype_all.html │ ├── gce_list_networks.html │ ├── gce_list_registry.html │ ├── gce_list_zone_op.html │ ├── gce_list_zones.html │ ├── gce_load_container.html │ ├── gce_make_boot_disk.html │ ├── gce_make_disk.html │ ├── gce_make_firewall_rule.html │ ├── gce_make_firewall_webports.html │ ├── gce_make_image_source_url.html │ ├── gce_make_machinetype_url.html │ ├── gce_make_network.html │ ├── gce_metadata_env.html │ ├── gce_opencpu_addpackage.html │ ├── gce_pull_registry.html │ ├── gce_push_registry.html │ ├── gce_rstudio_adduser.html │ ├── gce_rstudio_password.html │ ├── gce_save_container.html │ ├── gce_schedule_build_script.html │ ├── gce_schedule_docker.html │ ├── gce_set_machinetype.html │ ├── gce_set_metadata.html │ ├── gce_set_mincpuplatform.html │ ├── gce_shiny_addapp.html │ ├── gce_shiny_addpackage.html │ ├── gce_shiny_listapps.html │ ├── gce_shiny_logs.html │ ├── gce_ssh.html │ ├── gce_ssh_addkeys.html │ ├── gce_ssh_browser.html │ ├── gce_ssh_setup.html │ ├── gce_startup_logs.html │ ├── gce_tag_container.html │ ├── gce_vm.html │ ├── gce_vm_cluster.html │ ├── gce_vm_container.html │ ├── gce_vm_create.html │ ├── gce_vm_delete.html │ ├── gce_vm_gpu.html │ ├── gce_vm_logs.html │ ├── gce_vm_reset.html │ ├── gce_vm_scheduler.html │ ├── gce_vm_start.html │ ├── gce_vm_stop.html │ ├── gce_vm_template.html │ ├── gce_wait.html │ ├── get_cloud_init_file.html │ ├── get_dockerfile.html │ ├── get_dockerfolder.html │ ├── get_template_file.html │ ├── googleComputeEngineR.html │ ├── idempotency.html │ ├── index.html │ ├── is.NullOb.html │ ├── is.error.html │ ├── is.gce_global_operation.html │ ├── is.gce_instance.html │ ├── is.gce_region_operation.html │ ├── is.gce_zone_operation.html │ ├── localhost.html │ ├── makeDockerClusterPSOCK.html │ ├── myMessage.html │ ├── read_cloud_init_file.html │ ├── read_shell_startup_file.html │ ├── rmNullObs.html │ └── timestamp_to_r.html └── sitemap.xml ├── drat.sh ├── googleComputeEngineR.Rproj ├── index.Rmd ├── inst ├── cloudconfig │ ├── dynamic.yaml │ ├── opencpu.yaml │ ├── r-base.yaml │ ├── r-parallel.yaml │ ├── rstudio-gpu.yaml │ ├── rstudio-noauth.yaml │ ├── rstudio-shiny.yaml │ ├── rstudio.yaml │ └── shiny.yaml ├── dockerfiles │ ├── cloudDataLabR │ │ ├── Dockerfile │ │ └── googleDatalabR.Rmd │ ├── demoDockerAppEngine │ │ ├── Dockerfile │ │ ├── README.md │ │ ├── api.R │ │ ├── app.yaml │ │ └── cron.yaml │ ├── demoDockerScheduler │ │ ├── Dockerfile │ │ └── schedule.R │ ├── gceScheduler │ │ ├── download.R │ │ ├── gce-launcher.R │ │ ├── master │ │ │ └── Dockerfile │ │ ├── scheduled-rscripts.Rmd │ │ └── slave │ │ │ └── Dockerfile │ ├── googleAuthR-verse │ │ └── Dockerfile │ ├── googleComputeEngineR-worker │ │ └── Dockerfile │ ├── hadleyverse-crontab │ │ ├── Dockerfile │ │ └── demo-schedule.R │ ├── opencpu-installgithub │ │ └── Dockerfile │ ├── persistentRStudio-verse │ │ ├── Dockerfile │ │ ├── README.md │ │ └── Rprofile.site │ ├── persistentRStudio │ │ ├── Dockerfile │ │ ├── README.md │ │ └── Rprofile.site │ ├── publicDocker.sh │ ├── rstudio-gcloud │ │ ├── Dockerfile │ │ └── README.md │ ├── rstudio-k8s │ │ ├── Dockerfile │ │ └── rserver.conf │ ├── rstudio-keras │ │ ├── Dockerfile │ │ ├── add_shiny.sh │ │ ├── disable_auth_rserver.conf │ │ ├── hello-world.R │ │ ├── install.R │ │ ├── pam-helper.sh │ │ └── userconf.sh │ ├── shiny-googleAuthRdemo │ │ ├── Dockerfile │ │ └── shiny │ │ │ ├── DESCRIPTION │ │ │ ├── readme.md │ │ │ ├── server.R │ │ │ └── ui.R │ └── testTrigger │ │ └── Dockerfile ├── nginx │ └── r-proxy-pass.conf └── startupscripts │ ├── dynamic.sh │ ├── installdocker.sh │ ├── opencpu.sh │ ├── r-base.sh │ ├── r-parallel.sh │ ├── rstudio-gpu.sh │ ├── rstudio-noauth.sh │ ├── rstudio-shiny.sh │ ├── rstudio.sh │ └── shiny.sh ├── man ├── AttachedDisk.Rd ├── Disk.Rd ├── Instance.Rd ├── Metadata.Rd ├── as.cluster.gce_instance.Rd ├── cat0.Rd ├── cli_tools.Rd ├── container_logs.Rd ├── container_rm.Rd ├── container_running.Rd ├── container_update_info.Rd ├── containers.Rd ├── docker_build.Rd ├── docker_cmd.Rd ├── docker_cmd.gce_instance.Rd ├── docker_inspect.Rd ├── docker_pull.Rd ├── docker_run.Rd ├── error.message.Rd ├── gce_attach_disk.Rd ├── gce_auth.Rd ├── gce_check_gpu.Rd ├── gce_check_ssh.Rd ├── gce_container_logs.Rd ├── gce_delete_access_config.Rd ├── gce_delete_disk.Rd ├── gce_delete_firewall_rule.Rd ├── gce_delete_op.Rd ├── gce_delete_op.gce_global_operation.Rd ├── gce_delete_op.gce_zone_operation.Rd ├── gce_extract_projectzone.Rd ├── gce_get_disk.Rd ├── gce_get_external_ip.Rd ├── gce_get_firewall_rule.Rd ├── gce_get_global_project.Rd ├── gce_get_global_zone.Rd ├── gce_get_image.Rd ├── gce_get_image_family.Rd ├── gce_get_instance.Rd ├── gce_get_machinetype.Rd ├── gce_get_metadata.Rd ├── gce_get_metadata_project.Rd ├── gce_get_network.Rd ├── gce_get_op.Rd ├── gce_get_op.gce_global_operation.Rd ├── gce_get_op.gce_zone_operation.Rd ├── gce_get_project.Rd ├── gce_get_zone.Rd ├── gce_global_project.Rd ├── gce_global_zone.Rd ├── gce_list_disks.Rd ├── gce_list_disks_all.Rd ├── gce_list_firewall_rules.Rd ├── gce_list_gpus.Rd ├── gce_list_images.Rd ├── gce_list_instances.Rd ├── gce_list_machinetype.Rd ├── gce_list_machinetype_all.Rd ├── gce_list_networks.Rd ├── gce_list_zone_op.Rd ├── gce_list_zones.Rd ├── gce_make_boot_disk.Rd ├── gce_make_disk.Rd ├── gce_make_firewall_rule.Rd ├── gce_make_firewall_webports.Rd ├── gce_make_image_source_url.Rd ├── gce_make_machinetype_url.Rd ├── gce_make_network.Rd ├── gce_metadata_env.Rd ├── gce_pull_registry.Rd ├── gce_push_registry.Rd ├── gce_rstudio_adduser.Rd ├── gce_rstudio_password.Rd ├── gce_schedule_docker.Rd ├── gce_set_machinetype.Rd ├── gce_set_metadata.Rd ├── gce_set_mincpuplatform.Rd ├── gce_shiny_addapp.Rd ├── gce_shiny_listapps.Rd ├── gce_shiny_logs.Rd ├── gce_ssh.Rd ├── gce_ssh_addkeys.Rd ├── gce_ssh_browser.Rd ├── gce_ssh_setup.Rd ├── gce_startup_logs.Rd ├── gce_tag_container.Rd ├── gce_vm.Rd ├── gce_vm_cluster.Rd ├── gce_vm_container.Rd ├── gce_vm_create.Rd ├── gce_vm_delete.Rd ├── gce_vm_deletion_protection.Rd ├── gce_vm_gpu.Rd ├── gce_vm_logs.Rd ├── gce_vm_reset.Rd ├── gce_vm_scheduler.Rd ├── gce_vm_start.Rd ├── gce_vm_stop.Rd ├── gce_vm_template.Rd ├── gce_wait.Rd ├── get_dockerfolder.Rd ├── googleComputeEngineR.Rd ├── idempotency.Rd ├── is.NullOb.Rd ├── is.error.Rd ├── localhost.Rd ├── makeDockerClusterPSOCK.Rd ├── read_cloud_init_file.Rd ├── read_shell_startup_file.Rd ├── rmNullObs.Rd └── timestamp_to_r.Rd ├── pkgdown └── _pkgdown.yml ├── tests ├── testthat.R └── testthat │ ├── test_aa_auth.R │ ├── test_bb_create_vm.R │ ├── test_cc_disks.R │ ├── test_externalIP.R │ ├── test_firewalls.R │ ├── test_images.R │ ├── test_instances.R │ ├── test_machinetype.R │ ├── test_ssh.R │ ├── test_yyy_containers.R │ └── test_zzz_cleanup.R └── vignettes ├── build-trigger-menu.png ├── build-trigger-running.png ├── build-trigger-settings.png ├── creating-vms.Rmd ├── creating-vms.html ├── deeplearning-with-r-book.jpg ├── docker-ssh-futures.Rmd ├── docker-ssh-futures.html ├── docker.Rmd ├── docker.html ├── example-workflows.Rmd ├── example-workflows.html ├── gpu.Rmd ├── gpu.html ├── installation-and-authentication.R ├── installation-and-authentication.Rmd ├── installation-and-authentication.html ├── massive-parallel.Rmd ├── massive-parallel.html ├── opencpu-api-server.Rmd ├── opencpu-api-server.html ├── persistent-rstudio.Rmd ├── persistent-rstudio.html ├── rstudio-gpu.png ├── rstudio-team.Rmd ├── rstudio-team.html ├── scheduled-rscripts.Rmd ├── scheduled-rscripts.html ├── shiny-app.Rmd ├── shiny-app.html ├── single-scheduler.Rmd ├── single-scheduler.html ├── ssh-login.gif ├── troubleshooting.Rmd └── troubleshooting.html /.Rbuildignore: -------------------------------------------------------------------------------- 1 | ^.*\.Rproj$ 2 | ^\.Rproj\.user$ 3 | ^\.httr-oauth$ 4 | cran-comments\.md 5 | \.travis\.yml 6 | test_signedurls\.RData 7 | ^codecov\.yml$ 8 | ^CONTRIBUTING\.md$ 9 | ^Readme\.md$ 10 | ^auth\.json$ 11 | ^auth\.json\.enc$ 12 | ^drat\.sh$ 13 | ^revdep 14 | ^\.travis\.yml$ 15 | ^docs 16 | _staticdocs\.yml 17 | _pkgdown\.yml 18 | ^auth 19 | ^secrets\.tar 20 | ^cran-comments\.md$ 21 | ^pkgdown 22 | ^pkgdown$ 23 | ^index\.Rmd$ 24 | ^index\.html$ 25 | ^cran-comments\.md$ 26 | ^\.github -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: [MarkEdmondson1234] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 13 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: bug 6 | assignees: MarkEdmondson1234 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behaviour. Note if the behaviour can't be reproduced, it is unlikely it will be fixed quickly. 15 | 16 | **Expected behavior** 17 | A clear and concise description of what you expected to happen. 18 | 19 | **Screenshots** 20 | If applicable, add screenshots to help explain your problem. 21 | 22 | **Session Info 23 | Please run `sessionInfo()` and put results here: 24 | 25 | **Additional context** 26 | Add any other context about the problem here. 27 | You can also try running your bug code with `options(googleAuthR.verbose = 2)` at the top to give more debugging output. 28 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/documentation-updates.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Documentation updates 3 | about: Update documentation 4 | title: '' 5 | labels: documentation 6 | assignees: MarkEdmondson1234 7 | 8 | --- 9 | 10 | # Please describe where the documentation to change/add is 11 | 12 | # Please describe the changes to make 13 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: enhancement 6 | assignees: MarkEdmondson1234 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .Rproj.user 2 | .Rhistory 3 | .RData 4 | .httr-oauth 5 | .httr-oauth-SUSPENDED 6 | inst/doc 7 | auth.json 8 | 9 | auth/travis-ssh-key 10 | auth/travis-ssh-key.pub 11 | secrets.tar 12 | tests/testthat/travis-ssh-key 13 | tests/testthat/travis-ssh-key.pub 14 | *.httr-oauth 15 | *.history 16 | gcs_save_error 17 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: r 2 | cache: packages 3 | notifications: 4 | slack: googleauthrverse:tGfXjSD58cQSEr1YuzQ5hKPS 5 | email: 6 | on_success: change 7 | on_failure: change 8 | r_packages: 9 | - knitr 10 | - covr 11 | - drat 12 | after_success: 13 | - Rscript -e 'library("covr");codecov(line_exclusions = list("R/options.R", "R/utilities.R"))' 14 | -------------------------------------------------------------------------------- /DESCRIPTION: -------------------------------------------------------------------------------- 1 | Package: googleComputeEngineR 2 | Type: Package 3 | Version: 0.3.0.9000 4 | Title: R Interface with Google Compute Engine 5 | Description: Interact with the 'Google Compute Engine' API in R. Lets you create, 6 | start and stop instances in the 'Google Cloud'. Support for preconfigured instances, 7 | with templates for common R needs. 8 | Authors@R: c( 9 | person("Mark", "Edmondson", email = "r@sunholo.com", 10 | role = c("aut", "cre"), 11 | comment = c(ORCID = "0000-0002-8434-3881")), 12 | person("Scott", "Chamberlain", role = "ctb", email = "myrmecocystus@gmail.com"), 13 | person("Winston", "Chang", role = "ctb", email = "winston@stdout.org"), 14 | person("Henrik", "Bengtsson", role="ctb", email = "henrikb@braju.com"), 15 | person("Jacki","Novik", role="ctb", email = "jackinovik@gmail.com") 16 | ) 17 | URL: https://cloudyr.github.io/googleComputeEngineR/ 18 | BugReports: https://github.com/cloudyr/googleComputeEngineR/issues 19 | Depends: 20 | R (>= 3.3.0) 21 | Imports: 22 | assertthat, 23 | cli, 24 | gargle, 25 | parallelly, 26 | googleAuthR (>= 0.7.0), 27 | httr (>= 1.3.1), 28 | jsonlite (>= 1.1), 29 | utils 30 | Suggests: 31 | future, 32 | covr, 33 | googleCloudStorageR, 34 | knitr, 35 | rmarkdown, 36 | testthat 37 | License: MIT + file LICENSE 38 | LazyData: true 39 | VignetteBuilder: knitr 40 | RoxygenNote: 7.3.2 41 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | YEAR: 2019 2 | COPYRIGHT HOLDER: Sunholo Ltd. -------------------------------------------------------------------------------- /NEWS.md: -------------------------------------------------------------------------------- 1 | # 0.3.0.9000 2 | 3 | * Upgrade docker calls for `gce_push_registry` and friends (#151) 4 | * Fix being able to restart cluster VMs (#149) 5 | * Remove `gce_list_registry` as its not working 6 | * Add `gce_vm_deletion_protection` to help add or remove deletion protection for VMs 7 | * Support subnetworks (#154) and expose making your own networks via `gce_make_network` 8 | * Fix vectorised VM deletions (#144) 9 | * Add new template "r-parallel" (#161) 10 | * Update rocker/ml-gpu image to rocker/ml (#179) 11 | 12 | # 0.3.0 13 | 14 | * Fixed broken passing of `zone` and `project` arguments in `gce_vm`, `gce_vm_template`, `gce_get_external_ip`, and `gce_set_metadata`. 15 | * remove `gce_auth()` to favour auth with JSON key (#79) 16 | * Fix project-id error if numbers in project (#72) 17 | * Block users using "rstudio" as a login name 18 | * Remove defunct example from `gce_schedule_docker` 19 | * Support GPU images for Tensorflow, keras etc. (#101) via `gce_vm_gpu()` and `gce_vm(template = "rstudio-gpu")` (#101) 20 | * Support common instance metadata by supply `gce_set_metadata(instance = "project-wide")` 21 | * Support minCpuPlatform in instance creation and via `gce_set_mincpuplatform()` (#112) 22 | * Add ability to specify a startup-script in `gce_vm_container()` 23 | * Switch RStudio templates to use startup-scripts and metadata 24 | * Switch to applying a nginx proxy service to deal with port routing for templates 25 | * Add `gce_startup_logs()` to track whts going on when launching an instance 26 | * Vectorise `gce_vm_delete`, `gce_vm_stop`, `gce_vm_start` and `gce_vm_reset` functions so you can pass in a list of instances 27 | * Add `gce_vm_cluster()` to make it easier to create clusters for `future` 28 | 29 | # 0.2.0 30 | 31 | ## Changes 32 | 33 | - Update website 34 | - Bug fixes 35 | - Add R-Datalab Dockerfile example 36 | - Let Rstudio users be added with staff rights so they can install packages etc. 37 | - Add ability to specify disk size when creating a VM (#38) - thanks @jburos 38 | - Add firewall functions (#34) 39 | - Add global operation class 40 | - Add `open_webports` argument to `gce_vm` that will open web ports 80 and 443 if necessary 41 | - Add GPU functions 42 | - Migrate to use `system2` instead of `system` for cross-platform SSH (#35) 43 | - `gce_shiny_addapp` is now much more useful 44 | - Add `gce_schedule_docker` and `gce_vm_scheduler` for easy Dockerfile scheduling 45 | - Add `gce_vm_logs` to quickly browse to an instance logs online 46 | - Fix custom machine types creation (#63) - thanks @Blaza 47 | - Set environment vars on VMs from metadata via `gce_metadata_env` 48 | 49 | # 0.1.0 50 | 51 | ## Major changes 52 | 53 | - Start, stop and restart VMs 54 | - Create instances using cloudinit 55 | - Browser based SSH 56 | - SSH from R 57 | - Metadata 58 | - Docker 59 | - Google container registry 60 | - VM templates 61 | - Future asynch cluster computing -------------------------------------------------------------------------------- /R/auth.R: -------------------------------------------------------------------------------- 1 | #' Defunct - Authenticate this session 2 | #' 3 | #' No longer used. Authenticate via downloading a JSON file and setting in your environment arguments instead. 4 | #' 5 | #' @param new_user If TRUE, reauthenticate via Google login screen 6 | #' @param no_auto Will ignore auto-authentication settings if TRUE 7 | #' 8 | #' @return Invisibly, the token that has been saved to the session 9 | #' @import googleAuthR 10 | #' @export 11 | gce_auth <- function(new_user = FALSE, no_auto = FALSE){ 12 | .Defunct("gar_attach_auto_auth", package = "googleAuthR", 13 | msg = "gce_auth() is defunct. Authenticate instead by downloading your JSON key and placing in a GCE_AUTH_FILE environment argument. See https://cloudyr.github.io/googleComputeEngineR/articles/installation-and-authentication.html or vignette('installation-and-authentication', package = 'googleComputeEngineR')") 14 | } 15 | 16 | -------------------------------------------------------------------------------- /R/cloud-init.R: -------------------------------------------------------------------------------- 1 | #' create the cloud_init file to upload 2 | #' @keywords internal 3 | #' @import assertthat 4 | read_cloud_init_file <- function(template) { 5 | 6 | the_file <- get_template_file(template, "cloudconfig") 7 | 8 | # written to /etc/systemd/system/gcer.service 9 | cloud_init_file <- readChar(the_file, nchars = file.info(the_file)$size) 10 | 11 | # gets put into /etc/gcer/startup.sh 12 | shell_script_file <- read_shell_startup_file(template) 13 | 14 | # needs a nginx configuration as well 15 | if(template == "rstudio-shiny"){ 16 | # gets nginx config file for /etc/nginx.conf 17 | nginx_config <- read_and_indent(system.file("nginx", "r-proxy-pass.conf", 18 | package = "googleComputeEngineR"), 19 | indent = 4) 20 | return(sprintf(cloud_init_file, 21 | shell_script_file, 22 | nginx_config) 23 | ) 24 | } 25 | 26 | # most others only put in the shell script 27 | sprintf(cloud_init_file, shell_script_file) 28 | 29 | } 30 | 31 | -------------------------------------------------------------------------------- /R/deletion-prevention.R: -------------------------------------------------------------------------------- 1 | #' Toggle deletion protection for existing instances 2 | #' 3 | #' @param instance The vm to work with its deletion protection 4 | #' @param cmd Whether to get the status, or toggle "true" or "false" 5 | #' on deletion protection for this VM 6 | #' @param project The projectId 7 | #' @param zone The zone 8 | #' 9 | #' @export 10 | #' @importFrom googleAuthR gar_api_generator 11 | #' @examples 12 | #' 13 | #' \dontrun{ 14 | #' 15 | #' # a workflow for deleting lots of VMs across zones that have deletion protection 16 | #' zones <- gce_list_zones() 17 | #' instances <- lapply(zones$name, function(x) gce_list_instances(zone = x)) 18 | #' 19 | #' instances_e <- lapply(instances, function(x) x$items$name) 20 | #' names(instances_e) <- zones$name 21 | #' 22 | #' status <- lapply(zones$name, function(x){ 23 | #' lapply(instances_e[[x]], function(y) { 24 | #' gce_vm_deletion_protection(y, cmd = "false", zone = x))) 25 | #' } 26 | #' } 27 | #' 28 | #' deletes <- lapply(zones$name, function(x){ 29 | #' lapply(instances_e[[x]], function(y) { 30 | #' gce_vm_delete(y, zone = x))) 31 | #' } 32 | #' } 33 | #' } 34 | gce_vm_deletion_protection <- function(instance, 35 | cmd = c("status", "true", "false"), 36 | project = gce_get_global_project(), 37 | zone = gce_get_global_zone()){ 38 | 39 | cmd <- match.arg(cmd) 40 | 41 | if(cmd == "status"){ 42 | # GET https://compute.googleapis.com/compute/v1/projects/[PROJECT_ID]/zones/[ZONE]/instances/[INSTANCE_NAME] 43 | f <- gar_api_generator("https://compute.googleapis.com/compute/v1/", 44 | "GET", 45 | path_args = list( 46 | projects = project, 47 | zones = zone, 48 | instances = as.gce_instance_name(instance) 49 | ), 50 | data_parse_function = function(x) x) 51 | 52 | } else { 53 | # POST https://compute.googleapis.com/compute/v1/projects/[PROJECT_ID]/zones/[ZONE]/instances/[INSTANCE_NAME]/setDeletionProtection?deletionProtection=true 54 | f <- gar_api_generator("https://compute.googleapis.com/compute/v1/", 55 | "POST", 56 | path_args = list( 57 | projects = project, 58 | zones = zone, 59 | instances = as.gce_instance_name(instance), 60 | setDeletionProtection = "" 61 | ), 62 | pars_args = list(deletionProtection = cmd), 63 | data_parse_function = function(x) x) 64 | } 65 | 66 | f() 67 | 68 | } -------------------------------------------------------------------------------- /R/googleComputeEngineR.R: -------------------------------------------------------------------------------- 1 | #' Working with Google Compute Engine from R 2 | #' 3 | #' See demos and examples at the \href{googleComputeEngineR website}{https://cloudyr.github.io/googleComputeEngineR/}. 4 | #' 5 | #' @docType package 6 | #' @name googleComputeEngineR 7 | NULL 8 | 9 | 10 | ## store bucket name 11 | .gce_env <- new.env(parent = emptyenv()) 12 | -------------------------------------------------------------------------------- /R/harbor_containers.R: -------------------------------------------------------------------------------- 1 | #' Get list of all containers on a host. 2 | #' @inheritParams docker_cmd 3 | #' @export 4 | #' @author Winston Change \email{winston@@stdout.org} 5 | containers <- function(host = localhost, ...) { 6 | ids <- docker_cmd(host, "ps", "-qa", capture_text = TRUE, ...) 7 | 8 | cons <- lapply(ids, as.container, host) 9 | names(cons) <- pluck(cons, "name", character(1)) 10 | cons 11 | } 12 | -------------------------------------------------------------------------------- /R/harbor_utils.R: -------------------------------------------------------------------------------- 1 | # Return a string of random letters and numbers, with an optional prefix. 2 | random_name <- function(prefix = NULL, length = 6) { 3 | chars <- c(letters, 0:9) 4 | rand_str <- paste(sample(chars, length), collapse = "") 5 | paste(c(prefix, rand_str), collapse = "_") 6 | } 7 | 8 | # Given a string, indent every line by some number of spaces. 9 | # The exception is to not add spaces after a trailing \n. 10 | indent <- function(str, indent = 0) { 11 | gsub("(^|\\n)(?!$)", 12 | paste0("\\1", paste(rep(" ", indent), collapse = "")), 13 | str, 14 | perl = TRUE 15 | ) 16 | } 17 | 18 | pluck <- function(x, name, type) { 19 | if (missing(type)) { 20 | lapply(x, "[[", name) 21 | } else { 22 | vapply(x, "[[", name, FUN.VALUE = type) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /R/min-cpu-platform.R: -------------------------------------------------------------------------------- 1 | #' Set a minCPU platform on a stopped instance 2 | #' 3 | #' @param instance The (stopped) instance to set a minimum CPU platform upon 4 | #' @param minCpuPlatform The platform to set 5 | #' 6 | #' @export 7 | #' @importFrom googleAuthR gar_api_generator 8 | gce_set_mincpuplatform <- function(instance, minCpuPlatform){ 9 | instance <- as.gce_instance(instance) 10 | instance_pz <- gce_extract_projectzone(instance) 11 | 12 | assert_that(is.string(minCpuPlatform)) 13 | 14 | f <- gar_api_generator( 15 | sprintf("https://www.googleapis.com/compute/v1/projects/%s/zones/%s/instances/%s/setMinCpuPlatform", 16 | instance_pz$project, instance_pz$zone, instance$name), 17 | "POST", 18 | data_parse_function = function(x) x 19 | ) 20 | 21 | f(the_body = list(minCpuPlatform = minCpuPlatform)) 22 | } 23 | -------------------------------------------------------------------------------- /R/opencpu.R: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudyr/googleComputeEngineR/ce451646b3a43c42a31638dc8152f65a67f67227/R/opencpu.R -------------------------------------------------------------------------------- /R/options.R: -------------------------------------------------------------------------------- 1 | .onAttach <- function(libname, pkgname){ 2 | 3 | attempt <- try(googleAuthR::gar_attach_auto_auth("https://www.googleapis.com/auth/cloud-platform", 4 | environment_var = "GCE_AUTH_FILE")) 5 | if(inherits(attempt, "try-error")){ 6 | warning("Tried to auto-authenticate but failed.") 7 | } 8 | 9 | if(Sys.getenv("GCE_CLIENT_ID") != ""){ 10 | options(googleAuthR.client_id = Sys.getenv("GCE_CLIENT_ID")) 11 | } 12 | 13 | if(Sys.getenv("GCE_CLIENT_SECRET") != ""){ 14 | options(googleAuthR.client_secret = Sys.getenv("GCE_CLIENT_SECRET")) 15 | } 16 | 17 | if(Sys.getenv("GCE_WEB_CLIENT_ID") != ""){ 18 | options(googleAuthR.webapp.client_id = Sys.getenv("GCE_WEB_CLIENT_ID")) 19 | } 20 | 21 | if(Sys.getenv("GCE_WEB_CLIENT_SECRET") != ""){ 22 | options(googleAuthR.webapp.client_id = Sys.getenv("GCE_WEB_CLIENT_SECRET")) 23 | } 24 | 25 | if(Sys.getenv("GCE_DEFAULT_PROJECT_ID") != ""){ 26 | .gce_env$project <- Sys.getenv("GCE_DEFAULT_PROJECT_ID") 27 | packageStartupMessage("Set default project ID to '", .gce_env$project,"'") 28 | } 29 | 30 | if(Sys.getenv("GCE_DEFAULT_ZONE") != ""){ 31 | .gce_env$zone <- Sys.getenv("GCE_DEFAULT_ZONE") 32 | packageStartupMessage("Set default zone to '", .gce_env$zone,"'") 33 | } 34 | 35 | invisible() 36 | 37 | } -------------------------------------------------------------------------------- /R/projects.R: -------------------------------------------------------------------------------- 1 | #' Returns the specified Project resource. 2 | #' 3 | #' 4 | #' @seealso \href{https://developers.google.com/compute/docs/reference/latest/}{Google Documentation} 5 | #' 6 | #' @details 7 | #' Authentication scopes used by this function are: 8 | #' \itemize{ 9 | #' \item https://www.googleapis.com/auth/cloud-platform 10 | #' \item https://www.googleapis.com/auth/compute 11 | #' \item https://www.googleapis.com/auth/compute.readonly 12 | #' } 13 | #' 14 | #' 15 | #' @param project Project ID for this request 16 | #' @importFrom googleAuthR gar_api_generator 17 | #' @export 18 | gce_get_project <- function(project = gce_get_global_project()) { 19 | url <- sprintf("https://www.googleapis.com/compute/v1/projects/%s", project) 20 | # compute.projects.get 21 | f <- gar_api_generator(url, "GET", data_parse_function = function(x) x) 22 | 23 | proj <- f() 24 | 25 | structure(proj, class = "gce_project") 26 | 27 | } 28 | 29 | 30 | #' Set global project name 31 | #' 32 | #' Set a project name used for this R session 33 | #' 34 | #' @param project project name you want this session to use by default, or a project object 35 | #' 36 | #' @details 37 | #' This sets a project to a global environment value so you don't need to 38 | #' supply the project argument to other API calls. 39 | #' 40 | #' @return The project name (invisibly) 41 | #' 42 | #' @export 43 | gce_global_project <- function(project = gce_get_global_project()){ 44 | 45 | if(inherits(project, "gce_project")){ 46 | project <- project$name 47 | } 48 | 49 | assertthat::assert_that( 50 | assertthat::is.string(project), 51 | is.lower_hypen(project) 52 | ) 53 | 54 | .gce_env$project <- project 55 | myMessage("Set default project name to '", project,"'", level = 3) 56 | return(invisible(.gce_env$project)) 57 | 58 | } 59 | 60 | #' Get global project name 61 | #' 62 | #' Project name set this session to use by default 63 | #' 64 | #' @return Project name 65 | #' 66 | #' @details 67 | #' Set the project name via \link{gce_global_project} 68 | #' 69 | #' @family project functions 70 | #' @export 71 | gce_get_global_project <- function(){ 72 | 73 | if(!exists("project", envir = .gce_env)){ 74 | stop("Project is not set and couldn't find global project name. Set via gce_global_project()", call. = FALSE) 75 | } 76 | 77 | .gce_env$project 78 | 79 | } -------------------------------------------------------------------------------- /R/rstudio.R: -------------------------------------------------------------------------------- 1 | #' Creates a user on an RStudio templated instance 2 | #' 3 | #' RStudio has users based on unix user accounts 4 | #' 5 | #' @param instance An instance with RStudio installed via \link{gce_vm_template} 6 | #' @param username The user to create 7 | #' @param password The user password 8 | #' @param admin Default TRUE - Will the user be able to install packages and other sudo tasks? 9 | #' @param container The rstudio container to add the user to 10 | #' 11 | #' @return The instance 12 | #' @export 13 | gce_rstudio_adduser <- function(instance, username, password, admin = TRUE, 14 | container = "rstudio"){ 15 | 16 | ssh_au <- paste0("adduser ", 17 | username, 18 | " --gecos 'First Last,RoomNumber,WorkPhone,HomePhone' --disabled-password") 19 | 20 | docker_cmd(instance, 21 | cmd = "exec", 22 | args = c(container, ssh_au), 23 | docker_opts = "") 24 | 25 | if(admin){ 26 | docker_cmd(instance, cmd = "exec", 27 | args = c(container, 28 | paste0("sudo adduser ",username," staff")) 29 | ) 30 | } 31 | 32 | docker_cmd(instance, 33 | "exec", 34 | args = c(container, "ls /home/")) 35 | 36 | gce_rstudio_password(instance, 37 | username = username, 38 | password = password, 39 | container = container) 40 | 41 | gce_set_metadata(list(rstudio_users = c(gce_get_metadata(instance, "rstudio_users")$value), username), 42 | instance) 43 | 44 | instance 45 | 46 | } 47 | 48 | #' Changes password for a user on RStudio container 49 | #' 50 | #' RStudio has users based on unix user accounts 51 | #' 52 | #' @param instance An instance with RStudio installed via \link{gce_vm_template} 53 | #' @param username The user to change the password for 54 | #' @param password The user password 55 | #' @param container The rstudio container to add the user to 56 | #' 57 | #' @return The instance 58 | #' @export 59 | gce_rstudio_password <- function(instance, username, password, 60 | container = "rstudio"){ 61 | 62 | ssh_ap <- paste0("sh -c 'echo ",username,":",password," | sudo chpasswd'") 63 | 64 | docker_cmd(instance, 65 | cmd = "exec", 66 | args = c(container, ssh_ap), 67 | docker_opts = "") 68 | 69 | instance 70 | 71 | } 72 | 73 | -------------------------------------------------------------------------------- /R/service-accounts.R: -------------------------------------------------------------------------------- 1 | #' Make serviceAccounts objects 2 | #' @noRd 3 | gce_make_serviceaccounts <- function(){ 4 | 5 | # use this on GCE only 6 | token = try({gargle::credentials_gce()}, silent = TRUE) 7 | email = NULL 8 | if (inherits(token, "GceToken")) { 9 | email = token$params$service_account 10 | scope = token$params$scope 11 | if (is.null(scope) || !tolower(basename(scope)) %in% "cloud-platform") { 12 | email = NULL 13 | } 14 | } 15 | if(Sys.getenv("GCE_AUTH_FILE") == "" && is.null(email)){ 16 | stop("No email found in the authentication file at Sys.getenv('GCE_AUTH_FILE')", call.=FALSE) 17 | } 18 | 19 | if (is.null(email)) { 20 | email <- jsonlite::unbox(jsonlite::fromJSON(Sys.getenv("GCE_AUTH_FILE"))$client_email) 21 | } 22 | if(is.null(email)){ 23 | stop("Couldn't find client_email in GCE_AUTH_FILE environment file", call.=FALSE) 24 | } 25 | 26 | list( 27 | list( 28 | email = email, 29 | scopes = list("https://www.googleapis.com/auth/cloud-platform") 30 | ) 31 | ) 32 | 33 | } -------------------------------------------------------------------------------- /R/startup-scripts.R: -------------------------------------------------------------------------------- 1 | #' create the shell file to upload 2 | #' @keywords internal 3 | #' @import assertthat 4 | read_shell_startup_file <- function(template){ 5 | 6 | the_file <- get_template_file(template, "startupscripts") 7 | 8 | read_and_indent(the_file, indent = 4) 9 | 10 | } 11 | 12 | setup_shell_metadata <- function(dots, 13 | template, 14 | username, 15 | password, 16 | dynamic_image = NULL){ 17 | 18 | if(!is.null(dynamic_image)){ 19 | assert_that(is.string(dynamic_image)) 20 | the_image <- dynamic_image 21 | } else { 22 | the_image <- switch(template, 23 | "rstudio" = "rocker/tidyverse", 24 | "rstudio-noauth" = "rocker/verse", 25 | "rstudio-gpu" = "rocker/ml", 26 | "rstudio-shiny" = "rocker/tidyverse", 27 | "shiny" = "rocker/shiny", 28 | "opencpu" = "opencpu/base", 29 | "r-base" = "rocker/r-base", 30 | "r-parallel" = "rocker/r-parallel" 31 | ) 32 | } 33 | 34 | modify_metadata(dots, 35 | list(rstudio_user = username, 36 | rstudio_pw = password, 37 | gcer_docker_image = the_image)) 38 | 39 | } 40 | 41 | 42 | -------------------------------------------------------------------------------- /codecov.yml: -------------------------------------------------------------------------------- 1 | comment: false 2 | -------------------------------------------------------------------------------- /cran-comments.md: -------------------------------------------------------------------------------- 1 | ## Test environments 2 | * local - macOS 10.14.2, R 3.5.0 3 | * travis - Ubuntu 14.04.5 LTS, R 3.5.2 4 | * rhub - Windows Server 2008 R2 SP1, R-devel, 32/64 bit, R 3.5.2 5 | 6 | ## R CMD check results 7 | 8 | 0 errors | 0 warnings | 0 notes 9 | 10 | ## Reverse dependencies 11 | 12 | There are no reverse dependencies. 13 | 14 | -------------------------------------------------------------------------------- /docs/LICENSE: -------------------------------------------------------------------------------- 1 | YEAR: 2016 2 | COPYRIGHT HOLDER: Sunholo Ltd. -------------------------------------------------------------------------------- /docs/articles/build-trigger-menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudyr/googleComputeEngineR/ce451646b3a43c42a31638dc8152f65a67f67227/docs/articles/build-trigger-menu.png -------------------------------------------------------------------------------- /docs/articles/build-trigger-running.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudyr/googleComputeEngineR/ce451646b3a43c42a31638dc8152f65a67f67227/docs/articles/build-trigger-running.png -------------------------------------------------------------------------------- /docs/articles/build-trigger-settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudyr/googleComputeEngineR/ce451646b3a43c42a31638dc8152f65a67f67227/docs/articles/build-trigger-settings.png -------------------------------------------------------------------------------- /docs/articles/deeplearning-with-r-book.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudyr/googleComputeEngineR/ce451646b3a43c42a31638dc8152f65a67f67227/docs/articles/deeplearning-with-r-book.jpg -------------------------------------------------------------------------------- /docs/articles/docker.R: -------------------------------------------------------------------------------- 1 | ## ----setup, include=FALSE------------------------------------------------ 2 | knitr::opts_chunk$set(echo = TRUE) 3 | 4 | ## ---- message=FALSE, warning=FALSE--------------------------------------- 5 | library(googleComputeEngineR) 6 | gce_tag_container("shiny-googleauthrdemo", project = "gcer-public") 7 | 8 | -------------------------------------------------------------------------------- /docs/articles/img/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudyr/googleComputeEngineR/ce451646b3a43c42a31638dc8152f65a67f67227/docs/articles/img/logo.png -------------------------------------------------------------------------------- /docs/articles/installation-and-authentication.R: -------------------------------------------------------------------------------- 1 | ## ---- echo=FALSE--------------------------------------------------------- 2 | knitr::include_url("https://www.youtube.com/embed/1oM0NZbRhSI?rel=0") 3 | 4 | -------------------------------------------------------------------------------- /docs/articles/rstudio-gpu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudyr/googleComputeEngineR/ce451646b3a43c42a31638dc8152f65a67f67227/docs/articles/rstudio-gpu.png -------------------------------------------------------------------------------- /docs/articles/scheduled-rscripts.R: -------------------------------------------------------------------------------- 1 | ## ----setup, include=FALSE------------------------------------------------ 2 | knitr::opts_chunk$set(echo = TRUE) 3 | 4 | -------------------------------------------------------------------------------- /docs/articles/shiny-app.R: -------------------------------------------------------------------------------- 1 | ## ---- message=FALSE, warning=FALSE--------------------------------------- 2 | library(googleComputeEngineR) 3 | gce_tag_container("shiny-googleauthrdemo", project = "gcer-public") 4 | 5 | -------------------------------------------------------------------------------- /docs/articles/ssh-login.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudyr/googleComputeEngineR/ce451646b3a43c42a31638dc8152f65a67f67227/docs/articles/ssh-login.gif -------------------------------------------------------------------------------- /docs/docsearch.js: -------------------------------------------------------------------------------- 1 | $(function() { 2 | 3 | // register a handler to move the focus to the search bar 4 | // upon pressing shift + "/" (i.e. "?") 5 | $(document).on('keydown', function(e) { 6 | if (e.shiftKey && e.keyCode == 191) { 7 | e.preventDefault(); 8 | $("#search-input").focus(); 9 | } 10 | }); 11 | 12 | $(document).ready(function() { 13 | // do keyword highlighting 14 | /* modified from https://jsfiddle.net/julmot/bL6bb5oo/ */ 15 | var mark = function() { 16 | 17 | var referrer = document.URL ; 18 | var paramKey = "q" ; 19 | 20 | if (referrer.indexOf("?") !== -1) { 21 | var qs = referrer.substr(referrer.indexOf('?') + 1); 22 | var qs_noanchor = qs.split('#')[0]; 23 | var qsa = qs_noanchor.split('&'); 24 | var keyword = ""; 25 | 26 | for (var i = 0; i < qsa.length; i++) { 27 | var currentParam = qsa[i].split('='); 28 | 29 | if (currentParam.length !== 2) { 30 | continue; 31 | } 32 | 33 | if (currentParam[0] == paramKey) { 34 | keyword = decodeURIComponent(currentParam[1].replace(/\+/g, "%20")); 35 | } 36 | } 37 | 38 | if (keyword !== "") { 39 | $(".contents").unmark({ 40 | done: function() { 41 | $(".contents").mark(keyword); 42 | } 43 | }); 44 | } 45 | } 46 | }; 47 | 48 | mark(); 49 | }); 50 | }); 51 | 52 | /* Search term highlighting ------------------------------*/ 53 | 54 | function matchedWords(hit) { 55 | var words = []; 56 | 57 | var hierarchy = hit._highlightResult.hierarchy; 58 | // loop to fetch from lvl0, lvl1, etc. 59 | for (var idx in hierarchy) { 60 | words = words.concat(hierarchy[idx].matchedWords); 61 | } 62 | 63 | var content = hit._highlightResult.content; 64 | if (content) { 65 | words = words.concat(content.matchedWords); 66 | } 67 | 68 | // return unique words 69 | var words_uniq = [...new Set(words)]; 70 | return words_uniq; 71 | } 72 | 73 | function updateHitURL(hit) { 74 | 75 | var words = matchedWords(hit); 76 | var url = ""; 77 | 78 | if (hit.anchor) { 79 | url = hit.url_without_anchor + '?q=' + escape(words.join(" ")) + '#' + hit.anchor; 80 | } else { 81 | url = hit.url + '?q=' + escape(words.join(" ")); 82 | } 83 | 84 | return url; 85 | } 86 | -------------------------------------------------------------------------------- /docs/jquery.sticky-kit.min.js: -------------------------------------------------------------------------------- 1 | /* 2 | Sticky-kit v1.1.2 | WTFPL | Leaf Corcoran 2015 | http://leafo.net 3 | */ 4 | (function(){var b,f;b=this.jQuery||window.jQuery;f=b(window);b.fn.stick_in_parent=function(d){var A,w,J,n,B,K,p,q,k,E,t;null==d&&(d={});t=d.sticky_class;B=d.inner_scrolling;E=d.recalc_every;k=d.parent;q=d.offset_top;p=d.spacer;w=d.bottoming;null==q&&(q=0);null==k&&(k=void 0);null==B&&(B=!0);null==t&&(t="is_stuck");A=b(document);null==w&&(w=!0);J=function(a,d,n,C,F,u,r,G){var v,H,m,D,I,c,g,x,y,z,h,l;if(!a.data("sticky_kit")){a.data("sticky_kit",!0);I=A.height();g=a.parent();null!=k&&(g=g.closest(k)); 5 | if(!g.length)throw"failed to find stick parent";v=m=!1;(h=null!=p?p&&a.closest(p):b("
"))&&h.css("position",a.css("position"));x=function(){var c,f,e;if(!G&&(I=A.height(),c=parseInt(g.css("border-top-width"),10),f=parseInt(g.css("padding-top"),10),d=parseInt(g.css("padding-bottom"),10),n=g.offset().top+c+f,C=g.height(),m&&(v=m=!1,null==p&&(a.insertAfter(h),h.detach()),a.css({position:"",top:"",width:"",bottom:""}).removeClass(t),e=!0),F=a.offset().top-(parseInt(a.css("margin-top"),10)||0)-q, 6 | u=a.outerHeight(!0),r=a.css("float"),h&&h.css({width:a.outerWidth(!0),height:u,display:a.css("display"),"vertical-align":a.css("vertical-align"),"float":r}),e))return l()};x();if(u!==C)return D=void 0,c=q,z=E,l=function(){var b,l,e,k;if(!G&&(e=!1,null!=z&&(--z,0>=z&&(z=E,x(),e=!0)),e||A.height()===I||x(),e=f.scrollTop(),null!=D&&(l=e-D),D=e,m?(w&&(k=e+u+c>C+n,v&&!k&&(v=!1,a.css({position:"fixed",bottom:"",top:c}).trigger("sticky_kit:unbottom"))),eb&&!v&&(c-=l,c=Math.max(b-u,c),c=Math.min(q,c),m&&a.css({top:c+"px"})))):e>F&&(m=!0,b={position:"fixed",top:c},b.width="border-box"===a.css("box-sizing")?a.outerWidth()+"px":a.width()+"px",a.css(b).addClass(t),null==p&&(a.after(h),"left"!==r&&"right"!==r||h.append(a)),a.trigger("sticky_kit:stick")),m&&w&&(null==k&&(k=e+u+c>C+n),!v&&k)))return v=!0,"static"===g.css("position")&&g.css({position:"relative"}), 8 | a.css({position:"absolute",bottom:d,top:"auto"}).trigger("sticky_kit:bottom")},y=function(){x();return l()},H=function(){G=!0;f.off("touchmove",l);f.off("scroll",l);f.off("resize",y);b(document.body).off("sticky_kit:recalc",y);a.off("sticky_kit:detach",H);a.removeData("sticky_kit");a.css({position:"",bottom:"",top:"",width:""});g.position("position","");if(m)return null==p&&("left"!==r&&"right"!==r||a.insertAfter(h),h.remove()),a.removeClass(t)},f.on("touchmove",l),f.on("scroll",l),f.on("resize", 9 | y),b(document.body).on("sticky_kit:recalc",y),a.on("sticky_kit:detach",H),setTimeout(l,0)}};n=0;for(K=this.length;n 2 | 3 | 5 | 8 | 12 | 13 | -------------------------------------------------------------------------------- /docs/pkgdown.yml: -------------------------------------------------------------------------------- 1 | pandoc: 2.3.1 2 | pkgdown: 1.4.1 3 | pkgdown_sha: ~ 4 | articles: 5 | creating-vms: creating-vms.html 6 | docker-ssh-futures: docker-ssh-futures.html 7 | docker: docker.html 8 | example-workflows: example-workflows.html 9 | gpu: gpu.html 10 | installation-and-authentication: installation-and-authentication.html 11 | massive-parallel: massive-parallel.html 12 | opencpu-api-server: opencpu-api-server.html 13 | persistent-rstudio: persistent-rstudio.html 14 | rstudio-team: rstudio-team.html 15 | scheduled-rscripts: scheduled-rscripts.html 16 | shiny-app: shiny-app.html 17 | single-scheduler: single-scheduler.html 18 | troubleshooting: troubleshooting.html 19 | urls: 20 | reference: https://cloudyr.github.io/googleComputeEngineR//reference 21 | article: https://cloudyr.github.io/googleComputeEngineR//articles 22 | 23 | -------------------------------------------------------------------------------- /drat.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -o errexit -o nounset 3 | addToDrat(){ 4 | mkdir drat; cd drat 5 | 6 | ## Set up Repo parameters 7 | git init 8 | git config user.name "leeper" 9 | git config user.email "thosjleeper@gmail.com" 10 | git config --global push.default simple 11 | 12 | ## Get drat repo 13 | git remote add upstream "https://$GH_TOKEN@github.com/cloudyr/cloudyr.github.io.git" 14 | git fetch upstream 15 | git checkout master 16 | 17 | Rscript -e "drat::insertPackage('../$PKG_TARBALL', repodir = './drat')" 18 | git add --all 19 | git commit -m "add $PKG_TARBALL (build $TRAVIS_BUILD_ID)" 20 | git push 21 | 22 | } 23 | addToDrat 24 | -------------------------------------------------------------------------------- /googleComputeEngineR.Rproj: -------------------------------------------------------------------------------- 1 | Version: 1.0 2 | 3 | RestoreWorkspace: No 4 | SaveWorkspace: No 5 | AlwaysSaveHistory: Yes 6 | 7 | EnableCodeIndexing: Yes 8 | UseSpacesForTab: Yes 9 | NumSpacesForTab: 2 10 | Encoding: UTF-8 11 | 12 | RnwWeave: Sweave 13 | LaTeX: pdfLaTeX 14 | 15 | BuildType: Package 16 | PackageUseDevtools: Yes 17 | PackageInstallArgs: --no-multiarch --with-keep.source 18 | PackageRoxygenize: rd,collate,namespace,vignette 19 | -------------------------------------------------------------------------------- /inst/cloudconfig/dynamic.yaml: -------------------------------------------------------------------------------- 1 | #cloud-config 2 | 3 | users: 4 | - name: gcer 5 | uid: 2000 6 | 7 | write_files: 8 | - path: /etc/gcer/startup.sh 9 | permissions: 0755 10 | owner: root 11 | content: | 12 | %s 13 | - path: /etc/systemd/system/gcer.service 14 | permissions: 0644 15 | owner: root 16 | content: | 17 | [Unit] 18 | Description=Start Dynamic Docker image 19 | 20 | [Service] 21 | Restart=always 22 | Environment="HOME=/home/gcer" 23 | ExecStartPre=/usr/bin/docker-credential-gcr configure-docker 24 | ExecStart=/etc/gcer/startup.sh 25 | ExecStop=/usr/bin/docker stop dynamic 26 | ExecStopPost=/usr/bin/docker rm dynamic 27 | 28 | runcmd: 29 | - systemctl daemon-reload 30 | - systemctl start gcer.service -------------------------------------------------------------------------------- /inst/cloudconfig/opencpu.yaml: -------------------------------------------------------------------------------- 1 | #cloud-config 2 | 3 | users: 4 | - name: gcer 5 | uid: 2000 6 | 7 | write_files: 8 | - path: /etc/gcer/startup.sh 9 | permissions: 0755 10 | owner: root 11 | content: | 12 | %s 13 | - path: /etc/systemd/system/gcer.service 14 | permissions: 0644 15 | owner: root 16 | content: | 17 | [Unit] 18 | Description=Start OpenCPU with RStudio 19 | Requires=docker.service 20 | After=docker.service 21 | 22 | [Service] 23 | Restart=always 24 | Environment="HOME=/home/gcer" 25 | ExecStartPre=/usr/bin/docker-credential-gcr configure-docker 26 | ExecStart=/etc/gcer/startup.sh 27 | ExecStop=/usr/bin/docker stop opencpu 28 | ExecStopPost=/usr/bin/docker rm opencpu 29 | 30 | runcmd: 31 | - systemctl daemon-reload 32 | - systemctl start gcer.service -------------------------------------------------------------------------------- /inst/cloudconfig/r-base.yaml: -------------------------------------------------------------------------------- 1 | #cloud-config 2 | 3 | users: 4 | - name: gcer 5 | uid: 2000 6 | 7 | write_files: 8 | - path: /etc/gcer/startup.sh 9 | permissions: 0755 10 | owner: root 11 | content: | 12 | %s 13 | - path: /etc/systemd/system/gcer.service 14 | permissions: 0644 15 | owner: root 16 | content: | 17 | [Unit] 18 | Description=R Base 19 | Requires=docker.service 20 | After=docker.service 21 | 22 | [Service] 23 | Restart=always 24 | Environment="HOME=/home/gcer" 25 | ExecStartPre=/usr/bin/docker-credential-gcr configure-docker 26 | ExecStart=/etc/gcer/startup.sh 27 | ExecStop=/usr/bin/docker stop r-base 28 | ExecStopPost=/usr/bin/docker rm r-base 29 | 30 | runcmd: 31 | - systemctl daemon-reload 32 | - systemctl start gcer.service -------------------------------------------------------------------------------- /inst/cloudconfig/r-parallel.yaml: -------------------------------------------------------------------------------- 1 | #cloud-config 2 | 3 | users: 4 | - name: gcer 5 | uid: 2000 6 | 7 | write_files: 8 | - path: /etc/gcer/startup.sh 9 | permissions: 0755 10 | owner: root 11 | content: | 12 | %s 13 | - path: /etc/systemd/system/gcer.service 14 | permissions: 0644 15 | owner: root 16 | content: | 17 | [Unit] 18 | Description=R Base 19 | Requires=docker.service 20 | After=docker.service 21 | 22 | [Service] 23 | Restart=always 24 | Environment="HOME=/home/gcer" 25 | ExecStartPre=/usr/bin/docker-credential-gcr configure-docker 26 | ExecStart=/etc/gcer/startup.sh 27 | ExecStop=/usr/bin/docker stop r-parallel 28 | ExecStopPost=/usr/bin/docker rm r-parallel 29 | 30 | runcmd: 31 | - systemctl daemon-reload 32 | - systemctl start gcer.service -------------------------------------------------------------------------------- /inst/cloudconfig/rstudio-gpu.yaml: -------------------------------------------------------------------------------- 1 | #cloud-config 2 | 3 | users: 4 | - name: gcer 5 | uid: 2000 6 | 7 | write_files: 8 | - path: /etc/gcer/startup.sh 9 | permissions: 0755 10 | owner: root 11 | content: | 12 | %s 13 | - path: /etc/systemd/system/gcer.service 14 | permissions: 0644 15 | owner: root 16 | content: | 17 | [Unit] 18 | Description=googleComputeEngineR RStudio GPU Docker startup 19 | Requires=docker.service 20 | After=docker.service 21 | 22 | [Service] 23 | Restart=always 24 | Environment="HOME=/home/gcer" 25 | ExecStartPre=/usr/bin/docker-credential-gcr configure-docker 26 | ExecStart=/etc/gcer/startup.sh 27 | ExecStop=/usr/bin/docker stop rstudio-gpu 28 | ExecStopPost=/usr/bin/docker rm rstudio-gpu 29 | 30 | runcmd: 31 | - systemctl daemon-reload 32 | - systemctl start gcer.service 33 | -------------------------------------------------------------------------------- /inst/cloudconfig/rstudio-noauth.yaml: -------------------------------------------------------------------------------- 1 | #cloud-config 2 | 3 | users: 4 | - name: gcer 5 | uid: 2000 6 | 7 | write_files: 8 | - path: /etc/gcer/startup.sh 9 | permissions: 0755 10 | owner: root 11 | content: | 12 | %s 13 | - path: /etc/systemd/system/gcer.service 14 | permissions: 0644 15 | owner: root 16 | content: | 17 | [Unit] 18 | Description=RStudio Docker startup 19 | Requires=docker.service 20 | After=docker.service 21 | 22 | [Service] 23 | Restart=always 24 | Environment="HOME=/home/gcer" 25 | ExecStartPre=/usr/bin/docker-credential-gcr configure-docker 26 | ExecStart=/etc/gcer/startup.sh 27 | ExecStop=/usr/bin/docker stop rstudio 28 | ExecStopPost=/usr/bin/docker rm rstudio 29 | 30 | runcmd: 31 | - systemctl daemon-reload 32 | - systemctl start gcer.service 33 | -------------------------------------------------------------------------------- /inst/cloudconfig/rstudio-shiny.yaml: -------------------------------------------------------------------------------- 1 | #cloud-config 2 | 3 | users: 4 | - name: gcer 5 | uid: 2000 6 | 7 | write_files: 8 | - path: /etc/gcer/startup.sh 9 | permissions: 0755 10 | owner: root 11 | content: | 12 | %s 13 | - path: /etc/gcer/nginx.conf 14 | permissions: 0755 15 | owner: root 16 | content: | 17 | %s 18 | - path: /etc/systemd/system/gcer.service 19 | permissions: 0644 20 | owner: root 21 | content: | 22 | [Unit] 23 | Description=googleComputeEngineR generic Docker startup 24 | 25 | [Service] 26 | Restart=always 27 | Type=simple 28 | Environment="HOME=/home/gcer" 29 | ExecStartPre=/usr/bin/docker-credential-gcr configure-docker 30 | ExecStartPre=/usr/bin/docker network create --driver=bridge r-net 31 | ExecStart=/etc/gcer/startup.sh 32 | ExecStop=/usr/bin/docker stop gcer-docker 33 | ExecStopPost=/usr/bin/docker rm gcer-docker 34 | - path: /etc/systemd/system/nginx.service 35 | permissions: 0644 36 | owner: root 37 | content: | 38 | [Unit] 39 | Description=nginx server for R services 40 | # https://fardog.io/blog/2017/12/30/running-docker-containers-with-systemd/ 41 | [Service] 42 | Restart=always 43 | Type=simple 44 | ExecStart=/usr/bin/docker run --name r-nginx \ 45 | --network=r-net \ 46 | -p 80:80 -p 443:443 \ 47 | -v /etc/gcer/nginx.conf:/etc/nginx/nginx.conf:ro \ 48 | nginx:1.14 49 | ExecStop=/usr/bin/docker stop r-nginx 50 | ExecStopPost=/usr/bin/docker rm r-nginx 51 | runcmd: 52 | - systemctl daemon-reload 53 | - systemctl start gcer.service 54 | - systemctl start nginx.service 55 | 56 | -------------------------------------------------------------------------------- /inst/cloudconfig/rstudio.yaml: -------------------------------------------------------------------------------- 1 | #cloud-config 2 | 3 | users: 4 | - name: gcer 5 | uid: 2000 6 | 7 | write_files: 8 | - path: /etc/gcer/startup.sh 9 | permissions: 0755 10 | owner: root 11 | content: | 12 | %s 13 | - path: /etc/systemd/system/gcer.service 14 | permissions: 0644 15 | owner: root 16 | content: | 17 | [Unit] 18 | Description=RStudio Docker startup 19 | Requires=docker.service 20 | After=docker.service 21 | 22 | [Service] 23 | Restart=always 24 | Environment="HOME=/home/gcer" 25 | ExecStartPre=/usr/bin/docker-credential-gcr configure-docker 26 | ExecStart=/etc/gcer/startup.sh 27 | ExecStop=/usr/bin/docker stop rstudio 28 | ExecStopPost=/usr/bin/docker rm rstudio 29 | 30 | runcmd: 31 | - systemctl daemon-reload 32 | - systemctl start gcer.service 33 | -------------------------------------------------------------------------------- /inst/cloudconfig/shiny.yaml: -------------------------------------------------------------------------------- 1 | #cloud-config 2 | 3 | users: 4 | - name: gcer 5 | uid: 2000 6 | 7 | write_files: 8 | - path: /etc/gcer/startup.sh 9 | permissions: 0755 10 | owner: root 11 | content: | 12 | %s 13 | - path: /etc/systemd/system/gcer.service 14 | permissions: 0644 15 | owner: root 16 | content: | 17 | [Unit] 18 | Description=Shiny Server 19 | Requires=docker.service 20 | After=docker.service 21 | 22 | [Service] 23 | Restart=always 24 | Environment="HOME=/home/gcer" 25 | ExecStartPre=/usr/bin/docker-credential-gcr configure-docker 26 | ExecStart=/etc/gcer/startup.sh 27 | ExecStop=/usr/bin/docker stop shiny 28 | ExecStopPost=/usr/bin/docker rm shiny 29 | 30 | runcmd: 31 | - systemctl daemon-reload 32 | - systemctl start gcer.service -------------------------------------------------------------------------------- /inst/dockerfiles/cloudDataLabR/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM rocker/hadleyverse 2 | MAINTAINER Mark Edmondson (r@sunholo.com) 3 | 4 | # install cron and nano and tensorflow and tflearn 5 | RUN apt-get update && apt-get install -y \ 6 | cron nano \ 7 | python-pip python-dev libhdf5-dev \ 8 | && pip install cython \ 9 | && pip install numpy \ 10 | && pip install pandas \ 11 | && export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.0.0-cp27-none-linux_x86_64.whl \ 12 | && pip install --upgrade $TF_BINARY_URL \ 13 | && pip install git+https://github.com/tflearn/tflearn.git \ 14 | 15 | && pip install feather-format \ 16 | && pip install h5py \ 17 | ## clean up 18 | && apt-get clean \ 19 | && rm -rf /var/lib/apt/lists/ \ 20 | && rm -rf /tmp/downloaded_packages/ /tmp/*.rds 21 | 22 | ## Install packages from CRAN 23 | RUN install2.r --error \ 24 | -r 'http://cran.rstudio.com' \ 25 | googleAuthR googleAnalyticsR searchConsoleR googleCloudStorageR bigQueryR htmlwidgets feather rPython \ 26 | ## install Github packages 27 | && Rscript -e "devtools::install_github(c('MarkEdmondson1234/youtubeAnalyticsR', 'MarkEdmondson1234/googleID', 'MarkEdmondson1234/googleAuthR'))" \ 28 | && Rscript -e "devtools::install_github(c('bnosac/cronR'))" \ 29 | && Rscript -e "devtools::install_github(c('rstudio/tensorflow'))" \ 30 | ## clean up 31 | && rm -rf /tmp/downloaded_packages/ /tmp/*.rds \ 32 | -------------------------------------------------------------------------------- /inst/dockerfiles/demoDockerAppEngine/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM trestletech/plumber 2 | LABEL maintainer="mark" 3 | RUN export DEBIAN_FRONTEND=noninteractive; apt-get -y update \ 4 | && apt-get install -y libcairo2-dev \ 5 | libcurl4-openssl-dev \ 6 | libgmp-dev \ 7 | libpng-dev \ 8 | libssl-dev \ 9 | libxml2-dev \ 10 | make \ 11 | pandoc \ 12 | pandoc-citeproc \ 13 | zlib1g-dev 14 | RUN ["install2.r", "-r 'https://cloud.r-project.org'", "readr", "googleCloudStorageR", "Rcpp", "digest", "crayon", "withr", "mime", "R6", "jsonlite", "xtable", "magrittr", "httr", "curl", "testthat", "devtools", "hms", "shiny", "httpuv", "memoise", "htmltools", "openssl", "tibble", "remotes"] 15 | RUN ["installGithub.r", "MarkEdmondson1234/googleAuthR@7917351", "hadley/rlang@ff87439"] 16 | WORKDIR /payload/ 17 | COPY [".", "./"] 18 | 19 | EXPOSE 8080 20 | ENTRYPOINT ["R", "-e", "pr <- plumber::plumb(commandArgs()[4]); pr$run(host='0.0.0.0', port=8080, swagger=TRUE)"] 21 | CMD ["api.R"] -------------------------------------------------------------------------------- /inst/dockerfiles/demoDockerAppEngine/api.R: -------------------------------------------------------------------------------- 1 | library(googleAuthR) ## authentication 2 | library(googleCloudStorageR) ## google cloud storage 3 | library(readr) ## 4 | ## gcs auto authenticated via environment file 5 | ## pointed to via sys.env GCS_AUTH_FILE 6 | 7 | #* @get /demoR 8 | demoScheduleAPI <- function(){ 9 | 10 | ## download or do something 11 | something <- tryCatch({ 12 | gcs_get_object("schedule/test.csv", 13 | bucket = "mark-edmondson-public-files") 14 | }, error = function(ex) { 15 | NULL 16 | }) 17 | 18 | something_else <- data.frame(X1 = 1, 19 | time = Sys.time(), 20 | blah = paste(sample(letters, 10, replace = TRUE), collapse = "")) 21 | something <- rbind(something, something_else) 22 | 23 | tmp <- tempfile(fileext = ".csv") 24 | on.exit(unlink(tmp)) 25 | write.csv(something, file = tmp, row.names = FALSE) 26 | ## upload something 27 | gcs_upload(tmp, 28 | bucket = "mark-edmondson-public-files", 29 | name = "schedule/test.csv") 30 | 31 | cat("Done", Sys.time()) 32 | } 33 | 34 | ## run locally via 35 | # pr <- plumber::plumb("schedule.R"); pr$run(port=8080) -------------------------------------------------------------------------------- /inst/dockerfiles/demoDockerAppEngine/app.yaml: -------------------------------------------------------------------------------- 1 | runtime: custom 2 | env: flex 3 | automatic_scaling: 4 | min_num_instances: 1 5 | max_num_instances: 1 6 | 7 | resources: 8 | cpu: 1 9 | memory_gb: 2 10 | 11 | env_variables: 12 | GCS_AUTH_FILE: auth.json 13 | -------------------------------------------------------------------------------- /inst/dockerfiles/demoDockerAppEngine/cron.yaml: -------------------------------------------------------------------------------- 1 | cron: 2 | - description: "test cron" 3 | url: /demoR 4 | schedule: every 1 hours 5 | -------------------------------------------------------------------------------- /inst/dockerfiles/demoDockerScheduler/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM rocker/r-ver:3.4.0 2 | LABEL maintainer="mark" 3 | RUN export DEBIAN_FRONTEND=noninteractive; apt-get -y update \ 4 | && apt-get install -y libcairo2-dev \ 5 | libcurl4-openssl-dev \ 6 | libgmp-dev \ 7 | libpng-dev \ 8 | libssl-dev \ 9 | libxml2-dev \ 10 | make \ 11 | pandoc \ 12 | pandoc-citeproc \ 13 | zlib1g-dev 14 | RUN ["install2.r", "-r 'https://cloud.r-project.org'", "googleCloudStorageR", "googleAuthR", "Rcpp", "assertthat", "digest", "crayon", "withr", "mime", "R6", "jsonlite", "xtable", "magrittr", "httr", "curl", "testthat", "devtools", "readr", "hms", "shiny", "httpuv", "memoise", "htmltools", "openssl", "tibble", "remotes"] 15 | RUN ["installGithub.r", "hadley/rlang@c351186"] 16 | WORKDIR /payload/ 17 | COPY [".", "./"] 18 | CMD ["R", "--vanilla", "-f", "schedule.R"] 19 | -------------------------------------------------------------------------------- /inst/dockerfiles/demoDockerScheduler/schedule.R: -------------------------------------------------------------------------------- 1 | library(googleAuthR) ## authentication 2 | library(googleCloudStorageR) ## google cloud storage 3 | 4 | ## set authentication details for non-cloud services 5 | # options(googleAuthR.scopes.selected = "XXX", 6 | # googleAuthR.client_id = "", 7 | # googleAuthR.client_secret = "") 8 | 9 | ## download or do something 10 | something <- tryCatch({ 11 | gcs_get_object("schedule/test.csv", 12 | bucket = "mark-edmondson-public-files") 13 | }, error = function(ex) { 14 | NULL 15 | }) 16 | 17 | something_else <- data.frame(X1 = 1, 18 | time = Sys.time(), 19 | blah = paste(sample(letters, 10, replace = TRUE), collapse = "")) 20 | something <- rbind(something, something_else) 21 | 22 | ## authenticate on GCE for google cloud services 23 | googleAuthR::gar_gce_auth() 24 | 25 | tmp <- tempfile(fileext = ".csv") 26 | on.exit(unlink(tmp)) 27 | write.csv(something, file = tmp, row.names = FALSE) 28 | ## upload something 29 | gcs_upload(tmp, 30 | bucket = "mark-edmondson-public-files", 31 | name = "schedule/test.csv") 32 | -------------------------------------------------------------------------------- /inst/dockerfiles/gceScheduler/download.R: -------------------------------------------------------------------------------- 1 | library(googleCloudStorageR) 2 | library(googleAnalyticsR) 3 | gcs_global_bucket("mark-cron") 4 | 5 | ## gcs can authenticate via GCE auth keys 6 | googleAuthR::gar_gce_auth() 7 | 8 | ## use GCS to download auth key (that you have previously uploaded) 9 | gcs_get_object("ga.httr-oauth", 10 | saveToDisk = "ga.httr-oauth") 11 | 12 | auth_token <- readRDS("ga.httr-oauth") 13 | options(googleAuthR.scopes.selected = c("https://www.googleapis.com/auth/analytics", 14 | "https://www.googleapis.com/auth/analytics.readonly"), 15 | googleAuthR.httr_oauth_cache = "ga.httr-oauth") 16 | googleAuthR::gar_auth(auth_token) 17 | 18 | ## fetch data 19 | 20 | gadata <- google_analytics_4(81416156, 21 | date_range = c(Sys.Date() - 8, Sys.Date() - 1), 22 | dimensions = c("medium", "source", "landingPagePath"), 23 | metrics = "sessions", 24 | max = -1) 25 | 26 | ## back to Cloud Storage 27 | googleAuthR::gar_gce_auth() 28 | gcs_upload(gadata, name = "uploads/gadata_81416156.csv") 29 | gcs_upload("ga.httr-oauth") 30 | 31 | message("Upload complete", Sys.time()) -------------------------------------------------------------------------------- /inst/dockerfiles/gceScheduler/gce-launcher.R: -------------------------------------------------------------------------------- 1 | ## intended to be run on a small instance via cron 2 | ## use this script to launch other VMs with more expensive tasks 3 | library(googleComputeEngineR) 4 | library(googleCloudStorageR) 5 | 6 | gce_global_project("mark-edmondson-gde") 7 | gce_global_zone("europe-west1-b") 8 | ## auth to same project we're on 9 | googleAuthR::gar_gce_auth() 10 | 11 | ## download your customised RStudio with necessary packages installed 12 | tag <- gce_tag_container("slave-1") 13 | 14 | ## launch the VM 15 | ## will either create or start the VM if its not created already 16 | vm <- gce_vm(name = "slave-1", 17 | predefined_type = "n1-standard-1", 18 | template = "rstudio", 19 | dynamic_image = tag) 20 | 21 | vm <- gce_ssh_setup(vm, username = "master", ssh_overwrite = TRUE) 22 | ## get the script from googleCloudStorage 23 | myscript <- tempfile(fileext = ".R") 24 | gcs_get_object("download.R", bucket = "mark-cron", saveToDisk = myscript) 25 | 26 | ## upload script to VM 27 | gce_ssh_upload(vm, myscript, "./myscript.R") 28 | 29 | ## copy script to docker container 30 | docker_cmd(vm, cmd = "cp", args = c("./myscript.R", "rstudio:tmp/myscript.R")) 31 | 32 | ## run the script on the VM 33 | out <- docker_cmd(vm, 34 | cmd = "exec", 35 | args = c("rstudio", "Rscript 'tmp/myscript.R'"), 36 | wait = TRUE) 37 | 38 | ## once finished, stop the VM 39 | gce_vm_stop(vm) -------------------------------------------------------------------------------- /inst/dockerfiles/gceScheduler/master/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM rocker/hadleyverse 2 | MAINTAINER Mark Edmondson (r@sunholo.com) 3 | 4 | # install cron and R package dependencies 5 | RUN apt-get update && apt-get install -y \ 6 | cron \ 7 | nano \ 8 | ## clean up 9 | && apt-get clean \ 10 | && rm -rf /var/lib/apt/lists/ \ 11 | && rm -rf /tmp/downloaded_packages/ /tmp/*.rds 12 | 13 | ## Install packages from CRAN 14 | RUN install2.r --error \ 15 | -r 'http://cran.rstudio.com' \ 16 | googleComputeEngineR googleCloudStorageR shinyFiles cronR \ 17 | ## && Rscript -e "devtools::install_github(c('bnosac/cronR', 'MarkEdmondson1234/googleAuthR'))" \ 18 | ## clean up 19 | && rm -rf /tmp/downloaded_packages/ /tmp/*.rds 20 | 21 | ## Start cron 22 | RUN sudo service cron start 23 | -------------------------------------------------------------------------------- /inst/dockerfiles/gceScheduler/slave/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM rocker/verse 2 | MAINTAINER Mark Edmondson (r@sunholo.com) 3 | 4 | # install R package dependencies 5 | RUN apt-get update && apt-get install -y \ 6 | ## clean up 7 | && apt-get clean \ 8 | && rm -rf /var/lib/apt/lists/ \ 9 | && rm -rf /tmp/downloaded_packages/ /tmp/*.rds 10 | 11 | ## Install packages from CRAN 12 | RUN install2.r --error \ 13 | -r 'http://cran.rstudio.com' \ 14 | googleComputeEngineR googleCloudStorageR googleAnalyticsR searchConsoleR bigQueryR \ 15 | && Rscript -e "devtools::install_github('MarkEdmondson1234/googleAuthR')" \ 16 | ## clean up 17 | && rm -rf /tmp/downloaded_packages/ /tmp/*.rds 18 | 19 | -------------------------------------------------------------------------------- /inst/dockerfiles/googleAuthR-verse/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM rocker/tidyverse 2 | MAINTAINER Mark Edmondson (r@sunholo.com) 3 | 4 | # install R package dependencies 5 | RUN apt-get update && apt-get install -y \ 6 | ## clean up 7 | && apt-get clean \ 8 | && rm -rf /var/lib/apt/lists/ \ 9 | && rm -rf /tmp/downloaded_packages/ /tmp/*.rds 10 | 11 | ## Install packages from CRAN 12 | RUN install2.r --error \ 13 | -r 'http://cran.rstudio.com' \ 14 | googleAuthR \ 15 | googleComputeEngineR \ 16 | googleAnalyticsR \ 17 | searchConsoleR \ 18 | googleCloudStorageR \ 19 | bigQueryR \ 20 | ## install Github packages 21 | && installGithub.r MarkEdmondson1234/youtubeAnalyticsR \ 22 | MarkEdmondson1234/googleID \ 23 | MarkEdmondson1234/googleCloudRunner \ 24 | ## clean up 25 | && rm -rf /tmp/downloaded_packages/ /tmp/*.rds \ 26 | 27 | -------------------------------------------------------------------------------- /inst/dockerfiles/googleComputeEngineR-worker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM rocker/verse 2 | MAINTAINER Mark Edmondson (r@sunholo.com) 3 | 4 | # install R package dependencies 5 | RUN apt-get update && apt-get install -y \ 6 | ## clean up 7 | && apt-get clean \ 8 | && rm -rf /var/lib/apt/lists/ \ 9 | && rm -rf /tmp/downloaded_packages/ /tmp/*.rds 10 | 11 | ## Install packages from CRAN 12 | RUN install2.r --error \ 13 | -r 'http://cran.rstudio.com' \ 14 | googleComputeEngineR \ 15 | ## install Github packages 16 | ## clean up 17 | && rm -rf /tmp/downloaded_packages/ /tmp/*.rds \ 18 | -------------------------------------------------------------------------------- /inst/dockerfiles/hadleyverse-crontab/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM rocker/tidyverse 2 | MAINTAINER Mark Edmondson (r@sunholo.com) 3 | 4 | # install cron and R package dependencies 5 | RUN apt-get update && apt-get install -y \ 6 | cron \ 7 | nano \ 8 | libxml2-dev \ 9 | ## clean up 10 | && apt-get clean \ 11 | && rm -rf /var/lib/apt/lists/ \ 12 | && rm -rf /tmp/downloaded_packages/ /tmp/*.rds 13 | 14 | ## Install packages from CRAN 15 | RUN install2.r --error \ 16 | -r 'http://cran.rstudio.com' \ 17 | googleAuthR shinyFiles googleCloudStorageR \ 18 | bigQueryR gmailr googleAnalyticsR cronR googleComputeEngineR searchConsoleR \ 19 | ## install Github packages 20 | && Rscript -e "devtools::install_github(c('MarkEdmondson1234/googleLanguageR'))" \ 21 | ## clean up 22 | && rm -rf /tmp/downloaded_packages/ /tmp/*.rds \ 23 | 24 | ## Start cron 25 | RUN sudo service cron start 26 | -------------------------------------------------------------------------------- /inst/dockerfiles/hadleyverse-crontab/demo-schedule.R: -------------------------------------------------------------------------------- 1 | library(googleCloudStorageR) 2 | library(bigQueryR) 3 | library(gmailr) 4 | library(googleAnalyticsR) 5 | 6 | ## set options for authentication 7 | options(googleAuthR.client_id = XXXXX) 8 | options(googleAuthR.client_secret = XXXX) 9 | options(googleAuthR.scopes.selected = c("https://www.googleapis.com/auth/cloud-platform", 10 | "https://www.googleapis.com/auth/analytics.readonly")) 11 | 12 | ## authenticate 13 | ## using service account, ensure service account email added to GA account, BigQuery user permissions set, etc. 14 | googleAuthR::gar_auth_service("auth.json") 15 | 16 | ## get Google Analytics data 17 | gadata <- google_analytics_4(123456, 18 | date_range = c(Sys.Date() - 2, Sys.Date() - 1), 19 | metrics = "sessions", 20 | dimensions = "medium", 21 | anti_sample = TRUE) 22 | 23 | ## upload to Google BigQuery 24 | bqr_upload_data(projectId = "myprojectId", 25 | datasetId = "mydataset", 26 | tableId = paste0("gadata_",format(Sys.Date(),"%Y%m%d")), 27 | upload_data = gadata, 28 | create = TRUE) 29 | 30 | ## upload to Google Cloud Storage 31 | gcs_upload(gadata, name = paste0("gadata_",Sys.Date(),".csv")) 32 | 33 | 34 | ## get top medium referrer 35 | top_ref <- paste(gadata[order(gadata$sessions, decreasing = TRUE),][1, ], collapse = ",") 36 | # 3456, organic 37 | 38 | ## send email with todays figures 39 | daily_email <- mime( 40 | To = "bob@myclient.com", 41 | From = "bill@coolagency.com", 42 | Subject = "Todays winner is....", 43 | body = paste0("Top referrer was: "),top_ref) 44 | send_message(daily_email) 45 | -------------------------------------------------------------------------------- /inst/dockerfiles/opencpu-installgithub/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM opencpu/base 2 | MAINTAINER Mark Edmondson (r@sunholo.com) 3 | 4 | # install any package dependencies 5 | RUN apt-get update && apt-get install -y \ 6 | nano \ 7 | ## clean up 8 | && apt-get clean \ 9 | && rm -rf /var/lib/apt/lists/ \ 10 | && rm -rf /tmp/downloaded_packages/ /tmp/*.rds 11 | 12 | ## Install your custom package from Github 13 | RUN Rscript -e "devtools::install_github(c('MarkEdmondson1234/predictClickOpenCPU'))" 14 | -------------------------------------------------------------------------------- /inst/dockerfiles/persistentRStudio-verse/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM rocker/verse 2 | MAINTAINER Mark Edmondson (r@sunholo.com) 3 | 4 | RUN apt-get -qqy update && apt-get install -qqy \ 5 | openssh-client \ 6 | qpdf 7 | 8 | ## Install packages from CRAN 9 | RUN install2.r --error \ 10 | -r 'http://cran.rstudio.com' \ 11 | googleAuthR \ 12 | googleComputeEngineR \ 13 | googleAnalyticsR \ 14 | searchConsoleR \ 15 | googleCloudStorageR \ 16 | bigQueryR \ 17 | zip \ 18 | ## install Github packages 19 | && installGithub.r MarkEdmondson1234/youtubeAnalyticsR \ 20 | MarkEdmondson1234/googleID \ 21 | cloudyr/googleCloudStorageR \ 22 | cloudyr/googleComputeEngineR \ 23 | ## clean up 24 | && rm -rf /tmp/downloaded_packages/ /tmp/*.rds 25 | 26 | COPY Rprofile.site /usr/local/lib/R/etc/Rprofile.site 27 | -------------------------------------------------------------------------------- /inst/dockerfiles/persistentRStudio-verse/Rprofile.site: -------------------------------------------------------------------------------- 1 | .First <- function(){ 2 | message("\n# Welcome to RStudio Server on Google Compute Engine! Today is ", date(), "\n") 3 | 4 | googleCloudStorageR::gcs_first() 5 | } 6 | 7 | 8 | .Last <- function(){ 9 | googleCloudStorageR::gcs_last() 10 | message("\nGoodbye at ", date(), "\n") 11 | } 12 | -------------------------------------------------------------------------------- /inst/dockerfiles/persistentRStudio/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM rocker/tidyverse 2 | MAINTAINER Mark Edmondson (r@sunholo.com) 3 | 4 | # install gcsfuse deps 5 | RUN apt-get update && apt-get install -y gnupg lsb-release wget 6 | RUN lsb_release -c -s > /tmp/lsb_release 7 | 8 | RUN GCSFUSE_REPO=$(cat /tmp/lsb_release); \ 9 | echo "deb http://packages.cloud.google.com/apt gcsfuse-$GCSFUSE_REPO main" | \ 10 | tee /etc/apt/sources.list.d/gcsfuse.list 11 | RUN wget -O - https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - 12 | 13 | # install system deps 14 | RUN apt-get -qqy update && apt-get install -qqy \ 15 | openssh-client \ 16 | qpdf \ 17 | libsodium-dev \ 18 | gcsfuse 19 | 20 | ## Install packages from CRAN 21 | RUN install2.r --error \ 22 | -r 'http://cran.rstudio.com' \ 23 | googleAuthR \ 24 | googleComputeEngineR \ 25 | googleAnalyticsR \ 26 | searchConsoleR \ 27 | googleCloudStorageR \ 28 | bigQueryR \ 29 | googleCloudRunner \ 30 | zip \ 31 | ## install Github packages 32 | && installGithub.r cloudyr/googleCloudStorageR \ 33 | cloudyr/googleComputeEngineR \ 34 | MarkEdmondson1234/googleCloudRunner \ 35 | ## clean up 36 | && rm -rf /tmp/downloaded_packages/ /tmp/*.rds 37 | 38 | COPY Rprofile.site /usr/local/lib/R/etc/Rprofile.site 39 | -------------------------------------------------------------------------------- /inst/dockerfiles/persistentRStudio/Rprofile.site: -------------------------------------------------------------------------------- 1 | .First <- function(){ 2 | message("\n# Welcome to RStudio Server on Google Compute Engine! Today is ", date(), "\n") 3 | 4 | googleCloudStorageR::gcs_first() 5 | } 6 | 7 | 8 | .Last <- function(){ 9 | googleCloudStorageR::gcs_last() 10 | message("\nGoodbye at ", date(), "\n") 11 | } 12 | -------------------------------------------------------------------------------- /inst/dockerfiles/publicDocker.sh: -------------------------------------------------------------------------------- 1 | ## script to push public versions of build Dockerfiles 2 | ## to Google project gcer-public 3 | ## as per https://cloud.google.com/container-registry/docs/access-control 4 | 5 | ## using gsutil CLI 6 | gsutil defacl ch -u AllUsers:R gs://artifacts.gcer-public.appspot.com 7 | 8 | gsutil acl ch -r -u -m AllUsers:R gs://artifacts.gcer-public.appspot.com 9 | 10 | gsutil acl ch -u AllUsers:R gs://artifacts.gcer-public.appspot.com 11 | 12 | -------------------------------------------------------------------------------- /inst/dockerfiles/rstudio-gcloud/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM rocker/tidyverse 2 | MAINTAINER Mark Edmondson (r@sunholo.com) 3 | 4 | ## install gcloud 5 | ## from https://github.com/GoogleCloudPlatform/cloud-sdk-docker 6 | ENV CLOUD_SDK_VERSION 167.0.0 7 | 8 | RUN apt-get -qqy update && apt-get install -qqy \ 9 | curl \ 10 | gcc \ 11 | python-dev \ 12 | python-setuptools \ 13 | apt-transport-https \ 14 | lsb-release \ 15 | openssh-client \ 16 | git \ 17 | gnupg \ 18 | && easy_install -U pip && \ 19 | pip install -U crcmod && \ 20 | export CLOUD_SDK_REPO="cloud-sdk-$(lsb_release -c -s)" && \ 21 | echo "deb https://packages.cloud.google.com/apt $CLOUD_SDK_REPO main" > /etc/apt/sources.list.d/google-cloud-sdk.list && \ 22 | curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - && \ 23 | apt-get update && \ 24 | apt-get install -y google-cloud-sdk=${CLOUD_SDK_VERSION}-0 \ 25 | google-cloud-sdk-app-engine-python \ 26 | google-cloud-sdk-app-engine-java \ 27 | google-cloud-sdk-app-engine-go \ 28 | google-cloud-sdk-datalab \ 29 | google-cloud-sdk-datastore-emulator \ 30 | google-cloud-sdk-pubsub-emulator \ 31 | google-cloud-sdk-bigtable-emulator \ 32 | google-cloud-sdk-cbt \ 33 | kubectl && \ 34 | gcloud config set core/disable_usage_reporting true && \ 35 | gcloud config set component_manager/disable_update_check true && \ 36 | gcloud config set metrics/environment github_docker_image 37 | VOLUME ["/root/.config"] 38 | 39 | ## Install packages from CRAN 40 | RUN install2.r --error \ 41 | -r 'http://cran.rstudio.com' \ 42 | googleAuthR \ 43 | googleComputeEngineR \ 44 | googleAnalyticsR \ 45 | searchConsoleR \ 46 | googleCloudStorageR \ 47 | bigQueryR \ 48 | zip \ 49 | ## install Github packages 50 | && installGithub.r MarkEdmondson1234/youtubeAnalyticsR \ 51 | MarkEdmondson1234/googleID \ 52 | cloudyr/googleCloudStorageR \ 53 | cloudyr/googleComputeEngineR \ 54 | ## clean up 55 | && rm -rf /tmp/downloaded_packages/ /tmp/*.rds 56 | 57 | -------------------------------------------------------------------------------- /inst/dockerfiles/rstudio-k8s/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM rocker/tidyverse 2 | MAINTAINER Mark Edmondson (r@sunholo.com) 3 | 4 | RUN apt-get -qqy update && apt-get install -qqy \ 5 | openssh-client \ 6 | qpdf 7 | 8 | ## Install packages from CRAN 9 | RUN install2.r --error \ 10 | -r 'http://cran.rstudio.com' \ 11 | googleAuthR \ 12 | googleComputeEngineR \ 13 | googleAnalyticsR \ 14 | searchConsoleR \ 15 | googleCloudStorageR \ 16 | bigQueryR \ 17 | zip \ 18 | ## install Github packages 19 | && installGithub.r MarkEdmondson1234/youtubeAnalyticsR \ 20 | MarkEdmondson1234/googleID \ 21 | cloudyr/googleCloudStorageR \ 22 | cloudyr/googleComputeEngineR \ 23 | ## clean up 24 | && rm -rf /tmp/downloaded_packages/ /tmp/*.rds 25 | 26 | ## install Github packages 27 | && installGithub.r \ 28 | MarkEdmondson1234/gcloudR 29 | 30 | ## clean up 31 | && rm -rf /tmp/downloaded_packages/ /tmp/*.rds 32 | 33 | COPY rserver.conf /etc/rstudio/rserver.conf 34 | 35 | EXPOSE 80 36 | -------------------------------------------------------------------------------- /inst/dockerfiles/rstudio-k8s/rserver.conf: -------------------------------------------------------------------------------- 1 | www-port=80 -------------------------------------------------------------------------------- /inst/dockerfiles/rstudio-keras/add_shiny.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/with-contenv bash 2 | 3 | ADD=${ADD:=none} 4 | 5 | ## A script to add shiny to an rstudio-based rocker image. 6 | 7 | if [ "$ADD" == "shiny" ]; then 8 | echo "Adding shiny server to container..." 9 | apt-get update && apt-get -y install \ 10 | gdebi-core \ 11 | libxt-dev && \ 12 | wget --no-verbose https://s3.amazonaws.com/rstudio-shiny-server-os-build/ubuntu-12.04/x86_64/VERSION -O "version.txt" && \ 13 | VERSION=$(cat version.txt) && \ 14 | wget --no-verbose "https://s3.amazonaws.com/rstudio-shiny-server-os-build/ubuntu-12.04/x86_64/shiny-server-$VERSION-amd64.deb" -O ss-latest.deb && \ 15 | gdebi -n ss-latest.deb && \ 16 | rm -f version.txt ss-latest.deb && \ 17 | install2.r -e shiny rmarkdown && \ 18 | cp -R /usr/local/lib/R/site-library/shiny/examples/* /srv/shiny-server/ && \ 19 | rm -rf /var/lib/apt/lists/* && \ 20 | mkdir -p /var/log/shiny-server && \ 21 | chown shiny.shiny /var/log/shiny-server && \ 22 | mkdir -p /etc/services.d/shiny-server && \ 23 | cd /etc/services.d/shiny-server && \ 24 | echo '#!/bin/bash' > run && echo 'exec shiny-server > /var/log/shiny-server.log' >> run && \ 25 | chmod +x run && \ 26 | adduser rstudio shiny && \ 27 | cd / 28 | fi 29 | 30 | if [ $"$ADD" == "none" ]; then 31 | echo "Nothing additional to add" 32 | fi 33 | -------------------------------------------------------------------------------- /inst/dockerfiles/rstudio-keras/disable_auth_rserver.conf: -------------------------------------------------------------------------------- 1 | # Server Configuration File 2 | 3 | rsession-which-r=/usr/local/bin/R 4 | auth-none=1 5 | 6 | -------------------------------------------------------------------------------- /inst/dockerfiles/rstudio-keras/hello-world.R: -------------------------------------------------------------------------------- 1 | library(keras) 2 | 3 | mnist <- dataset_mnist() 4 | train_images <- mnist$train$x 5 | train_labels <- mnist$train$y 6 | test_images <- mnist$test$x 7 | test_labels <- mnist$test$y 8 | 9 | network <- keras_model_sequential() %>% 10 | layer_dense(units = 512, activation = "relu", input_shape = c(28*28)) %>% 11 | layer_dense(units = 10, activation = "softmax") 12 | 13 | network %>% compile( 14 | optimizer = "rmsprop", 15 | loss = "categorical_crossentropy", 16 | metrics = c("accuracy") 17 | ) 18 | 19 | train_images <- array_reshape(train_images, c(60000, 28*28)) 20 | train_images <- train_images / 255 21 | 22 | test_images <- array_reshape(test_images, c(10000, 28*28)) 23 | test_images <- test_images / 255 24 | 25 | train_labels <- to_categorical(train_labels) 26 | test_labels <- to_categorical(test_labels) 27 | 28 | network %>% fit(train_images, train_labels, epochs = 5, batch_size = 128) 29 | -------------------------------------------------------------------------------- /inst/dockerfiles/rstudio-keras/install.R: -------------------------------------------------------------------------------- 1 | tensorflow::install_tensorflow() 2 | keras::install_keras(tensorflow = "gpu") 3 | reticulate::py_discover_config("keras") 4 | reticulate::py_discover_config("tensorflow") 5 | -------------------------------------------------------------------------------- /inst/dockerfiles/rstudio-keras/pam-helper.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ## Enforces the custom password specified in the PASSWORD environment variable 4 | ## The accepted RStudio username is the same as the USER environment variable (i.e., local user name). 5 | 6 | set -o nounset 7 | 8 | IFS='' read -r password 9 | 10 | [ "${USER}" = "${1}" ] && [ "${PASSWORD}" = "${password}" ] 11 | -------------------------------------------------------------------------------- /inst/dockerfiles/shiny-googleAuthRdemo/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM rocker/shiny 2 | MAINTAINER Mark Edmondson (r@sunholo.com) 3 | 4 | # install R package dependencies 5 | RUN apt-get update && apt-get install -y \ 6 | libssl-dev \ 7 | ## clean up 8 | && apt-get clean \ 9 | && rm -rf /var/lib/apt/lists/ \ 10 | && rm -rf /tmp/downloaded_packages/ /tmp/*.rds 11 | 12 | ## Install packages from CRAN 13 | RUN install2.r --error \ 14 | -r 'http://cran.rstudio.com' \ 15 | googleAuthR \ 16 | ## install Github packages 17 | ## clean up 18 | && rm -rf /tmp/downloaded_packages/ /tmp/*.rds 19 | 20 | ## assume shiny app is in build folder /shiny 21 | COPY ./shiny/ /srv/shiny-server/shiny/ 22 | -------------------------------------------------------------------------------- /inst/dockerfiles/shiny-googleAuthRdemo/shiny/DESCRIPTION: -------------------------------------------------------------------------------- 1 | Title: googleAuthR Example 2 | Author: Mark Edmondson 3 | AuthorUrl: http://code.markedmondson.me/googleAuthR/ 4 | License: MIT 5 | DisplayMode: Showcase 6 | Type: Shiny -------------------------------------------------------------------------------- /inst/dockerfiles/shiny-googleAuthRdemo/shiny/readme.md: -------------------------------------------------------------------------------- 1 | This is an example of using googleAuthR multi-user authentication within a Shiny app. 2 | 3 | Use the Shiny Module functions `googleAuthUI` and `googleAuth` to make the login flow, and then wrap your created functions made with `gar_api_generator` with `with_shiny` to ensure the authentication token is passed in the correct manner. -------------------------------------------------------------------------------- /inst/dockerfiles/shiny-googleAuthRdemo/shiny/server.R: -------------------------------------------------------------------------------- 1 | library(shiny) 2 | library(googleAuthR) 3 | options(googleAuthR.scopes.selected = "https://www.googleapis.com/auth/urlshortener") 4 | options(googleAuthR.webapp.client_id = "201908948134-cjjs89cffh3k429vi7943ftpk3jg36ed.apps.googleusercontent.com") 5 | options(googleAuthR.webapp.client_secret = "mE7rHl0-iNtzyI1MQia-mg1o") 6 | 7 | shorten_url <- function(url){ 8 | 9 | body = list( 10 | longUrl = url 11 | ) 12 | 13 | f <- gar_api_generator("https://www.googleapis.com/urlshortener/v1/url", 14 | "POST", 15 | data_parse_function = function(x) x$id) 16 | 17 | f(the_body = body) 18 | 19 | } 20 | 21 | ## server.R 22 | server <- function(input, output, session){ 23 | 24 | ## Create access token and render login button 25 | access_token <- callModule(googleAuth, "loginButton", approval_prompt = "force") 26 | 27 | short_url_output <- eventReactive(input$submit, { 28 | ## wrap existing function with_shiny 29 | ## pass the reactive token in shiny_access_token 30 | ## pass other named arguments 31 | with_shiny(f = shorten_url, 32 | shiny_access_token = access_token(), 33 | url=input$url) 34 | 35 | }) 36 | 37 | output$short_url <- renderText({ 38 | 39 | short_url_output() 40 | 41 | }) 42 | } -------------------------------------------------------------------------------- /inst/dockerfiles/shiny-googleAuthRdemo/shiny/ui.R: -------------------------------------------------------------------------------- 1 | library(shiny) 2 | library(googleAuthR) 3 | 4 | ## ui.R 5 | ui <- fluidPage(title = "googleAuthR Shiny Demo", 6 | googleAuthUI("loginButton"), 7 | textInput("url", "Enter URL"), 8 | actionButton("submit", "Shorten URL"), 9 | textOutput("short_url") 10 | ) -------------------------------------------------------------------------------- /inst/dockerfiles/testTrigger/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM rocker/tidyverse 2 | 3 | # Install secret 4 | RUN install2.r --error \ 5 | secret -------------------------------------------------------------------------------- /inst/nginx/r-proxy-pass.conf: -------------------------------------------------------------------------------- 1 | user nginx; 2 | 3 | events { 4 | worker_connections 1024; 5 | } 6 | 7 | http { 8 | 9 | map $http_upgrade $connection_upgrade { 10 | default upgrade; 11 | '' close; 12 | } 13 | 14 | upstream rstudiohost { 15 | server gcer-docker:8787; 16 | } 17 | 18 | upstream shinyhost { 19 | server gcer-docker:3838; 20 | } 21 | 22 | access_log /var/log/nginx/access.log; 23 | 24 | server { 25 | listen 80; 26 | 27 | rewrite ^/shiny$ $scheme://$http_host/shiny/ permanent; 28 | 29 | location / { 30 | proxy_pass http://rstudiohost; 31 | proxy_redirect http://rstudiohost/ $scheme://$http_host/; 32 | proxy_http_version 1.1; 33 | proxy_set_header Upgrade $http_upgrade; 34 | proxy_set_header Connection $connection_upgrade; 35 | proxy_read_timeout 20d; 36 | } 37 | 38 | location /shiny/ { 39 | rewrite ^/shiny/(.*)$ /$1 break; 40 | proxy_pass http://shinyhost; 41 | proxy_redirect / $scheme://$http_host/shiny/; 42 | proxy_http_version 1.1; 43 | proxy_set_header Upgrade $http_upgrade; 44 | proxy_set_header Connection $connection_upgrade; 45 | proxy_read_timeout 20d; 46 | proxy_buffering off; 47 | } 48 | 49 | } 50 | } -------------------------------------------------------------------------------- /inst/startupscripts/dynamic.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo "Dynamic launch script" 3 | # customise this script by overwriting metadata then rebooting VM to apply it 4 | 5 | GCER_DOCKER_IMAGE=$(curl http://metadata.google.internal/computeMetadata/v1/instance/attributes/gcer_docker_image -H "Metadata-Flavor: Google") 6 | 7 | echo "Docker image: $GCER_DOCKER_IMAGE" 8 | 9 | docker run --name=dynamic $GCER_DOCKER_IMAGE 10 | -------------------------------------------------------------------------------- /inst/startupscripts/installdocker.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | echo "Installing docker on Debian 9 (Stretch)" 3 | 4 | # https://docs.docker.com/engine/installation/linux/debian/ 5 | ## install docker dependencies 6 | sudo apt-get install -y \ 7 | apt-transport-https \ 8 | ca-certificates \ 9 | curl \ 10 | gnupg2 \ 11 | software-properties-common 12 | ## docker gpg key 13 | curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add - 14 | sudo apt-key fingerprint 0EBFCD88 15 | 16 | ## add stable repository 17 | sudo add-apt-repository \ 18 | "deb [arch=amd64] https://download.docker.com/linux/debian \ 19 | $(lsb_release -cs) \ 20 | stable" 21 | sudo apt-get update 22 | 23 | ## install docker 24 | sudo apt-get install -y docker-ce 25 | 26 | ## start docker 27 | sudo service docker start 28 | -------------------------------------------------------------------------------- /inst/startupscripts/opencpu.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo "Docker OpenCPU launch script" 3 | 4 | GCER_DOCKER_IMAGE=$(curl http://metadata.google.internal/computeMetadata/v1/instance/attributes/gcer_docker_image -H "Metadata-Flavor: Google") 5 | 6 | echo "Docker image: $GCER_DOCKER_IMAGE" 7 | 8 | docker run --name=opencpu -p 80:80 -p 8004:8004 $GCER_DOCKER_IMAGE 9 | -------------------------------------------------------------------------------- /inst/startupscripts/r-base.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo "Docker R-base launch script" 3 | 4 | GCER_DOCKER_IMAGE=$(curl http://metadata.google.internal/computeMetadata/v1/instance/attributes/gcer_docker_image -H "Metadata-Flavor: Google") 5 | 6 | echo "Docker image: $GCER_DOCKER_IMAGE" 7 | 8 | docker run --name=r-base $GCER_DOCKER_IMAGE 9 | -------------------------------------------------------------------------------- /inst/startupscripts/r-parallel.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo "Docker R-Parallel launch script" 3 | 4 | GCER_DOCKER_IMAGE=$(curl http://metadata.google.internal/computeMetadata/v1/instance/attributes/gcer_docker_image -H "Metadata-Flavor: Google") 5 | 6 | echo "Docker image: $GCER_DOCKER_IMAGE" 7 | 8 | docker run --name=r-parallel $GCER_DOCKER_IMAGE 9 | -------------------------------------------------------------------------------- /inst/startupscripts/rstudio-gpu.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo "Docker RStudio GPU launch script" 3 | # not done via cloud-init as not on container-os image for now 4 | 5 | RSTUDIO_USER=$(curl http://metadata.google.internal/computeMetadata/v1/instance/attributes/rstudio_user -H "Metadata-Flavor: Google") 6 | RSTUDIO_PW=$(curl http://metadata.google.internal/computeMetadata/v1/instance/attributes/rstudio_pw -H "Metadata-Flavor: Google") 7 | GCER_DOCKER_IMAGE=$(curl http://metadata.google.internal/computeMetadata/v1/instance/attributes/gcer_docker_image -H "Metadata-Flavor: Google") 8 | 9 | echo "Docker image: $GCER_DOCKER_IMAGE" 10 | 11 | echo "GPU settings" 12 | ls -la /dev | grep nvidia 13 | nvidia-smi 14 | 15 | nvidia-docker run -p 80:8787 \ 16 | -e ROOT=TRUE \ 17 | -e USER=$RSTUDIO_USER -e PASSWORD=$RSTUDIO_PW \ 18 | -d \ 19 | --name=rstudio-gpu \ 20 | --restart=always \ 21 | $GCER_DOCKER_IMAGE 22 | -------------------------------------------------------------------------------- /inst/startupscripts/rstudio-noauth.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo "Docker RStudio launch script" 3 | 4 | GCER_DOCKER_IMAGE=$(curl http://metadata.google.internal/computeMetadata/v1/instance/attributes/gcer_docker_image -H "Metadata-Flavor: Google") 5 | # PORT=$(curl http://metadata.google.internal/computeMetadata/v1/instance/attributes/gcer_port -H "Metadata-Flavor: Google") 6 | 7 | # if [ -z "$PORT" ]; 8 | # then 9 | # PORT=80 10 | # fi 11 | 12 | echo "Docker image: $GCER_DOCKER_IMAGE" 13 | 14 | # as per https://www.rocker-project.org/use/managing_users/ 15 | docker run -p 8787:8787 \ 16 | -e ROOT=TRUE \ 17 | -e USER=rstudio -e DISABLE_AUTH=true \ 18 | --name=rstudio \ 19 | --privileged=true \ 20 | $GCER_DOCKER_IMAGE -------------------------------------------------------------------------------- /inst/startupscripts/rstudio-shiny.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo "Docker RStudio Shiny launch script" 3 | 4 | RSTUDIO_USER=$(curl http://metadata.google.internal/computeMetadata/v1/instance/attributes/rstudio_user -H "Metadata-Flavor: Google") 5 | RSTUDIO_PW=$(curl http://metadata.google.internal/computeMetadata/v1/instance/attributes/rstudio_pw -H "Metadata-Flavor: Google") 6 | GCER_DOCKER_IMAGE=$(curl http://metadata.google.internal/computeMetadata/v1/instance/attributes/gcer_docker_image -H "Metadata-Flavor: Google") 7 | 8 | echo "Docker image: $GCER_DOCKER_IMAGE" 9 | 10 | docker run -e ADD=shiny \ 11 | -e ROOT=TRUE \ 12 | -e USER=$RSTUDIO_USER -e PASSWORD=$RSTUDIO_PW \ 13 | --name=gcer-docker \ 14 | --network=r-net \ 15 | $GCER_DOCKER_IMAGE 16 | -------------------------------------------------------------------------------- /inst/startupscripts/rstudio.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo "Docker RStudio launch script" 3 | 4 | RSTUDIO_USER=$(curl http://metadata.google.internal/computeMetadata/v1/instance/attributes/rstudio_user -H "Metadata-Flavor: Google") 5 | RSTUDIO_PW=$(curl http://metadata.google.internal/computeMetadata/v1/instance/attributes/rstudio_pw -H "Metadata-Flavor: Google") 6 | GCER_DOCKER_IMAGE=$(curl http://metadata.google.internal/computeMetadata/v1/instance/attributes/gcer_docker_image -H "Metadata-Flavor: Google") 7 | 8 | echo "Docker image: $GCER_DOCKER_IMAGE" 9 | 10 | docker run -p 80:8787 \ 11 | -e ROOT=TRUE \ 12 | -e USER=$RSTUDIO_USER -e PASSWORD=$RSTUDIO_PW \ 13 | --name=rstudio \ 14 | $GCER_DOCKER_IMAGE 15 | -------------------------------------------------------------------------------- /inst/startupscripts/shiny.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo "Docker Shiny launch script" 3 | 4 | GCER_DOCKER_IMAGE=$(curl http://metadata.google.internal/computeMetadata/v1/instance/attributes/gcer_docker_image -H "Metadata-Flavor: Google") 5 | 6 | echo "Docker image: $GCER_DOCKER_IMAGE" 7 | 8 | docker run -p 80:3838 --name=shiny $GCER_DOCKER_IMAGE 9 | -------------------------------------------------------------------------------- /man/AttachedDisk.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/disks.R 3 | \name{AttachedDisk} 4 | \alias{AttachedDisk} 5 | \title{AttachedDisk Object} 6 | \usage{ 7 | AttachedDisk( 8 | autoDelete = NULL, 9 | boot = NULL, 10 | deviceName = NULL, 11 | diskEncryptionKey = NULL, 12 | index = NULL, 13 | initializeParams = NULL, 14 | interface = NULL, 15 | licenses = NULL, 16 | mode = NULL, 17 | source = NULL, 18 | type = NULL 19 | ) 20 | } 21 | \arguments{ 22 | \item{autoDelete}{Specifies whether the disk will be auto-deleted when the instance is deleted (but not when the disk is detached from the instance)} 23 | 24 | \item{boot}{Indicates that this is a boot disk} 25 | 26 | \item{deviceName}{Specifies a unique device name of your choice that is reflected into the /dev/disk/by-id/google-* tree of a Linux operating system running within the instance} 27 | 28 | \item{diskEncryptionKey}{Encrypts or decrypts a disk using a customer-supplied encryption key} 29 | 30 | \item{index}{Assigns a zero-based index to this disk, where 0 is reserved for the boot disk} 31 | 32 | \item{initializeParams}{A \link{gce_make_boot_disk} object for creating boot disks. Cannot be used with \code{source} also defined.} 33 | 34 | \item{interface}{Specifies the disk interface to use for attaching this disk, which is either SCSI or NVME} 35 | 36 | \item{licenses}{[Output Only] Any valid publicly visible licenses} 37 | 38 | \item{mode}{The mode in which to attach this disk, either READ_WRITE or READ_ONLY} 39 | 40 | \item{source}{Specifies a valid partial or full URL to an existing Persistent Disk resource} 41 | 42 | \item{type}{Specifies the type of the disk, either SCRATCH or PERSISTENT} 43 | } 44 | \value{ 45 | AttachedDisk object 46 | } 47 | \description{ 48 | AttachedDisk Object 49 | } 50 | \details{ 51 | An instance-attached disk resource. 52 | } 53 | \seealso{ 54 | Other AttachedDisk functions: 55 | \code{\link{gce_attach_disk}()} 56 | } 57 | \concept{AttachedDisk functions} 58 | \keyword{internal} 59 | -------------------------------------------------------------------------------- /man/Disk.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/disks.R 3 | \name{Disk} 4 | \alias{Disk} 5 | \title{Disk Object} 6 | \usage{ 7 | Disk( 8 | name = NULL, 9 | sourceImage = NULL, 10 | sizeGb = NULL, 11 | description = NULL, 12 | diskEncryptionKey = NULL, 13 | licenses = NULL, 14 | sourceImageEncryptionKey = NULL, 15 | sourceSnapshot = NULL, 16 | sourceSnapshotEncryptionKey = NULL, 17 | type = NULL 18 | ) 19 | } 20 | \arguments{ 21 | \item{name}{Name of the resource} 22 | 23 | \item{sourceImage}{The source image used to create this disk} 24 | 25 | \item{sizeGb}{Size of the persistent disk, specified in GB} 26 | 27 | \item{description}{An optional description of this resource} 28 | 29 | \item{diskEncryptionKey}{Encrypts the disk using a customer-supplied encryption key} 30 | 31 | \item{licenses}{Any applicable publicly visible licenses} 32 | 33 | \item{sourceImageEncryptionKey}{The customer-supplied encryption key of the source image} 34 | 35 | \item{sourceSnapshot}{The source snapshot used to create this disk} 36 | 37 | \item{sourceSnapshotEncryptionKey}{The customer-supplied encryption key of the source snapshot} 38 | 39 | \item{type}{URL of the disk type resource describing which disk type to use to create the disk} 40 | } 41 | \value{ 42 | Disk object 43 | } 44 | \description{ 45 | Disk Object 46 | } 47 | \details{ 48 | A Disk resource. 49 | } 50 | \concept{Disk functions} 51 | \keyword{internal} 52 | -------------------------------------------------------------------------------- /man/Instance.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/instances_admin.R 3 | \name{Instance} 4 | \alias{Instance} 5 | \title{Instance Object} 6 | \usage{ 7 | Instance( 8 | name = NULL, 9 | machineType = NULL, 10 | canIpForward = NULL, 11 | description = NULL, 12 | disks = NULL, 13 | metadata = NULL, 14 | networkInterfaces = NULL, 15 | scheduling = NULL, 16 | serviceAccounts = NULL, 17 | tags = NULL, 18 | minCpuPlatform = NULL, 19 | guestAccelerators = NULL 20 | ) 21 | } 22 | \arguments{ 23 | \item{name}{The name of the resource, provided by the client when initially creating the resource} 24 | 25 | \item{machineType}{Full or partial URL of the machine type resource to use for this instance, in the format: \code{zones/zone/machineTypes/machine-type}} 26 | 27 | \item{canIpForward}{Allows this instance to send and receive packets with non-matching destination or source IPs} 28 | 29 | \item{description}{An optional description of this resource} 30 | 31 | \item{disks}{The source image used to create this disk} 32 | 33 | \item{metadata}{A named list of metadata key/value pairs assigned to this instance} 34 | 35 | \item{networkInterfaces}{An array of configurations for this interface} 36 | 37 | \item{scheduling}{Scheduling options for this instance, such as preemptible instances} 38 | 39 | \item{serviceAccounts}{A list of service accounts, with their specified scopes, authorized for this instance} 40 | 41 | \item{tags}{A list of tags to apply to this instance} 42 | } 43 | \value{ 44 | Instance object 45 | } 46 | \description{ 47 | Instance Object 48 | } 49 | \details{ 50 | An Instance resource. 51 | } 52 | \concept{Instance functions} 53 | \keyword{internal} 54 | -------------------------------------------------------------------------------- /man/Metadata.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/metadata.R 3 | \name{Metadata} 4 | \alias{Metadata} 5 | \title{Metadata Object} 6 | \usage{ 7 | Metadata(items) 8 | } 9 | \arguments{ 10 | \item{items}{A named list of key = value pairs} 11 | } 12 | \value{ 13 | Metadata object 14 | } 15 | \description{ 16 | Metadata Object 17 | } 18 | \seealso{ 19 | Other Metadata functions: 20 | \code{\link{gce_set_metadata}()} 21 | } 22 | \concept{Metadata functions} 23 | \keyword{internal} 24 | -------------------------------------------------------------------------------- /man/as.cluster.gce_instance.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/future.R 3 | \name{as.cluster.gce_instance} 4 | \alias{as.cluster.gce_instance} 5 | \title{Create a future cluster for GCE objects} 6 | \usage{ 7 | \method{as.cluster}{gce_instance}( 8 | x, 9 | project = gce_get_global_project(), 10 | zone = gce_get_global_zone(), 11 | rshopts = ssh_options(x), 12 | ..., 13 | recursive = FALSE 14 | ) 15 | } 16 | \arguments{ 17 | \item{x}{The instance to make a future cluster} 18 | 19 | \item{project}{The GCE project} 20 | 21 | \item{zone}{The GCE zone} 22 | 23 | \item{rshopts}{Options for the SSH} 24 | 25 | \item{...}{Other arguments passed to makeDockerClusterPSOCK} 26 | 27 | \item{recursive}{Not used.} 28 | } 29 | \value{ 30 | A \code{cluster} object. 31 | } 32 | \description{ 33 | S3 method for \code{\link[parallelly:as.cluster]{as.cluster}()} in the \pkg{future} package. 34 | } 35 | \details{ 36 | Only works for r-base containers created via \code{gce_vm_template("r-base")} or for 37 | docker containers created using the \code{--net=host} argument flag 38 | } 39 | \examples{ 40 | \donttest{\dontrun{ 41 | vm <- gce_vm("r-base", name = "future", predefined_type = "f1-micro") 42 | plan(cluster, workers = vm) ## equivalent to workers = as.cluster(vm) 43 | x \%<-\% { Sys.getinfo() } 44 | print(x) 45 | }} 46 | 47 | } 48 | -------------------------------------------------------------------------------- /man/cat0.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/utilities.R 3 | \name{cat0} 4 | \alias{cat0} 5 | \title{if argument is NULL, no line output} 6 | \usage{ 7 | cat0(prefix = "", x) 8 | } 9 | \description{ 10 | if argument is NULL, no line output 11 | } 12 | \keyword{internal} 13 | -------------------------------------------------------------------------------- /man/cli_tools.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ssh_admin.R 3 | \name{cli_tools} 4 | \alias{cli_tools} 5 | \title{See if ssh or scp is installed 6 | From https://github.com/sckott/analogsea/blob/master/R/zzz.R} 7 | \usage{ 8 | cli_tools() 9 | } 10 | \description{ 11 | See if ssh or scp is installed 12 | From https://github.com/sckott/analogsea/blob/master/R/zzz.R 13 | } 14 | \keyword{internal} 15 | -------------------------------------------------------------------------------- /man/container_logs.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/harbor_container.R 3 | \name{container_logs} 4 | \alias{container_logs} 5 | \title{Retrieve logs for a container.} 6 | \usage{ 7 | container_logs(container, timestamps = FALSE, follow = FALSE) 8 | } 9 | \arguments{ 10 | \item{container}{A container object} 11 | 12 | \item{timestamps}{Show timestamps.} 13 | 14 | \item{follow}{Follow log output as it is happening.} 15 | } 16 | \description{ 17 | Retrieve logs for a container. 18 | } 19 | \examples{ 20 | \dontrun{ 21 | container_rm(con) 22 | } 23 | } 24 | \author{ 25 | Winston Change \email{winston@stdout.org} 26 | } 27 | -------------------------------------------------------------------------------- /man/container_rm.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/harbor_container.R 3 | \name{container_rm} 4 | \alias{container_rm} 5 | \title{Delete a container.} 6 | \usage{ 7 | container_rm(container, force = FALSE) 8 | } 9 | \arguments{ 10 | \item{container}{A container object} 11 | 12 | \item{force}{Force removal of a running container.} 13 | } 14 | \description{ 15 | Delete a container. 16 | } 17 | \examples{ 18 | \dontrun{ 19 | container_rm(con) 20 | } 21 | } 22 | \author{ 23 | Winston Change \email{winston@stdout.org} 24 | } 25 | -------------------------------------------------------------------------------- /man/container_running.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/harbor_container.R 3 | \name{container_running} 4 | \alias{container_running} 5 | \title{Report whether a container is currently running.} 6 | \usage{ 7 | container_running(container) 8 | } 9 | \arguments{ 10 | \item{container}{A container object} 11 | } 12 | \description{ 13 | Report whether a container is currently running. 14 | } 15 | \examples{ 16 | \dontrun{ 17 | container_running(con) 18 | } 19 | } 20 | \author{ 21 | Winston Change \email{winston@stdout.org} 22 | } 23 | -------------------------------------------------------------------------------- /man/container_update_info.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/harbor_container.R 3 | \name{container_update_info} 4 | \alias{container_update_info} 5 | \title{Update the information about a container.} 6 | \usage{ 7 | container_update_info(container) 8 | } 9 | \arguments{ 10 | \item{container}{A container object} 11 | } 12 | \description{ 13 | This queries docker (on the host) for information about the container, and 14 | saves the returned information into a container object, which is returned. 15 | This does not use reference semantics, so if you want to store the updated 16 | information, you need to save the result. 17 | } 18 | \examples{ 19 | \dontrun{ 20 | con <- container_update_info(con) 21 | } 22 | } 23 | \author{ 24 | Winston Change \email{winston@stdout.org} 25 | } 26 | -------------------------------------------------------------------------------- /man/containers.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/harbor_containers.R 3 | \name{containers} 4 | \alias{containers} 5 | \title{Get list of all containers on a host.} 6 | \usage{ 7 | containers(host = localhost, ...) 8 | } 9 | \arguments{ 10 | \item{host}{A host object.} 11 | 12 | \item{...}{Other arguments passed to the SSH command for the host} 13 | } 14 | \description{ 15 | Get list of all containers on a host. 16 | } 17 | \author{ 18 | Winston Change \email{winston@stdout.org} 19 | } 20 | -------------------------------------------------------------------------------- /man/docker_build.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/harbor_gce.R 3 | \name{docker_build} 4 | \alias{docker_build} 5 | \title{Build image on an instance from a local Dockerfile} 6 | \usage{ 7 | docker_build( 8 | host = localhost, 9 | dockerfolder, 10 | new_image, 11 | folder = "buildimage", 12 | wait = FALSE, 13 | ... 14 | ) 15 | } 16 | \arguments{ 17 | \item{host}{A host object.} 18 | 19 | \item{dockerfolder}{Local location of build directory including valid \code{Dockerfile}} 20 | 21 | \item{new_image}{Name of the new image} 22 | 23 | \item{folder}{Where on host to build dockerfile} 24 | 25 | \item{wait}{Whether to block R console until finished build} 26 | 27 | \item{...}{Other arguments passed to the SSH command for the host} 28 | } 29 | \value{ 30 | A table of active images on the instance 31 | } 32 | \description{ 33 | Uploads a folder with a \code{Dockerfile} and supporting files to an instance and builds it 34 | } 35 | \details{ 36 | Dockerfiles are best practice when creating your own docker images, 37 | rather than logging into a Docker container, making changes and committing. 38 | } 39 | \examples{ 40 | \dontrun{ 41 | docker_build(localhost, "/home/stuff/dockerfolder" ,"new_image", wait = TRUE) 42 | docker_run(localhost, "new_image") 43 | } 44 | } 45 | \seealso{ 46 | \href{https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/}{Best practices for writing Dockerfiles} 47 | 48 | An example Dockerfile for \href{https://hub.docker.com/r/rocker/ropensci/~/dockerfile/}{rOpensci} 49 | 50 | General R Docker images found at \href{https://github.com/rocker-org}{rocker-org} 51 | } 52 | -------------------------------------------------------------------------------- /man/docker_cmd.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/harbor_docker.R 3 | \name{docker_cmd} 4 | \alias{docker_cmd} 5 | \title{Run a docker command on a host.} 6 | \usage{ 7 | docker_cmd( 8 | host, 9 | cmd = NULL, 10 | args = NULL, 11 | docker_opts = NULL, 12 | capture_text = FALSE, 13 | ... 14 | ) 15 | } 16 | \arguments{ 17 | \item{host}{A host object.} 18 | 19 | \item{cmd}{A docker command, such as "run" or "ps"} 20 | 21 | \item{args}{Arguments to pass to the docker command} 22 | 23 | \item{docker_opts}{Options to docker. These are things that come before the 24 | docker command, when run on the command line.} 25 | 26 | \item{capture_text}{If \code{FALSE} (the default), return the host object. 27 | This is useful for chaining functions. If \code{TRUE}, capture the text 28 | output from both stdout and stderr, and return that. Note that \code{TRUE} 29 | may not be available on all types of hosts.} 30 | 31 | \item{...}{Other arguments passed to the SSH command for the host} 32 | } 33 | \description{ 34 | Run a docker command on a host. 35 | } 36 | \examples{ 37 | \dontrun{ 38 | docker_cmd(localhost, "ps", "-a") 39 | } 40 | } 41 | \author{ 42 | Winston Change \email{winston@stdout.org} 43 | } 44 | -------------------------------------------------------------------------------- /man/docker_cmd.gce_instance.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/harbor_gce.R 3 | \name{docker_cmd.gce_instance} 4 | \alias{docker_cmd.gce_instance} 5 | \title{Docker S3 method for use with harbor package} 6 | \usage{ 7 | \method{docker_cmd}{gce_instance}( 8 | host, 9 | cmd = NULL, 10 | args = NULL, 11 | docker_opts = NULL, 12 | capture_text = FALSE, 13 | nvidia = FALSE, 14 | ... 15 | ) 16 | } 17 | \arguments{ 18 | \item{host}{The GCE instance} 19 | 20 | \item{cmd}{The command to pass to docker} 21 | 22 | \item{args}{arguments to the command} 23 | 24 | \item{docker_opts}{options for docker} 25 | 26 | \item{capture_text}{whether to return the output} 27 | 28 | \item{nvidia}{If true will use \code{nvidia-docker} instead of {docker}} 29 | 30 | \item{...}{other arguments passed to \link{gce_ssh}} 31 | } 32 | \description{ 33 | Docker S3 method for use with harbor package 34 | } 35 | \details{ 36 | Instances launched in the \code{google-containers} image family automatically add your user to the docker group, 37 | but for others you will need to run \code{sudo usermod -a -G docker ${USER}} and log out and back in. 38 | } 39 | -------------------------------------------------------------------------------- /man/docker_inspect.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/harbor_docker.R 3 | \name{docker_inspect} 4 | \alias{docker_inspect} 5 | \title{Inspect one or more containers, given name(s) or ID(s).} 6 | \usage{ 7 | docker_inspect(host = localhost, names = NULL, ...) 8 | } 9 | \arguments{ 10 | \item{host}{A host object.} 11 | 12 | \item{names}{Names of the containers} 13 | 14 | \item{...}{Other arguments passed to the SSH command for the host} 15 | } 16 | \value{ 17 | A list of lists, where each sublist represents one container. This is 18 | the output of `docker inspect` translated directly from raw JSON to an R 19 | object. 20 | } 21 | \description{ 22 | Inspect one or more containers, given name(s) or ID(s). 23 | } 24 | \examples{ 25 | \dontrun{ 26 | docker_run(localhost, "debian:testing", "echo foo", name = "harbor-test") 27 | docker_inspect(localhost, "harbor-test") 28 | } 29 | } 30 | \author{ 31 | Winston Change \email{winston@stdout.org} 32 | } 33 | -------------------------------------------------------------------------------- /man/docker_pull.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/harbor_docker.R 3 | \name{docker_pull} 4 | \alias{docker_pull} 5 | \title{Pull a docker image onto a host.} 6 | \usage{ 7 | docker_pull(host = localhost, image, ...) 8 | } 9 | \arguments{ 10 | \item{host}{A host object.} 11 | 12 | \item{image}{The docker image to pull e.g. \code{rocker/rstudio}} 13 | 14 | \item{...}{Other arguments passed to the SSH command for the host} 15 | } 16 | \value{ 17 | The \code{host} object. 18 | } 19 | \description{ 20 | Pull a docker image onto a host. 21 | } 22 | \examples{ 23 | \dontrun{ 24 | docker_pull(localhost, "debian:testing") 25 | } 26 | } 27 | \author{ 28 | Winston Change \email{winston@stdout.org} 29 | } 30 | -------------------------------------------------------------------------------- /man/docker_run.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/harbor_docker.R 3 | \name{docker_run} 4 | \alias{docker_run} 5 | \title{Run a command in a new container on a host.} 6 | \usage{ 7 | docker_run( 8 | host = localhost, 9 | image = NULL, 10 | cmd = NULL, 11 | name = NULL, 12 | rm = FALSE, 13 | detach = FALSE, 14 | docker_opts = NULL, 15 | ... 16 | ) 17 | } 18 | \arguments{ 19 | \item{host}{An object representing the host where the container will be run.} 20 | 21 | \item{image}{The name or ID of a docker image.} 22 | 23 | \item{cmd}{A command to run in the container.} 24 | 25 | \item{name}{A name for the container. If none is provided, a random name will 26 | be used.} 27 | 28 | \item{rm}{If \code{TRUE}, remove the container after it finishes. This is 29 | incompatible with \code{detach=TRUE}.} 30 | 31 | \item{detach}{If \code{TRUE}, run the container in the background.} 32 | 33 | \item{docker_opts}{Options to docker. These are things that come before the 34 | docker command, when run on the command line.} 35 | 36 | \item{...}{Other arguments passed to the SSH command for the host} 37 | } 38 | \value{ 39 | A \code{container} object. When \code{rm=TRUE}, this function returns 40 | \code{NULL} instead of a container object, because the container no longer 41 | exists. 42 | } 43 | \description{ 44 | Run a command in a new container on a host. 45 | } 46 | \examples{ 47 | \dontrun{ 48 | docker_run(localhost, "debian:testing", "echo foo") 49 | #> foo 50 | 51 | # Arguments will be concatenated 52 | docker_run(localhost, "debian:testing", c("echo foo", "bar")) 53 | #> foo bar 54 | 55 | docker_run(localhost, "rocker/r-base", c("Rscript", "-e", "1+1")) 56 | #> [1] 2 57 | } 58 | } 59 | \author{ 60 | Winston Change \email{winston@stdout.org} 61 | } 62 | -------------------------------------------------------------------------------- /man/error.message.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/utilities.R 3 | \name{error.message} 4 | \alias{error.message} 5 | \title{Get the error message} 6 | \usage{ 7 | error.message(test_me) 8 | } 9 | \arguments{ 10 | \item{test_me}{an object that has failed is.error} 11 | } 12 | \value{ 13 | The error message 14 | } 15 | \description{ 16 | Get the error message 17 | } 18 | \keyword{internal} 19 | -------------------------------------------------------------------------------- /man/gce_attach_disk.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/disks.R 3 | \name{gce_attach_disk} 4 | \alias{gce_attach_disk} 5 | \title{Attaches a Disk resource to an instance.} 6 | \usage{ 7 | gce_attach_disk( 8 | instance, 9 | source = NULL, 10 | autoDelete = NULL, 11 | boot = NULL, 12 | deviceName = NULL, 13 | diskEncryptionKey = NULL, 14 | index = NULL, 15 | initializeParams = NULL, 16 | interface = NULL, 17 | licenses = NULL, 18 | mode = NULL, 19 | type = NULL, 20 | project = gce_get_global_project(), 21 | zone = gce_get_global_zone() 22 | ) 23 | } 24 | \arguments{ 25 | \item{instance}{The instance name for this request} 26 | 27 | \item{source}{Specifies a valid partial or full URL to an existing Persistent Disk resource} 28 | 29 | \item{autoDelete}{Specifies whether the disk will be auto-deleted when the instance is deleted (but not when the disk is detached from the instance)} 30 | 31 | \item{boot}{Indicates that this is a boot disk} 32 | 33 | \item{deviceName}{Specifies a unique device name of your choice that is reflected into the /dev/disk/by-id/google-* tree of a Linux operating system running within the instance} 34 | 35 | \item{diskEncryptionKey}{Encrypts or decrypts a disk using a customer-supplied encryption key} 36 | 37 | \item{index}{Assigns a zero-based index to this disk, where 0 is reserved for the boot disk} 38 | 39 | \item{initializeParams}{A \link{gce_make_boot_disk} object for creating boot disks. Cannot be used with \code{source} also defined.} 40 | 41 | \item{interface}{Specifies the disk interface to use for attaching this disk, which is either SCSI or NVME} 42 | 43 | \item{licenses}{[Output Only] Any valid publicly visible licenses} 44 | 45 | \item{mode}{The mode in which to attach this disk, either READ_WRITE or READ_ONLY} 46 | 47 | \item{type}{Specifies the type of the disk, either SCRATCH or PERSISTENT} 48 | 49 | \item{project}{Project ID for this request} 50 | 51 | \item{zone}{The name of the zone for this request} 52 | } 53 | \description{ 54 | Attaches a Disk resource to an instance. 55 | } 56 | \details{ 57 | Authentication scopes used by this function are: 58 | \itemize{ 59 | \item https://www.googleapis.com/auth/cloud-platform 60 | \item https://www.googleapis.com/auth/compute 61 | } 62 | } 63 | \seealso{ 64 | \href{https://cloud.google.com/compute/docs/reference/latest/disks}{Google Documentation} 65 | 66 | Other AttachedDisk functions: 67 | \code{\link{AttachedDisk}()} 68 | } 69 | \concept{AttachedDisk functions} 70 | -------------------------------------------------------------------------------- /man/gce_auth.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/auth.R 3 | \name{gce_auth} 4 | \alias{gce_auth} 5 | \title{Defunct - Authenticate this session} 6 | \usage{ 7 | gce_auth(new_user = FALSE, no_auto = FALSE) 8 | } 9 | \arguments{ 10 | \item{new_user}{If TRUE, reauthenticate via Google login screen} 11 | 12 | \item{no_auto}{Will ignore auto-authentication settings if TRUE} 13 | } 14 | \value{ 15 | Invisibly, the token that has been saved to the session 16 | } 17 | \description{ 18 | No longer used. Authenticate via downloading a JSON file and setting in your environment arguments instead. 19 | } 20 | -------------------------------------------------------------------------------- /man/gce_check_gpu.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/gpus.R 3 | \name{gce_check_gpu} 4 | \alias{gce_check_gpu} 5 | \title{Check GPU installed ok} 6 | \usage{ 7 | gce_check_gpu(vm) 8 | } 9 | \arguments{ 10 | \item{vm}{The instance to check} 11 | } 12 | \value{ 13 | The NVIDIA-SMI output via ssh 14 | } 15 | \description{ 16 | Check GPU installed ok 17 | } 18 | \seealso{ 19 | \url{https://cloud.google.com/compute/docs/gpus/add-gpus#verify-driver-install} 20 | 21 | Other GPU instances: 22 | \code{\link{gce_list_gpus}()}, 23 | \code{\link{gce_vm_gpu}()} 24 | } 25 | \concept{GPU instances} 26 | -------------------------------------------------------------------------------- /man/gce_check_ssh.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ssh_admin.R 3 | \name{gce_check_ssh} 4 | \alias{gce_check_ssh} 5 | \title{Calls API for the current SSH settings for an instance} 6 | \usage{ 7 | gce_check_ssh(instance) 8 | } 9 | \arguments{ 10 | \item{instance}{An instance to check} 11 | } 12 | \value{ 13 | A data.frame of SSH users and public keys 14 | } 15 | \description{ 16 | Calls API for the current SSH settings for an instance 17 | } 18 | -------------------------------------------------------------------------------- /man/gce_container_logs.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/container.R 3 | \name{gce_container_logs} 4 | \alias{gce_container_logs} 5 | \alias{gce_check_container} 6 | \title{Check the docker logs of a container} 7 | \usage{ 8 | gce_container_logs(instance, container) 9 | 10 | gce_check_container(...) 11 | } 12 | \arguments{ 13 | \item{instance}{The instance running docker} 14 | 15 | \item{container}{A running container to get logs of} 16 | 17 | \item{...}{Arguments passed to \link{gce_container_logs}} 18 | } 19 | \value{ 20 | logs 21 | } 22 | \description{ 23 | Check the docker logs of a container 24 | } 25 | -------------------------------------------------------------------------------- /man/gce_delete_access_config.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/networks.R 3 | \name{gce_delete_access_config} 4 | \alias{gce_delete_access_config} 5 | \title{Deletes an Access Config, Typically for an External IP Address.} 6 | \usage{ 7 | gce_delete_access_config( 8 | instance, 9 | access_config = "external-nat", 10 | network_interface = "nic0", 11 | project = gce_get_global_project(), 12 | zone = gce_get_global_zone() 13 | ) 14 | } 15 | \arguments{ 16 | \item{instance}{Name of the instance resource, or an instance object e.g. from \link{gce_get_instance}} 17 | 18 | \item{access_config}{The name of the access config to delete.} 19 | 20 | \item{network_interface}{The name of the network interface.} 21 | 22 | \item{project}{Project ID for this request, default as set by \link{gce_get_global_project}} 23 | 24 | \item{zone}{The name of the zone for this request, default as set by \link{gce_get_global_zone}} 25 | } 26 | \value{ 27 | A list of operation objects with pending status 28 | } 29 | \description{ 30 | Deletes an Access Config, Typically for an External IP Address. 31 | } 32 | \details{ 33 | Authentication scopes used by this function are: 34 | \itemize{ 35 | \item https://www.googleapis.com/auth/cloud-platform 36 | \item https://www.googleapis.com/auth/compute 37 | } 38 | } 39 | \seealso{ 40 | \href{https://developers.google.com/compute/docs/reference/latest/}{Google Documentation} 41 | } 42 | -------------------------------------------------------------------------------- /man/gce_delete_disk.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/disks.R 3 | \name{gce_delete_disk} 4 | \alias{gce_delete_disk} 5 | \title{Deletes the specified persistent disk.} 6 | \usage{ 7 | gce_delete_disk( 8 | disk, 9 | project = gce_get_global_project(), 10 | zone = gce_get_global_zone() 11 | ) 12 | } 13 | \arguments{ 14 | \item{disk}{Name of the persistent disk to delete} 15 | 16 | \item{project}{Project ID for this request} 17 | 18 | \item{zone}{The name of the zone for this request} 19 | } 20 | \description{ 21 | Deleting a disk removes its data permanently and is irreversible. 22 | } 23 | \details{ 24 | However, deleting a disk does not delete any snapshots previously made from the disk. 25 | You must separately delete snapshots. 26 | 27 | 28 | Authentication scopes used by this function are: 29 | \itemize{ 30 | \item https://www.googleapis.com/auth/cloud-platform 31 | \item https://www.googleapis.com/auth/compute 32 | } 33 | } 34 | \seealso{ 35 | \href{https://developers.google.com/compute/docs/reference/latest/}{Google Documentation} 36 | } 37 | -------------------------------------------------------------------------------- /man/gce_delete_firewall_rule.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/firewalls.R 3 | \name{gce_delete_firewall_rule} 4 | \alias{gce_delete_firewall_rule} 5 | \title{Delete a firewall rule} 6 | \usage{ 7 | gce_delete_firewall_rule(name, project = gce_get_global_project()) 8 | } 9 | \arguments{ 10 | \item{name}{Name of the firewall rule} 11 | 12 | \item{project}{The Google Cloud project} 13 | } 14 | \description{ 15 | Deletes a firewall rule of name specified 16 | } 17 | \seealso{ 18 | API Documentation \url{https://cloud.google.com/compute/docs/reference/latest/firewalls/delete} 19 | 20 | Other firewall functions: 21 | \code{\link{gce_get_firewall_rule}()}, 22 | \code{\link{gce_list_firewall_rules}()}, 23 | \code{\link{gce_make_firewall_rule}()}, 24 | \code{\link{gce_make_firewall_webports}()} 25 | } 26 | \concept{firewall functions} 27 | -------------------------------------------------------------------------------- /man/gce_delete_op.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/operations.R 3 | \name{gce_delete_op} 4 | \alias{gce_delete_op} 5 | \title{Deletes the specified Operations resource.} 6 | \usage{ 7 | gce_delete_op(operation) 8 | } 9 | \arguments{ 10 | \item{operation}{Name of the Operations resource to delete} 11 | } 12 | \value{ 13 | TRUE if successful 14 | } 15 | \description{ 16 | Deletes the specified Operations resource. 17 | } 18 | \seealso{ 19 | \href{https://developers.google.com/compute/docs/reference/latest/}{Google Documentation} 20 | } 21 | -------------------------------------------------------------------------------- /man/gce_delete_op.gce_global_operation.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/operations.R 3 | \name{gce_delete_op.gce_global_operation} 4 | \alias{gce_delete_op.gce_global_operation} 5 | \title{Deletes the specified global Operations resource.} 6 | \usage{ 7 | \method{gce_delete_op}{gce_global_operation}(operation) 8 | } 9 | \arguments{ 10 | \item{operation}{Name of the Operations resource to delete} 11 | } 12 | \value{ 13 | The deleted operation 14 | } 15 | \description{ 16 | Deletes the specified global Operations resource. 17 | } 18 | \seealso{ 19 | \href{https://developers.google.com/compute/docs/reference/latest/}{Google Documentation} 20 | } 21 | -------------------------------------------------------------------------------- /man/gce_delete_op.gce_zone_operation.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/operations.R 3 | \name{gce_delete_op.gce_zone_operation} 4 | \alias{gce_delete_op.gce_zone_operation} 5 | \title{Deletes the specified zone-specific Operations resource.} 6 | \usage{ 7 | \method{gce_delete_op}{gce_zone_operation}(operation) 8 | } 9 | \arguments{ 10 | \item{operation}{Name of the Operations resource to delete} 11 | } 12 | \value{ 13 | The deleted operation 14 | } 15 | \description{ 16 | Deletes the specified zone-specific Operations resource. 17 | } 18 | \seealso{ 19 | \href{https://developers.google.com/compute/docs/reference/latest/}{Google Documentation} 20 | } 21 | -------------------------------------------------------------------------------- /man/gce_extract_projectzone.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/instances_admin.R 3 | \name{gce_extract_projectzone} 4 | \alias{gce_extract_projectzone} 5 | \title{Extract zone and project from an instance object} 6 | \usage{ 7 | gce_extract_projectzone(instance) 8 | } 9 | \arguments{ 10 | \item{instance}{The instance} 11 | } 12 | \value{ 13 | A list of $project and $zone 14 | } 15 | \description{ 16 | Extract zone and project from an instance object 17 | } 18 | -------------------------------------------------------------------------------- /man/gce_get_disk.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/disks.R 3 | \name{gce_get_disk} 4 | \alias{gce_get_disk} 5 | \title{Returns a specified persistent disk.} 6 | \usage{ 7 | gce_get_disk( 8 | disk, 9 | project = gce_get_global_project(), 10 | zone = gce_get_global_zone() 11 | ) 12 | } 13 | \arguments{ 14 | \item{disk}{Name of the persistent disk to return} 15 | 16 | \item{project}{Project ID for this request} 17 | 18 | \item{zone}{The name of the zone for this request} 19 | } 20 | \description{ 21 | Returns a specified persistent disk. 22 | } 23 | \details{ 24 | Authentication scopes used by this function are: 25 | \itemize{ 26 | \item https://www.googleapis.com/auth/cloud-platform 27 | \item https://www.googleapis.com/auth/compute 28 | \item https://www.googleapis.com/auth/compute.readonly 29 | } 30 | } 31 | \seealso{ 32 | \href{https://developers.google.com/compute/docs/reference/latest/}{Google Documentation} 33 | } 34 | -------------------------------------------------------------------------------- /man/gce_get_external_ip.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/networks.R 3 | \name{gce_get_external_ip} 4 | \alias{gce_get_external_ip} 5 | \title{Get the external IP of an instance} 6 | \usage{ 7 | gce_get_external_ip(instance, verbose = TRUE, ...) 8 | } 9 | \arguments{ 10 | \item{instance}{Name or instance object to find the external IP for} 11 | 12 | \item{verbose}{Give a user message about the IP} 13 | 14 | \item{...}{passed to \link{gce_get_instance} 15 | 16 | This is a helper to extract the external IP of an instance} 17 | } 18 | \value{ 19 | The external IP 20 | } 21 | \description{ 22 | Get the external IP of an instance 23 | } 24 | -------------------------------------------------------------------------------- /man/gce_get_firewall_rule.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/firewalls.R 3 | \name{gce_get_firewall_rule} 4 | \alias{gce_get_firewall_rule} 5 | \title{Get a firewall rule} 6 | \usage{ 7 | gce_get_firewall_rule(name, project = gce_get_global_project()) 8 | } 9 | \arguments{ 10 | \item{name}{Name of the firewall rule} 11 | 12 | \item{project}{The Google Cloud project} 13 | } 14 | \description{ 15 | Get a firewall rule of name specified 16 | } 17 | \seealso{ 18 | API Documentation \url{https://cloud.google.com/compute/docs/reference/latest/firewalls/get} 19 | 20 | Other firewall functions: 21 | \code{\link{gce_delete_firewall_rule}()}, 22 | \code{\link{gce_list_firewall_rules}()}, 23 | \code{\link{gce_make_firewall_rule}()}, 24 | \code{\link{gce_make_firewall_webports}()} 25 | } 26 | \concept{firewall functions} 27 | -------------------------------------------------------------------------------- /man/gce_get_global_project.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/projects.R 3 | \name{gce_get_global_project} 4 | \alias{gce_get_global_project} 5 | \title{Get global project name} 6 | \usage{ 7 | gce_get_global_project() 8 | } 9 | \value{ 10 | Project name 11 | } 12 | \description{ 13 | Project name set this session to use by default 14 | } 15 | \details{ 16 | Set the project name via \link{gce_global_project} 17 | } 18 | \concept{project functions} 19 | -------------------------------------------------------------------------------- /man/gce_get_global_zone.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/zones.R 3 | \name{gce_get_global_zone} 4 | \alias{gce_get_global_zone} 5 | \title{Get global zone name} 6 | \usage{ 7 | gce_get_global_zone() 8 | } 9 | \value{ 10 | zone name 11 | } 12 | \description{ 13 | zone name set this session to use by default 14 | } 15 | \details{ 16 | Set the zone name via \link{gce_global_zone} 17 | } 18 | \concept{zone functions} 19 | -------------------------------------------------------------------------------- /man/gce_get_image.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/images.R 3 | \name{gce_get_image} 4 | \alias{gce_get_image} 5 | \title{Returns the specified image.} 6 | \usage{ 7 | gce_get_image(image_project, image) 8 | } 9 | \arguments{ 10 | \item{image_project}{Project ID of where the image lies} 11 | 12 | \item{image}{Name of the image resource to return} 13 | } 14 | \description{ 15 | Returns the specified image. 16 | } 17 | \details{ 18 | Authentication scopes used by this function are: \itemize{ \item 19 | https://www.googleapis.com/auth/cloud-platform \item 20 | https://www.googleapis.com/auth/compute \item 21 | https://www.googleapis.com/auth/compute.readonly } 22 | 23 | You may want to use \link{gce_get_image_family} instead to ensure the most up to date image is used. 24 | } 25 | \seealso{ 26 | \href{https://cloud.google.com/compute/docs/images}{Google 27 | Documentation} 28 | } 29 | -------------------------------------------------------------------------------- /man/gce_get_image_family.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/images.R 3 | \name{gce_get_image_family} 4 | \alias{gce_get_image_family} 5 | \title{Returns the latest image that is part of an image family and is not deprecated.} 6 | \usage{ 7 | gce_get_image_family(image_project, family) 8 | } 9 | \arguments{ 10 | \item{image_project}{Project ID for this request} 11 | 12 | \item{family}{Name of the image family to search for} 13 | } 14 | \description{ 15 | Returns the latest image that is part of an image family and is not deprecated. 16 | } 17 | \details{ 18 | Authentication scopes used by this function are: 19 | \itemize{ 20 | \item https://www.googleapis.com/auth/cloud-platform 21 | \item https://www.googleapis.com/auth/compute 22 | \item https://www.googleapis.com/auth/compute.readonly 23 | } 24 | } 25 | \seealso{ 26 | \href{https://cloud.google.com/compute/docs/images}{Google Documentation} 27 | } 28 | -------------------------------------------------------------------------------- /man/gce_get_instance.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/instances_admin.R 3 | \name{gce_get_instance} 4 | \alias{gce_get_instance} 5 | \title{Returns the specified Instance resource.} 6 | \usage{ 7 | gce_get_instance( 8 | instance, 9 | project = gce_get_global_project(), 10 | zone = gce_get_global_zone() 11 | ) 12 | } 13 | \arguments{ 14 | \item{instance}{Name of the instance resource} 15 | 16 | \item{project}{Project ID for this request, default as set by \link{gce_get_global_project}} 17 | 18 | \item{zone}{The name of the zone for this request, default as set by \link{gce_get_global_zone}} 19 | } 20 | \description{ 21 | Returns the specified Instance resource. 22 | } 23 | \details{ 24 | Authentication scopes used by this function are: 25 | \itemize{ 26 | \item https://www.googleapis.com/auth/cloud-platform 27 | \item https://www.googleapis.com/auth/compute 28 | \item https://www.googleapis.com/auth/compute.readonly 29 | } 30 | } 31 | \seealso{ 32 | \href{https://developers.google.com/compute/docs/reference/latest/}{Google Documentation} 33 | } 34 | -------------------------------------------------------------------------------- /man/gce_get_machinetype.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/machineType.R 3 | \name{gce_get_machinetype} 4 | \alias{gce_get_machinetype} 5 | \title{Returns the specified machine type.} 6 | \usage{ 7 | gce_get_machinetype( 8 | machineType, 9 | project = gce_get_global_project(), 10 | zone = gce_get_global_zone() 11 | ) 12 | } 13 | \arguments{ 14 | \item{machineType}{Name of the machine type to return} 15 | 16 | \item{project}{Project ID for this request} 17 | 18 | \item{zone}{The name of the zone for this request} 19 | } 20 | \description{ 21 | Returns the specified machine type. 22 | } 23 | \details{ 24 | Authentication scopes used by this function are: 25 | \itemize{ 26 | \item https://www.googleapis.com/auth/cloud-platform 27 | \item https://www.googleapis.com/auth/compute 28 | \item https://www.googleapis.com/auth/compute.readonly 29 | } 30 | } 31 | \seealso{ 32 | \href{https://developers.google.com/compute/docs/reference/latest/}{Google Documentation} 33 | } 34 | -------------------------------------------------------------------------------- /man/gce_get_metadata.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/metadata.R 3 | \name{gce_get_metadata} 4 | \alias{gce_get_metadata} 5 | \title{Extract metadata from an instance object} 6 | \usage{ 7 | gce_get_metadata(instance, key = NULL) 8 | } 9 | \arguments{ 10 | \item{instance}{instance to get metadata from} 11 | 12 | \item{key}{optional metadata key to filter metadata result} 13 | } 14 | \value{ 15 | data.frame $key and $value of metadata or NULL 16 | } 17 | \description{ 18 | Extract metadata from an instance object 19 | } 20 | -------------------------------------------------------------------------------- /man/gce_get_metadata_project.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/metadata.R 3 | \name{gce_get_metadata_project} 4 | \alias{gce_get_metadata_project} 5 | \title{Get project wide metadata} 6 | \usage{ 7 | gce_get_metadata_project(project = gce_global_project()) 8 | } 9 | \arguments{ 10 | \item{project}{The project to get the project-wide metadata from} 11 | } 12 | \description{ 13 | Get project wide metadata 14 | } 15 | -------------------------------------------------------------------------------- /man/gce_get_network.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/networks.R 3 | \name{gce_get_network} 4 | \alias{gce_get_network} 5 | \title{Returns the specified network.} 6 | \usage{ 7 | gce_get_network(network, project = gce_get_global_project()) 8 | } 9 | \arguments{ 10 | \item{network}{Name of the network to return} 11 | 12 | \item{project}{Project ID for this request} 13 | } 14 | \description{ 15 | Returns the specified network. 16 | } 17 | \details{ 18 | Authentication scopes used by this function are: 19 | \itemize{ 20 | \item https://www.googleapis.com/auth/cloud-platform 21 | \item https://www.googleapis.com/auth/compute 22 | \item https://www.googleapis.com/auth/compute.readonly 23 | } 24 | } 25 | \seealso{ 26 | \href{https://developers.google.com/compute/docs/reference/latest/}{Google Documentation} 27 | } 28 | -------------------------------------------------------------------------------- /man/gce_get_op.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/operations.R 3 | \name{gce_get_op} 4 | \alias{gce_get_op} 5 | \title{Retrieves the specified Operations resource.} 6 | \usage{ 7 | gce_get_op(operation = .Last.value) 8 | } 9 | \arguments{ 10 | \item{operation}{Name of the Operations resource to return} 11 | } 12 | \description{ 13 | s3 method dispatcher 14 | } 15 | \details{ 16 | S3 Methods for classes 17 | \itemize{ 18 | \item gce_get_op.gce_zone_operation 19 | \item gce_get_op.gce_global_operation 20 | \item gce_get_op.gce_region_operation 21 | } 22 | } 23 | \seealso{ 24 | \href{https://developers.google.com/compute/docs/reference/latest/}{Google Documentation} 25 | } 26 | -------------------------------------------------------------------------------- /man/gce_get_op.gce_global_operation.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/operations.R 3 | \name{gce_get_op.gce_global_operation} 4 | \alias{gce_get_op.gce_global_operation} 5 | \title{Retrieves the specified global Operations resource.} 6 | \usage{ 7 | \method{gce_get_op}{gce_global_operation}(operation) 8 | } 9 | \arguments{ 10 | \item{operation}{Name of the Operations resource to return} 11 | } 12 | \description{ 13 | Retrieves the specified global Operations resource. 14 | } 15 | \seealso{ 16 | \href{https://developers.google.com/compute/docs/reference/latest/}{Google Documentation} 17 | } 18 | -------------------------------------------------------------------------------- /man/gce_get_op.gce_zone_operation.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/operations.R 3 | \name{gce_get_op.gce_zone_operation} 4 | \alias{gce_get_op.gce_zone_operation} 5 | \title{Retrieves the specified zone-specific Operations resource.} 6 | \usage{ 7 | \method{gce_get_op}{gce_zone_operation}(operation) 8 | } 9 | \arguments{ 10 | \item{operation}{Name of the Operations resource to return} 11 | } 12 | \description{ 13 | Retrieves the specified zone-specific Operations resource. 14 | } 15 | \seealso{ 16 | \href{https://developers.google.com/compute/docs/reference/latest/}{Google Documentation} 17 | } 18 | -------------------------------------------------------------------------------- /man/gce_get_project.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/projects.R 3 | \name{gce_get_project} 4 | \alias{gce_get_project} 5 | \title{Returns the specified Project resource.} 6 | \usage{ 7 | gce_get_project(project = gce_get_global_project()) 8 | } 9 | \arguments{ 10 | \item{project}{Project ID for this request} 11 | } 12 | \description{ 13 | Returns the specified Project resource. 14 | } 15 | \details{ 16 | Authentication scopes used by this function are: 17 | \itemize{ 18 | \item https://www.googleapis.com/auth/cloud-platform 19 | \item https://www.googleapis.com/auth/compute 20 | \item https://www.googleapis.com/auth/compute.readonly 21 | } 22 | } 23 | \seealso{ 24 | \href{https://developers.google.com/compute/docs/reference/latest/}{Google Documentation} 25 | } 26 | -------------------------------------------------------------------------------- /man/gce_get_zone.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/zones.R 3 | \name{gce_get_zone} 4 | \alias{gce_get_zone} 5 | \title{Returns the specified Zone resource. Get a list of available zones by making a list() request.} 6 | \usage{ 7 | gce_get_zone(project, zone) 8 | } 9 | \arguments{ 10 | \item{project}{Project ID for this request} 11 | 12 | \item{zone}{Name of the zone resource to return} 13 | } 14 | \description{ 15 | Returns the specified Zone resource. Get a list of available zones by making a list() request. 16 | } 17 | \details{ 18 | Authentication scopes used by this function are: 19 | \itemize{ 20 | \item https://www.googleapis.com/auth/cloud-platform 21 | \item https://www.googleapis.com/auth/compute 22 | \item https://www.googleapis.com/auth/compute.readonly 23 | } 24 | } 25 | \seealso{ 26 | \href{https://developers.google.com/compute/docs/reference/latest/}{Google Documentation} 27 | } 28 | -------------------------------------------------------------------------------- /man/gce_global_project.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/projects.R 3 | \name{gce_global_project} 4 | \alias{gce_global_project} 5 | \title{Set global project name} 6 | \usage{ 7 | gce_global_project(project = gce_get_global_project()) 8 | } 9 | \arguments{ 10 | \item{project}{project name you want this session to use by default, or a project object} 11 | } 12 | \value{ 13 | The project name (invisibly) 14 | } 15 | \description{ 16 | Set a project name used for this R session 17 | } 18 | \details{ 19 | This sets a project to a global environment value so you don't need to 20 | supply the project argument to other API calls. 21 | } 22 | -------------------------------------------------------------------------------- /man/gce_global_zone.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/zones.R 3 | \name{gce_global_zone} 4 | \alias{gce_global_zone} 5 | \title{Set global zone name} 6 | \usage{ 7 | gce_global_zone(zone) 8 | } 9 | \arguments{ 10 | \item{zone}{zone name you want this session to use by default, or a zone object} 11 | } 12 | \value{ 13 | The zone name (invisibly) 14 | } 15 | \description{ 16 | Set a zone name used for this R session 17 | } 18 | \details{ 19 | This sets a zone to a global environment value so you don't need to 20 | supply the zone argument to other API calls. 21 | } 22 | -------------------------------------------------------------------------------- /man/gce_list_disks.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/disks.R 3 | \name{gce_list_disks} 4 | \alias{gce_list_disks} 5 | \title{Retrieves a list of persistent disks contained within the specified zone.} 6 | \usage{ 7 | gce_list_disks( 8 | filter = NULL, 9 | maxResults = NULL, 10 | pageToken = NULL, 11 | project = gce_get_global_project(), 12 | zone = gce_get_global_zone() 13 | ) 14 | } 15 | \arguments{ 16 | \item{filter}{Sets a filter expression for filtering listed resources, in the form filter={expression}} 17 | 18 | \item{maxResults}{The maximum number of results per page that should be returned} 19 | 20 | \item{pageToken}{Specifies a page token to use} 21 | 22 | \item{project}{Project ID for this request} 23 | 24 | \item{zone}{The name of the zone for this request} 25 | } 26 | \description{ 27 | Retrieves a list of persistent disks contained within the specified zone. 28 | } 29 | \details{ 30 | Authentication scopes used by this function are: 31 | \itemize{ 32 | \item https://www.googleapis.com/auth/cloud-platform 33 | \item https://www.googleapis.com/auth/compute 34 | \item https://www.googleapis.com/auth/compute.readonly 35 | } 36 | } 37 | \seealso{ 38 | \href{https://developers.google.com/compute/docs/reference/latest/}{Google Documentation} 39 | } 40 | -------------------------------------------------------------------------------- /man/gce_list_disks_all.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/disks.R 3 | \name{gce_list_disks_all} 4 | \alias{gce_list_disks_all} 5 | \title{Retrieves an aggregated list of persistent disks across all zones.} 6 | \usage{ 7 | gce_list_disks_all( 8 | filter = NULL, 9 | maxResults = NULL, 10 | pageToken = NULL, 11 | project = gce_get_global_project() 12 | ) 13 | } 14 | \arguments{ 15 | \item{filter}{Sets a filter expression for filtering listed resources, in the form filter={expression}} 16 | 17 | \item{maxResults}{The maximum number of results per page that should be returned} 18 | 19 | \item{pageToken}{Specifies a page token to use} 20 | 21 | \item{project}{Project ID for this request} 22 | } 23 | \description{ 24 | Retrieves an aggregated list of persistent disks across all zones. 25 | } 26 | \details{ 27 | Authentication scopes used by this function are: 28 | \itemize{ 29 | \item https://www.googleapis.com/auth/cloud-platform 30 | \item https://www.googleapis.com/auth/compute 31 | \item https://www.googleapis.com/auth/compute.readonly 32 | } 33 | } 34 | \seealso{ 35 | \href{https://developers.google.com/compute/docs/reference/latest/}{Google Documentation} 36 | } 37 | -------------------------------------------------------------------------------- /man/gce_list_firewall_rules.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/firewalls.R 3 | \name{gce_list_firewall_rules} 4 | \alias{gce_list_firewall_rules} 5 | \title{List firewall rules} 6 | \usage{ 7 | gce_list_firewall_rules( 8 | filter = NULL, 9 | maxResults = NULL, 10 | pageToken = NULL, 11 | project = gce_get_global_project() 12 | ) 13 | } 14 | \arguments{ 15 | \item{filter}{Sets a filter expression for filtering listed resources, in the form filter={expression}} 16 | 17 | \item{maxResults}{The maximum number of results per page that should be returned} 18 | 19 | \item{pageToken}{Specifies a page token to use} 20 | 21 | \item{project}{The Google Cloud project} 22 | } 23 | \description{ 24 | Get a firewall rule of name specified 25 | } 26 | \seealso{ 27 | API Documentation \url{https://cloud.google.com/compute/docs/reference/latest/firewalls/list} 28 | 29 | Other firewall functions: 30 | \code{\link{gce_delete_firewall_rule}()}, 31 | \code{\link{gce_get_firewall_rule}()}, 32 | \code{\link{gce_make_firewall_rule}()}, 33 | \code{\link{gce_make_firewall_webports}()} 34 | } 35 | \concept{firewall functions} 36 | -------------------------------------------------------------------------------- /man/gce_list_gpus.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/gpus.R 3 | \name{gce_list_gpus} 4 | \alias{gce_list_gpus} 5 | \title{Retrieves a list GPUs you can attach to an instance} 6 | \usage{ 7 | gce_list_gpus( 8 | filter = NULL, 9 | maxResults = NULL, 10 | pageToken = NULL, 11 | project = gce_get_global_project(), 12 | zone = gce_get_global_zone() 13 | ) 14 | } 15 | \arguments{ 16 | \item{filter}{Sets a filter expression for filtering listed resources, in the form filter={expression}} 17 | 18 | \item{maxResults}{The maximum number of results per page that should be returned} 19 | 20 | \item{pageToken}{Specifies a page token to use} 21 | 22 | \item{project}{Project ID for this request} 23 | 24 | \item{zone}{The name of the zone for this request} 25 | } 26 | \description{ 27 | Retrieves a list GPUs you can attach to an instance 28 | } 29 | \details{ 30 | To filter you need a single string in the form \code{field_name eq|ne string} 31 | e.g. \code{gce_list_instances("status eq RUNNING")} where \code{eq} is 'equals' and \code{ne} is 'not-equals'. 32 | } 33 | \seealso{ 34 | \href{https://cloud.google.com/compute/docs/gpus/#introduction}{GPUs on Compute Engine} 35 | 36 | Other GPU instances: 37 | \code{\link{gce_check_gpu}()}, 38 | \code{\link{gce_vm_gpu}()} 39 | } 40 | \concept{GPU instances} 41 | -------------------------------------------------------------------------------- /man/gce_list_images.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/images.R 3 | \name{gce_list_images} 4 | \alias{gce_list_images} 5 | \title{Retrieves the list of private images available to the specified project.} 6 | \usage{ 7 | gce_list_images( 8 | image_project, 9 | filter = NULL, 10 | maxResults = NULL, 11 | pageToken = NULL 12 | ) 13 | } 14 | \arguments{ 15 | \item{image_project}{Project ID for this request} 16 | 17 | \item{filter}{Sets a filter expression for filtering listed resources, in the form filter={expression}} 18 | 19 | \item{maxResults}{The maximum number of results per page that should be returned} 20 | 21 | \item{pageToken}{Specifies a page token to use} 22 | } 23 | \description{ 24 | Retrieves the list of private images available to the specified project. 25 | } 26 | \details{ 27 | Authentication scopes used by this function are: 28 | \itemize{ 29 | \item https://www.googleapis.com/auth/cloud-platform 30 | \item https://www.googleapis.com/auth/compute 31 | \item https://www.googleapis.com/auth/compute.readonly 32 | } 33 | 34 | 35 | If you want to get a list of publicly-available images, 36 | use this method to make a request to the respective image project, 37 | such as debian-cloud, windows-cloud or google-containers. 38 | } 39 | \seealso{ 40 | \href{https://cloud.google.com/compute/docs/images}{Google Documentation} 41 | } 42 | -------------------------------------------------------------------------------- /man/gce_list_instances.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/instances_admin.R 3 | \name{gce_list_instances} 4 | \alias{gce_list_instances} 5 | \title{Retrieves the list of instances contained within the specified zone.} 6 | \usage{ 7 | gce_list_instances( 8 | filter = NULL, 9 | maxResults = NULL, 10 | pageToken = NULL, 11 | project = gce_get_global_project(), 12 | zone = gce_get_global_zone() 13 | ) 14 | } 15 | \arguments{ 16 | \item{filter}{Sets a filter expression for filtering listed resources, in the form filter={expression}} 17 | 18 | \item{maxResults}{The maximum number of results per page that should be returned} 19 | 20 | \item{pageToken}{Specifies a page token to use} 21 | 22 | \item{project}{Project ID for this request} 23 | 24 | \item{zone}{The name of the zone for this request} 25 | } 26 | \description{ 27 | Retrieves the list of instances contained within the specified zone. 28 | } 29 | \details{ 30 | Authentication scopes used by this function are: 31 | \itemize{ 32 | \item https://www.googleapis.com/auth/cloud-platform 33 | \item https://www.googleapis.com/auth/compute 34 | \item https://www.googleapis.com/auth/compute.readonly 35 | } 36 | 37 | To filter you need a single string in the form \code{field_name eq|ne string} 38 | e.g. \code{gce_list_instances("status eq RUNNING")} where \code{eq} is 'equals' and \code{ne} is 'not-equals'. 39 | } 40 | \seealso{ 41 | \href{https://developers.google.com/compute/docs/reference/latest/}{Google Documentation} 42 | } 43 | -------------------------------------------------------------------------------- /man/gce_list_machinetype.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/machineType.R 3 | \name{gce_list_machinetype} 4 | \alias{gce_list_machinetype} 5 | \title{Retrieves a list of machine types available to the specified project.} 6 | \usage{ 7 | gce_list_machinetype( 8 | filter = NULL, 9 | maxResults = NULL, 10 | pageToken = NULL, 11 | project = gce_get_global_project(), 12 | zone = gce_get_global_zone() 13 | ) 14 | } 15 | \arguments{ 16 | \item{filter}{Sets a filter expression for filtering listed resources, in the form filter={expression}} 17 | 18 | \item{maxResults}{The maximum number of results per page that should be returned} 19 | 20 | \item{pageToken}{Specifies a page token to use} 21 | 22 | \item{project}{Project ID for this request} 23 | 24 | \item{zone}{The name of the zone for this request} 25 | } 26 | \description{ 27 | Retrieves a list of machine types available to the specified project. 28 | } 29 | \details{ 30 | Authentication scopes used by this function are: 31 | \itemize{ 32 | \item https://www.googleapis.com/auth/cloud-platform 33 | \item https://www.googleapis.com/auth/compute 34 | \item https://www.googleapis.com/auth/compute.readonly 35 | } 36 | } 37 | \seealso{ 38 | \href{https://developers.google.com/compute/docs/reference/latest/}{Google Documentation} 39 | } 40 | -------------------------------------------------------------------------------- /man/gce_list_machinetype_all.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/machineType.R 3 | \name{gce_list_machinetype_all} 4 | \alias{gce_list_machinetype_all} 5 | \title{Retrieves an aggregated list of machine types from all zones.} 6 | \usage{ 7 | gce_list_machinetype_all( 8 | filter = NULL, 9 | maxResults = NULL, 10 | pageToken = NULL, 11 | project = gce_get_global_project() 12 | ) 13 | } 14 | \arguments{ 15 | \item{filter}{Sets a filter expression for filtering listed resources, in the form filter={expression}} 16 | 17 | \item{maxResults}{The maximum number of results per page that should be returned} 18 | 19 | \item{pageToken}{Specifies a page token to use} 20 | 21 | \item{project}{Project ID for this request} 22 | } 23 | \description{ 24 | Retrieves an aggregated list of machine types from all zones. 25 | } 26 | \details{ 27 | Authentication scopes used by this function are: 28 | \itemize{ 29 | \item https://www.googleapis.com/auth/cloud-platform 30 | \item https://www.googleapis.com/auth/compute 31 | \item https://www.googleapis.com/auth/compute.readonly 32 | } 33 | } 34 | \seealso{ 35 | \href{https://developers.google.com/compute/docs/reference/latest/}{Google Documentation} 36 | } 37 | -------------------------------------------------------------------------------- /man/gce_list_networks.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/networks.R 3 | \name{gce_list_networks} 4 | \alias{gce_list_networks} 5 | \title{Retrieves the list of networks available to the specified project.} 6 | \usage{ 7 | gce_list_networks( 8 | filter = NULL, 9 | maxResults = NULL, 10 | pageToken = NULL, 11 | project = gce_get_global_project() 12 | ) 13 | } 14 | \arguments{ 15 | \item{filter}{Sets a filter expression for filtering listed resources, in the form filter={expression}} 16 | 17 | \item{maxResults}{The maximum number of results per page that should be returned} 18 | 19 | \item{pageToken}{Specifies a page token to use} 20 | 21 | \item{project}{Project ID for this request} 22 | } 23 | \description{ 24 | Retrieves the list of networks available to the specified project. 25 | } 26 | \details{ 27 | Authentication scopes used by this function are: 28 | \itemize{ 29 | \item https://www.googleapis.com/auth/cloud-platform 30 | \item https://www.googleapis.com/auth/compute 31 | \item https://www.googleapis.com/auth/compute.readonly 32 | } 33 | } 34 | \seealso{ 35 | \href{https://developers.google.com/compute/docs/reference/latest/}{Google Documentation} 36 | } 37 | -------------------------------------------------------------------------------- /man/gce_list_zone_op.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/operations.R 3 | \name{gce_list_zone_op} 4 | \alias{gce_list_zone_op} 5 | \title{Retrieves a list of Operation resources contained within the specified zone.} 6 | \usage{ 7 | gce_list_zone_op( 8 | filter = NULL, 9 | maxResults = NULL, 10 | pageToken = NULL, 11 | project = gce_get_global_project(), 12 | zone = gce_get_global_zone() 13 | ) 14 | } 15 | \arguments{ 16 | \item{filter}{Sets a filter expression for filtering listed resources, in the form filter={expression}} 17 | 18 | \item{maxResults}{The maximum number of results per page that should be returned} 19 | 20 | \item{pageToken}{Specifies a page token to use} 21 | 22 | \item{project}{Project ID for this request} 23 | 24 | \item{zone}{Name of the zone for request} 25 | } 26 | \description{ 27 | Retrieves a list of Operation resources contained within the specified zone. 28 | } 29 | \details{ 30 | Authentication scopes used by this function are: 31 | \itemize{ 32 | \item https://www.googleapis.com/auth/cloud-platform 33 | \item https://www.googleapis.com/auth/compute 34 | \item https://www.googleapis.com/auth/compute.readonly 35 | } 36 | } 37 | \seealso{ 38 | \href{https://developers.google.com/compute/docs/reference/latest/}{Google Documentation} 39 | } 40 | -------------------------------------------------------------------------------- /man/gce_list_zones.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/zones.R 3 | \name{gce_list_zones} 4 | \alias{gce_list_zones} 5 | \title{Retrieves the list of Zone resources available to the specified project.} 6 | \usage{ 7 | gce_list_zones(project, filter = NULL, maxResults = NULL, pageToken = NULL) 8 | } 9 | \arguments{ 10 | \item{project}{Project ID for this request} 11 | 12 | \item{filter}{Sets a filter expression for filtering listed resources, in the form filter={expression}} 13 | 14 | \item{maxResults}{The maximum number of results per page that should be returned} 15 | 16 | \item{pageToken}{Specifies a page token to use} 17 | } 18 | \description{ 19 | Retrieves the list of Zone resources available to the specified project. 20 | } 21 | \details{ 22 | Authentication scopes used by this function are: 23 | \itemize{ 24 | \item https://www.googleapis.com/auth/cloud-platform 25 | \item https://www.googleapis.com/auth/compute 26 | \item https://www.googleapis.com/auth/compute.readonly 27 | } 28 | } 29 | \seealso{ 30 | \href{https://developers.google.com/compute/docs/reference/latest/}{Google Documentation} 31 | } 32 | -------------------------------------------------------------------------------- /man/gce_make_boot_disk.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/disks.R 3 | \name{gce_make_boot_disk} 4 | \alias{gce_make_boot_disk} 5 | \title{Make a boot disk for attachment to an instance} 6 | \usage{ 7 | gce_make_boot_disk( 8 | diskName = NULL, 9 | diskSizeGb = NULL, 10 | diskType = NULL, 11 | sourceImage = NULL, 12 | sourceImageEncryptionKey = NULL 13 | ) 14 | } 15 | \arguments{ 16 | \item{diskName}{Specifies the disk name} 17 | 18 | \item{diskSizeGb}{Specifies the size of the disk in base-2 GB} 19 | 20 | \item{diskType}{Specifies the disk type to use to create the instance} 21 | 22 | \item{sourceImage}{The source image used to create this disk} 23 | 24 | \item{sourceImageEncryptionKey}{The customer-supplied encryption key of the source image} 25 | } 26 | \value{ 27 | AttachedDiskInitializeParams object 28 | } 29 | \description{ 30 | Make a boot disk for attachment to an instance 31 | } 32 | \details{ 33 | Specifies the parameters for a new disk that will be created alongside the new instance. 34 | 35 | Use initialization parameters to create boot disks or local SSDs attached to the new instance. 36 | 37 | This property is mutually exclusive with the source property; you can only define one or the other, but not both. 38 | } 39 | \concept{AttachedDiskInitializeParams functions} 40 | -------------------------------------------------------------------------------- /man/gce_make_disk.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/disks.R 3 | \name{gce_make_disk} 4 | \alias{gce_make_disk} 5 | \title{Creates a persistent disk in the specified project using the data in the request.} 6 | \usage{ 7 | gce_make_disk( 8 | name, 9 | sourceImage = NULL, 10 | sizeGb = NULL, 11 | description = NULL, 12 | diskEncryptionKey = NULL, 13 | licenses = NULL, 14 | sourceSnapshot = NULL, 15 | sourceImageEncryptionKey = NULL, 16 | sourceSnapshotEncryptionKey = NULL, 17 | type = NULL, 18 | project = gce_get_global_project(), 19 | zone = gce_get_global_zone() 20 | ) 21 | } 22 | \arguments{ 23 | \item{name}{Name of the resource} 24 | 25 | \item{sourceImage}{The source image used to create this disk} 26 | 27 | \item{sizeGb}{Size of the persistent disk, specified in GB} 28 | 29 | \item{description}{An optional description of this resource} 30 | 31 | \item{diskEncryptionKey}{Encrypts the disk using a customer-supplied encryption key} 32 | 33 | \item{licenses}{Any applicable publicly visible licenses} 34 | 35 | \item{sourceSnapshot}{The source snapshot used to create this disk} 36 | 37 | \item{sourceImageEncryptionKey}{The customer-supplied encryption key of the source image} 38 | 39 | \item{sourceSnapshotEncryptionKey}{The customer-supplied encryption key of the source snapshot} 40 | 41 | \item{type}{URL of the disk type resource describing which disk type to use to create the disk} 42 | 43 | \item{project}{Project ID for this request} 44 | 45 | \item{zone}{The name of the zone for this request} 46 | } 47 | \value{ 48 | a zone operation 49 | } 50 | \description{ 51 | You can create a disk with a sourceImage, a sourceSnapshot, or create an empty 500 GB data disk by omitting all properties. 52 | } 53 | \details{ 54 | You can also create a disk that is larger than the default size by specifying the sizeGb property. 55 | 56 | 57 | Authentication scopes used by this function are: 58 | \itemize{ 59 | \item https://www.googleapis.com/auth/cloud-platform 60 | \item https://www.googleapis.com/auth/compute 61 | } 62 | } 63 | \seealso{ 64 | \href{https://developers.google.com/compute/docs/reference/latest/}{Google Documentation} 65 | } 66 | -------------------------------------------------------------------------------- /man/gce_make_firewall_rule.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/firewalls.R 3 | \name{gce_make_firewall_rule} 4 | \alias{gce_make_firewall_rule} 5 | \title{Add one firewall rule to the network} 6 | \usage{ 7 | gce_make_firewall_rule( 8 | name, 9 | protocol, 10 | ports, 11 | sourceRanges = NULL, 12 | sourceTags = NULL, 13 | project = gce_get_global_project() 14 | ) 15 | } 16 | \arguments{ 17 | \item{name}{Name of the firewall rule} 18 | 19 | \item{protocol}{Protocol such as \code{tcp, udp, icmp, esp, ah, sctp} or IP protocol number.} 20 | 21 | \item{ports}{Port numbers to open} 22 | 23 | \item{sourceRanges}{From where to accept connections. If \code{NULL} then will default to \code{0.0.0.0/0} (everywhere)} 24 | 25 | \item{sourceTags}{A list of instance tags this rule applies to. One or both of \code{sourceRanges} and \code{sourceTags} may be set.} 26 | 27 | \item{project}{The Google Cloud project} 28 | } 29 | \value{ 30 | A global operation object 31 | } 32 | \description{ 33 | Use this to create firewall rules to apply to the network settings. 34 | Most commonly this is to setup web access (port 80 and 443) 35 | } 36 | \section{sourceRanges and/or sourceTags}{ 37 | 38 | 39 | If both properties are set, 40 | an inbound connection is allowed if the range or the tag of the source matches the 41 | sourceRanges OR matches the sourceTags property; the connection does not need to match both properties. 42 | } 43 | 44 | \examples{ 45 | 46 | \dontrun{ 47 | 48 | gce_make_firewall_rule("allow-http", protocol = "tcp", ports = 80) 49 | gce_make_firewall_rule("allow-https", protocol = "tcp", ports = 443) 50 | gce_make_firewall_rule("shiny", protocol = "tcp", ports = 3838) 51 | gce_make_firewall_rule("rstudio", protocol = "tcp", ports = 8787) 52 | } 53 | 54 | } 55 | \seealso{ 56 | API Documentation \url{https://cloud.google.com/compute/docs/reference/latest/firewalls/insert} 57 | 58 | Other firewall functions: 59 | \code{\link{gce_delete_firewall_rule}()}, 60 | \code{\link{gce_get_firewall_rule}()}, 61 | \code{\link{gce_list_firewall_rules}()}, 62 | \code{\link{gce_make_firewall_webports}()} 63 | } 64 | \concept{firewall functions} 65 | -------------------------------------------------------------------------------- /man/gce_make_firewall_webports.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/firewalls.R 3 | \name{gce_make_firewall_webports} 4 | \alias{gce_make_firewall_webports} 5 | \title{Make HTTP and HTTPS firewall rules} 6 | \usage{ 7 | gce_make_firewall_webports(project = gce_get_global_project()) 8 | } 9 | \arguments{ 10 | \item{project}{The project the firewall will open for} 11 | } 12 | \value{ 13 | Vector of the firewall objects 14 | } 15 | \description{ 16 | Do the common use case of opening HTTP and HTTPS ports 17 | } 18 | \details{ 19 | This will invoke \link{gce_make_firewall_rule} and look for the rules named \code{allow-http} and \code{allow-https}. 20 | If not present, it will create them. 21 | } 22 | \seealso{ 23 | Other firewall functions: 24 | \code{\link{gce_delete_firewall_rule}()}, 25 | \code{\link{gce_get_firewall_rule}()}, 26 | \code{\link{gce_list_firewall_rules}()}, 27 | \code{\link{gce_make_firewall_rule}()} 28 | } 29 | \concept{firewall functions} 30 | -------------------------------------------------------------------------------- /man/gce_make_image_source_url.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/images.R 3 | \name{gce_make_image_source_url} 4 | \alias{gce_make_image_source_url} 5 | \title{Make initial disk image object} 6 | \usage{ 7 | gce_make_image_source_url(image_project, image = NULL, family = NULL) 8 | } 9 | \arguments{ 10 | \item{image_project}{Project ID of where the image lies} 11 | 12 | \item{image}{Name of the image resource to return} 13 | 14 | \item{family}{Name of the image family to search for} 15 | } 16 | \value{ 17 | The selfLink of the image object 18 | } 19 | \description{ 20 | Make initial disk image object 21 | } 22 | -------------------------------------------------------------------------------- /man/gce_make_machinetype_url.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/machineType.R 3 | \name{gce_make_machinetype_url} 4 | \alias{gce_make_machinetype_url} 5 | \title{Construct a machineType URL} 6 | \usage{ 7 | gce_make_machinetype_url( 8 | predefined_type = NULL, 9 | cpus = NULL, 10 | memory = NULL, 11 | zone = gce_get_global_zone() 12 | ) 13 | } 14 | \arguments{ 15 | \item{predefined_type}{A predefined machine type from \link{gce_list_machinetype}} 16 | 17 | \item{cpus}{If not defining \code{predefined_type}, the number of CPUs} 18 | 19 | \item{memory}{If not defining \code{predefined_type}, amount of memory} 20 | 21 | \item{zone}{zone for URL} 22 | } 23 | \value{ 24 | A url for use in instance creation 25 | } 26 | \description{ 27 | Construct a machineType URL 28 | } 29 | \details{ 30 | \code{cpus} must be in multiples of 2 up to 32 31 | \code{memory} must be in multiples of 256 32 | } 33 | -------------------------------------------------------------------------------- /man/gce_make_network.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/networks.R 3 | \name{gce_make_network} 4 | \alias{gce_make_network} 5 | \title{Make a network interface for instance creation} 6 | \usage{ 7 | gce_make_network( 8 | network = "default", 9 | name = NULL, 10 | subnetwork = NULL, 11 | externalIP = NULL, 12 | project = gce_get_global_project() 13 | ) 14 | } 15 | \arguments{ 16 | \item{network}{Name of network resource} 17 | 18 | \item{name}{Name of the access config} 19 | 20 | \item{subnetwork}{A subnetwork name if its exists 21 | 22 | You need to provide accessConfig explicitly if you want an ephemeral IP assigned, see \code{https://cloud.google.com/compute/docs/vm-ip-addresses}} 23 | 24 | \item{externalIP}{An external IP you have created previously, leave NULL to have one assigned or "none" for none} 25 | 26 | \item{project}{Project ID for this request} 27 | } 28 | \value{ 29 | A Network object 30 | } 31 | \description{ 32 | Make a network interface for instance creation 33 | } 34 | -------------------------------------------------------------------------------- /man/gce_metadata_env.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/metadata.R 3 | \name{gce_metadata_env} 4 | \alias{gce_metadata_env} 5 | \title{Turn metadata into an environment argument} 6 | \usage{ 7 | gce_metadata_env(key) 8 | } 9 | \arguments{ 10 | \item{key}{The metadata key. Pass "" to list the keys} 11 | } 12 | \value{ 13 | The metadata key value, if successful 14 | } 15 | \description{ 16 | This turns instance metadata into an environment argument R (and other software) can see. 17 | Only works on a running instance. 18 | } 19 | -------------------------------------------------------------------------------- /man/gce_pull_registry.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/build.R 3 | \name{gce_pull_registry} 4 | \alias{gce_pull_registry} 5 | \title{Load a previously saved private Google Container} 6 | \usage{ 7 | gce_pull_registry( 8 | instance, 9 | container_name, 10 | container_url = "gcr.io", 11 | pull_only = FALSE, 12 | project = gce_get_global_project(), 13 | ... 14 | ) 15 | } 16 | \arguments{ 17 | \item{instance}{The VM to run within} 18 | 19 | \item{container_name}{The name of the saved container} 20 | 21 | \item{container_url}{The URL of where the container was saved} 22 | 23 | \item{pull_only}{If TRUE, will not run the container, only pull to the VM} 24 | 25 | \item{project}{Project ID for this request, default as set by \link{gce_get_global_project}} 26 | 27 | \item{...}{Other arguments passed to \link{docker_run} or \link{docker_pull} 28 | 29 | After starting a VM, you can load the container again using this command. 30 | 31 | \itemize{ 32 | \item For Shiny based containers, pass \code{"-p 80:3838"} to run it at the IP URL 33 | \item For RStudio based containers, pass \code{"-p 80:8787"} to run it at the IP URL 34 | }} 35 | } 36 | \value{ 37 | The instance 38 | } 39 | \description{ 40 | Load a previously saved private Google Container 41 | } 42 | \seealso{ 43 | Other container registry functions: 44 | \code{\link{gce_push_registry}()}, 45 | \code{\link{gce_tag_container}()} 46 | } 47 | \concept{container registry functions} 48 | -------------------------------------------------------------------------------- /man/gce_push_registry.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/build.R 3 | \name{gce_push_registry} 4 | \alias{gce_push_registry} 5 | \title{Push to Google Container Registry} 6 | \usage{ 7 | gce_push_registry( 8 | instance, 9 | save_name, 10 | container_name = NULL, 11 | image_name = NULL, 12 | container_url = "gcr.io", 13 | project = gce_get_global_project(), 14 | wait = FALSE 15 | ) 16 | } 17 | \arguments{ 18 | \item{instance}{The VM to run within} 19 | 20 | \item{save_name}{The new name for the saved image} 21 | 22 | \item{container_name}{A running docker container. Can't be set if \code{image_name} is too.} 23 | 24 | \item{image_name}{A docker image on the instance. Can't be set if \code{container_name} is too.} 25 | 26 | \item{container_url}{The URL of where to save container} 27 | 28 | \item{project}{Project ID for this request, default as set by \link{gce_get_global_project} 29 | 30 | This will only work on the Google Container optimised containers of image_family google_containers. 31 | Otherwise you will need to get a container authentication yourself (for now) 32 | 33 | It will start the push but it may take a long time to finish, especially the first time, 34 | this function will return whilst waiting but don't turn off the VM until its finished.} 35 | 36 | \item{wait}{Will wait for operation to finish on the instance if TRUE} 37 | } 38 | \value{ 39 | The tag the image was tagged with on GCE 40 | } 41 | \description{ 42 | Commit and save a running container or docker image to the Google Container Registry 43 | } 44 | \seealso{ 45 | Other container registry functions: 46 | \code{\link{gce_pull_registry}()}, 47 | \code{\link{gce_tag_container}()} 48 | } 49 | \concept{container registry functions} 50 | -------------------------------------------------------------------------------- /man/gce_rstudio_adduser.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/rstudio.R 3 | \name{gce_rstudio_adduser} 4 | \alias{gce_rstudio_adduser} 5 | \title{Creates a user on an RStudio templated instance} 6 | \usage{ 7 | gce_rstudio_adduser( 8 | instance, 9 | username, 10 | password, 11 | admin = TRUE, 12 | container = "rstudio" 13 | ) 14 | } 15 | \arguments{ 16 | \item{instance}{An instance with RStudio installed via \link{gce_vm_template}} 17 | 18 | \item{username}{The user to create} 19 | 20 | \item{password}{The user password} 21 | 22 | \item{admin}{Default TRUE - Will the user be able to install packages and other sudo tasks?} 23 | 24 | \item{container}{The rstudio container to add the user to} 25 | } 26 | \value{ 27 | The instance 28 | } 29 | \description{ 30 | RStudio has users based on unix user accounts 31 | } 32 | -------------------------------------------------------------------------------- /man/gce_rstudio_password.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/rstudio.R 3 | \name{gce_rstudio_password} 4 | \alias{gce_rstudio_password} 5 | \title{Changes password for a user on RStudio container} 6 | \usage{ 7 | gce_rstudio_password(instance, username, password, container = "rstudio") 8 | } 9 | \arguments{ 10 | \item{instance}{An instance with RStudio installed via \link{gce_vm_template}} 11 | 12 | \item{username}{The user to change the password for} 13 | 14 | \item{password}{The user password} 15 | 16 | \item{container}{The rstudio container to add the user to} 17 | } 18 | \value{ 19 | The instance 20 | } 21 | \description{ 22 | RStudio has users based on unix user accounts 23 | } 24 | -------------------------------------------------------------------------------- /man/gce_set_machinetype.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/machineType.R 3 | \name{gce_set_machinetype} 4 | \alias{gce_set_machinetype} 5 | \title{Changes the machine type for a stopped instance to the machine type specified in the request.} 6 | \usage{ 7 | gce_set_machinetype( 8 | predefined_type, 9 | cpus, 10 | memory, 11 | instance, 12 | project = gce_get_global_project(), 13 | zone = gce_get_global_zone() 14 | ) 15 | } 16 | \arguments{ 17 | \item{predefined_type}{A predefined machine type from \link{gce_list_machinetype}} 18 | 19 | \item{cpus}{If not defining \code{predefined_type}, the number of CPUs} 20 | 21 | \item{memory}{If not defining \code{predefined_type}, amount of memory} 22 | 23 | \item{instance}{Name of the instance resource to change} 24 | 25 | \item{project}{Project ID for this request, default as set by \link{gce_get_global_project}} 26 | 27 | \item{zone}{The name of the zone for this request, default as set by \link{gce_get_global_zone}} 28 | } 29 | \value{ 30 | A zone operation job 31 | } 32 | \description{ 33 | Changes the machine type for a stopped instance to the machine type specified in the request. 34 | } 35 | \details{ 36 | Authentication scopes used by this function are: 37 | \itemize{ 38 | \item https://www.googleapis.com/auth/cloud-platform 39 | \item https://www.googleapis.com/auth/compute 40 | } 41 | } 42 | \seealso{ 43 | \href{https://developers.google.com/compute/docs/reference/latest/}{Google Documentation} 44 | } 45 | -------------------------------------------------------------------------------- /man/gce_set_metadata.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/metadata.R 3 | \name{gce_set_metadata} 4 | \alias{gce_set_metadata} 5 | \title{Sets metadata for the specified instance or projectwise to the data included in the request.} 6 | \usage{ 7 | gce_set_metadata( 8 | metadata, 9 | instance, 10 | project = gce_get_global_project(), 11 | zone = gce_get_global_zone() 12 | ) 13 | } 14 | \arguments{ 15 | \item{metadata}{A named list of metadata key/value pairs to assign to this instance} 16 | 17 | \item{instance}{Name of the instance scoping this request. If "project-wide" will set the metadata project wide, available to all instances} 18 | 19 | \item{project}{Project ID for this request, default as set by \link{gce_get_global_project}} 20 | 21 | \item{zone}{The name of the zone for this request, default as set by \link{gce_get_global_zone}} 22 | } 23 | \description{ 24 | Set, change and append metadata for an instance. 25 | } 26 | \details{ 27 | Authentication scopes used by this function are: 28 | \itemize{ 29 | \item https://www.googleapis.com/auth/cloud-platform 30 | \item https://www.googleapis.com/auth/compute 31 | } 32 | 33 | To append to existing metadata passed a named list. 34 | 35 | To change existing metadata pass a named list with the same key and modified value you will change. 36 | 37 | To delete metadata pass an empty string \code{""} with the same key 38 | } 39 | \examples{ 40 | 41 | \dontrun{ 42 | # Use "project-wide" to set "enable-oslogin" = "TRUE" to take advantage of OS Login. 43 | # But you won't be able to login via SSH if you do 44 | gce_set_metadata(list("enable-oslogin" = "TRUE"), instance = "project-wide") 45 | 46 | # enable google logging 47 | gce_set_metadata(list("google-logging-enabled"="True"), instance = "project-wide") 48 | } 49 | 50 | } 51 | \seealso{ 52 | \href{https://developers.google.com/compute/docs/reference/latest/}{Google Documentation} 53 | 54 | Other Metadata functions: 55 | \code{\link{Metadata}()} 56 | } 57 | \concept{Metadata functions} 58 | -------------------------------------------------------------------------------- /man/gce_set_mincpuplatform.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/min-cpu-platform.R 3 | \name{gce_set_mincpuplatform} 4 | \alias{gce_set_mincpuplatform} 5 | \title{Set a minCPU platform on a stopped instance} 6 | \usage{ 7 | gce_set_mincpuplatform(instance, minCpuPlatform) 8 | } 9 | \arguments{ 10 | \item{instance}{The (stopped) instance to set a minimum CPU platform upon} 11 | 12 | \item{minCpuPlatform}{The platform to set} 13 | } 14 | \description{ 15 | Set a minCPU platform on a stopped instance 16 | } 17 | -------------------------------------------------------------------------------- /man/gce_shiny_addapp.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/shiny.R 3 | \name{gce_shiny_addapp} 4 | \alias{gce_shiny_addapp} 5 | \title{Add Shiny app to a Shiny template instance} 6 | \usage{ 7 | gce_shiny_addapp(instance, app_image, dockerfolder = NULL) 8 | } 9 | \arguments{ 10 | \item{instance}{The instance running Shiny} 11 | 12 | \item{app_image}{The name of the Docker image to create or use existing from Google Container Registry. Must be numbers, dashes or lowercase letters only.} 13 | 14 | \item{dockerfolder}{The folder location containing the \code{Dockerfile} and app dependencies} 15 | } 16 | \value{ 17 | The instance 18 | } 19 | \description{ 20 | Add a local shiny app to a running Shiny VM installed via \link{gce_vm_template} 21 | via \link{docker_build} and \link{gce_push_registry} / \link{gce_pull_registry}. 22 | } 23 | \details{ 24 | To deploy a Shiny app, you first need to construct a \code{Dockerfile} which load the R packages and 25 | dependencies, as well as copying over the Shiny app in the same folder. 26 | 27 | This function will take the Dockerfile, build it into a Docker image and 28 | upload it to Google Container Registry for use later. 29 | 30 | If already created, then the function will download the \code{app_image} from Google Container Registry 31 | and start it on the instance provided. 32 | 33 | Any existing Shiny Docker containers are stopped and removed, 34 | so if you want multiple apps put them in the same \code{Dockerfile}. 35 | } 36 | \section{Dockerfile}{ 37 | 38 | 39 | Example \code{Dockerfile}'s are found in 40 | \code{system.file("dockerfiles",package = "googleComputeEngineR")} 41 | 42 | The Dockerfile is in the same folder as your shiny app, 43 | which consists of a \code{ui.R} and \code{server.R} in a shiny subfolder. 44 | This is copied into the Dockerfile in the last line. 45 | Change the name of the subfolder to have that name appear 46 | in the final URL of the Shinyapp. 47 | 48 | This is then run using the R commands below: 49 | } 50 | 51 | \examples{ 52 | \dontrun{ 53 | 54 | vm <- gce_vm("shiny-test", 55 | template = "shiny", 56 | predefined_type = "n1-standard-1") 57 | 58 | vm <- vm_ssh_setup(vm) 59 | 60 | app_dir <- system.file("dockerfiles","shiny-googleAuthRdemo", 61 | package = "googleComputeEngineR") 62 | 63 | gce_shiny_addapp(vm, app_image = "gceshinydemo", dockerfolder = app_dir) 64 | 65 | # a new VM, it loads the Shiny docker image from before 66 | gce_shiny_addapp(vm2, app_image = "gceshinydemo") 67 | 68 | } 69 | 70 | } 71 | \seealso{ 72 | The vignette entry called \code{Shiny App} has examples and a walk through. 73 | } 74 | -------------------------------------------------------------------------------- /man/gce_shiny_listapps.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/shiny.R 3 | \name{gce_shiny_listapps} 4 | \alias{gce_shiny_listapps} 5 | \title{List shiny apps on the instance} 6 | \usage{ 7 | gce_shiny_listapps(instance) 8 | } 9 | \arguments{ 10 | \item{instance}{Instance with Shiny apps installed} 11 | } 12 | \value{ 13 | character vector 14 | } 15 | \description{ 16 | List shiny apps on the instance 17 | } 18 | -------------------------------------------------------------------------------- /man/gce_shiny_logs.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/shiny.R 3 | \name{gce_shiny_logs} 4 | \alias{gce_shiny_logs} 5 | \title{Get the latest shiny logs for a shinyapp} 6 | \usage{ 7 | gce_shiny_logs(instance, shinyapp = NULL) 8 | } 9 | \arguments{ 10 | \item{instance}{Instance with Shiny app installed} 11 | 12 | \item{shinyapp}{Name of shinyapp to see logs for. If NULL will return general shiny logs} 13 | } 14 | \value{ 15 | log printout 16 | } 17 | \description{ 18 | Get the latest shiny logs for a shinyapp 19 | } 20 | -------------------------------------------------------------------------------- /man/gce_ssh_addkeys.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ssh_admin.R 3 | \name{gce_ssh_addkeys} 4 | \alias{gce_ssh_addkeys} 5 | \title{Add SSH details to a gce_instance} 6 | \usage{ 7 | gce_ssh_addkeys( 8 | instance, 9 | key.pub = NULL, 10 | key.private = NULL, 11 | username = Sys.info()[["user"]], 12 | overwrite = FALSE 13 | ) 14 | } 15 | \arguments{ 16 | \item{instance}{The gce_instance} 17 | 18 | \item{key.pub}{filepath to public SSH key} 19 | 20 | \item{key.private}{filepath to the private SSK key} 21 | 22 | \item{username}{SSH username to login with} 23 | 24 | \item{overwrite}{Overwrite existing SSH details if they exist} 25 | } 26 | \value{ 27 | The instance with SSH details included in $ssh 28 | } 29 | \description{ 30 | Add SSH details to a gce_instance 31 | } 32 | \details{ 33 | You will only need to run this yourself if you save your SSH keys somewhere other 34 | than \code{$HOME/.ssh/google_compute_engine.pub} or use a different username than 35 | your local username as found in \code{Sys.info[["user"]]}, otherwise it will configure 36 | itself automatically the first time you use \link{gce_ssh} in an R session. 37 | 38 | If key.pub is NULL then will look for default Google credentials at 39 | \code{file.path(Sys.getenv("HOME"), ".ssh", "google_compute_engine.pub")} 40 | } 41 | \examples{ 42 | 43 | \dontrun{ 44 | 45 | library(googleComputeEngineR) 46 | 47 | vm <- gce_vm("my-instance") 48 | 49 | ## if you have already logged in via gcloud, the default keys will be used 50 | ## no need to run gce_ssh_addkeys 51 | ## run command on instance 52 | gce_ssh(vm, "echo foo") 53 | 54 | 55 | ## if running on Windows, use the RStudio default SSH client 56 | ## e.g. add C:\Program Files\RStudio\bin\msys-ssh-1000-18 to your PATH 57 | ## then run: 58 | vm2 <- gce_vm("my-instance2") 59 | 60 | ## add SSH info to the VM object 61 | ## custom info 62 | vm <- gce_ssh_setup(vm, 63 | username = "mark", 64 | key.pub = "C://.ssh/id_rsa.pub", 65 | key.private = "C://.ssh/id_rsa") 66 | 67 | ## run command on instance 68 | gce_ssh(vm, "echo foo") 69 | #> foo 70 | 71 | ## example to check logs of rstudio docker container 72 | gce_ssh(vm, "sudo journalctl -u rstudio") 73 | 74 | } 75 | } 76 | \seealso{ 77 | Other ssh functions: 78 | \code{\link{gce_ssh_browser}()}, 79 | \code{\link{gce_ssh_setup}()}, 80 | \code{\link{gce_ssh}()} 81 | } 82 | \concept{ssh functions} 83 | -------------------------------------------------------------------------------- /man/gce_ssh_browser.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ssh.R 3 | \name{gce_ssh_browser} 4 | \alias{gce_ssh_browser} 5 | \title{Open a cloud SSH browser for an instance} 6 | \usage{ 7 | gce_ssh_browser(instance) 8 | } 9 | \arguments{ 10 | \item{instance}{the instance resource} 11 | } 12 | \value{ 13 | Opens a browser window to the SSH session, returns the SSH URL. 14 | } 15 | \description{ 16 | This will open an SSH from the browser session if \code{getOption("browser")} is not NULL 17 | } 18 | \details{ 19 | You will need to login the first time with an email that has access to the instance. 20 | } 21 | \seealso{ 22 | \url{https://cloud.google.com/compute/docs/ssh-in-browser} 23 | 24 | Other ssh functions: 25 | \code{\link{gce_ssh_addkeys}()}, 26 | \code{\link{gce_ssh_setup}()}, 27 | \code{\link{gce_ssh}()} 28 | } 29 | \concept{ssh functions} 30 | -------------------------------------------------------------------------------- /man/gce_ssh_setup.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ssh_admin.R 3 | \name{gce_ssh_setup} 4 | \alias{gce_ssh_setup} 5 | \title{Setup a SSH connection with GCE from a new SSH key-pair} 6 | \usage{ 7 | gce_ssh_setup( 8 | instance, 9 | key.pub = NULL, 10 | key.private = NULL, 11 | ssh_overwrite = FALSE, 12 | username = Sys.info()[["user"]] 13 | ) 14 | } 15 | \arguments{ 16 | \item{instance}{Name of the instance of run ssh command upon} 17 | 18 | \item{key.pub}{The filepath location of the public key} 19 | 20 | \item{key.private}{The filepath location of the private key} 21 | 22 | \item{ssh_overwrite}{Will check if SSH settings already set and overwrite them if TRUE} 23 | 24 | \item{username}{The username you used to generate the key-pair} 25 | } 26 | \value{ 27 | TRUE if successful 28 | } 29 | \description{ 30 | Uploads ssh-keys to an instance 31 | } 32 | \details{ 33 | This loads a public ssh-key to an instance's metadata. It does not use the project SSH-Keys, that may be set separately. 34 | 35 | You will need to generate a new SSH key-pair if you have not connected to an instance before. 36 | 37 | Instructions for this can be found here: \url{https://cloud.google.com/compute/docs/instances/connecting-to-instance}. Once you have generated run this function once to initiate setup. 38 | 39 | If you have historically connected via gcloud or some other means, ssh keys may have been generated automatically. 40 | 41 | These will be looked for and used if found, at \code{file.path(Sys.getenv("HOME"), ".ssh", "google_compute_engine.pub")} 42 | } 43 | \examples{ 44 | 45 | \dontrun{ 46 | 47 | library(googleComputeEngineR) 48 | 49 | vm <- gce_vm("my-instance") 50 | 51 | ## if you have already logged in via gcloud, the default keys will be used 52 | ## no need to run gce_ssh_addkeys 53 | ## run command on instance 54 | gce_ssh(vm, "echo foo") 55 | 56 | 57 | ## if running on Windows, use the RStudio default SSH client 58 | ## e.g. add C:\Program Files\RStudio\bin\msys-ssh-1000-18 to your PATH 59 | ## then run: 60 | vm2 <- gce_vm("my-instance2") 61 | 62 | ## add SSH info to the VM object 63 | ## custom info 64 | vm <- gce_ssh_setup(vm, 65 | username = "mark", 66 | key.pub = "C://.ssh/id_rsa.pub", 67 | key.private = "C://.ssh/id_rsa") 68 | 69 | ## run command on instance 70 | gce_ssh(vm, "echo foo") 71 | #> foo 72 | 73 | ## example to check logs of rstudio docker container 74 | gce_ssh(vm, "sudo journalctl -u rstudio") 75 | 76 | } 77 | } 78 | \seealso{ 79 | \url{https://cloud.google.com/compute/docs/instances/adding-removing-ssh-keys} 80 | 81 | Other ssh functions: 82 | \code{\link{gce_ssh_addkeys}()}, 83 | \code{\link{gce_ssh_browser}()}, 84 | \code{\link{gce_ssh}()} 85 | } 86 | \concept{ssh functions} 87 | -------------------------------------------------------------------------------- /man/gce_startup_logs.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/container.R 3 | \name{gce_startup_logs} 4 | \alias{gce_startup_logs} 5 | \title{Get startup script logs} 6 | \usage{ 7 | gce_startup_logs(instance, type = c("shell", "cloud-config", "nginx")) 8 | } 9 | \arguments{ 10 | \item{instance}{The instance to get startup script logs from} 11 | 12 | \item{type}{The type of log to run 13 | 14 | Will use SSH so that needs to be setup} 15 | } 16 | \description{ 17 | Get startup script logs 18 | } 19 | -------------------------------------------------------------------------------- /man/gce_tag_container.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/build.R 3 | \name{gce_tag_container} 4 | \alias{gce_tag_container} 5 | \title{Return a container tag for Google Container Registry} 6 | \usage{ 7 | gce_tag_container( 8 | container_name, 9 | project = gce_get_global_project(), 10 | container_url = "gcr.io" 11 | ) 12 | } 13 | \arguments{ 14 | \item{container_name}{A running docker container. Can't be set if \code{image_name} is too.} 15 | 16 | \item{project}{Project ID for this request, default as set by \link{gce_get_global_project} 17 | 18 | This will only work on the Google Container optimised containers of image_family google_containers. 19 | Otherwise you will need to get a container authentication yourself (for now) 20 | 21 | It will start the push but it may take a long time to finish, especially the first time, 22 | this function will return whilst waiting but don't turn off the VM until its finished.} 23 | 24 | \item{container_url}{The URL of where to save container} 25 | } 26 | \value{ 27 | A tag for use in Google Container Registry 28 | } 29 | \description{ 30 | Return a container tag for Google Container Registry 31 | } 32 | \seealso{ 33 | Other container registry functions: 34 | \code{\link{gce_pull_registry}()}, 35 | \code{\link{gce_push_registry}()} 36 | } 37 | \concept{container registry functions} 38 | -------------------------------------------------------------------------------- /man/gce_vm_cluster.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/future.R 3 | \name{gce_vm_cluster} 4 | \alias{gce_vm_cluster} 5 | \title{Make a VM cluster suitable for running parallel workloads} 6 | \usage{ 7 | gce_vm_cluster( 8 | vm_prefix = "r-cluster-", 9 | cluster_size = 3, 10 | docker_image = NULL, 11 | ..., 12 | ssh_args = NULL, 13 | project = gce_get_global_project(), 14 | zone = gce_get_global_zone() 15 | ) 16 | } 17 | \arguments{ 18 | \item{vm_prefix}{The prefix of the VMs you want to make. Will be appended the cluster number} 19 | 20 | \item{cluster_size}{The number of VMs in your cluster} 21 | 22 | \item{docker_image}{The docker image the jobs on the cluster will run on. Default NULL will use \code{rocker/r-parallel}} 23 | 24 | \item{...}{Passed to \link{gce_vm_template}} 25 | 26 | \item{ssh_args}{A list of optional arguments that will be passed to \link{gce_ssh_setup}} 27 | 28 | \item{project}{The project to launch the cluster in} 29 | 30 | \item{zone}{The zone to launch the cluster in} 31 | } 32 | \description{ 33 | This wraps the commands for creating a cluster suitable for \link[future]{future} workloads. 34 | } 35 | \examples{ 36 | 37 | \dontrun{ 38 | library(future) 39 | library(googleComputeEngineR) 40 | 41 | vms <- gce_vm_cluster() 42 | 43 | ## make a future cluster 44 | plan(cluster, workers = as.cluster(vms)) 45 | 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /man/gce_vm_container.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/container.R 3 | \name{gce_vm_container} 4 | \alias{gce_vm_container} 5 | \title{Launch a container-VM image} 6 | \usage{ 7 | gce_vm_container( 8 | file = NULL, 9 | cloud_init = NULL, 10 | shell_script = NULL, 11 | image_family = "cos-stable", 12 | image_project = "cos-cloud", 13 | ... 14 | ) 15 | } 16 | \arguments{ 17 | \item{file}{file location of a valid cloud-init or shell_script file. 18 | One of \code{file} or \code{cloud_init} or \code{shell_script} must be supplied} 19 | 20 | \item{cloud_init}{contents of a cloud-init file, for example read via \code{readChar(file, nchars = 32768)}} 21 | 22 | \item{shell_script}{contents of a shell_script file, for example read via \code{readChar(file, nchars = 32768)}} 23 | 24 | \item{image_family}{An image-family. It must come from the \code{image_project} family.} 25 | 26 | \item{image_project}{An image-project, where the image-family resides.} 27 | 28 | \item{...}{Other arguments passed to \link{gce_vm_create}} 29 | } 30 | \value{ 31 | A zone operation 32 | } 33 | \description{ 34 | This lets you specify docker images when creating the VM. These are a special class of Google instances that are setup for running Docker containers. 35 | } 36 | \details{ 37 | \code{file} expects a filepath to a \href{cloud-init}{https://cloudinit.readthedocs.io/en/latest/topics/format.html} configuration file or a valid bash script e.g. has \code{!#/bin/} or \code{#cloud-config} at top of file. 38 | 39 | \code{image_project} will be ignored if set, overriden to \code{cos-cloud}. 40 | If you want to set it then use the \link{gce_vm_create} function directly that this function wraps with some defaults. 41 | } 42 | \seealso{ 43 | \url{https://cloud.google.com/container-optimized-os/docs/how-to/create-configure-instance} - \href{https://www.freedesktop.org/software/systemd/man/systemd.service.html}{help using cloud-init files} 44 | } 45 | -------------------------------------------------------------------------------- /man/gce_vm_delete.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/vms.R 3 | \name{gce_vm_delete} 4 | \alias{gce_vm_delete} 5 | \title{Deletes the specified Instance resource.} 6 | \usage{ 7 | gce_vm_delete( 8 | instances, 9 | project = gce_get_global_project(), 10 | zone = gce_get_global_zone() 11 | ) 12 | } 13 | \arguments{ 14 | \item{instances}{Name of the instance resource, or an instance object e.g. from \link{gce_get_instance}, or a list of instances to delete} 15 | 16 | \item{project}{Project ID for this request, default as set by \link{gce_get_global_project}} 17 | 18 | \item{zone}{The name of the zone for this request, default as set by \link{gce_get_global_zone}} 19 | } 20 | \description{ 21 | Deletes the specified Instance resource. 22 | } 23 | \details{ 24 | Authentication scopes used by this function are: 25 | \itemize{ 26 | \item https://www.googleapis.com/auth/cloud-platform 27 | \item https://www.googleapis.com/auth/compute 28 | } 29 | } 30 | \seealso{ 31 | \href{https://developers.google.com/compute/docs/reference/latest/}{Google Documentation} 32 | } 33 | -------------------------------------------------------------------------------- /man/gce_vm_deletion_protection.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/deletion-prevention.R 3 | \name{gce_vm_deletion_protection} 4 | \alias{gce_vm_deletion_protection} 5 | \title{Toggle deletion protection for existing instances} 6 | \usage{ 7 | gce_vm_deletion_protection( 8 | instance, 9 | cmd = c("status", "true", "false"), 10 | project = gce_get_global_project(), 11 | zone = gce_get_global_zone() 12 | ) 13 | } 14 | \arguments{ 15 | \item{instance}{The vm to work with its deletion protection} 16 | 17 | \item{cmd}{Whether to get the status, or toggle "true" or "false" 18 | on deletion protection for this VM} 19 | 20 | \item{project}{The projectId} 21 | 22 | \item{zone}{The zone} 23 | } 24 | \description{ 25 | Toggle deletion protection for existing instances 26 | } 27 | \examples{ 28 | 29 | \dontrun{ 30 | 31 | # a workflow for deleting lots of VMs across zones that have deletion protection 32 | zones <- gce_list_zones() 33 | instances <- lapply(zones$name, function(x) gce_list_instances(zone = x)) 34 | 35 | instances_e <- lapply(instances, function(x) x$items$name) 36 | names(instances_e) <- zones$name 37 | 38 | status <- lapply(zones$name, function(x){ 39 | lapply(instances_e[[x]], function(y) { 40 | gce_vm_deletion_protection(y, cmd = "false", zone = x))) 41 | } 42 | } 43 | 44 | deletes <- lapply(zones$name, function(x){ 45 | lapply(instances_e[[x]], function(y) { 46 | gce_vm_delete(y, zone = x))) 47 | } 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /man/gce_vm_gpu.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/gpus.R 3 | \name{gce_vm_gpu} 4 | \alias{gce_vm_gpu} 5 | \title{Launch a GPU enabled instance} 6 | \usage{ 7 | gce_vm_gpu(..., return_dots = FALSE) 8 | } 9 | \arguments{ 10 | \item{...}{arguments passed to \link{gce_vm}} 11 | 12 | \item{return_dots}{Only return the settings, do not call \link{gce_vm}} 13 | } 14 | \value{ 15 | A VM object 16 | } 17 | \description{ 18 | Helper function that fills in some defaults passed to \link{gce_vm} 19 | } 20 | \details{ 21 | If not specified, this function will enter defaults to get a GPU instance up and running. 22 | 23 | \itemize{ 24 | \item \code{acceleratorCount: 1} 25 | \item \code{acceleratorType: "nvidia-tesla-p4"} 26 | \item \code{scheduling: list(onHostMaintenance = "TERMINATE", automaticRestart = TRUE)} 27 | \item \code{image_project: "deeplearning-platform-release"} 28 | \item \code{image_family: "tf2-ent-latest-gpu"} 29 | \item \code{predefined_type: "n1-standard-8"} 30 | \item \code{metadata: "install-nvidia-driver" = "True"} 31 | } 32 | } 33 | \seealso{ 34 | \href{Deep Learning VM}{https://cloud.google.com/deep-learning-vm/docs/quickstart-cli} 35 | 36 | Other GPU instances: 37 | \code{\link{gce_check_gpu}()}, 38 | \code{\link{gce_list_gpus}()} 39 | } 40 | \concept{GPU instances} 41 | -------------------------------------------------------------------------------- /man/gce_vm_logs.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/vms.R 3 | \name{gce_vm_logs} 4 | \alias{gce_vm_logs} 5 | \title{Open browser to the serial console output for a VM} 6 | \usage{ 7 | gce_vm_logs(instance, open_browser = TRUE) 8 | } 9 | \arguments{ 10 | \item{instance}{The VM to see serial console output for} 11 | 12 | \item{open_browser}{Whether to return a URL or open the browser} 13 | } 14 | \value{ 15 | a URL 16 | } 17 | \description{ 18 | Saves a few clicks 19 | } 20 | -------------------------------------------------------------------------------- /man/gce_vm_reset.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/vms.R 3 | \name{gce_vm_reset} 4 | \alias{gce_vm_reset} 5 | \title{Performs a hard reset on the instance.} 6 | \usage{ 7 | gce_vm_reset( 8 | instances, 9 | project = gce_get_global_project(), 10 | zone = gce_get_global_zone() 11 | ) 12 | } 13 | \arguments{ 14 | \item{instances}{Name of the instance resource, or an instance object e.g. from \link{gce_get_instance}} 15 | 16 | \item{project}{Project ID for this request, default as set by \link{gce_get_global_project}} 17 | 18 | \item{zone}{The name of the zone for this request, default as set by \link{gce_get_global_zone}} 19 | } 20 | \description{ 21 | Performs a hard reset on the instance. 22 | } 23 | \details{ 24 | Authentication scopes used by this function are: 25 | \itemize{ 26 | \item https://www.googleapis.com/auth/cloud-platform 27 | \item https://www.googleapis.com/auth/compute 28 | } 29 | } 30 | \seealso{ 31 | \href{https://developers.google.com/compute/docs/reference/latest/}{Google Documentation} 32 | } 33 | -------------------------------------------------------------------------------- /man/gce_vm_scheduler.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/scheduler.R 3 | \name{gce_vm_scheduler} 4 | \alias{gce_vm_scheduler} 5 | \title{Create or start a scheduler VM} 6 | \usage{ 7 | gce_vm_scheduler(vm_name = "scheduler", ...) 8 | } 9 | \arguments{ 10 | \item{vm_name}{The name of the VM scheduler to create or return} 11 | 12 | \item{...}{ 13 | Arguments passed on to \code{\link[=gce_vm]{gce_vm}} 14 | \describe{ 15 | \item{\code{name}}{The name of the instance} 16 | \item{\code{open_webports}}{If TRUE, will open firewall ports 80 and 443 if not open already} 17 | \item{\code{project}}{Project ID for this request} 18 | \item{\code{zone}}{The name of the zone for this request} 19 | }} 20 | } 21 | \value{ 22 | A VM object 23 | } 24 | \description{ 25 | This starts up a VM with cron and docker installed that can be used to schedule scripts 26 | } 27 | \seealso{ 28 | Other scheduler functions: 29 | \code{\link{gce_schedule_docker}()} 30 | } 31 | \concept{scheduler functions} 32 | -------------------------------------------------------------------------------- /man/gce_vm_start.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/vms.R 3 | \name{gce_vm_start} 4 | \alias{gce_vm_start} 5 | \title{Starts an instance that was stopped using the using the stop method.} 6 | \usage{ 7 | gce_vm_start( 8 | instances, 9 | project = gce_get_global_project(), 10 | zone = gce_get_global_zone() 11 | ) 12 | } 13 | \arguments{ 14 | \item{instances}{Name of the instance resource, or an instance object e.g. from \link{gce_get_instance}} 15 | 16 | \item{project}{Project ID for this request, default as set by \link{gce_get_global_project}} 17 | 18 | \item{zone}{The name of the zone for this request, default as set by \link{gce_get_global_zone}} 19 | } 20 | \value{ 21 | A list of operation objects with pending status 22 | } 23 | \description{ 24 | Starts an instance that was stopped using the using the stop method. 25 | } 26 | \details{ 27 | Authentication scopes used by this function are: 28 | \itemize{ 29 | \item https://www.googleapis.com/auth/cloud-platform 30 | \item https://www.googleapis.com/auth/compute 31 | } 32 | } 33 | \seealso{ 34 | \href{https://developers.google.com/compute/docs/reference/latest/}{Google Documentation} 35 | } 36 | -------------------------------------------------------------------------------- /man/gce_vm_stop.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/vms.R 3 | \name{gce_vm_stop} 4 | \alias{gce_vm_stop} 5 | \alias{gce_vm_suspend} 6 | \alias{gce_vm_resume} 7 | \title{Stops a running instance, shutting it down cleanly, and allows you to restart the instance at a later time.} 8 | \usage{ 9 | gce_vm_stop( 10 | instances, 11 | project = gce_get_global_project(), 12 | zone = gce_get_global_zone() 13 | ) 14 | 15 | gce_vm_suspend( 16 | instances, 17 | project = gce_get_global_project(), 18 | zone = gce_get_global_zone() 19 | ) 20 | 21 | gce_vm_resume( 22 | instances, 23 | project = gce_get_global_project(), 24 | zone = gce_get_global_zone() 25 | ) 26 | } 27 | \arguments{ 28 | \item{instances}{Names of the instance resource, or an instance object e.g. from \link{gce_get_instance}} 29 | 30 | \item{project}{Project ID for this request, default as set by \link{gce_get_global_project}} 31 | 32 | \item{zone}{The name of the zone for this request, default as set by \link{gce_get_global_zone}} 33 | } 34 | \description{ 35 | Stops a running instance, shutting it down cleanly, and allows you to restart the instance at a later time. 36 | } 37 | \details{ 38 | Authentication scopes used by this function are: 39 | \itemize{ 40 | \item https://www.googleapis.com/auth/cloud-platform 41 | \item https://www.googleapis.com/auth/compute 42 | } 43 | 44 | Stopped instances do not incur per-minute, virtual machine usage charges 45 | while they are stopped, but any resources that the virtual machine is using, 46 | such as persistent disks and static IP addresses, 47 | will continue to be charged until they are deleted. 48 | } 49 | \seealso{ 50 | \href{https://developers.google.com/compute/docs/reference/latest/}{Google Documentation} 51 | } 52 | -------------------------------------------------------------------------------- /man/gce_wait.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/operations.R 3 | \name{gce_wait} 4 | \alias{gce_wait} 5 | \title{Wait for an operation to finish} 6 | \usage{ 7 | gce_wait(operation, wait = 3, verbose = TRUE, timeout_tries = 50) 8 | } 9 | \arguments{ 10 | \item{operation}{The operation object} 11 | 12 | \item{wait}{Time in seconds between checks, default 3 seconds.} 13 | 14 | \item{verbose}{Whether to give user feedback} 15 | 16 | \item{timeout_tries}{Number of times to wait} 17 | } 18 | \value{ 19 | The completed job object, invisibly 20 | } 21 | \description{ 22 | Will periodically check an operation until its status is \code{DONE} 23 | } 24 | -------------------------------------------------------------------------------- /man/get_dockerfolder.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/template.R 3 | \name{get_dockerfolder} 4 | \alias{get_dockerfolder} 5 | \title{Get Dockerfolder of templates} 6 | \usage{ 7 | get_dockerfolder(dockerfile_folder) 8 | } 9 | \arguments{ 10 | \item{dockerfile_folder}{The folder containing \code{Dockerfile}} 11 | } 12 | \value{ 13 | file location 14 | } 15 | \description{ 16 | This gets the folder location of available Dockerfile examples 17 | } 18 | -------------------------------------------------------------------------------- /man/googleComputeEngineR.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/googleComputeEngineR.R 3 | \docType{package} 4 | \name{googleComputeEngineR} 5 | \alias{googleComputeEngineR} 6 | \title{Working with Google Compute Engine from R} 7 | \description{ 8 | See demos and examples at the \href{googleComputeEngineR website}{https://cloudyr.github.io/googleComputeEngineR/}. 9 | } 10 | -------------------------------------------------------------------------------- /man/idempotency.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/utilities.R 3 | \name{idempotency} 4 | \alias{idempotency} 5 | \title{Idempotency} 6 | \usage{ 7 | idempotency() 8 | } 9 | \value{ 10 | A random 15 digit hash 11 | } 12 | \description{ 13 | A random code to ensure no repeats 14 | } 15 | \keyword{internal} 16 | -------------------------------------------------------------------------------- /man/is.NullOb.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/utilities.R 3 | \name{is.NullOb} 4 | \alias{is.NullOb} 5 | \title{A helper function that tests whether an object is either NULL _or_ 6 | a list of NULLs} 7 | \usage{ 8 | is.NullOb(x) 9 | } 10 | \description{ 11 | A helper function that tests whether an object is either NULL _or_ 12 | a list of NULLs 13 | } 14 | \keyword{internal} 15 | -------------------------------------------------------------------------------- /man/is.error.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/utilities.R 3 | \name{is.error} 4 | \alias{is.error} 5 | \title{Is this a try error?} 6 | \usage{ 7 | is.error(test_me) 8 | } 9 | \arguments{ 10 | \item{test_me}{an object created with try()} 11 | } 12 | \value{ 13 | Boolean 14 | } 15 | \description{ 16 | Utility to test errors 17 | } 18 | \keyword{internal} 19 | -------------------------------------------------------------------------------- /man/localhost.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/harbor_container.R 3 | \docType{data} 4 | \name{localhost} 5 | \alias{localhost} 6 | \title{An object representing the current computer that R is running on.} 7 | \format{ 8 | An object of class \code{localhost} (inherits from \code{host}) of length 0. 9 | } 10 | \usage{ 11 | localhost 12 | } 13 | \description{ 14 | An object representing the current computer that R is running on. 15 | } 16 | \keyword{datasets} 17 | -------------------------------------------------------------------------------- /man/makeDockerClusterPSOCK.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/future.R 3 | \name{makeDockerClusterPSOCK} 4 | \alias{makeDockerClusterPSOCK} 5 | \title{Make the Docker cluster on Google Compute Engine} 6 | \usage{ 7 | makeDockerClusterPSOCK( 8 | workers, 9 | docker_image = "rocker/r-parallel", 10 | rscript = c("docker", "run", "--net=host", docker_image, "Rscript"), 11 | rscript_args = NULL, 12 | install_future = FALSE, 13 | ..., 14 | verbose = FALSE 15 | ) 16 | } 17 | \arguments{ 18 | \item{workers}{The VMs being called upon} 19 | 20 | \item{docker_image}{The docker image to use on the cluster} 21 | 22 | \item{rscript}{The Rscript command to run on the cluster} 23 | 24 | \item{rscript_args}{Arguments to the RScript} 25 | 26 | \item{install_future}{Whether to check if future is installed first (not needed if using docker derived from rocker/r-parallel which is recommended)} 27 | 28 | \item{...}{Other arguments passed to \link[parallelly]{makeClusterPSOCK}} 29 | 30 | \item{verbose}{How much feedback to show} 31 | } 32 | \description{ 33 | Called by \link{as.cluster} 34 | } 35 | \author{ 36 | Henrik Bengtsson \email{henrikb@braju.com} 37 | } 38 | -------------------------------------------------------------------------------- /man/read_cloud_init_file.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/cloud-init.R 3 | \name{read_cloud_init_file} 4 | \alias{read_cloud_init_file} 5 | \title{create the cloud_init file to upload} 6 | \usage{ 7 | read_cloud_init_file(template) 8 | } 9 | \description{ 10 | create the cloud_init file to upload 11 | } 12 | \keyword{internal} 13 | -------------------------------------------------------------------------------- /man/read_shell_startup_file.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/startup-scripts.R 3 | \name{read_shell_startup_file} 4 | \alias{read_shell_startup_file} 5 | \title{create the shell file to upload} 6 | \usage{ 7 | read_shell_startup_file(template) 8 | } 9 | \description{ 10 | create the shell file to upload 11 | } 12 | \keyword{internal} 13 | -------------------------------------------------------------------------------- /man/rmNullObs.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/utilities.R 3 | \name{rmNullObs} 4 | \alias{rmNullObs} 5 | \title{Recursively step down into list, removing all such objects} 6 | \usage{ 7 | rmNullObs(x) 8 | } 9 | \description{ 10 | Recursively step down into list, removing all such objects 11 | } 12 | \keyword{internal} 13 | -------------------------------------------------------------------------------- /man/timestamp_to_r.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/utilities.R 3 | \name{timestamp_to_r} 4 | \alias{timestamp_to_r} 5 | \title{Timestamp to R date} 6 | \usage{ 7 | timestamp_to_r(t) 8 | } 9 | \description{ 10 | Timestamp to R date 11 | } 12 | \keyword{internal} 13 | -------------------------------------------------------------------------------- /tests/testthat.R: -------------------------------------------------------------------------------- 1 | library(testthat) 2 | library(googleComputeEngineR) 3 | 4 | # change this to run tests 5 | do_test <- FALSE 6 | 7 | if(all(Sys.getenv("CI") != "true", do_test)){ 8 | test_check("googleComputeEngineR") 9 | } 10 | 11 | -------------------------------------------------------------------------------- /tests/testthat/test_aa_auth.R: -------------------------------------------------------------------------------- 1 | 2 | # context("Auth") 3 | 4 | # test_that("We can login", { 5 | # skip_on_cran() 6 | # 7 | # expect_is(gce_auth(), "Token2.0") 8 | # 9 | # }) 10 | 11 | context("Projects") 12 | 13 | test_that("We can see a project resource", { 14 | skip_on_cran() 15 | 16 | proj <- gce_get_project("mark-edmondson-gde") 17 | expect_equal(proj$kind, "compute#project") 18 | 19 | }) 20 | 21 | context("Auto projects") 22 | 23 | test_that("We can set auto project", { 24 | skip_on_cran() 25 | 26 | proj <- gce_global_project("mark-edmondson-gde2") 27 | expect_equal(proj, "mark-edmondson-gde2") 28 | 29 | proj <- gce_global_project("mark-edmondson-gde") 30 | expect_equal(proj, "mark-edmondson-gde") 31 | 32 | }) 33 | 34 | test_that("We can get auto project", { 35 | skip_on_cran() 36 | 37 | proj <- gce_get_global_project() 38 | 39 | expect_equal(proj, "mark-edmondson-gde") 40 | 41 | }) 42 | 43 | context("Auto Zone") 44 | 45 | test_that("We can set auto zones", { 46 | skip_on_cran() 47 | 48 | z <- gce_global_zone("europe-west1-a") 49 | expect_equal(z, "europe-west1-a") 50 | 51 | z <- gce_global_zone("europe-west1-b") 52 | expect_equal(z, "europe-west1-b") 53 | 54 | }) 55 | 56 | test_that("We can get auto zone", { 57 | skip_on_cran() 58 | 59 | proj <- gce_get_global_zone() 60 | 61 | expect_equal(proj, "europe-west1-b") 62 | 63 | }) 64 | 65 | context("Networks") 66 | 67 | test_that("We can list networks", { 68 | skip_on_cran() 69 | 70 | networks <- gce_list_networks() 71 | 72 | expect_equal(networks$kind, "compute#networkList") 73 | 74 | }) 75 | 76 | test_that("We can get a network", { 77 | skip_on_cran() 78 | 79 | networks <- gce_get_network("default") 80 | 81 | expect_equal(networks$kind, "compute#network") 82 | 83 | }) 84 | 85 | -------------------------------------------------------------------------------- /tests/testthat/test_cc_disks.R: -------------------------------------------------------------------------------- 1 | 2 | context("Disks") 3 | 4 | test_that("We can list disks in a zone", { 5 | skip_on_cran() 6 | 7 | the_list <- gce_list_disks() 8 | expect_equal(the_list$kind, "compute#diskList") 9 | 10 | 11 | }) 12 | 13 | test_that("We can list disks in all", { 14 | skip_on_cran() 15 | 16 | the_list <- gce_list_disks_all() 17 | expect_equal(the_list$kind, "compute#diskAggregatedList") 18 | 19 | 20 | }) 21 | 22 | test_that("We can create and/or get a disk", { 23 | skip_on_cran() 24 | 25 | job <- gce_make_disk("test-disk") 26 | 27 | if(job$kind == "compute#operation"){ 28 | gce_wait(job, wait = 10) 29 | } 30 | 31 | disk <- gce_get_disk("test-disk") 32 | 33 | 34 | disk <- gce_get_disk("test-disk") 35 | expect_equal(disk$kind, "compute#disk") 36 | 37 | 38 | }) 39 | 40 | test_that("We can create a disk from an image", { 41 | skip_on_cran() 42 | 43 | img <- gce_get_image_family("debian-cloud","debian-8") 44 | expect_equal(img$kind, "compute#image") 45 | 46 | job <- gce_make_disk("test-disk-image", sourceImage = img$selfLink) 47 | 48 | disk <- gce_wait(job, wait = 10) 49 | 50 | disk_image <- gce_get_disk("test-disk-image") 51 | expect_equal(disk_image$sourceImage, img$selfLink) 52 | 53 | 54 | }) 55 | 56 | 57 | test_that("We can attach a disk", { 58 | skip_on_cran() 59 | 60 | disk_image <- gce_get_disk("test-disk-image") 61 | 62 | job <- gce_attach_disk(instance = "rstudio-test", 63 | autoDelete = TRUE, 64 | source = disk_image$selfLink) 65 | gce_wait(job) 66 | 67 | ins <- gce_get_instance("rstudio-test") 68 | 69 | expect_true(disk_image$selfLink %in% ins$disks$source) 70 | 71 | }) 72 | 73 | 74 | 75 | test_that("We can delete a disk", { 76 | skip_on_cran() 77 | 78 | job <- gce_delete_disk("test-disk") 79 | 80 | disk <- gce_wait(job, wait = 10) 81 | 82 | expect_equal(disk$kind, "compute#operation") 83 | expect_equal(disk$status, "DONE") 84 | 85 | # expect_error(gce_get_disk("test-disk")) 86 | 87 | }) 88 | 89 | -------------------------------------------------------------------------------- /tests/testthat/test_externalIP.R: -------------------------------------------------------------------------------- 1 | library(googleComputeEngineR) 2 | 3 | context("externalIP") 4 | 5 | test_that("A new External IP is automatically created and assigned to the VM", { 6 | vm <- gce_vm(template = "rstudio", 7 | name = "rstudio-server-6", 8 | username = "jas", password = "jas12345", 9 | predefined_type = "n1-standard-8", 10 | externalIP = NULL 11 | ) 12 | expect_equal(vm$status, "RUNNING") 13 | }) 14 | 15 | test_that("We can assign an External IP already created to the VM", { 16 | vm <- gce_vm(template = "rstudio", 17 | name = "rstudio-server-6", 18 | username = "jas", password = "jas12345", 19 | predefined_type = "n1-standard-8", 20 | externalIP = "35.230.96.64" 21 | ) 22 | expect_equal(vm$status, "RUNNING") 23 | }) 24 | 25 | test_that("An invalid IP which has not been previous created shouldn't work.", { 26 | vm <- gce_vm(template = "rstudio", 27 | name = "rstudio-server-6", 28 | username = "jas", password = "jas12345", 29 | predefined_type = "n1-standard-8", 30 | externalIP = "103.323.2323.232" 31 | ) 32 | #An error message should appear similar to: 33 | #Error: API returned: Invalid value for field 'resource.networkInterfaces[0].accessConfigs[0].natIP': '103.323.2323.232'. The specified external IP address '103.323.2323.232' was not found in region 'us-west1'. 34 | }) 35 | 36 | test_that("No IP should be assigned to the VM if externalIP specified as none", { 37 | vm <- gce_vm(template = "rstudio", 38 | name = "rstudio-server-7", 39 | username = "jas", password = "jas12345", 40 | predefined_type = "n1-standard-8", 41 | externalIP = "none" 42 | ) 43 | expect_equal(gce_get_external_ip(vm), NULL) 44 | }) 45 | -------------------------------------------------------------------------------- /tests/testthat/test_firewalls.R: -------------------------------------------------------------------------------- 1 | 2 | context("Firewalls") 3 | 4 | test_that("We can list firewalls", { 5 | skip_on_cran() 6 | 7 | the_list <- gce_list_firewall_rules(project = "mark-edmondson-gde") 8 | expect_equal(the_list$kind, "compute#firewallList") 9 | 10 | 11 | }) 12 | 13 | test_that("We can create a firewall rule", { 14 | skip_on_cran() 15 | 16 | the_rule <- gce_make_firewall_rule(name = "test-rule", 17 | protocol = "tcp", 18 | ports = 9988, 19 | project = "mark-edmondson-gde") 20 | ## global op 21 | expect_equal(the_rule$kind, "compute#operation") 22 | 23 | gce_wait(the_rule) 24 | 25 | fw <- gce_get_firewall_rule("test-rule") 26 | 27 | expect_equal(fw$kind, "compute#firewall") 28 | 29 | }) 30 | 31 | test_that("We can get a firewall rule", { 32 | skip_on_cran() 33 | 34 | the_rule <- gce_get_firewall_rule("test-rule", project = "mark-edmondson-gde") 35 | expect_equal(the_rule$kind, "compute#firewall") 36 | 37 | 38 | }) 39 | 40 | test_that("We can delete a firewall rule", { 41 | skip_on_cran() 42 | 43 | the_op <- gce_delete_firewall_rule("test-rule", project = "mark-edmondson-gde") 44 | expect_equal(the_op$kind, "compute#operation") 45 | 46 | job <- gce_wait(the_op) 47 | expect_equal(job$status, "DONE") 48 | }) 49 | 50 | test_that("We can create a web firewall rule", { 51 | skip_on_cran() 52 | 53 | fws <- gce_make_firewall_webports() 54 | 55 | expect_equal(fws[[1]]$kind, "compute#firewall") 56 | expect_equal(fws[[2]]$kind, "compute#firewall") 57 | }) -------------------------------------------------------------------------------- /tests/testthat/test_images.R: -------------------------------------------------------------------------------- 1 | 2 | context("Images") 3 | 4 | test_that("We can list images", { 5 | skip_on_cran() 6 | 7 | images <- gce_list_images(image_project = "cos-cloud") 8 | 9 | expect_equal(images$kind, "compute#imageList") 10 | 11 | }) 12 | 13 | test_that("We can get an image from a family", { 14 | skip_on_cran() 15 | 16 | image <- gce_get_image_family(image_project = "cos-cloud", family = "cos-stable") 17 | 18 | expect_equal(image$kind, "compute#image") 19 | expect_equal(image$family, "cos-stable") 20 | 21 | }) 22 | 23 | test_that("We can get a specific image", { 24 | skip_on_cran() 25 | 26 | images <- gce_list_images(image_project = "cos-cloud") 27 | 28 | image <- gce_get_image(image_project = "cos-cloud", image = images$items$name[[1]]) 29 | 30 | expect_equal(image$kind, "compute#image") 31 | }) -------------------------------------------------------------------------------- /tests/testthat/test_machinetype.R: -------------------------------------------------------------------------------- 1 | 2 | context("Machine types") 3 | 4 | test_that("We can list machinetypes", { 5 | skip_on_cran() 6 | 7 | the_list <- gce_list_machinetype() 8 | expect_equal(the_list$kind, "compute#machineTypeList") 9 | 10 | 11 | }) 12 | 13 | test_that("We can list aggregated machinetypes", { 14 | skip_on_cran() 15 | 16 | the_list <- gce_list_machinetype_all() 17 | expect_equal(the_list$kind, "compute#machineTypeAggregatedList") 18 | 19 | 20 | }) 21 | 22 | test_that("We can get a machine type", { 23 | skip_on_cran() 24 | 25 | the_mt <- gce_get_machinetype("f1-micro") 26 | expect_equal(the_mt$kind, "compute#machineType") 27 | 28 | 29 | }) 30 | 31 | test_that("We can make a predefined machine type URL ", { 32 | skip_on_cran() 33 | 34 | mt_url<- gce_make_machinetype_url("f1-micro", zone = "europe-west1-b") 35 | expect_equal(mt_url, "zones/europe-west1-b/machineTypes/f1-micro") 36 | 37 | 38 | }) 39 | 40 | test_that("We can make a custom machine type URL ", { 41 | skip_on_cran() 42 | 43 | mt_url<- gce_make_machinetype_url(cpus = 2, memory = 256, zone = "europe-west1-b") 44 | expect_equal(mt_url, "zones/europe-west1-b/machineTypes/custom-2-256") 45 | 46 | 47 | }) 48 | 49 | test_that("We can change a machine type", { 50 | skip_on_cran() 51 | 52 | mt <- gce_set_machinetype("f1-micro", instance = "markdev") 53 | 54 | expect_equal(mt$kind, "compute#operation") 55 | 56 | job <- gce_wait(mt) 57 | 58 | expect_equal(job$status, "DONE") 59 | 60 | ## change it back 61 | Sys.sleep(10) 62 | mt <- gce_set_machinetype("n1-standard-1", instance = "markdev") 63 | 64 | expect_equal(mt$kind, "compute#operation") 65 | 66 | job <- gce_wait(mt) 67 | 68 | expect_equal(job$status, "DONE") 69 | 70 | }) -------------------------------------------------------------------------------- /tests/testthat/test_ssh.R: -------------------------------------------------------------------------------- 1 | 2 | context("ssh") 3 | 4 | test_that("The SSH URL is made", { 5 | skip_on_cran() 6 | ## won't open browser on travis 7 | sshurl <- gce_ssh_browser("mc-server") 8 | 9 | expect_equal(sshurl, "https://ssh.cloud.google.com/projects/mark-edmondson-gde/zones/europe-west1-b/instances/mc-server?projectNumber=mark-edmondson-gde") 10 | }) 11 | 12 | -------------------------------------------------------------------------------- /tests/testthat/test_yyy_containers.R: -------------------------------------------------------------------------------- 1 | 2 | context("Futures and containers") 3 | 4 | 5 | context("Futures") 6 | 7 | test_that("We can install a package via futures", { 8 | skip_on_cran() 9 | 10 | # vm <- gce_vm(name = "test-container-nodelete", 11 | # template = "r-base", 12 | # auth_email = "TRAVIS_GCE_AUTH_FILE") 13 | vm <- gce_vm("test-container-nodelete") 14 | 15 | ## install packages 16 | worked <- gce_future_install_packages(vm, "rocker/r-base", cran_packages = "corpcor") 17 | expect_true(worked) 18 | 19 | 20 | 21 | 22 | }) 23 | 24 | context("Google Container Registry") 25 | 26 | # 27 | # ## this needs a container that can be saved quickly to avoid timeouts 28 | test_that("Save docker containers", { 29 | skip_on_cran() 30 | 31 | vm <- gce_vm("test-container-nodelete") 32 | 33 | ## saves the running my-rstudio image that is named rstudio 34 | ## commits and saves it to container registry as travis-test-container 35 | cons <- containers(vm) 36 | worked <- gce_push_registry(vm, 37 | save_name = "travis-test-container", 38 | container_name = cons[[1]]$name, 39 | wait = TRUE 40 | ) 41 | 42 | expect_equal(worked, "gcr.io/mark-edmondson-gde/travis-test-container") 43 | }) 44 | # 45 | # 46 | test_that("Load docker containers", { 47 | skip_on_cran() 48 | 49 | vm <- gce_vm("test-container-nodelete") 50 | 51 | ## loads and runs an rstudio template from my projects container registry 52 | worked <- gce_pull_registry(vm, 53 | container_name = "travis-test-container", 54 | name = paste(sample(LETTERS, 15),collapse="")) 55 | expect_s3_class(worked, "gce_instance") 56 | 57 | gce_vm_stop("test-container-nodelete") 58 | }) 59 | -------------------------------------------------------------------------------- /tests/testthat/test_zzz_cleanup.R: -------------------------------------------------------------------------------- 1 | 2 | ## forced to do thsi dependent on another file as need to avoid timeouts 3 | context("Clean up test VMs") 4 | 5 | test_that("We can delete the test VMs",{ 6 | skip_on_cran() 7 | Sys.sleep(10) 8 | 9 | del <- gce_vm_delete("test-vm") 10 | del2 <- gce_vm_delete("test-container") 11 | del3 <- gce_vm_delete("rstudio-test") 12 | del4 <- gce_vm_delete("test-disk-size") 13 | 14 | expect_equal(del$kind, "compute#operation") 15 | 16 | vm <- gce_wait(del, wait = 10) 17 | 18 | expect_equal(vm$kind, "compute#operation") 19 | expect_equal(vm$status, "DONE") 20 | 21 | expect_error(gce_get_instance("test-vm")) 22 | 23 | }) -------------------------------------------------------------------------------- /vignettes/build-trigger-menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudyr/googleComputeEngineR/ce451646b3a43c42a31638dc8152f65a67f67227/vignettes/build-trigger-menu.png -------------------------------------------------------------------------------- /vignettes/build-trigger-running.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudyr/googleComputeEngineR/ce451646b3a43c42a31638dc8152f65a67f67227/vignettes/build-trigger-running.png -------------------------------------------------------------------------------- /vignettes/build-trigger-settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudyr/googleComputeEngineR/ce451646b3a43c42a31638dc8152f65a67f67227/vignettes/build-trigger-settings.png -------------------------------------------------------------------------------- /vignettes/deeplearning-with-r-book.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudyr/googleComputeEngineR/ce451646b3a43c42a31638dc8152f65a67f67227/vignettes/deeplearning-with-r-book.jpg -------------------------------------------------------------------------------- /vignettes/example-workflows.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Example Workflows - Introduction" 3 | author: "Mark Edmondson" 4 | date: "`r Sys.Date()`" 5 | output: rmarkdown::html_vignette 6 | vignette: > 7 | %\VignetteIndexEntry{Example Workflows - Introduction} 8 | %\VignetteEngine{knitr::rmarkdown} 9 | %\VignetteEncoding{UTF-8} 10 | --- 11 | 12 | The following are some R scripts for common workflows. They assume you have previously signed up and setup a Google project, authentication and SSH. 13 | 14 | * [Custom team RStudio Server](rstudio-team.html) 15 | * [Remote R cluster](remote-cluster.html) 16 | * [RStudio server + scheduler](single-scheduler.html) 17 | * [Self-contained Shiny app](shiny-app.html) 18 | * [OpenCPU R API server](opencpu-api-server.html) 19 | * [Master/Slave R script scheduler](scheduled-rscripts.html) 20 | * [Massive parallel computing](massive-parallel.html) 21 | 22 | ## Terminology 23 | 24 | The examples refers to these objects: 25 | 26 | * Instance - Sometimes called Virtual Machine (VM), this is the computer you start in the Google Cloud. It can be configured just like your desktop computer at home. `googleComputeEngineR` uses instances with the Debain Linux operating system installed. You are charged per minute they are up. 27 | * Docker - A program that allows you to run a further type of virtual machine on any computer. The idea is that if any computer installs Docker, they can run the images created. 28 | * Docker Image - Templates of the applications you run. Contain all the information and files needed to run it within Docker. They can contain different operating systems to what Docker is installed upon (e.g. you can run a Linux Docker image on OSX) 29 | * Docker container - The running process made from a Docker Image when you run them. 30 | 31 | Read me about [Docker here](https://www.docker.com/). 32 | 33 | An instance/VM can have multiple docker images, which are running multiple docker containers. 34 | 35 | -------------------------------------------------------------------------------- /vignettes/installation-and-authentication.R: -------------------------------------------------------------------------------- 1 | ## ---- echo=FALSE--------------------------------------------------------- 2 | knitr::include_url("https://www.youtube.com/embed/1oM0NZbRhSI?rel=0") 3 | 4 | -------------------------------------------------------------------------------- /vignettes/rstudio-gpu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudyr/googleComputeEngineR/ce451646b3a43c42a31638dc8152f65a67f67227/vignettes/rstudio-gpu.png -------------------------------------------------------------------------------- /vignettes/ssh-login.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudyr/googleComputeEngineR/ce451646b3a43c42a31638dc8152f65a67f67227/vignettes/ssh-login.gif --------------------------------------------------------------------------------