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. This command is idempotent, so feel free to run it on a single server multiple times.

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

Arguments

droplet

The DigitalOcean droplet that you want to provision (see analogsea::droplet()). If empty, a new DigitalOcean server will be created.

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.

Details

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

  • A recent version of R installed

  • plumber installed globally in the system library

  • An example plumber API deployed at /var/plumber

  • A systemd definition for the above plumber API which will ensure that the plumber API is started on machine boot and respawned if the R process ever crashes. On the server you can use commands like systemctl restart plumber to manage your API, or journalctl -u plumber to see the logs associated with your plumber process.

  • The `nginx`` web server installed to route web traffic from port 80 (HTTP) to your plumber process.

  • ufw installed as a firewall to restrict access on the server. By default it only allows incoming traffic on port 22 (SSH) and port 80 (HTTP).

  • A 4GB swap file is created to ensure that machines with little RAM (the default) are able to get through the necessary R package compilations.