do_provision {plumberDeploy}R Documentation

Provision a DigitalOcean plumber server

Description

Create (if required), install the necessary prerequisites, and deploy a sample plumber application on a DigitalOcean virtual machine. You may sign up for a Digital Ocean account here. You should configure an account ssh key with analogsea::key_create() prior to using this method. This command is idempotent, so feel free to run it on a single server multiple times.

Usage

do_provision(droplet, unstable = FALSE, example = TRUE, ...)

do_install_plumber(droplet, unstable, ...)

do_ip(droplet, path)

Arguments

droplet

The DigitalOcean droplet that you want to provision (see analogsea::droplet()).

unstable

If FALSE, will install plumber from CRAN. If TRUE, will install the unstable version of plumber from GitHub.

example

If TRUE, will deploy an example API named hello to the server on port 8000.

...

Arguments passed into the analogsea::droplet_create() function.

path

path to attach to the IP address before browsing. Should likely start with a / or : (as in ⁠:8080⁠), otherwise / will be added.

Details

Provisions a Ubuntu 20.04-x64 droplet with the following customizations:

Value

The DigitalOcean droplet

The URL to be browsed

Note

Please see https://github.com/sckott/analogsea/issues/205 in case of an error by default do_provision and an error of "Error: Size is not available in this region.".

Examples

## Not run: 
  auth = try(analogsea::do_oauth())
  if (!inherits(auth, "try-error") &&
      inherits(auth, "request")) {
    analogsea::droplets()
    droplet = do_provision(region = "sfo3", example = FALSE)
    analogsea::droplets()
    analogsea::install_r_package(droplet, c("readr", "remotes"))
    do_deploy_api(droplet, "hello",
                  system.file("plumber", "10-welcome", package = "plumber"),
                  port=8000, forward=TRUE)
    if (interactive()) {
        utils::browseURL(do_ip(droplet, "/hello"))
    }
    analogsea::droplet_delete(droplet)
  }

## End(Not run)

[Package plumberDeploy version 0.2.1 Index]