Skip to content

Instantly share code, notes, and snippets.

@mdlincoln
Last active August 9, 2022 11:46
Show Gist options
  • Star 13 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save mdlincoln/1f40f4e88ce32c55b5f3 to your computer and use it in GitHub Desktop.
Save mdlincoln/1f40f4e88ce32c55b5f3 to your computer and use it in GitHub Desktop.
cloud-config script to setup Rstudio server and Shiny server on Ubuntu 14.04 on Digital Ocean
#cloud-config
# In order to access RStudio server via the web interface, you must log on with
# a user account that allows password access. This script does not add that user
# by default. You may either ssh as root into the server and `adduser` as
# normal, or script a user addition here:
# users:
# - name: # username #
# lock-passwd: false # allow login with password
# passwd: # hashed password #
# Add apt mirror to get the latest version of R necessary for Shiny
apt_sources:
- source: deb https://cran.rstudio.com/bin/linux/ubuntu/ trusty/
keyid: E084DAB9
package_upgrade: true
packages:
- nginx
- libxml2-dev
- libcurl4-gnutls-dev
- libssl-dev
- r-base-dev
- libapparmor1
- gdebi-core
- git-core
write_files:
# Forward ports for Rstudio and Shiny
- path: /etc/nginx/sites-enabled/default
content: |
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /usr/share/nginx/html;
index index.html index.htm;
# Make site accessible from http://localhost/
server_name localhost;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}
location /shiny/ {
proxy_pass http://127.0.0.1:3838/;
}
location /rstudio/ {
proxy_pass http://127.0.0.1:8787/;
}
}
runcmd:
# Install "shiny" package for R
- R -e 'install.packages(c("shiny", "rmarkdown"), repos="https://cran.rstudio.com/")'
# Download and install rstudio-server
- wget https://download2.rstudio.org/rstudio-server-0.99.892-amd64.deb
- gdebi -n rstudio-server-0.99.892-amd64.deb
# Download and install Shiny
- wget https://download3.rstudio.org/ubuntu-12.04/x86_64/shiny-server-1.4.2.786-amd64.deb
- gdebi -n shiny-server-1.4.2.786-amd64.deb
# Clean package files
- rm *.deb
- service nginx restart
@mdlincoln
Copy link
Author

This is totally indebted to Dean Attali's tutorial on how to manually set up RStudio server and Shiny on DO.

@tiwo
Copy link

tiwo commented Aug 28, 2019

line 16: Using only the short form to identify the key seems to be ambiguous and renders whole package signing useless:

# gpg --receive-keys E084DAB9
gpg: key 4359ED62E084DAB9: public key "Totally Legit Signing Key <mallory@example.org>" imported
gpg: key 51716619E084DAB9: public key "Michael Rutter <marutter@gmail.com>" imported
gpg: Total number processed: 2
gpg:               imported: 2

Use the full fingerprint instead, E298A3A825C0D65DFD57CBB651716619E084DAB9.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment