Learn R Programming

⚠️There's a newer version (1.0.7.2) of this package.Take me there.

analogsea

analogsea is an R client for version 2 of the Digital Ocean API. See ?droplet_functions after loading analogsea. It allows you to programatically create and destroy droplets (remote computers), and install various R related tools: (these are still a work in progress):

  • R (done)
  • RStudio Server (done)
  • RStudio Shiny Server (done)
  • OpenCPU (not yet)
  • Use packrat to move a project to a droplet (not yet)

Install

Stable version from CRAN

install.packages("analogsea")

Development version from GitHub

remotes::install_github("sckott/analogsea")
library("analogsea")

Create a DO account

If you don't already have one, create a DO account. By using this link, you'll start with $10 in credits (enough for >600 hours of computing on a 1 gb machine), and if you become a digital ocean customer we'll get some DO credits for us to offset our costs for testing. Thanks :)

Authenticate

The best way to authenticate is to generate a personal access token (https://cloud.digitalocean.com/settings/tokens/new) and save it in an environment variable called DO_PAT. If you don't do this, you'll be prompted to authenticate in your browser the first time you use analogsea.

Make sure you provide digitial ocean your public key at https://cloud.digitalocean.com/ssh_keys. Github has some good advice on creating a new public key if you don't already have one: https://help.github.com/articles/generating-ssh-keys/.

Get droplets

All droplets

droplets()
<r> droplets()
$unintrenchable
<droplet>unintrenchable (2724525)
  Status: off
  Region: San Francisco 1
  Image: Ubuntu 14.04 x64
  Size: 512mb ($0.00744 / hr)

$basipterygium
<droplet>basipterygium (2724526)
  Status: active
  Region: San Francisco 1
  Image: Ubuntu 14.04 x64
  Size: 512mb ($0.00744 / hr)

A single droplet. Pass in a single droplet id.

droplet(2724525)
<droplet>unintrenchable (2724525)
  Status: off
  Region: San Francisco 1
  Image: Ubuntu 14.04 x64
  Size: 512mb ($0.00744 / hr)

Spin up a new droplet

To make this as dead simple as possible, you just use one function, without any parameters.

droplet_create()
Using default ssh key: Jane Doe
NB: This costs $0.00744 / hour  until you droplet_delete() it
<droplet>sabaoth (2727258)
  Status: new
  Region: San Francisco 1
  Image: Ubuntu 14.04 x64
  Size: 512mb ($0.00744 / hr)

You can of course pass in lots of options for name of the droplet, RAM size, disk size, ssh keys, etc. See regions() and sizes() to list available regions and sizes.

Delete a droplet

droplet_delete(1707487)

Chaining

Most of the droplet_* functions can be chained together using the %>% function. For example, you can turn a droplet off, snapshot, and then turn it back on with:

d %>%
   droplet_power_off() %>%
   droplet_snapshot() %>%
   droplet_power_on() %>%

R

We're still working on these, but would love feedback.

Install RStudio Server

This requires a "docklet", a droplet with docker installed:

docklet_create() %>%
  docklet_rstudio()

This will install R, RStudio Server and it's dependencies. It will automatically pop open the RStudio server instance in your default browser, with default username/password of rstudio/server.

Meta

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

Copy Link

Version

Install

install.packages('analogsea')

Monthly Downloads

864

Version

0.8.0

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Scott Chamberlain

Last Published

January 30th, 2020

Functions in analogsea (0.8.0)

analogsea-package

R client for Digital Ocean
droplets_create

Create many new droplets.
account

Get account information
image_actions

Retrieve an action associated with a particular image id.
analogsea-deprecated

Deprecated functions in analogsea
analogsea-defunct

Defunct functions in analogsea
httr-verbs

httr wrappers.
do_oauth

Authorize with Digital Ocean.
neighbors

List neighbors
do_options

Set Digital Ocean options including ssh keys, etc.
action

Retrieve an existing action by action id
droplet_create

Create a new droplet.
actions

List actions across all droplets.
droplet_delete

Delete a droplet.
domains

Get information on a single domain or all your domains.
firewall_add_droplets

Add/remove droplets to a firewall
tag_create

Create a tag
docklet_create

Docklets: docker on droplets.
tag_delete

Delete a tag
droplet

Retrieve a single droplet.
firewall_add_tags

Add/remove tags to a firewall
droplet_actions

Retrieve a droplet action or list all actions associatd with a droplet.
droplet_action

Perform various actions on a droplet.
adjectives

Adjectives to use for seeding random word selection when name not given for a droplet
nouns

Nouns to use for seeding random word selection when name not given for a droplet
droplet_modify

Modify a droplet.
docklets_create

Docklets: docker on droplets - create many docklets
droplet_kernels_list

List all available kernels for a droplet.
droplet_reuse

Reuse a droplet or image by name
image_convert

Convert an backup image to a snapshot.
droplet_snapshot

Take and restore snapshots.
rate_limit

Rate limit information for the authenticated user.
space_create

Create a new Space
regions

Get list of regions and their metadata
image_delete

Rename/delete an image
as.snapshot

Snapshot operations
words

1000 words to use for seeding random word selection when name not given for a droplet
droplet_wait

Wait for a droplet to be ready.
droplets

List all available droplets.
image_transfer

Transfer an image to a specified region.
as.domain_record

List, create, update, and delete domain records.
certificate_delete

Delete a certificate
droplet_do_actions

Perform actions on one or more droplets associated with a tag
domain_create

Create/delete domains.
as.certificate

Get list of certificate and their metadata, or a single certificate
keys

List your ssh keys, or get a single key
project_delete

Delete a project
key-crud

Create, update, and delete ssh keys.
project_patch

Update certain aspects of a project
droplet_ssh

Remotely execute ssh code, upload & download files.
droplet_execute

Execute R code on a droplet.
as.image

Get list of images and their metadata, or a single image
firewall_delete

Delete a firewall
droplet_upgrades_list

List all droplets that are scheduled to be upgraded.
%>%

Pipe operator
tag_resource_delete

Untag a resource
sizes

Get all the available sizes that can be used to create a droplet.
tags

List tags
resize

Resize a droplet by power off, snapshot, and create new droplet
project_create

Create a project
as.project

Get list of projects and their metadata, or a single project
spaces

List all Spaces.
as.firewall

Get list of firewalls and their metadata, or a single firewall
project_update

Update all aspects of a project
spaces_info

DigitalOcean Spaces
spaces_GET

Internal helper method to get information about a Space
standardise_keys

Standardise specification of ssh keys.
tag_rename

Rename a tag
tag_resource

Tag a resource
volume_attach

Attach a volume to a droplet
as.volume

Block storage operations
as.space

Coerce an object to a space
debian

Helpers for managing a debian droplets.
cloud_config

Generate cloud config file.
droplet_freeze

Freeze/thaw droplets.
droplets_cost

Calculate cost across droplets
droplet_functions

Functions for DigitalOcean (DO) droplets