Deploy R api plumber scripts, HTML files or other images create the Docker image, add the build to Cloud Build and deploy to Cloud Run
cr_deploy_run( local, remote = basename(local), dockerfile = NULL, image_name = remote, tag = "$BUILD_ID", region = cr_region_get(), bucket = cr_bucket_get(), projectId = cr_project_get(), launch_browser = interactive(), timeout = 600L, ... ) cr_deploy_html( html_folder, remote = basename(html_folder), image_name = remote, tag = "$BUILD_ID", region = cr_region_get(), bucket = cr_bucket_get(), projectId = cr_project_get(), launch_browser = interactive(), timeout = 600L, ... ) cr_deploy_plumber( api, remote = basename(api), dockerfile = NULL, image_name = remote, tag = "$BUILD_ID", region = cr_region_get(), bucket = cr_bucket_get(), projectId = cr_project_get(), launch_browser = interactive(), timeout = 600L, ... )
local | A folder containing the scripts and Dockerfile to deploy to Cloud Run |
---|---|
remote | The folder on Google Cloud Storage, and the name of the service on Cloud Run |
dockerfile | An optional Dockerfile built to support the script. Not needed if 'Dockerfile' exists in folder. If supplied will be copied into deployment folder and called "Dockerfile" |
image_name | The gcr.io image name that will be deployed and/or built |
tag | The tag or tags to be attached to the pushed image - can use |
region | The Cloud Run endpoint set by CR_REGION env arg |
bucket | The Cloud Storage bucket that will hold the code |
projectId | The projectId where it all gets deployed to |
launch_browser | Whether to launch the logs URL in a browser once deployed |
timeout | Amount of time that this build should be allowed to run, to second |
... | Arguments passed on to
|
html_folder | the folder containing all the html |
api | A folder containing the R script using plumber called api.R and all its dependencies |
Deploy html files to a nginx server on Cloud Run.
Supply the html folder to host it on Cloud Run. Builds the dockerfile with the html within it, then deploys to Cloud Run
Will add a default.template
file to the html folder that holds the nginx configuration
The entrypoint for CloudRun will be via a plumber script called api.R - this should be included in your local folder to deploy. From that api.R you can source or call other resources in the same folder, using relative paths.
The function will create a local folder called "deploy" and a tar.gz of that folder which is what is being uploaded to Google Cloud Storage
For scheduling Cloud Run apps cr_run_schedule_http
These deploy containers to Cloud Run, a scale 0-to-millions container-as-a-service on Google Cloud Platform.
cr_deploy_run_website which has more features like rending Rmd files and deploying upon each git commit
Other Deployment functions:
cr_deploy_docker_trigger()
,
cr_deploy_docker()
,
cr_deploy_packagetests()
,
cr_deploy_pkgdown()
,
cr_deploy_run_website()
,
cr_deploy_r()
if (FALSE) { cr_project_set("my-project") cr_region_set("europe-west1") cr_bucket_set("my-bucket") cr_deploy_run(system.file("example/", package = "googleCloudRunner")) } if (FALSE) { cr_project_set("my-project") cr_region_set("europe-west1") cr_bucket_set("my-bucket") cr_deploy_html("my_folder") } if (FALSE) { cr_project_set("my-project") cr_region_set("europe-west1") cr_bucket_set("my-bucket") cr_deploy_plumber(system.file("example/", package = "googleCloudRunner")) }