Using R shiny app in a domain owned by my organisation

ggplot2
shiny
rstudio

#1

I want to make and use shiny apps involving input to R using webpage, saving input to a database, and give graphical output to a separate webpage. All these webpages should be part of my official domain and available to general public.
Please inform if this is doable by Rstudio-shiny combination.
This is for basic sciences research only and not for any for-profit / commercial purpose.


#2

Yes this is possible however keep in mind the max concurrent users limit on shiny server.
With free version you can only have 10 which is often not suitable for web app.
You can either obtain a budget and purchase licence or build a website using html/css/js/php host using apache server and use R only as API processing data (e.g. for prediction). If you are only after a userform input stored in DB then apache hosted website will be more suitable solution.
Rgds,
Peter


#3

I know that if I have free version on the shiny server it may not be possible, but I was asking if it was possible at all as your tutorial was not very clear about it, We may have access to some limited funds after the site is shown to be operational.
If possible direct me to a tutorial about how to do this with apache server. I do need the graphical output to webpage too.


#4

google search
setting up lamp server (linux, apache, mysql, php)
basic website building, focus at form and how to pass form data to server using jquery and php
how to protect website forms from malicious attacks
how to set up mysql server
how to protect sql injection in php
once done you can create R API using plumber package


#5

HI @SirWries. It seems that i am in a very similar situation with @TV_India. I wish to build a shiny app which will be used by people in my institute. What do you mean by "max 10 concurrent users" ? That at most 10 people can use it simultaneously ? And seeing also your answer below, briefly would you say that it is doable to build such a server for someone with no familirity with these stuff ? Or should i look for alternatives( I am not very confident about aying for the shinyapps.io server...)?


#6

Yes, 10 unique users are maximum for free shiny server.
Now i don't want to deter people from using shiny server product, but i would not recommend using it if you are building regular website. R is language for statistical computing and data mining, shiny server is extension for R that allows non-website programmers to create website apps.
I have build a simple website for company in amazon web services. There is an easy process how to create webserver, underlying database, domain registration and scaling all for 0.5 USD a month.
Yes it's possible to do it with help from google and communities like this.
If you choose that route i will be able to help.
Rgds,
Peter


#7

Hi @SirWries, So I feel that you are saying shiny server would be too costly?
I was thinking to build the demo using shiny so that I can get time to learn the other stuff so the free version works fine as I am not going to go live with it. or I might buy the standard plan after the demo succeeds as then I would have something to ask money for.


#8

@SirWries thanks for your answer!

The reason why i chose to go with the shiny app option, was because i wanted to provide people with the ability to use R under the hood. That is, use this shiny app and without knowing or even have R in their own PCs, they would be able to carry out some calculations( power calculations for instance). That is the main purpose but in the app it will be about 30% of it. The other 70% will be static text and images.

I understand then, that you would not encourage me to continue with shiny app, right ?

Thanks,
John


#9

what do you mean by this?


#10

I mean i want them to do some power calculations for their experiments on their own with R. And i don't want them to actually use R for that, but instead to provide their numbers and then the shiny app will give the results. Exactly like an interactive app.


#11

You have several options:

  1. Shiny server (free).
    pros: if you are proficient in R this allows you to build website apps without knowledge of web development.
    no licencing costs
    cons: complex and/or demanding calculations may require the server to spawn additional R sessions which is pro-server feature, you can partially mitigate this if you code/function can be processed in parallel.
    note: Multi user environment like shiny is completely different from scripting programming in R. You code has to be neat and efficient where every second saved in processing is tangible. I spent days optimizing certain parts of the code in order to save some time.
    no support from RStudio
    limited number of concurrent users (10)
  2. Shiny server (pro)
    pros: same as free version, plus more enhanced server options, security and also support from RStudio.
    cons: still the user limit is restricting if you expect your app to be potentially used by 100s of users
  3. LAMP server with R resful api
    pros: all advantages of R processing and website server , with RStudio connect paid you can have seamless api functionality.
    R will only process "power computation" and sent data back either as json, xml or even javascript object.
    Website itself and data fetching from DB is handled by webserver while some heavy computing done by R (likely extended by custom cpp functions)
    cons: requires knowledge of linux, apache, html, css, javascript, php, R, SQL
    note: i would recommend using PostgreSQL instead of MySQL if you expect to handle big data.

#12

@SirWries requesting the reason behind "recommend using PostgreSQL" as I was checking out mysql


#13

@SirWries Really thanks for this elaborated answer!!

First of all i will not have any intensive calculations. Mostly R built-in functions( 1 line or 2 of code). And i expect around 50 users to use it at least in the beggining, maybe more later! In that sense, if i completely disregard the 3rd option because of unfamiliarity with all these languages( except R of course), and if i understand it correctly then the free version is also not a possibility anymore, i have either to go with the basic package( 499$ per year) or i have to look for (more) alternatives...

Thanks again,
John


#14

PostgreSQL vs MySQL
i recommend reading thoroughly the detailed part not only the summary at the end.
key highlights:
psql has more nosql data support, support check constraints for data integrity, more suitable for business intelligence, security and language support (including R)
https://www.2ndquadrant.com/en/postgresql/postgresql-vs-mysql/


#15

Sean Lopp had a nice talk at RStudio conf about scaling Shiny, "Scaling Shiny rstudio::conf(2018L)". Besides the excellent documentation for administering shiny

And there's a bunch of videos on working with and administering shiny on RStudio's videos/webinar page.