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

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.

Related

ERR_EMPTY_RESPONSE shiny server

I am currently hosting a number of shiny apps on a shiny-server open source on a centos7 distro. All the apps were/are working fine but for one of the apps when I try to go to the url I get the following message:
This page isn't working
<ip.address> did not receive any data.
ERR_EMPTY_RESPONSE.
All the other shiny apps hosted on the same shiny server are working just fine. I checked /var/log/shiny-server and there is no log file for this App. As the other apps are working fine, I dont think its a port issue.
The only difference between other apps and this one is that it was used the most by its users. Is there some restriction/limit on shiny-server for runtime? I can't figure out what the problem is. The app runs fine on RStudio Server and if I copy it into a new directory in /srv/shiny-server/ with a different name, it also works fine.
A couple of thoughts:
If a process closes successfully, then shiny deletes the log files. So it's possible you may be missing some log files. You may override this with preserve_logs, see here. Your users may be triggering some error through their interactions with the app, but other sessions are successful, so shiny deletes the log files.
Shiny creates one process per app be default, but an unlimited number of session (see here). This means that if your app is the one that is used the most by users, each user is generating a new session. And if the app is computationally intensive, then some of the user sessions may be getting backlogged which might trigger the ERR_EMPTY_RESPONSE. You can fix this by using Docker to spin up a process for each user. Here are some options, I've found shinyproxy to be the most intuitive.

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}

R shiny leaflet maps do not load for more than one browser instance

We're creating a webapp (http://52.2.13.97:3838/Boston-Inspections/) that uses a leaflet map. shiny-server is being run on an Amazon EC2 Ubuntu instance.
We noticed (and you can probably notice from the link) that the map does not update as it should when the shiny inputs change. However, they do update for the very first instance of shiny on the EC2 instance.
Does anyone know why the map would properly render for the very instance, but for every subsequent instance, the map simply does not load/update? If it helps, all of these 'instances' seem to run in the same worker process on the EC2 instance (ie. multiple tabs running the webapp will all be contained under the same process via ps aux).
Update: if it helps, we've tried upgrading to a t2.large instance and had exactly the same issue. We don't think it's a performance issue. We also checks /var/log/shiny-server and found nothing out of the ordinary while the webapp is running.

Resources