Skip to contents

Adds TLS/SSL (HTTPS) to a droplet created using do_provision().

Usage

do_configure_https(
  droplet,
  domain,
  email,
  terms_of_service = FALSE,
  force = FALSE,
  ...
)

Arguments

droplet

The droplet on which to act. It's expected that this droplet was provisioned using do_provision(). See analogsea::droplet() to obtain a reference to a running droplet.

domain

The domain name associated with this instance. Used to obtain a TLS/SSL certificate.

email

Your email address; given to letsencrypt for "urgent renewal and security notices".

terms_of_service

Set to TRUE to agree to the letsencrypt subscriber agreement. At the time of writing, the current version is available here. Must be set to true to obtain a certificate through letsencrypt.

force

If FALSE, will error if the given domain name does not appear to be registered for this droplet according to DigitalOcean's Metadata service. If TRUE, will ignore any discrepancy and attempt to register anyway.

...

additional arguments to pass to analogsea::droplet_ssh(), such as keyfile.

Value

The DigitalOcean droplet

Details

In order to get a TLS/SSL certificate, you need to point a domain name to the IP address associated with your droplet. If you don't already have a domain name, you can register one on Google Domains or Amazon Route53.

When sourcing a domain name, check if your registrar allows you to manage your own DNS records. If not, consider a service like CloudFlare to manage your DNS. DigitalOcean also offers DNS management.

Examples

if (FALSE) { # \dontrun{
  droplet <- analogsea::droplet(123456)

  # Add HTTPS support with Let's Encrypt
  do_configure_https(
    droplet,
    domain = "myapp.example.com",
    email = "admin@example.com",
    terms_of_service = TRUE
  )
} # }