Error when hosting shiny app on DigitalOcean ubuntu server - r

I have built a shiny app that I have successfully deployed to shinyapps.io in the past. However, since I need better hosting resources and a custom domain, and the only shinyapps.io option allowing for the latter is out of my price range, I am trying to host the app on a digital ocean ubuntu droplet.
I have been able to set up shiny server on my droplet using this tutorial. The sample apps work just fine. However, when I try to access my own app (having uploaded it into a directory within my shiny server) I get the following error:
An error has occurred! An error has occurred. Check your logs or
contact the app author for clarification.
I've googled for a solution and have tried moving the data cleaning steps from outside the server/ui function into the functions. I have also checked that RStudio on the droplet has all the required packages installed and that seems to be the case. I have checked the logs but there is nothing about this app or the error in the shiny server log. My app works fine both on my local computer and on shinyapps.io. I'd really appreciate any pointers (and apologies if I am duplicating but I haven't found anything that seems directly applicable).

Okay - it turns out one of the packages was indeed missing. I had installed them all using my non-root user with admin privileges, and was under the impression they were available globally. One of the packages was not available to root and installing it there resolved the problem.

Related

Switching between tabs not possible online

I wrote a shiny app which works fine on my machine and on my server. Now I migrated the app to another virtual server (running Ubuntu 22.04 LTS). I can access the virtual server via a GUI and when I run the app on that virtual server in Rstudio it works fine. When I access the app (running with free shinyserver) from the internet, I reach the application and can see the dashboard. It actually looks fine, all the links work and so on, but I cannot switch between dashboard tabs. When I click on a tab, the webpage changes from "webpage/" to "webpage/#tab-2470-2" (or some other number behind "#tab-") but nothing happens.
Since the R code and the shiny config on my server (where everything works) and the new virtual server is exactly the same, I presume that the virtual server is missing some packages. It's a fresh installation aside from R, Rstudio, shinyserver, the required dependencies and all updates. The problem is that I do not get any error messages (shiny log directory is empty), so I do not even know where to start troubleshooting.
So I am wondering if anyone experienced the same behaviour or has an idea what I am missing?
Thanks in advance!

R shiny downloadHandler returns a network error after a short duration

The issue I'm encountering has been discussed here on GitHub. The problem I'm having is that, after a short period of time (~45-90sec), the downloadHandler returns a network error instead of the plot.png that is expected. Sometimes the download link will work but it's hit or miss. The shiny app is deployed on an Open onDemand HPC setup. From the shared discussion, the advice is to add http_keepalive_timeout 600; to the shiny-server.conf file. My problem is that I'm not aware of any shiny-server.conf file. The shiny-server docs says the file is located at /etc/shiny-server/shiny-server. conf. Can anyone tell me how to find this file? I have very little experience with app deployment and the engineer who deployed the app for me is not aware of any such file/location.

Host ShinyApp from own (Linux) server and own domain

I have programmed a Shiny WebApp and would now like to deploy it myself. So far I have made it available at shinyapps.io. For this I have already set up my own server (a virtual machine running on a datacenter), installed CentOS Server and bought my own domain. Likewise, I have already installed ShinyServer.
However, now I do not really know how to proceed.
In forums I have found various possibilities, which I can not really understand. Therefore I would like to ask here, which possibility is the simplest to provide a Shiny WebApp from the own server under the own domain. This should work without additional costs.
Thanks in advance!
I you have already installed Shinyserver on the CentOs -instance i would advise you to
test if the installation is running properly by checking if the sample app’s are running:
go to a webbrowser on your local machine http://"your-server-address":3838/sample-apps
the test apps should be displayed here , if not:
$ sudo systemctl start shiny-server
check again
copy (scp or clone from git ) your App.R onto the server and put it inside a subdirectory of the /srv/shiny-server/ - directory
check if the app is displayed and works properly (often dependencies are missing) on the server port 3838:
http://"your-server-address":3838/myApp
4: read the
documentation: https://docs.rstudio.com/shiny-server/
quick start guide: https://shiny.rstudio.com/articles/shiny-server.html

ShinyApp : Connection Reset By Peer

The shinyapp I built earlier was running fine in my old laptop. Recently I got a new laptop with Windows10. After setting up everything, I tried to run the app but it the browser opens and closes immediately with the error :
Listening on http://127.0.0.1:5004
ERROR: [on_request_read] connection reset by peer
I have also set chrome as default browser....
I deployed this app in shinyapps.io it is working fine there.
I tried few more simple apps in Rstudio but the same issue coming. Looks like the issue is more related to some setting in Windows10. Can someone help me please.
Thanks in Advance.....
Without details on the specific code, I'd share my personal experience with the same error for your reference. In my case, I used RStudio to create a shiny app that save data to a local directory on my computer, while I told R to output files to directory "response", I hadn't created such directory under the working directory so came the error. Simply creating the sub directory named "response" solve this right away. Or for moving your project files to different places in the future, you can just check whether the folder exists, if not, create one shall save you a lot of time.

Shiny app on Server: not publish it, only make it run

I am working on an Shiny app in R. My goal is to put in on a server, not on my local pc.
EDIT: my goal is not to publish it on the web, but only make it run on the server locally.
I have installed R on the server, added all the libraries I need, lastly I tried to launch my app that it is quite long, the schema is more or less this:
data preprocessing (with RODBC)
some custom functions
server<- etc.
ui<- etc.
shinyapp(server,ui)
Well in my local pc everything is fine, but on the server I cannot have a result, it is impossible to reach the address.
I decided to do something like this, create the two files called server and ui, and launching them with:
runApp(".../shiny")
Having the idea to use the option of runApp.
Well it is arriving this
ERROR: Error sourcing C:\Users\...\AppData\Local\Temp\Rtmp8YeSOV\file22281c0c2f6d
First of all, this procedure is going to help me?
If so, could you tell me what that error mean?
Thanks in advance.
I'm not sure, but I think it's not possible to reach a shiny app running in a local computer (or server). For that purpose you can use the Shiny Sever, which allow you to put your Shiny apps accessible online.
It seems that your server is a Windows computer, so your options are:
Build Shiny Server from its source code, (maybe a little difficult).
Use a virtual machine like VMware Player (free for non-commercial use) and install Ubuntu or other Linux distribution to use the pre-built binary of Shiny Server. With this option you can restrict the access to only your local network and maybe faster access to your DB's.
Use a DigitalOcean virtual server (for a very reasonable price), in this case you apps will be on the cloud and accesible everywhere.
For option 2 and 3 you can follow the very useful and well written tutorial of Dean Attali about installing and setting up a Shiny Sever. It is for DigitalOcean but is pretty much the same if you decide to use a virtual machine with Linux.
The answer is quite simple, I was using IE as browser: if you use Chrome specifying it on the runApp statement, everything works fine.

Resources