R Shiny + Ansible = shiny.nzoss.org.nz


Bruno P. Kinoshita
https://kinoshita.eti.brhttps://github.com/kinow


Auckland, New Zealand 2018

R Shiny

  • Brings R to the web
  • Requires minimum knowledge of web development
  • Both Pro & Open Source versions available
  • Good documentation, code, and community

R Shiny installation

  • Linux only
  • Debian, SUSE, and Red Hat packages available
  • On Ubuntu:
    • $ sudo apt-get install r-base
    • $ R
    • > install.packages('shiny')
    • $ sudo apt-get install gdebi-core
    • $ wget https://download3.rstudio.org/ubuntu-12.04/x86_64/shiny-server-1.5.6.875-amd64.deb
    • $ # you md5sum check the file...
    • $ sudo gdebi shiny-server-1.5.6.875-amd64.deb

R Shiny (automated) installation

R Shiny (automated) installation

  • My preference: Configuration Management Tools
  • More specifically Ansible. But worked with Puppet and SaltStack in the past, both are good as well
  • With a CM tool you can craft a setup that is/has:
    • reproducible builds
    • portable across OS's
    • more declarative, less imperative
    • push and/or pull based
    • applicable to Docker, Vagrant, baremetal, Windows, Linux, notebook, Cloud, supercomputer, etc

shiny.nzoss.org.nz

shiny.nzoss.org.nz

  • Still a work in progress
  • We aim at working with R and Shiny users around NZ to make it useful and well used
  • We want to increase the amount of open data available here
  • Applications are deployed via pull requests to a git repository
  • The server automatically install new applications listed in a file
  • For more information visit https://github.com/kinow/nz-shiny-server/wiki/Adding-new-R-applications

shiny.nzoss.org.nz

  • Built with Ansible, compatible with Debian distros for now
  • Security updates automatically installed daily with Ubuntu unattended-upgrades
  • Basic OS security roles adapted from British Antarctic Survey Ansible (github.com/antarctica), HTTPS thanks to LetsEncrypt
  • The server queries the GitHub repository to check for new applications automatically
  • In case of a disaster, a new server can be created in under 30 minutes *

shiny.nzoss.org.nz

  • Infrastructure code in GitHub under MIT License
  • 4 CPU
  • 4 GB
  • 10 GB disk + 20 GB partition
  • 1 instance on Catalyst Cloud nz-por1

Current apps

New Zealand River Monitoring (BETA)

Canterbury (NZ) Earthquake Analysis

Future work

  • Get more applications running
  • Make it easier to manage what applications are deployed
  • Add security (ansible/ansible-lockdown, openshift)
  • Add monitoring (Google Analytics, Graphite, collectd, etc)
  • Improve documentation
  • Investigate ShinyProxy

Thanks

  • Aimee Whitcroft
  • Auckland R Users Group (AKLRUG)
  • Brent Wood
  • Catalyst Cloud
  • InternetNZ
  • New Zealand Open Source Society — NZOSS
  • All software involved, Open Source or commercial

Questions ?