ShinyApps on AWS with Rstudio AMI - r

I created an AWS instance with this R Studio AMI.
The instructions point that to make the Shiny App available to public you should put it in a ShinyApps folder (public dir).
The issue I'm having though, is that my apps are accesable only through that particular directory, but I can't access them through subdirectories.
For instance:
http://<instance IP address>/shiny/username - works
http://<instance IP address>/shiny/**subdirectory**/username - doesnt work
So I can't really show more than one Shiny App on a single instance.
My goal is to create an index.html page that links several ShinyApps like this one.
Update:
I've updated my index.html with this repo
The problem is again, when I link an app from the index.html I get only the R code opens up, rather than the app.

Related

Publish R-markdown (Shiny doc) on remote Shiny server (in docker) - basic question

This is basic educational question. I am confused about some fundamental concepts.
So I work on my local machine and I created R-markdown (Shiny doc) . Now, if I want to publish it, I just click in the top right corner (where I previously established account at shinyapps.io and connected to it). Well due to some reasons, I would like to publish it different place then shinyapps.io.
So my understanding is that I can accomplish it if I install and configure shiny server in docker. Is this accurate? Do I need Shiny proxy as well.
I also read about dockerizing shiny app, but this sound like to much work creating container instance for each app.
The publishing button works with shinyapps.io or rstudio connect. If you'd like to publish an app using free shiny-server, you won't be able to use the publishing button. You'll need to put a copy of the app in the folder tree you configure shiny-server to publish from. This is a bit more manual. You don't necessarily need Docker, but you do need a Linux computer to run shiny-server. If you want to put your apps in docker containers, you'll want to check out shinyproxy if you're trying to go the free route. RStudio has great paid options if you want to go that route.

Shiny server on EC2: URL lists folder content instead of displaying app

[Sorry, newbie here!]
I've just installed R server, shiny server on an ubuntu EC2 instance. I have left the shiny-server.conf intact, except that I added: preserve_logs true;. The sample app was working fine.
I have removed /srv/shiny-server/index.html and /srv/shiny-server/sample-apps.
I have linked my app files from my /home/myapp directory to /srv/shiny-server/myapp. The app files consists of a single apps.R, a footer.html, and a small dataset .Rds, and a www/style.css file.
When I navigate to http://[myip]:3838/ the only thing is the directory listing; the only folder is : myapp. When I click to http://[myip]:3838/myapp/ , I see the directory listing as well. That is, I see the content, and I can download each of them. BUt I see no evidence of the app running. If I click on apps.R, my browser downloads the file.
PS: the app works fine when tested in Rstudio, or deployed on Shinyapps.io
If anyone from the future reads this, I wish you heard the loud headslap when I realized my app single-file should be called app.R, not apps.R (which makes a lot of sense in retrospect).

Shiny putting app into production

I have created my first Shiny app and i want to share it with people.
I have a folder which contains my ui.R file and my Server.R file.
I have managed to get a server for it and install Shiny Server and it runs pretty well. In fact I have written the shiny app in the web browser.
My question is where do I save the scripts on the shiny server so that I can send the link to people and it will just load up as a website (assuming they have credentials?
Thank you for your time.
I found another question similiar to the one i was looking for.
Hosting LAN Shiny apps run from command line
This answers the question by specifiying that i should move my test scripts into production by saving them /srv/shiny-server/myApp
Which server do you use? Perhaps AWS (Amazon)? Then you can upload it in one of the folders on your server. In the case of Amazon, you do it through S3 Browser.
You can use a domain name to redirect you to the specific folder where you keep your shiny apps. Each shiny app should have its own sub-directory where you keep server and ui scripts. Then you load your shiny name like this:
yourdomain.com/sub_directory_where_shiny_script_are_located
Don't forget to adjust your directories in the script, so that when you load any data, it loads the data located on ubuntu server, for example.
if(Sys.info()[['user']] %in% c("ubuntu","shiny") ) {
load("/a2cka/ShinyApps/sub_directory_shin_app_/data.csv}

datatables.js not available to shiny-server apps on AWS

I've followed the directions Running R on AWS from the AWS Big Data Blog.
When I run an app through Rstudio on port 8787, datatables.js is attached and a renderDataTable() renders successfully. When I visit the EC2 url serving the app, datatables.js is not available and so the <div> container holding the datatable remains empty. How do I get datatables.js to attach at the EC2 url?
I'm not sure if "attach" is the right wording, but I mean make it available within the app folder without using RStudio to run the app.
It turns out that library(DT) is needed at the top of ui.R in addition to being in server.R. That fixed the problem.

Managing files after creating an RStudio EC2 instance

After following this simple tutorial http://www.louisaslett.com/RStudio_AMI/ I have setup an RStudio environment on EC2, and I'm able to run R code :)
The files that I create through RStudio - I'm not sure exactly where these files reside - can I view them on the web somewhere / can I access them via the AWS console?
Thanks!

Resources