All Projects → ministryofjustice → analytics-platform-shiny-server

ministryofjustice / analytics-platform-shiny-server

Licence: AGPL-3.0 license
Analytics Platform Shiny Server

Programming Languages

javascript
184084 projects - #8 most used programming language
r
7636 projects
CSS
56736 projects

Projects that are alternatives of or similar to analytics-platform-shiny-server

shinyCircos
an R/shiny application for creation of Circos plot interactively
Stars: ✭ 127 (+504.76%)
Mutual labels:  shiny, shiny-server
daattali.github.io
Dean Attali's website - R/Shiny Consultant
Stars: ✭ 51 (+142.86%)
Mutual labels:  shiny, shiny-server
shinyFilters
Cascading filter modules for Shiny
Stars: ✭ 13 (-38.1%)
Mutual labels:  shiny, shiny-server
shiny-server-arm-docker
Shiny-Server in docker for ARM(armv7/arm64) and amd64. Most suitable to run on SBCs such as Raspberry Pi. Enables installing R-libraries on top of the bare image.
Stars: ✭ 26 (+23.81%)
Mutual labels:  shiny, shiny-server
workshops-setup cloud analytics machine
Tips and Tricks to setup a cloud machine for Analytics and Data Science with R, RStudio and Shiny Servers, Python and JupyterLab
Stars: ✭ 12 (-42.86%)
Mutual labels:  shiny, shiny-server
math-server-docker
The ideal multi-user Data Science server with Jupyterhub and RStudio, ready for Python, R and Julia languages.
Stars: ✭ 70 (+233.33%)
Mutual labels:  shiny-server
nodefony
nodefony core framework
Stars: ✭ 19 (-9.52%)
Mutual labels:  sockjs
echarty
Minimal R/Shiny Interface to ECharts.js
Stars: ✭ 49 (+133.33%)
Mutual labels:  shiny
Shinycssloaders
⌛ Add loading animations to a Shiny output while it's recalculating
Stars: ✭ 248 (+1080.95%)
Mutual labels:  shiny
shiny crud
Example Shiny apps implementing CRUD database functionality
Stars: ✭ 88 (+319.05%)
Mutual labels:  shiny
tweet-conf-dash
A shiny twitter conference dashboard
Stars: ✭ 117 (+457.14%)
Mutual labels:  shiny
shinyhttr
Give httr::progress the ability to talk to shinyWidgets::progressBar.
Stars: ✭ 32 (+52.38%)
Mutual labels:  shiny
grillade
Grid sytem for shiny apps or rmarkdown and to create htmlwidgets matrix
Stars: ✭ 16 (-23.81%)
Mutual labels:  shiny
charpente
Seamlessly design robust 'shiny' extensions
Stars: ✭ 36 (+71.43%)
Mutual labels:  shiny
capm shiny
Demo project of creating an interactive analytical tool for stock market using CAPM.
Stars: ✭ 31 (+47.62%)
Mutual labels:  shiny
shiny-apps
Some of my Shiny apps for fun
Stars: ✭ 54 (+157.14%)
Mutual labels:  shiny
RagGrid
R interface to ag-grid.
Stars: ✭ 31 (+47.62%)
Mutual labels:  shiny
vertx-ddns
基于 Vert.x 的 DDNS 解决方案。自动更新域名解析到本机IP, 支持的DNS服务商: Alidns(阿里云) 、 Dnspod(腾讯云) 、Cloudflare、华为云
Stars: ✭ 126 (+500%)
Mutual labels:  sockjs
lineup htmlwidget
HTMLWidget wrapper of LineUp for Visual Analysis of Multi-Attribute Rankings
Stars: ✭ 51 (+142.86%)
Mutual labels:  shiny
ng-stomp
📑 STOMP for AngularJS
Stars: ✭ 42 (+100%)
Mutual labels:  sockjs

Analytics Platform Shiny Server

This is a 'shiny server', for serving Shiny applications over the web.

MOJ has developed this this one because the other shiny servers did not meet our needs.

Features

  • Host a single Shiny application
  • Supports non-websocket-capable browsers, like IE9, by using SockJS
  • Supports adding Google Analytics tracking into the app
  • Free and open source
  • Install via NPM (no OS specific installers required)
  • JSON / structured logging to STDOUT

SockJS

Shiny apps use websockets, which is a newish addition beyond HTTP, so it is not supported by some older browsers (e.g. IE9) and older firewalls, which many corporates still have. A Shiny app will simply appear 'greyed out' if websockets are not available.

However SockJS is a bit of javascript that redirects websocket requests via normal HTTP, so this server adds this into every page, which kicks in as a fallback option. This is achieved by adding an HTTP filter that inserts the <script src="sock.js"> into HTTP responses from the app. You can also reduce the ALLOWED_PROTOCOLS the app will try to us, if you're still having trouble.

Google Analytics

To collect analytics about your app's usage, you could either add the snippet of javascript into your Shiny app's code, or leave it to this server, by specifying SHINY_GAID.

Why write another shiny server?

Comparison with Rstudio's Shiny-Server

Feature AP Shiny Server RStudio Shiny Server
Multiple Tenants
Multiple Shiny Apps
Multiple Users
Google Analytics
SockJS fallback
Authentication ✓* (paid)
Forward all headers ✓* (paid)
Use non-system R ✓ (will use R on PATH) ✓* (paid)
Timeouts (app and session)
Restart by writing restart.txt ✘ (TODO)

Here were the problems we had with RStudio Shiny Server Open Source:

  • It doesn’t pass HTTP headers through to the app - reserved for the paid Pro version
  • You can't configure it to use a separate R environment, such as a Conda environment - reserved for the paid Pro version
  • It logs to a file - this requires us to run a log shipper - it would be better to log to stdout for running as a container.
  • It has no health-check endpoint - reserved for the paid Pro version
  • No resource metrics - reserved for the paid Pro version

We don't need several of the features of RStudio Shiny Server:

  • serving multiple apps and multiple threads, because we run each app in its own containers, which scale fine horizontally.
  • authentication is a Pro feature, for which we achieve instead with an auth proxy container.

Writing a single thread shiny server is actually pretty simple, so that's what we have done. It's written in NodeJS merely because it interfaces with HTTP well.

There are some other shiny servers we also considered:

  • Shiny Server Pro is a closed-source paid product and "it is not being actively developed. We strongly recommend customers consider RStudio Connect instead." (RStudio Connect is a managed hosting platform for Shiny apps etc starting at $15k at time of writing)
  • ShinyProxy appears to deploys docker containers, but we prefer to keep control of deployment with helm, which installs our auth-proxy for us. Also it doesn't appear to have the SockJS fallback.

Configuration

Name Description Default
SHINY_APP Location of Shiny app root ./example
SHINY_GAID Google Analytics tracking code (e.g. UA-XXXXX-X) No Default
LOG_LEVEL One of info or debug info
ALLOWED_PROTOCOLS SockJS enabled transports websocket, xdr-streaming, xhr-streaming, iframe-eventsource, iframe-htmlfile, xdr-polling, xhr-polling, iframe-xhr-polling, jsonp-polling
PORT Port to run this server on 9999
TARGET_PORT Port to run Shiny on. There probably isn't a good reason to change this. 7999

How to Run

  1. Install it: $ npm i -g ministryofjustice/analytics-platform-shiny-server
  2. Run it: $ SHINY_APP=/path/to/shiny-app analytics-platform-shiny-server

Which will give you a shiny-server that spawns the R shiny app as a child process, access it on http://localhost:9999

How to release

  1. Make your changes
  2. npm run build
  3. Commit your files included transpiled ones in ./static/
  4. Push to a new branch on github and make a PR

Design

The key line of code is to call Shiny's own server method:

shiny::runApp('/myapp', port=80, launch.browser=FALSE)

It configures a shiny.http.response.filter to inject into the <head> of all sever responses the scripts for SockJS and protocol/transport options etc.

It sets up logging to stdout using logging.js.

Licences

GNU Affero General Public License version 3. See LICENCE

Why this licence? While this isn't a fork of the official shiny-server, it is heavily inspired by it. So we've decided to effectively treat this as a fork for licensing purposes and apply the same licence as that: AGPL-3.0.

Example App (Creative Commons)

The example app that is served when no SHINY_APP is specified has it's own licence.

The example app requires a working R and Rshiny install.

Sockjs (MIT)

Sockjs is bundled in this repository and is licenced under MIT.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].