vnijs / radiant

Business analytics using R and Shiny
http://radiant-rstats.github.io/docs/
Other
253 stars 152 forks source link

Code is not evaluated when running Radiant on a server #18

Closed dbuijs closed 8 years ago

dbuijs commented 9 years ago

I noticed this when I was trying out Radiant on a Digital Ocean shiny server. In the Code and Report tabs, messages come up indicating that code and rmd files are not evaluated when Radiant is running on a server.

I was able to find where these flags are in the code base, but had some difficulty finding comments or documentation on why this is disabled.

Can I get these features to work on a server simply by commenting out the !r_local statements?

Is there any unexpected behaviour I should look for when I do this?

vnijs commented 9 years ago

Interesting. Did you use http://www.r-bloggers.com/git-pushing-shiny-apps-with-docker-dokku/ for setup or something else?

The main risk here is that you can run arbitrary R-code through the code and rmarkdown modules. This is at-your-own risk when running locally but on a server this is a security problem (e.g., a user could try system("rm -rf *"))

I have talked to the folks at Rstudio and will (hopefully) discuss with them over the summer how to make this work with something like (R)AppArmor.

I have not used AppArmor before. Rstudio server seems to have a profile that might be applied (see https://github.com/rstudio/rstudio/blob/master/INSTALL)

I don't know if commenting out !r_local will work perfectly on a server. Haven't tried it. Feel free to try and report back :) Perhaps try forcing r_local to TRUE in inst/base/global.R (r_local is set in that file). Happy to help but I really wouldn't use this feature on a server unless you can mitigate the security concerns somehow.

Just curious ... what are you planning to use radiant for? A class or something else?

dbuijs commented 9 years ago

I actually used the rocker/shiny Docker image. As far as Digital Ocean goes, I'm just using the Docker appliance. I had to update r-base to 3.2, create a swap file (very important for R), and then install the radiant R package (with all it's dependencies). Then I pulled the GItHub repo, copied /inst/base over to /srv/shinyapps/ and fired it up.

Thanks so much for the feedback! Usually there's a good reason for stuff like this, and I'm glad you let me know before I did something silly. I'll fiddle with it myself. I'm not sure you could get past the Docker container, but you never know..

I've figured out that there's a pretty good use case for giving semi-processed datasets to non-technical scientists and letting them play with the data themselves. I was about to start writing stand-alone shiny apps for this, but Radiant seems like a very good candidate for a generic "R with training wheels".

At this point it's still just a skunkworks project. I've got some basic import scripts up on GitHub to give you an idea of what I'm starting with: https://github.com/dbuijs/HealthCanadaOpenData

vnijs commented 9 years ago

I will give Docker a try pretty soon. If a solution presents itself to use the code and report feature fully on a server I will post back here.

Good luck with the project! If you use radiant let me know if you have comments / suggestions.

vnijs commented 8 years ago

Radiant development has been moved to https://github.com/radiant-rstats. Updated documentation is available at https://radiant-rstats.github.io/docs/

As soon as the development versions of Shiny and DT hit CRAN I'll push the new Radiant packages as well

Please open any new issues at https://github.com/radiant-rstats/radiant/issues